Commit 615358fb17e1482247b78120a8d7df0cdfdd8969
1 parent
03bffb3b
Importers CRUD
Showing
19 changed files
with
95 additions
and
51 deletions
Show diff stats
backend/controllers/MarginsImportersImportController.php
@@ -2,6 +2,8 @@ | @@ -2,6 +2,8 @@ | ||
2 | 2 | ||
3 | namespace backend\controllers; | 3 | namespace backend\controllers; |
4 | 4 | ||
5 | +use backend\models\Importers; | ||
6 | +use common\models\Margins; | ||
5 | use Yii; | 7 | use Yii; |
6 | use common\models\MarginsImportersImport; | 8 | use common\models\MarginsImportersImport; |
7 | use common\models\MarginsImportersImportSearch; | 9 | use common\models\MarginsImportersImportSearch; |
@@ -64,12 +66,15 @@ class MarginsImportersImportController extends Controller | @@ -64,12 +66,15 @@ class MarginsImportersImportController extends Controller | ||
64 | public function actionCreate() | 66 | public function actionCreate() |
65 | { | 67 | { |
66 | $model = new MarginsImportersImport(); | 68 | $model = new MarginsImportersImport(); |
67 | - | 69 | + $importers= Importers::find()->all(); |
70 | + $margin = Margins::find()->all(); | ||
68 | if ($model->load(Yii::$app->request->post()) && $model->save()) { | 71 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
69 | return $this->redirect(['view', 'id' => $model->id]); | 72 | return $this->redirect(['view', 'id' => $model->id]); |
70 | } else { | 73 | } else { |
71 | return $this->render('create', [ | 74 | return $this->render('create', [ |
72 | 'model' => $model, | 75 | 'model' => $model, |
76 | + 'importers' => $importers, | ||
77 | + 'margin' => $margin, | ||
73 | ]); | 78 | ]); |
74 | } | 79 | } |
75 | } | 80 | } |
@@ -83,12 +88,15 @@ class MarginsImportersImportController extends Controller | @@ -83,12 +88,15 @@ class MarginsImportersImportController extends Controller | ||
83 | public function actionUpdate($id) | 88 | public function actionUpdate($id) |
84 | { | 89 | { |
85 | $model = $this->findModel($id); | 90 | $model = $this->findModel($id); |
86 | - | 91 | + $importers= Importers::find()->all(); |
92 | + $margin = Margins::find()->all(); | ||
87 | if ($model->load(Yii::$app->request->post()) && $model->save()) { | 93 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
88 | return $this->redirect(['view', 'id' => $model->id]); | 94 | return $this->redirect(['view', 'id' => $model->id]); |
89 | } else { | 95 | } else { |
90 | return $this->render('update', [ | 96 | return $this->render('update', [ |
91 | 'model' => $model, | 97 | 'model' => $model, |
98 | + 'importers' => $importers, | ||
99 | + 'margin' => $margin, | ||
92 | ]); | 100 | ]); |
93 | } | 101 | } |
94 | } | 102 | } |
backend/controllers/OfficesController.php
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | namespace backend\controllers; | 3 | namespace backend\controllers; |
4 | 4 | ||
5 | +use common\models\DicCities; | ||
5 | use Yii; | 6 | use Yii; |
6 | use common\models\Offices; | 7 | use common\models\Offices; |
7 | use common\models\OfficesSearch; | 8 | use common\models\OfficesSearch; |
@@ -13,7 +14,7 @@ use yii\filters\VerbFilter; | @@ -13,7 +14,7 @@ use yii\filters\VerbFilter; | ||
13 | * OfficesController implements the CRUD actions for Offices model. | 14 | * OfficesController implements the CRUD actions for Offices model. |
14 | */ | 15 | */ |
15 | class OfficesController extends Controller | 16 | class OfficesController extends Controller |
16 | -{ | 17 | +{ public $layout = "/column"; |
17 | public function behaviors() | 18 | public function behaviors() |
18 | { | 19 | { |
19 | return [ | 20 | return [ |
@@ -61,12 +62,13 @@ class OfficesController extends Controller | @@ -61,12 +62,13 @@ class OfficesController extends Controller | ||
61 | public function actionCreate() | 62 | public function actionCreate() |
62 | { | 63 | { |
63 | $model = new Offices(); | 64 | $model = new Offices(); |
64 | - | 65 | + $cities = DicCities::find()->all(); |
65 | if ($model->load(Yii::$app->request->post()) && $model->save()) { | 66 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
66 | return $this->redirect(['view', 'id' => $model->id]); | 67 | return $this->redirect(['view', 'id' => $model->id]); |
67 | } else { | 68 | } else { |
68 | return $this->render('create', [ | 69 | return $this->render('create', [ |
69 | 'model' => $model, | 70 | 'model' => $model, |
71 | + 'cities' => $cities, | ||
70 | ]); | 72 | ]); |
71 | } | 73 | } |
72 | } | 74 | } |
@@ -80,12 +82,13 @@ class OfficesController extends Controller | @@ -80,12 +82,13 @@ class OfficesController extends Controller | ||
80 | public function actionUpdate($id) | 82 | public function actionUpdate($id) |
81 | { | 83 | { |
82 | $model = $this->findModel($id); | 84 | $model = $this->findModel($id); |
83 | - | 85 | + $cities = DicCities::find()->all(); |
84 | if ($model->load(Yii::$app->request->post()) && $model->save()) { | 86 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
85 | return $this->redirect(['view', 'id' => $model->id]); | 87 | return $this->redirect(['view', 'id' => $model->id]); |
86 | } else { | 88 | } else { |
87 | return $this->render('update', [ | 89 | return $this->render('update', [ |
88 | 'model' => $model, | 90 | 'model' => $model, |
91 | + 'cities' => $cities, | ||
89 | ]); | 92 | ]); |
90 | } | 93 | } |
91 | } | 94 | } |
backend/views/layouts/column.php
@@ -316,7 +316,7 @@ $this->beginContent('@app/views/layouts/main.php'); | @@ -316,7 +316,7 @@ $this->beginContent('@app/views/layouts/main.php'); | ||
316 | ['label' => 'Категории товаров', 'url' => ['currency/index']], | 316 | ['label' => 'Категории товаров', 'url' => ['currency/index']], |
317 | ['label' => 'Vin коды', 'url' => ['currency/index']], | 317 | ['label' => 'Vin коды', 'url' => ['currency/index']], |
318 | ['label' => 'Запросы по номеру', 'url' => ['currency/index']], | 318 | ['label' => 'Запросы по номеру', 'url' => ['currency/index']], |
319 | - ['label' => 'Офисы', 'url' => ['currency/index']], | 319 | + ['label' => 'Офисы', 'url' => ['offices/index']], |
320 | ], | 320 | ], |
321 | ], | 321 | ], |
322 | ['label' => 'Справочник', 'url' => ['#'], 'items' => [ | 322 | ['label' => 'Справочник', 'url' => ['#'], 'items' => [ |
backend/views/margins-groups/_form.php
@@ -11,9 +11,9 @@ use yii\helpers\ArrayHelper; | @@ -11,9 +11,9 @@ use yii\helpers\ArrayHelper; | ||
11 | <div class="margins-groups-form"> | 11 | <div class="margins-groups-form"> |
12 | <?php $form = ActiveForm::begin(); ?> | 12 | <?php $form = ActiveForm::begin(); ?> |
13 | 13 | ||
14 | - <?= $form->field($model, 'importer_id')->dropDownList(ArrayHelper::map($importers, 'id', 'name'), ['prompt' => 'Выберие город']) ?> | 14 | + <?= $form->field($model, 'importer_id')->dropDownList(ArrayHelper::map($importers, 'id', 'name')) ?> |
15 | 15 | ||
16 | - <?= $form->field($model, 'margin_id')->dropDownList(ArrayHelper::map($margin, 'id', 'name'), ['prompt' => 'Выберие город']) ?> | 16 | + <?= $form->field($model, 'margin_id')->dropDownList(ArrayHelper::map($margin, 'id', 'name')) ?> |
17 | 17 | ||
18 | <?= $form->field($model, 'group')->textInput(['maxlength' => true]) ?> | 18 | <?= $form->field($model, 'group')->textInput(['maxlength' => true]) ?> |
19 | 19 |
backend/views/margins-importers-import/_form.php
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | 2 | ||
3 | use yii\helpers\Html; | 3 | use yii\helpers\Html; |
4 | use yii\widgets\ActiveForm; | 4 | use yii\widgets\ActiveForm; |
5 | - | 5 | +use \yii\helpers\ArrayHelper; |
6 | /* @var $this yii\web\View */ | 6 | /* @var $this yii\web\View */ |
7 | /* @var $model common\models\MarginsImportersImport */ | 7 | /* @var $model common\models\MarginsImportersImport */ |
8 | /* @var $form yii\widgets\ActiveForm */ | 8 | /* @var $form yii\widgets\ActiveForm */ |
@@ -12,14 +12,13 @@ use yii\widgets\ActiveForm; | @@ -12,14 +12,13 @@ use yii\widgets\ActiveForm; | ||
12 | 12 | ||
13 | <?php $form = ActiveForm::begin(); ?> | 13 | <?php $form = ActiveForm::begin(); ?> |
14 | 14 | ||
15 | - <?= $form->field($model, 'importer_id')->textInput() ?> | 15 | + <?= $form->field($model, 'importer_id')->dropDownList(ArrayHelper::map($importers, 'id', 'name')) ?> |
16 | 16 | ||
17 | - <?= $form->field($model, 'margin_id')->textInput() ?> | 17 | + <?= $form->field($model, 'margin_id')->dropDownList(ArrayHelper::map($margin, 'id', 'name')) ?> |
18 | 18 | ||
19 | <?= $form->field($model, 'koef')->textInput() ?> | 19 | <?= $form->field($model, 'koef')->textInput() ?> |
20 | 20 | ||
21 | - <?= $form->field($model, 'finish')->textInput() ?> | ||
22 | - | 21 | + <?= $form->field($model, 'finish')->checkbox() ?> |
23 | <div class="form-group"> | 22 | <div class="form-group"> |
24 | <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | 23 | <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> |
25 | </div> | 24 | </div> |
backend/views/margins-importers-import/create.php
@@ -16,6 +16,8 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -16,6 +16,8 @@ $this->params['breadcrumbs'][] = $this->title; | ||
16 | 16 | ||
17 | <?= $this->render('_form', [ | 17 | <?= $this->render('_form', [ |
18 | 'model' => $model, | 18 | 'model' => $model, |
19 | + 'importers' => $importers, | ||
20 | + 'margin' => $margin, | ||
19 | ]) ?> | 21 | ]) ?> |
20 | 22 | ||
21 | </div> | 23 | </div> |
backend/views/margins-importers-import/index.php
@@ -25,9 +25,14 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -25,9 +25,14 @@ $this->params['breadcrumbs'][] = $this->title; | ||
25 | 'columns' => [ | 25 | 'columns' => [ |
26 | ['class' => 'yii\grid\SerialColumn'], | 26 | ['class' => 'yii\grid\SerialColumn'], |
27 | 27 | ||
28 | - //'id', | ||
29 | - 'importer_id', | ||
30 | - 'margin_id', | 28 | + [ |
29 | + 'attribute' => 'importer_id', | ||
30 | + 'value' => 'importers.name' | ||
31 | + ], | ||
32 | + [ | ||
33 | + 'attribute' => 'margin_id', | ||
34 | + 'value' => 'margins.name' | ||
35 | + ], | ||
31 | 'koef', | 36 | 'koef', |
32 | 'finish', | 37 | 'finish', |
33 | 38 |
backend/views/margins-importers-import/update.php
@@ -16,6 +16,8 @@ $this->params['breadcrumbs'][] = 'Update'; | @@ -16,6 +16,8 @@ $this->params['breadcrumbs'][] = 'Update'; | ||
16 | 16 | ||
17 | <?= $this->render('_form', [ | 17 | <?= $this->render('_form', [ |
18 | 'model' => $model, | 18 | 'model' => $model, |
19 | + 'importers' => $importers, | ||
20 | + 'margin' => $margin, | ||
19 | ]) ?> | 21 | ]) ?> |
20 | 22 | ||
21 | </div> | 23 | </div> |
backend/views/margins-importers/_form.php
@@ -12,9 +12,9 @@ use yii\helpers\ArrayHelper; | @@ -12,9 +12,9 @@ use yii\helpers\ArrayHelper; | ||
12 | 12 | ||
13 | <?php $form = ActiveForm::begin(); ?> | 13 | <?php $form = ActiveForm::begin(); ?> |
14 | 14 | ||
15 | - <?= $form->field($model, 'importer_id')->dropDownList(ArrayHelper::map($importers, 'id', 'name'), ['prompt' => 'Выберие город']) ?> | 15 | + <?= $form->field($model, 'importer_id')->dropDownList(ArrayHelper::map($importers, 'id', 'name')) ?> |
16 | 16 | ||
17 | - <?= $form->field($model, 'margin_id')->dropDownList(ArrayHelper::map($margin, 'id', 'name'), ['prompt' => 'Выберие город']) ?> | 17 | + <?= $form->field($model, 'margin_id')->dropDownList(ArrayHelper::map($margin, 'id', 'name')) ?> |
18 | 18 | ||
19 | <?= $form->field($model, 'koef')->textInput() ?> | 19 | <?= $form->field($model, 'koef')->textInput() ?> |
20 | 20 |
backend/views/margins-importers/index.php
@@ -25,8 +25,14 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -25,8 +25,14 @@ $this->params['breadcrumbs'][] = $this->title; | ||
25 | 'columns' => [ | 25 | 'columns' => [ |
26 | ['class' => 'yii\grid\SerialColumn'], | 26 | ['class' => 'yii\grid\SerialColumn'], |
27 | 27 | ||
28 | - 'importers.name', | ||
29 | - 'margins.name', | 28 | + [ |
29 | + 'attribute' => 'importer_id', | ||
30 | + 'value' => 'importers.name' | ||
31 | + ], | ||
32 | + [ | ||
33 | + 'attribute' => 'margin_id', | ||
34 | + 'value' => 'margins.name' | ||
35 | + ], | ||
30 | 'koef', | 36 | 'koef', |
31 | 37 | ||
32 | ['class' => 'yii\grid\ActionColumn'], | 38 | ['class' => 'yii\grid\ActionColumn'], |
backend/views/offices/_form.php
@@ -16,11 +16,7 @@ use yii\widgets\ActiveForm; | @@ -16,11 +16,7 @@ use yii\widgets\ActiveForm; | ||
16 | 16 | ||
17 | <?= $form->field($model, 'info')->textarea(['rows' => 6]) ?> | 17 | <?= $form->field($model, 'info')->textarea(['rows' => 6]) ?> |
18 | 18 | ||
19 | - <?= $form->field($model, 'city_id')->textInput() ?> | ||
20 | - | ||
21 | - <?= $form->field($model, 'is_default')->textInput() ?> | ||
22 | - | ||
23 | - <?= $form->field($model, 'content_delete')->textarea(['rows' => 6]) ?> | 19 | + <?= $form->field($model, 'city_id')->dropDownList(\yii\helpers\ArrayHelper::map($cities, 'id', 'name'), ['prompt' => 'Выберие город']) ?> |
24 | 20 | ||
25 | <?= $form->field($model, 'coords')->textInput(['maxlength' => true]) ?> | 21 | <?= $form->field($model, 'coords')->textInput(['maxlength' => true]) ?> |
26 | 22 |
backend/views/offices/create.php
@@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; | ||
16 | 16 | ||
17 | <?= $this->render('_form', [ | 17 | <?= $this->render('_form', [ |
18 | 'model' => $model, | 18 | 'model' => $model, |
19 | + 'cities' => $cities, | ||
19 | ]) ?> | 20 | ]) ?> |
20 | 21 | ||
21 | </div> | 22 | </div> |
backend/views/offices/index.php
@@ -25,17 +25,17 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -25,17 +25,17 @@ $this->params['breadcrumbs'][] = $this->title; | ||
25 | 'columns' => [ | 25 | 'columns' => [ |
26 | ['class' => 'yii\grid\SerialColumn'], | 26 | ['class' => 'yii\grid\SerialColumn'], |
27 | 27 | ||
28 | - 'id', | ||
29 | 'name', | 28 | 'name', |
30 | - 'info:ntext', | ||
31 | - 'city_id', | ||
32 | - 'is_default', | 29 | + [ |
30 | + 'attribute' => 'city_id', | ||
31 | + 'value' => 'dicCities.name' | ||
32 | + ], | ||
33 | // 'content_delete:ntext', | 33 | // 'content_delete:ntext', |
34 | // 'coords', | 34 | // 'coords', |
35 | // 'phones', | 35 | // 'phones', |
36 | - // 'address', | ||
37 | - // 'email:email', | ||
38 | - // 'skype', | 36 | + 'address', |
37 | + 'email:email', | ||
38 | + 'skype', | ||
39 | 39 | ||
40 | ['class' => 'yii\grid\ActionColumn'], | 40 | ['class' => 'yii\grid\ActionColumn'], |
41 | ], | 41 | ], |
backend/views/offices/update.php
@@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = 'Update'; | @@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = 'Update'; | ||
16 | 16 | ||
17 | <?= $this->render('_form', [ | 17 | <?= $this->render('_form', [ |
18 | 'model' => $model, | 18 | 'model' => $model, |
19 | + 'cities' => $cities, | ||
19 | ]) ?> | 20 | ]) ?> |
20 | 21 | ||
21 | </div> | 22 | </div> |
common/models/MarginsGroupsSearch.php
@@ -68,7 +68,7 @@ class MarginsGroupsSearch extends MarginsGroups | @@ -68,7 +68,7 @@ class MarginsGroupsSearch extends MarginsGroups | ||
68 | ]); | 68 | ]); |
69 | 69 | ||
70 | $query->andFilterWhere(['like', 'group', $this->group]); | 70 | $query->andFilterWhere(['like', 'group', $this->group]); |
71 | - $query->andFilterWhere(['like', Importers::tableName().'name', $this->importer_id]); | 71 | + $query->andFilterWhere(['like', Importers::tableName().'.name', $this->importer_id]); |
72 | $query->andFilterWhere(['like', Margins::tableName().'.name', $this->margin_id]); | 72 | $query->andFilterWhere(['like', Margins::tableName().'.name', $this->margin_id]); |
73 | 73 | ||
74 | return $dataProvider; | 74 | return $dataProvider; |
common/models/MarginsImportersImport.php
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | namespace common\models; | 3 | namespace common\models; |
4 | 4 | ||
5 | +use backend\models\Importers; | ||
5 | use Yii; | 6 | use Yii; |
6 | 7 | ||
7 | /** | 8 | /** |
@@ -43,10 +44,20 @@ class MarginsImportersImport extends \yii\db\ActiveRecord | @@ -43,10 +44,20 @@ class MarginsImportersImport extends \yii\db\ActiveRecord | ||
43 | { | 44 | { |
44 | return [ | 45 | return [ |
45 | 'id' => 'ID', | 46 | 'id' => 'ID', |
46 | - 'importer_id' => 'Importer ID', | ||
47 | - 'margin_id' => 'Margin ID', | ||
48 | - 'koef' => 'Koef', | ||
49 | - 'finish' => 'Finish', | 47 | + 'importer_id' => 'Поставщик', |
48 | + 'margin_id' => 'Тип цены', | ||
49 | + 'koef' => 'Коэффициент', | ||
50 | + 'finish' => 'Активно', | ||
50 | ]; | 51 | ]; |
51 | } | 52 | } |
53 | + | ||
54 | + public function getImporters() | ||
55 | + { | ||
56 | + return $this->hasOne(Importers::className(), ['id' => 'importer_id']); | ||
57 | + } | ||
58 | + | ||
59 | + public function getMargins() | ||
60 | + { | ||
61 | + return $this->hasOne(Margins::className(), ['id' => 'margin_id']); | ||
62 | + } | ||
52 | } | 63 | } |
common/models/MarginsImportersImportSearch.php
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | namespace common\models; | 3 | namespace common\models; |
4 | 4 | ||
5 | +use backend\models\Importers; | ||
5 | use Yii; | 6 | use Yii; |
6 | use yii\base\Model; | 7 | use yii\base\Model; |
7 | use yii\data\ActiveDataProvider; | 8 | use yii\data\ActiveDataProvider; |
@@ -18,8 +19,9 @@ class MarginsImportersImportSearch extends MarginsImportersImport | @@ -18,8 +19,9 @@ class MarginsImportersImportSearch extends MarginsImportersImport | ||
18 | public function rules() | 19 | public function rules() |
19 | { | 20 | { |
20 | return [ | 21 | return [ |
21 | - [['id', 'importer_id', 'margin_id', 'finish'], 'integer'], | 22 | + [['id', 'finish'], 'integer'], |
22 | [['koef'], 'number'], | 23 | [['koef'], 'number'], |
24 | + [[ 'importer_id', 'margin_id',], 'safe'] | ||
23 | ]; | 25 | ]; |
24 | } | 26 | } |
25 | 27 | ||
@@ -54,15 +56,16 @@ class MarginsImportersImportSearch extends MarginsImportersImport | @@ -54,15 +56,16 @@ class MarginsImportersImportSearch extends MarginsImportersImport | ||
54 | // $query->where('0=1'); | 56 | // $query->where('0=1'); |
55 | return $dataProvider; | 57 | return $dataProvider; |
56 | } | 58 | } |
57 | - | 59 | + $query->joinWith(['importers','margins']); |
58 | $query->andFilterWhere([ | 60 | $query->andFilterWhere([ |
59 | 'id' => $this->id, | 61 | 'id' => $this->id, |
60 | - 'importer_id' => $this->importer_id, | ||
61 | - 'margin_id' => $this->margin_id, | ||
62 | 'koef' => $this->koef, | 62 | 'koef' => $this->koef, |
63 | 'finish' => $this->finish, | 63 | 'finish' => $this->finish, |
64 | ]); | 64 | ]); |
65 | 65 | ||
66 | + $query->andFilterWhere(['like', Importers::tableName().'.name', $this->importer_id]); | ||
67 | + $query->andFilterWhere(['like', Margins::tableName().'.name', $this->margin_id]); | ||
68 | + | ||
66 | return $dataProvider; | 69 | return $dataProvider; |
67 | } | 70 | } |
68 | } | 71 | } |
common/models/MarginsImportersSearch.php
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | namespace common\models; | 3 | namespace common\models; |
4 | 4 | ||
5 | +use backend\models\Importers; | ||
5 | use Yii; | 6 | use Yii; |
6 | use yii\base\Model; | 7 | use yii\base\Model; |
7 | use yii\data\ActiveDataProvider; | 8 | use yii\data\ActiveDataProvider; |
@@ -18,7 +19,8 @@ class MarginsImportersSearch extends MarginsImporters | @@ -18,7 +19,8 @@ class MarginsImportersSearch extends MarginsImporters | ||
18 | public function rules() | 19 | public function rules() |
19 | { | 20 | { |
20 | return [ | 21 | return [ |
21 | - [['id', 'importer_id', 'margin_id'], 'integer'], | 22 | + [['id',], 'integer'], |
23 | + [[ 'importer_id', 'margin_id',], 'safe'], | ||
22 | [['koef'], 'number'], | 24 | [['koef'], 'number'], |
23 | ]; | 25 | ]; |
24 | } | 26 | } |
@@ -54,14 +56,14 @@ class MarginsImportersSearch extends MarginsImporters | @@ -54,14 +56,14 @@ class MarginsImportersSearch extends MarginsImporters | ||
54 | // $query->where('0=1'); | 56 | // $query->where('0=1'); |
55 | return $dataProvider; | 57 | return $dataProvider; |
56 | } | 58 | } |
57 | - | 59 | + $query->joinWith(['importers','margins']); |
58 | $query->andFilterWhere([ | 60 | $query->andFilterWhere([ |
59 | 'id' => $this->id, | 61 | 'id' => $this->id, |
60 | - 'importer_id' => $this->importer_id, | ||
61 | - 'margin_id' => $this->margin_id, | ||
62 | 'koef' => $this->koef, | 62 | 'koef' => $this->koef, |
63 | ]); | 63 | ]); |
64 | 64 | ||
65 | + $query->andFilterWhere(['like', Importers::tableName().'.name', $this->importer_id]); | ||
66 | + $query->andFilterWhere(['like', Margins::tableName().'.name', $this->margin_id]); | ||
65 | return $dataProvider; | 67 | return $dataProvider; |
66 | } | 68 | } |
67 | } | 69 | } |
common/models/Offices.php
@@ -52,16 +52,21 @@ class Offices extends \yii\db\ActiveRecord | @@ -52,16 +52,21 @@ class Offices extends \yii\db\ActiveRecord | ||
52 | { | 52 | { |
53 | return [ | 53 | return [ |
54 | 'id' => 'ID', | 54 | 'id' => 'ID', |
55 | - 'name' => 'Name', | ||
56 | - 'info' => 'Info', | ||
57 | - 'city_id' => 'City ID', | 55 | + 'name' => 'Название', |
56 | + 'info' => 'Описание', | ||
57 | + 'city_id' => 'Город', | ||
58 | 'is_default' => 'Is Default', | 58 | 'is_default' => 'Is Default', |
59 | 'content_delete' => 'Content Delete', | 59 | 'content_delete' => 'Content Delete', |
60 | - 'coords' => 'Coords', | ||
61 | - 'phones' => 'Phones', | ||
62 | - 'address' => 'Address', | 60 | + 'coords' => 'Координаты карты Google', |
61 | + 'phones' => 'Телефоны', | ||
62 | + 'address' => 'Адрес', | ||
63 | 'email' => 'Email', | 63 | 'email' => 'Email', |
64 | 'skype' => 'Skype', | 64 | 'skype' => 'Skype', |
65 | ]; | 65 | ]; |
66 | } | 66 | } |
67 | + | ||
68 | + public function getDicCities() | ||
69 | + { | ||
70 | + return $this->hasOne(DicCities::className(), ['id' => 'city_id']); | ||
71 | + } | ||
67 | } | 72 | } |