add_orderby_small_fixes

This commit is contained in:
SoHardKI 2019-07-04 12:29:42 +03:00
parent 1cf00f1f85
commit b807262a99
9 changed files with 14 additions and 9 deletions

View File

@ -54,7 +54,8 @@ class BalanceSearch extends Balance
*/ */
public function search($params) public function search($params)
{ {
$query = Balance::find(); $query = Balance::find()->distinct();
$query->leftJoin('fields_value_new','fields_value_new.item_id=balance.id AND fields_value_new.item_type=3'); $query->leftJoin('fields_value_new','fields_value_new.item_id=balance.id AND fields_value_new.item_type=3');
// add conditions that should always apply here // add conditions that should always apply here
$dataProvider = new ActiveDataProvider([ $dataProvider = new ActiveDataProvider([

View File

@ -82,6 +82,8 @@ class UserCardSearch extends UserCard
$query->andFilterWhere(['skill.id' => $this->skills]); $query->andFilterWhere(['skill.id' => $this->skills]);
$query->orderBy('user_card.created_at DESC');
return $dataProvider; return $dataProvider;
} }
} }

View File

@ -5,15 +5,13 @@ use yii\helpers\Html;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model backend\modules\card\models\UserCard */ /* @var $model backend\modules\card\models\UserCard */
$this->title = 'Update User Card: ' . $model->id; $this->title = $model->fio;
$this->params['breadcrumbs'][] = ['label' => 'User Cards', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => 'User Cards', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update'; $this->params['breadcrumbs'][] = 'Update';
?> ?>
<div class="user-card-update"> <div class="user-card-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [ <?= $this->render('_form', [
'model' => $model, 'model' => $model,
]) ?> ]) ?>

View File

@ -13,6 +13,7 @@ use backend\modules\company\models\Company;
*/ */
class CompanySearch extends Company class CompanySearch extends Company
{ {
// public $status;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -43,7 +44,6 @@ class CompanySearch extends Company
public function search($params) public function search($params)
{ {
$query = Company::find()->joinWith('project'); $query = Company::find()->joinWith('project');
// add conditions that should always apply here // add conditions that should always apply here
$dataProvider = new ActiveDataProvider([ $dataProvider = new ActiveDataProvider([
@ -69,6 +69,7 @@ class CompanySearch extends Company
$query->andFilterWhere(['like', 'name', $this->name]) $query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'description', $this->description]); ->andFilterWhere(['like', 'description', $this->description]);
$query->orderBy('created_at DESC');
return $dataProvider; return $dataProvider;
} }

View File

@ -42,13 +42,13 @@ $this->params['breadcrumbs'][] = $this->title;
//'description:ntext', //'description:ntext',
//'status_id', //'status_id',
[ [
'attribute' => 'status', 'attribute' => 'status_id',
'value' => function($model){ 'value' => function($model){
return isset($model->status0->name) ? $model->status0->name : 'Не задано'; return isset($model->status->name) ? $model->status->name : 'Не задано';
}, },
'filter' => kartik\select2\Select2::widget([ 'filter' => kartik\select2\Select2::widget([
'model' => $searchModel, 'model' => $searchModel,
'attribute' => 'status', 'attribute' => 'status_id',
'data' => \common\models\Status::getStatusesArray(\common\models\UseStatus::USE_COMPANY), 'data' => \common\models\Status::getStatusesArray(\common\models\UseStatus::USE_COMPANY),
'options' => ['placeholder' => 'Начните вводить...','class' => 'form-control'], 'options' => ['placeholder' => 'Начните вводить...','class' => 'form-control'],
'pluginOptions' => [ 'pluginOptions' => [

View File

@ -71,6 +71,7 @@ class HhJobSearch extends HhJob
->andFilterWhere(['like', 'url', $this->url]) ->andFilterWhere(['like', 'url', $this->url])
->andFilterWhere(['like', 'salary_currency', $this->salary_currency]) ->andFilterWhere(['like', 'salary_currency', $this->salary_currency])
->andFilterWhere(['like', 'address', $this->address]); ->andFilterWhere(['like', 'address', $this->address]);
$query->orderBy('dt_add DESC');
return $dataProvider; return $dataProvider;
} }

View File

@ -67,6 +67,7 @@ class HhSearch extends Hh
$query->andFilterWhere(['like', 'url', $this->url]) $query->andFilterWhere(['like', 'url', $this->url])
->andFilterWhere(['like', 'title', $this->title]) ->andFilterWhere(['like', 'title', $this->title])
->andFilterWhere(['like', 'photo', $this->photo]); ->andFilterWhere(['like', 'photo', $this->photo]);
$query->orderBy('dt_add DESC');
return $dataProvider; return $dataProvider;
} }

View File

@ -67,6 +67,7 @@ class ProjectSearch extends Project
$query->andFilterWhere(['like', 'name', $this->name]) $query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'description', $this->description]); ->andFilterWhere(['like', 'description', $this->description]);
$query->orderBy('created_at DESC');
return $dataProvider; return $dataProvider;
} }

View File

@ -63,7 +63,7 @@ class AdditionalFieldsSearch extends AdditionalFields
]); ]);
$query->andFilterWhere(['like', 'name', $this->name]); $query->andFilterWhere(['like', 'name', $this->name]);
// Debug::dd($query->createCommand()->rawSql);
return $dataProvider; return $dataProvider;
} }
} }