Commit 83aa6595a7d170cf5f5fbfa4b864da5d792ed54e
1 parent
2d4b1514
edit brand-replace page
Showing
12 changed files
with
48 additions
and
25 deletions
Show diff stats
backend/views/brands-replace/_form.php
... | ... | @@ -16,12 +16,9 @@ use yii\widgets\ActiveForm; |
16 | 16 | |
17 | 17 | <?= $form->field($model, 'to_brand')->textInput(['maxlength' => true]) ?> |
18 | 18 | |
19 | - <?= $form->field($model, 'finish')->textInput() ?> | |
20 | - | |
21 | - <?= $form->field($model, 'timestamp')->textInput() ?> | |
22 | 19 | |
23 | 20 | <div class="form-group"> |
24 | - <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
21 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Редактировать', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
25 | 22 | </div> |
26 | 23 | |
27 | 24 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/brands-replace/create.php
... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
6 | 6 | /* @var $this yii\web\View */ |
7 | 7 | /* @var $model common\models\BrandsReplace */ |
8 | 8 | |
9 | -$this->title = 'Добавить Brands Replace'; | |
9 | +$this->title = 'Добавить'; | |
10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Brands Replaces', 'url' => ['index']]; |
11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | 12 | ?> | ... | ... |
backend/views/brands-replace/index.php
... | ... | @@ -7,7 +7,7 @@ use yii\grid\GridView; |
7 | 7 | /* @var $searchModel common\models\BrandsReplaceSearch */ |
8 | 8 | /* @var $dataProvider yii\data\ActiveDataProvider */ |
9 | 9 | |
10 | -$this->title = 'Brands Replaces'; | |
10 | +$this->title = 'Замена брендов'; | |
11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | 12 | ?> |
13 | 13 | <div class="brands-replace-index"> |
... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
17 | 17 | |
18 | 18 | <p> |
19 | - <?= Html::a('Добавить Brands Replace', ['create'], ['class' => 'btn btn-success']) ?> | |
19 | + <?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?> | |
20 | 20 | </p> |
21 | 21 | |
22 | 22 | <?= GridView::widget([ |
... | ... | @@ -28,7 +28,21 @@ $this->params['breadcrumbs'][] = $this->title; |
28 | 28 | 'id', |
29 | 29 | 'from_brand', |
30 | 30 | 'to_brand', |
31 | - 'finish', | |
31 | + ['attribute' => 'finish', | |
32 | + 'format' => 'raw', | |
33 | + 'filter' => [ | |
34 | + '1'=>'Закончена', | |
35 | + '0'=>'Не закончена', | |
36 | + ], | |
37 | + 'value' => function($data){ | |
38 | + if($data->finish){ | |
39 | + $status_img = '<i style="color: #008000" class="glyphicon glyphicon-ok"></i>'; | |
40 | + } else { | |
41 | + $status_img = '<i style="color: red" class="glyphicon glyphicon-remove"></i>'; | |
42 | + } | |
43 | + return $status_img; | |
44 | + }, | |
45 | + ], | |
32 | 46 | 'timestamp', |
33 | 47 | |
34 | 48 | ['class' => 'yii\grid\ActionColumn'], | ... | ... |
backend/views/brands-replace/update.php
... | ... | @@ -5,7 +5,7 @@ use yii\helpers\Html; |
5 | 5 | /* @var $this yii\web\View */ |
6 | 6 | /* @var $model common\models\BrandsReplace */ |
7 | 7 | |
8 | -$this->title = 'Update Brands Replace: ' . ' ' . $model->from_brand; | |
8 | +$this->title = 'Редактирование: ' . ' ' . $model->from_brand; | |
9 | 9 | $this->params['breadcrumbs'][] = ['label' => 'Brands Replaces', 'url' => ['index']]; |
10 | 10 | $this->params['breadcrumbs'][] = ['label' => $model->from_brand, 'url' => ['view', 'from_brand' => $model->from_brand, 'to_brand' => $model->to_brand]]; |
11 | 11 | $this->params['breadcrumbs'][] = 'Update'; | ... | ... |
backend/views/brands-replace/view.php
... | ... | @@ -15,8 +15,8 @@ $this->params['breadcrumbs'][] = $this->title; |
15 | 15 | <h1><?= Html::encode($this->title) ?></h1> |
16 | 16 | |
17 | 17 | <p> |
18 | - <?= Html::a('Update', ['update', 'from_brand' => $model->from_brand, 'to_brand' => $model->to_brand], ['class' => 'btn btn-primary']) ?> | |
19 | - <?= Html::a('Delete', ['delete', 'from_brand' => $model->from_brand, 'to_brand' => $model->to_brand], [ | |
18 | + <?= Html::a('Редактировать', ['update', 'from_brand' => $model->from_brand, 'to_brand' => $model->to_brand], ['class' => 'btn btn-primary']) ?> | |
19 | + <?= Html::a('Удалить', ['delete', 'from_brand' => $model->from_brand, 'to_brand' => $model->to_brand], [ | |
20 | 20 | 'class' => 'btn btn-danger', |
21 | 21 | 'data' => [ |
22 | 22 | 'confirm' => 'Are you sure you want to delete this item?', | ... | ... |
backend/views/details/_form.php
... | ... | @@ -12,9 +12,13 @@ use backend\models\Importers; |
12 | 12 | |
13 | 13 | <div class="details-form"> |
14 | 14 | |
15 | - <?php $form = ActiveForm::begin(); ?> | |
15 | + <?php $form = ActiveForm::begin(); | |
16 | + // первый элемент массива должен быть пустым | |
17 | + $arr_importers = [ null => '' ]; | |
18 | + $arr_importers = array_merge( $arr_importers, ArrayHelper::map( Importers::find()->orderBy('name')->all(), 'id','name' ) ); | |
19 | + ?> | |
16 | 20 | |
17 | - <?= $form->field($model, 'IMPORT_ID')->dropDownList( ArrayHelper::map( Importers::find()->orderBy('name')->all(), 'id','name' ) ) ?> | |
21 | + <?= $form->field($model, 'IMPORT_ID')->dropDownList( $arr_importers ) ?> | |
18 | 22 | |
19 | 23 | <?= $form->field($model, 'BRAND')->textInput(['maxlength' => true]) ?> |
20 | 24 | ... | ... |
backend/views/details/index.php
... | ... | @@ -27,10 +27,12 @@ $this->params['breadcrumbs'][] = $this->title; |
27 | 27 | ['class' => 'yii\grid\SerialColumn'], |
28 | 28 | 'ARTICLE', |
29 | 29 | 'BRAND', |
30 | - | |
31 | 30 | ['attribute' => 'IMPORT_ID', |
32 | - 'value' => function($model){return $model->importer;}], | |
33 | - | |
31 | + 'value' => function($model) | |
32 | + { | |
33 | + return $model->importer; | |
34 | + } | |
35 | + ], | |
34 | 36 | 'DESCR', |
35 | 37 | 'BOX', |
36 | 38 | 'ADD_BOX', | ... | ... |
common/components/parsers/Converter.php
common/models/BrandsReplace.php
... | ... | @@ -43,10 +43,10 @@ class BrandsReplace extends \yii\db\ActiveRecord |
43 | 43 | { |
44 | 44 | return [ |
45 | 45 | 'id' => 'ID', |
46 | - 'from_brand' => 'From Brand', | |
47 | - 'to_brand' => 'To Brand', | |
48 | - 'finish' => 'Finish', | |
49 | - 'timestamp' => 'Timestamp', | |
46 | + 'from_brand' => 'Не правильный бренд', | |
47 | + 'to_brand' => 'Правильный бренд', | |
48 | + 'finish' => 'Замена закончена', | |
49 | + 'timestamp' => 'Время', | |
50 | 50 | ]; |
51 | 51 | } |
52 | 52 | } | ... | ... |
common/models/BrandsReplaceSearch.php
... | ... | @@ -19,7 +19,7 @@ class BrandsReplaceSearch extends BrandsReplace |
19 | 19 | { |
20 | 20 | return [ |
21 | 21 | [['id', 'finish'], 'integer'], |
22 | - [['from_brand', 'to_brand', 'timestamp'], 'safe'], | |
22 | + [['from_brand', 'to_brand'], 'safe'], | |
23 | 23 | ]; |
24 | 24 | } |
25 | 25 | |
... | ... | @@ -58,7 +58,6 @@ class BrandsReplaceSearch extends BrandsReplace |
58 | 58 | $query->andFilterWhere([ |
59 | 59 | 'id' => $this->id, |
60 | 60 | 'finish' => $this->finish, |
61 | - 'timestamp' => $this->timestamp, | |
62 | 61 | ]); |
63 | 62 | |
64 | 63 | $query->andFilterWhere(['like', 'from_brand', $this->from_brand]) | ... | ... |
common/models/Details.php
... | ... | @@ -52,7 +52,13 @@ class Details extends BaseActiveRecord |
52 | 52 | |
53 | 53 | public function getImporter () |
54 | 54 | { |
55 | - return Importers::findOne(['id' => $this->IMPORT_ID])->name; | |
55 | + $importer = Importers::findOne(['id' => $this->IMPORT_ID]); | |
56 | + if ($importer) { | |
57 | + return $importer->name; | |
58 | + } else { | |
59 | + return null; | |
60 | + } | |
61 | + | |
56 | 62 | } |
57 | 63 | |
58 | 64 | /** |
... | ... | @@ -83,7 +89,7 @@ class Details extends BaseActiveRecord |
83 | 89 | 'Importer' => Yii::t('app', 'ПОСТАВЩИК'), |
84 | 90 | 'BRAND' => Yii::t('app', 'БРЕНД'), |
85 | 91 | 'ARTICLE' => Yii::t('app', 'АРТИКУЛ'), |
86 | - 'FULL_ARTICLE' => Yii::t('app', 'Full Article'), | |
92 | + 'FULL_ARTICLE' => Yii::t('app', 'ПОЛНЫЙ АРТИКУЛ'), | |
87 | 93 | 'PRICE' => Yii::t('app', 'ЦЕНА'), |
88 | 94 | 'DESCR' => Yii::t('app', 'ОПИСАНИЕ'), |
89 | 95 | 'BOX' => Yii::t('app', 'НАЛИЧИЕ'), | ... | ... |