Commit 83aa6595a7d170cf5f5fbfa4b864da5d792ed54e

Authored by Mihail
1 parent 2d4b1514

edit brand-replace page

backend/views/brands-replace/_form.php
@@ -16,12 +16,9 @@ use yii\widgets\ActiveForm; @@ -16,12 +16,9 @@ use yii\widgets\ActiveForm;
16 16
17 <?= $form->field($model, 'to_brand')->textInput(['maxlength' => true]) ?> 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 <div class="form-group"> 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 </div> 22 </div>
26 23
27 <?php ActiveForm::end(); ?> 24 <?php ActiveForm::end(); ?>
backend/views/brands-replace/create.php
@@ -6,7 +6,7 @@ use yii\helpers\Html; @@ -6,7 +6,7 @@ use yii\helpers\Html;
6 /* @var $this yii\web\View */ 6 /* @var $this yii\web\View */
7 /* @var $model common\models\BrandsReplace */ 7 /* @var $model common\models\BrandsReplace */
8 8
9 -$this->title = 'Добавить Brands Replace'; 9 +$this->title = 'Добавить';
10 $this->params['breadcrumbs'][] = ['label' => 'Brands Replaces', 'url' => ['index']]; 10 $this->params['breadcrumbs'][] = ['label' => 'Brands Replaces', 'url' => ['index']];
11 $this->params['breadcrumbs'][] = $this->title; 11 $this->params['breadcrumbs'][] = $this->title;
12 ?> 12 ?>
backend/views/brands-replace/index.php
@@ -7,7 +7,7 @@ use yii\grid\GridView; @@ -7,7 +7,7 @@ use yii\grid\GridView;
7 /* @var $searchModel common\models\BrandsReplaceSearch */ 7 /* @var $searchModel common\models\BrandsReplaceSearch */
8 /* @var $dataProvider yii\data\ActiveDataProvider */ 8 /* @var $dataProvider yii\data\ActiveDataProvider */
9 9
10 -$this->title = 'Brands Replaces'; 10 +$this->title = 'Замена брендов';
11 $this->params['breadcrumbs'][] = $this->title; 11 $this->params['breadcrumbs'][] = $this->title;
12 ?> 12 ?>
13 <div class="brands-replace-index"> 13 <div class="brands-replace-index">
@@ -16,7 +16,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -16,7 +16,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
16 <?php // echo $this->render('_search', ['model' => $searchModel]); ?> 16 <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
17 17
18 <p> 18 <p>
19 - <?= Html::a('Добавить Brands Replace', ['create'], ['class' => 'btn btn-success']) ?> 19 + <?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
20 </p> 20 </p>
21 21
22 <?= GridView::widget([ 22 <?= GridView::widget([
@@ -28,7 +28,21 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -28,7 +28,21 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
28 'id', 28 'id',
29 'from_brand', 29 'from_brand',
30 'to_brand', 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 'timestamp', 46 'timestamp',
33 47
34 ['class' => 'yii\grid\ActionColumn'], 48 ['class' => 'yii\grid\ActionColumn'],
backend/views/brands-replace/update.php
@@ -5,7 +5,7 @@ use yii\helpers\Html; @@ -5,7 +5,7 @@ use yii\helpers\Html;
5 /* @var $this yii\web\View */ 5 /* @var $this yii\web\View */
6 /* @var $model common\models\BrandsReplace */ 6 /* @var $model common\models\BrandsReplace */
7 7
8 -$this->title = 'Update Brands Replace: ' . ' ' . $model->from_brand; 8 +$this->title = 'Редактирование: ' . ' ' . $model->from_brand;
9 $this->params['breadcrumbs'][] = ['label' => 'Brands Replaces', 'url' => ['index']]; 9 $this->params['breadcrumbs'][] = ['label' => 'Brands Replaces', 'url' => ['index']];
10 $this->params['breadcrumbs'][] = ['label' => $model->from_brand, 'url' => ['view', 'from_brand' => $model->from_brand, 'to_brand' => $model->to_brand]]; 10 $this->params['breadcrumbs'][] = ['label' => $model->from_brand, 'url' => ['view', 'from_brand' => $model->from_brand, 'to_brand' => $model->to_brand]];
11 $this->params['breadcrumbs'][] = 'Update'; 11 $this->params['breadcrumbs'][] = 'Update';
backend/views/brands-replace/view.php
@@ -15,8 +15,8 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -15,8 +15,8 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
15 <h1><?= Html::encode($this->title) ?></h1> 15 <h1><?= Html::encode($this->title) ?></h1>
16 16
17 <p> 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 'class' => 'btn btn-danger', 20 'class' => 'btn btn-danger',
21 'data' => [ 21 'data' => [
22 'confirm' => 'Are you sure you want to delete this item?', 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,9 +12,13 @@ use backend\models\Importers;
12 12
13 <div class="details-form"> 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 <?= $form->field($model, 'BRAND')->textInput(['maxlength' => true]) ?> 23 <?= $form->field($model, 'BRAND')->textInput(['maxlength' => true]) ?>
20 24
backend/views/details/index.php
@@ -27,10 +27,12 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -27,10 +27,12 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
27 ['class' => 'yii\grid\SerialColumn'], 27 ['class' => 'yii\grid\SerialColumn'],
28 'ARTICLE', 28 'ARTICLE',
29 'BRAND', 29 'BRAND',
30 -  
31 ['attribute' => 'IMPORT_ID', 30 ['attribute' => 'IMPORT_ID',
32 - 'value' => function($model){return $model->importer;}],  
33 - 31 + 'value' => function($model)
  32 + {
  33 + return $model->importer;
  34 + }
  35 + ],
34 'DESCR', 36 'DESCR',
35 'BOX', 37 'BOX',
36 'ADD_BOX', 38 'ADD_BOX',
common/components/parsers/Converter.php
@@ -44,7 +44,7 @@ class Converter implements ConverterInterface @@ -44,7 +44,7 @@ class Converter implements ConverterInterface
44 if ($value == '') { 44 if ($value == '') {
45 return ''; 45 return '';
46 } 46 }
47 - $value = round((int)$value, 2); 47 + $value = (int)$value;
48 48
49 return $value; 49 return $value;
50 } 50 }
common/models/BrandsReplace.php
@@ -43,10 +43,10 @@ class BrandsReplace extends \yii\db\ActiveRecord @@ -43,10 +43,10 @@ class BrandsReplace extends \yii\db\ActiveRecord
43 { 43 {
44 return [ 44 return [
45 'id' => 'ID', 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,7 +19,7 @@ class BrandsReplaceSearch extends BrandsReplace
19 { 19 {
20 return [ 20 return [
21 [['id', 'finish'], 'integer'], 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,7 +58,6 @@ class BrandsReplaceSearch extends BrandsReplace
58 $query->andFilterWhere([ 58 $query->andFilterWhere([
59 'id' => $this->id, 59 'id' => $this->id,
60 'finish' => $this->finish, 60 'finish' => $this->finish,
61 - 'timestamp' => $this->timestamp,  
62 ]); 61 ]);
63 62
64 $query->andFilterWhere(['like', 'from_brand', $this->from_brand]) 63 $query->andFilterWhere(['like', 'from_brand', $this->from_brand])
common/models/Details.php
@@ -52,7 +52,13 @@ class Details extends BaseActiveRecord @@ -52,7 +52,13 @@ class Details extends BaseActiveRecord
52 52
53 public function getImporter () 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,7 +89,7 @@ class Details extends BaseActiveRecord
83 'Importer' => Yii::t('app', 'ПОСТАВЩИК'), 89 'Importer' => Yii::t('app', 'ПОСТАВЩИК'),
84 'BRAND' => Yii::t('app', 'БРЕНД'), 90 'BRAND' => Yii::t('app', 'БРЕНД'),
85 'ARTICLE' => Yii::t('app', 'АРТИКУЛ'), 91 'ARTICLE' => Yii::t('app', 'АРТИКУЛ'),
86 - 'FULL_ARTICLE' => Yii::t('app', 'Full Article'), 92 + 'FULL_ARTICLE' => Yii::t('app', 'ПОЛНЫЙ АРТИКУЛ'),
87 'PRICE' => Yii::t('app', 'ЦЕНА'), 93 'PRICE' => Yii::t('app', 'ЦЕНА'),
88 'DESCR' => Yii::t('app', 'ОПИСАНИЕ'), 94 'DESCR' => Yii::t('app', 'ОПИСАНИЕ'),
89 'BOX' => Yii::t('app', 'НАЛИЧИЕ'), 95 'BOX' => Yii::t('app', 'НАЛИЧИЕ'),
frontend/tmp/sess_p4qt4plherihoah2i54pkdda02 0 → 100644
  1 +__flash|a:0:{}__captcha/site/captcha|s:6:"jiwego";__captcha/site/captchacount|i:1;
0 \ No newline at end of file 2 \ No newline at end of file