hh fix, profile fix

This commit is contained in:
Kavalar 2018-11-23 16:09:29 +03:00
parent b013b1213b
commit 25e922cd37
8 changed files with 100 additions and 7 deletions

View File

@ -6,6 +6,7 @@ use common\classes\Debug;
use common\models\AdditionalFields;
use common\models\CardSkill;
use common\models\FieldsValue;
use common\models\Status;
use Yii;
use backend\modules\card\models\UserCard;
use backend\modules\card\models\UserCardSearch;
@ -41,6 +42,8 @@ class UserCardController extends Controller
*/
public function actionIndex()
{
$status = new Status();
//Debug::dd($status->getUseStatuses());
$searchModel = new UserCardSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);

View File

@ -91,10 +91,7 @@ use yii\widgets\ActiveForm;
</div>
<div class="col-xs-6">
<?= $form->field($model, 'status')
->dropDownList(\yii\helpers\ArrayHelper::map(
\common\models\Status::find()
->joinWith('useStatuses')
->where(['`use_status`.`use`' => \common\models\UseStatus::USE_PROFILE])->all(), 'id', 'name'),
->dropDownList(\common\models\Status::getStatusesArray(\common\models\UseStatus::USE_PROFILE),
[
'prompt' => 'Выберите'
]

View File

@ -38,7 +38,21 @@ $this->params['breadcrumbs'][] = $this->title;
'email:email',
//'gender',
//'dob',
//'status',
[
'attribute' => 'status',
'value' => function($model){
return $model->status0->name;
},
'filter' => kartik\select2\Select2::widget([
'model' => $searchModel,
'attribute' => 'status',
'data' => \common\models\Status::getStatusesArray(\common\models\UseStatus::USE_PROFILE),
'options' => ['placeholder' => 'Начните вводить...','class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]),
],
//'created_at',
//'updated_at',

View File

@ -8,6 +8,7 @@ use common\models\HhJob;
use Yii;
use backend\modules\hh\models\Hh;
use backend\modules\hh\models\HhSearch;
use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
@ -55,8 +56,17 @@ class HhController extends Controller
*/
public function actionView($id)
{
$model = $this->findModel($id);
$jobs = new ActiveDataProvider([
'query' => HhJob::find()->where(['employer_id' => $model->hh_id]),
'pagination' => [
'pageSize' => 200,
],
]);
return $this->render('view', [
'model' => $this->findModel($id),
'model' => $model,
'jobs' => $jobs,
]);
}

View File

@ -1,5 +1,6 @@
<?php
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\DetailView;
@ -36,5 +37,26 @@ $this->params['breadcrumbs'][] = $this->title;
'photo:image',
],
]) ?>
<br>
<h2>Вакансии</h2>
<?= GridView::widget([
'dataProvider' => $jobs,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'title',
'url:url',
'salary_from',
'salary_to',
'salary_currency',
'address',
'dt_add:date',
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view} {delete}'
],
],
]); ?>
</div>

View File

@ -3,6 +3,8 @@
namespace backend\modules\project\controllers;
use common\models\FieldsValue;
use common\models\Hh;
use common\models\HhJob;
use common\models\ProjectUser;
use Yii;
use backend\modules\project\models\Project;
@ -55,6 +57,16 @@ class ProjectController extends Controller
*/
public function actionView($id)
{
$model = $this->findModel($id);
$hh = Hh::findOne($model->hh_id);
$jobsProvider = new ActiveDataProvider([
'query' => HhJob::find()->where(['employer_id' => $hh->hh_id]),
'pagination' => [
'pageSize' => 200,
],
]);
$dataProvider = new ActiveDataProvider([
'query' => FieldsValue::find()->where(['project_id' => $id])->orderBy('order'),
'pagination' => [
@ -70,9 +82,10 @@ class ProjectController extends Controller
]);
return $this->render('view', [
'model' => $this->findModel($id),
'model' => $model,
'modelFildValue' => $dataProvider,
'modelUser' => $dataProviderUser,
'jobsProvider' => $jobsProvider,
]);
}

View File

@ -30,6 +30,10 @@ $this->params['breadcrumbs'][] = $this->title;
'attributes' => [
'id',
'name',
[
'label' => 'Сраница на hh.ru',
'attribute' => 'hh.url'
],
'description:ntext',
'created_at',
'updated_at',
@ -76,4 +80,25 @@ $this->params['breadcrumbs'][] = $this->title;
],
],
]); ?>
<h2>Вакансии hh.ru</h2>
<?= GridView::widget([
'dataProvider' => $jobsProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'title',
'url:url',
'salary_from',
'salary_to',
'salary_currency',
'address',
'dt_add:date',
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view} {delete}'
],
],
]); ?>
</div>

View File

@ -3,6 +3,7 @@
namespace common\models;
use Yii;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "status".
@ -56,6 +57,14 @@ class Status extends \yii\db\ActiveRecord
return $this->hasMany(UseStatus::class, ['status_id' => 'id']);
}
public static function getStatusesArray($type)
{
return ArrayHelper::map(
self::find()
->joinWith('useStatuses')
->where(['`use_status`.`use`' => $type])->all(), 'id', 'name');
}
/**
* @return \yii\db\ActiveQuery
*/