Commit 2e0d34224a62d2218a459f7bf2abf2e580eda2ac
Merge remote-tracking branch 'origin/master'
Showing
7 changed files
with
131 additions
and
50 deletions
Show diff stats
models/Category.php
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | * @todo Write doc for ArtboxTreeBehavior |
20 | 20 | * @property integer $id |
21 | 21 | * @property integer $sort |
22 | + * @property integer $sort2 | |
22 | 23 | * @property integer $remote_id |
23 | 24 | * @property integer $parent_id |
24 | 25 | * @property string $path |
... | ... | @@ -68,7 +69,7 @@ |
68 | 69 | return [ |
69 | 70 | 'artboxtree' => [ |
70 | 71 | 'class' => ArtboxTreeBehavior::className(), |
71 | - 'keyNameGroup' => NULL, | |
72 | + 'keyNameGroup' => null, | |
72 | 73 | 'keyNamePath' => 'path', |
73 | 74 | ], |
74 | 75 | 'language' => [ |
... | ... | @@ -110,6 +111,7 @@ |
110 | 111 | 'depth', |
111 | 112 | 'product_unit_id', |
112 | 113 | 'sort', |
114 | + 'sort2', | |
113 | 115 | ], |
114 | 116 | 'integer', |
115 | 117 | ], |
... | ... | @@ -138,6 +140,7 @@ |
138 | 140 | 'product_unit_id' => Yii::t('product', 'Product Unit ID'), |
139 | 141 | 'remote_id' => Yii::t('product', 'Remote ID'), |
140 | 142 | 'sort' => Yii::t('product', 'Порядок вывода'), |
143 | + 'sort2' => Yii::t('product', 'Порядок вывода на главной'), | |
141 | 144 | ]; |
142 | 145 | } |
143 | 146 | |
... | ... | @@ -212,7 +215,7 @@ |
212 | 215 | { |
213 | 216 | if (parent::beforeSave($insert)) { |
214 | 217 | |
215 | - if (empty($this->parent_id)) { | |
218 | + if (empty( $this->parent_id )) { | |
216 | 219 | $this->parent_id = 0; |
217 | 220 | } |
218 | 221 | ... | ... |
models/Order.php
... | ... | @@ -183,7 +183,7 @@ |
183 | 183 | public function afterFind() |
184 | 184 | { |
185 | 185 | parent::afterFind(); |
186 | - $this->deadline = !empty( $this->deadline ) ? date('d.m.Y', $this->deadline) : ''; | |
186 | + $this->deadline = !empty($this->deadline) ? date('d.m.Y', $this->deadline) : ''; | |
187 | 187 | |
188 | 188 | } |
189 | 189 | |
... | ... | @@ -200,7 +200,7 @@ |
200 | 200 | |
201 | 201 | protected function convertDate() |
202 | 202 | { |
203 | - if (!empty( $this->deadline )) { | |
203 | + if (!empty($this->deadline)) { | |
204 | 204 | $date = new \DateTime(); |
205 | 205 | $date->setTimestamp(strtotime($this->deadline)); |
206 | 206 | $date->format("d.m.Y"); |
... | ... | @@ -213,21 +213,37 @@ |
213 | 213 | public function attributeLabels() |
214 | 214 | { |
215 | 215 | return [ |
216 | - 'name' => Yii::t('app', 'order_name'), | |
217 | - 'phone' => Yii::t('app', 'order_phone'), | |
218 | - 'email' => Yii::t('app', 'order_email'), | |
219 | - 'comment' => Yii::t('app', 'order_comment'), | |
220 | - 'created_at' => Yii::t('app', 'Дата добавления'), | |
221 | - 'updated_at' => Yii::t('app', 'Дата обновления'), | |
222 | - 'deleted_at' => Yii::t('app', 'Дата удаления'), | |
223 | - 'deadline' => Yii::t('app', 'Дедлайн'), | |
224 | - 'reason' => Yii::t('app', 'Причина'), | |
225 | - 'check' => Yii::t('app', 'Чек'), | |
226 | - 'sms' => Yii::t('app', 'СМС'), | |
227 | - 'consignment' => Yii::t('app', 'Номер накладной'), | |
228 | - 'manager_id' => Yii::t('app', 'Менеджер'), | |
229 | - 'delivery_cost' => Yii::t('app', 'Стоимость доставки'), | |
230 | - 'published' => Yii::t('app', 'Опубликован'), | |
216 | + 'name' => Yii::t('app', 'order_name'), | |
217 | + 'phone' => Yii::t('app', 'order_phone'), | |
218 | + 'phone2' => Yii::t('app', 'Конактный телефон 2'), | |
219 | + 'email' => Yii::t('app', 'E-mail'), | |
220 | + 'comment' => Yii::t('app', 'Комментарий '), | |
221 | + 'created_at' => Yii::t('app', 'Дата добавления'), | |
222 | + 'updated_at' => Yii::t('app', 'Дата обновления'), | |
223 | + 'deleted_at' => Yii::t('app', 'Дата удаления'), | |
224 | + 'deadline' => Yii::t('app', 'Дедлайн'), | |
225 | + 'reason' => Yii::t('app', 'Причина'), | |
226 | + 'check' => Yii::t('app', 'Чек'), | |
227 | + 'sms' => Yii::t('app', 'СМС'), | |
228 | + 'consignment' => Yii::t('app', 'Номер накладной'), | |
229 | + 'manager_id' => Yii::t('app', 'Менеджер'), | |
230 | + 'delivery_cost' => Yii::t('app', 'Стоимость доставки'), | |
231 | + 'published' => Yii::t('app', 'Опубликован'), | |
232 | + 'label' => Yii::t('app', 'Метка'), | |
233 | + 'declaration' => Yii::t('app', 'Номер декларации'), | |
234 | + 'delivery' => Yii::t('app', 'Способ доставки'), | |
235 | + 'total' => Yii::t('app', 'Сумма'), | |
236 | + 'adress' => Yii::t('app', 'Адрес'), | |
237 | + 'pay' => Yii::t('app', 'Оплата'), | |
238 | + 'body' => Yii::t('app', 'Комментарий менеджера'), | |
239 | + 'id' => Yii::t('app', 'Номер'), | |
240 | + 'stock' => Yii::t('app', 'Номер склада'), | |
241 | + 'payment' => Yii::t('app', 'Способ оплаты'), | |
242 | + 'insurance' => Yii::t('app', 'Страховка'), | |
243 | + 'amount_imposed' => Yii::t('app', 'Сумма наложенного'), | |
244 | + 'shipping_by' => Yii::t('app', 'Отправка за счет'), | |
245 | + 'city' => Yii::t('app', 'Город'), | |
246 | + 'numbercard' => Yii::t('app', '№ карточки'), | |
231 | 247 | ]; |
232 | 248 | } |
233 | 249 | |
... | ... | @@ -273,8 +289,8 @@ |
273 | 289 | */ |
274 | 290 | public function getDeliveryString() |
275 | 291 | { |
276 | - if (!empty( $this->orderDelivery )) { | |
277 | - if (!empty( $this->orderDelivery->parent )) { | |
292 | + if (!empty($this->orderDelivery)) { | |
293 | + if (!empty($this->orderDelivery->parent)) { | |
278 | 294 | return $this->orderDelivery->parent->lang->title . ': ' . $this->orderDelivery->lang->title; |
279 | 295 | } else { |
280 | 296 | return $this->orderDelivery->lang->title; |
... | ... | @@ -292,7 +308,7 @@ |
292 | 308 | */ |
293 | 309 | public function getWasted() |
294 | 310 | { |
295 | - if (empty( $this->deadline )) { | |
311 | + if (empty($this->deadline)) { | |
296 | 312 | return false; |
297 | 313 | } else { |
298 | 314 | return time() > strtotime($this->deadline); | ... | ... |
models/OrderProduct.php
... | ... | @@ -79,15 +79,17 @@ |
79 | 79 | public function attributeLabels() |
80 | 80 | { |
81 | 81 | return [ |
82 | - 'product_name' => Yii::t('app', 'product_name'), | |
82 | + 'product_name' => Yii::t('app', 'Наименование'), | |
83 | 83 | 'name' => Yii::t('app', 'op_name'), |
84 | 84 | 'art' => Yii::t('app', 'art'), |
85 | 85 | 'cost' => Yii::t('app', 'cost'), |
86 | 86 | 'count' => Yii::t('app', 'count'), |
87 | - 'sum_cost' => Yii::t('app', 'sum_cost'), | |
87 | + 'sum_cost' => Yii::t('app', 'Сумма'), | |
88 | 88 | 'status' => Yii::t('app', 'Статус'), |
89 | 89 | 'booking' => Yii::t('app', 'Бронь'), |
90 | 90 | 'return' => Yii::t('app', 'Возврат'), |
91 | + 'sku' => Yii::t('app', 'Артикул'), | |
92 | + 'price' => Yii::t('app', 'Цена'), | |
91 | 93 | ]; |
92 | 94 | } |
93 | 95 | ... | ... |
models/OrderSearch.php
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | |
5 | 5 | use yii\base\Model; |
6 | 6 | use yii\data\ActiveDataProvider; |
7 | + use yii\helpers\ArrayHelper; | |
7 | 8 | use yii\helpers\VarDumper; |
8 | 9 | |
9 | 10 | /** |
... | ... | @@ -75,8 +76,8 @@ |
75 | 76 | |
76 | 77 | $dataProvider = new ActiveDataProvider( |
77 | 78 | [ |
78 | - 'query' => $query, | |
79 | - 'sort' => [ 'defaultOrder' => [ 'id' => SORT_DESC ] ], | |
79 | + 'query' => $query, | |
80 | + 'sort' => [ 'defaultOrder' => [ 'id' => SORT_DESC ] ], | |
80 | 81 | 'pagination' => [ |
81 | 82 | 'pageSize' => 50, |
82 | 83 | ], |
... | ... | @@ -93,7 +94,7 @@ |
93 | 94 | return $dataProvider; |
94 | 95 | } |
95 | 96 | |
96 | - if (!empty( $this->sku )) { | |
97 | + if (!empty($this->sku)) { | |
97 | 98 | $query->innerJoinWith('products.productVariant') |
98 | 99 | ->andWhere( |
99 | 100 | [ |
... | ... | @@ -125,9 +126,17 @@ |
125 | 126 | ); |
126 | 127 | $query->andFilterWhere( |
127 | 128 | [ |
128 | - 'like', | |
129 | - 'phone', | |
130 | - $this->phone, | |
129 | + 'or', | |
130 | + [ | |
131 | + 'like', | |
132 | + 'phone', | |
133 | + $this->phone, | |
134 | + ], | |
135 | + [ | |
136 | + 'like', | |
137 | + 'phone2', | |
138 | + $this->phone, | |
139 | + ], | |
131 | 140 | ] |
132 | 141 | ); |
133 | 142 | $query->andFilterWhere( |
... | ... | @@ -168,7 +177,7 @@ |
168 | 177 | 'delivery' => $this->delivery, |
169 | 178 | ] |
170 | 179 | ); |
171 | - if (!empty( $this->date_range )) { | |
180 | + if (!empty($this->date_range)) { | |
172 | 181 | $this->date_from = strtotime(explode('to', $this->date_range)[ 0 ]); |
173 | 182 | $this->date_to = strtotime(explode('to', $this->date_range)[ 1 ]); |
174 | 183 | |
... | ... | @@ -190,4 +199,13 @@ |
190 | 199 | |
191 | 200 | return $dataProvider; |
192 | 201 | } |
202 | + | |
203 | + public function attributeLabels() | |
204 | + { | |
205 | + $labels = [ | |
206 | + 'sku' => \Yii::t('app', 'Артикул'), | |
207 | + ]; | |
208 | + | |
209 | + return ArrayHelper::merge($labels, parent::attributeLabels()); | |
210 | + } | |
193 | 211 | } | ... | ... |
views/category/_form.php
... | ... | @@ -39,10 +39,14 @@ |
39 | 39 | ) |
40 | 40 | ->label(Yii::t('product', 'Parent category')) ?> |
41 | 41 | |
42 | - <?php | |
43 | - echo $form->field($model, 'sort'); | |
44 | - ?> | |
45 | - | |
42 | + <?php | |
43 | + echo $form->field($model, 'sort'); | |
44 | + ?> | |
45 | + | |
46 | + <?php | |
47 | + echo $form->field($model, 'sort2'); | |
48 | + ?> | |
49 | + | |
46 | 50 | <?= $form->field($model, 'image') |
47 | 51 | ->widget( |
48 | 52 | \kartik\file\FileInput::className(), |
... | ... | @@ -85,7 +89,10 @@ |
85 | 89 | 'gif', |
86 | 90 | 'png', |
87 | 91 | ], |
88 | - 'initialPreview' => !empty( $model->getImageUrl(1, false) ) ? ArtboxImageHelper::getImage( | |
92 | + 'initialPreview' => !empty( $model->getImageUrl( | |
93 | + 1, | |
94 | + false | |
95 | + ) ) ? ArtboxImageHelper::getImage( | |
89 | 96 | $model->getImageUrl(1, false), |
90 | 97 | 'list' |
91 | 98 | ) : '', | ... | ... |
views/order/_form.php
... | ... | @@ -379,7 +379,27 @@ JS; |
379 | 379 | [ |
380 | 380 | 'class' => SerialColumn::className(), |
381 | 381 | ], |
382 | - 'sku', | |
382 | + [ | |
383 | + 'attribute' => 'sku', | |
384 | + 'content' => function($model) { | |
385 | + return Html::a( | |
386 | + $model->sku, | |
387 | + '#', | |
388 | + [ | |
389 | + 'onclick' => 'event.preventDefault();', | |
390 | + 'data-toggle' => 'popover', | |
391 | + 'data-placement' => 'right', | |
392 | + 'data-html' => 'true', | |
393 | + 'data-content' => Html::img( | |
394 | + $model->productVariant->imageUrl, | |
395 | + [ | |
396 | + 'class' => 'img-rounded', | |
397 | + ] | |
398 | + ), | |
399 | + ] | |
400 | + ); | |
401 | + }, | |
402 | + ], | |
383 | 403 | [ |
384 | 404 | 'attribute' => 'product_name', |
385 | 405 | 'content' => function($model) { |
... | ... | @@ -398,7 +418,10 @@ JS; |
398 | 418 | } |
399 | 419 | }, |
400 | 420 | ], |
401 | - 'productVariant.product.brand.lang.title', | |
421 | + [ | |
422 | + 'attribute' => 'productVariant.product.brand.lang.title', | |
423 | + 'label' => 'Брэнд', | |
424 | + ], | |
402 | 425 | [ |
403 | 426 | 'attribute' => 'productVariant.lang.title', |
404 | 427 | 'label' => \Yii::t('app', 'Цвет'), |
... | ... | @@ -410,7 +433,10 @@ JS; |
410 | 433 | } |
411 | 434 | }, |
412 | 435 | ], |
413 | - 'productVariant.size', | |
436 | + [ | |
437 | + 'attribute' => 'productVariant.size', | |
438 | + 'label' => 'Размер', | |
439 | + ], | |
414 | 440 | 'price', |
415 | 441 | [ |
416 | 442 | 'class' => 'kartik\grid\EditableColumn', |
... | ... | @@ -496,7 +522,7 @@ JS; |
496 | 522 | 'pageSummary' => false, |
497 | 523 | ], |
498 | 524 | [ |
499 | -// 'label' => \Yii::t('app', 'Склады'), | |
525 | + // 'label' => \Yii::t('app', 'Склады'), | |
500 | 526 | 'content' => function($model) { |
501 | 527 | $content = '<table class="table"><tbody><tr><th>Склад</th><th>кол.</th></tr>'; |
502 | 528 | foreach ($model->productVariant->variantStocks as $stock) { |
... | ... | @@ -607,7 +633,7 @@ JS; |
607 | 633 | ), |
608 | 634 | ], |
609 | 635 | ] |
610 | - ); | |
636 | + )->label('Артикул'); | |
611 | 637 | |
612 | 638 | ?> |
613 | 639 | </div> |
... | ... | @@ -625,7 +651,7 @@ JS; |
625 | 651 | </div> |
626 | 652 | <div class="col-md-2" style="margin-top: 23px"> |
627 | 653 | <?php echo Html::submitButton( |
628 | - 'Add', | |
654 | + \Yii::t('app', 'Добавить'), | |
629 | 655 | [ |
630 | 656 | 'class' => $model->isNewRecord ? 'btn btn-primary disabled' : 'btn btn-primary', |
631 | 657 | ] | ... | ... |
views/order/index.php
... | ... | @@ -37,7 +37,7 @@ JS; |
37 | 37 | ?> |
38 | 38 | <h1>Заказы</h1> |
39 | 39 | <p> |
40 | - <?= Html::a('Add order', [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
40 | + <?= Html::a(\Yii::t('app', 'Добавить заказ'), [ 'create' ], [ 'class' => 'btn btn-success btn-lg' ]) ?> | |
41 | 41 | </p> |
42 | 42 | <?php Pjax::begin(); ?> |
43 | 43 | <?php |
... | ... | @@ -50,17 +50,21 @@ JS; |
50 | 50 | ); |
51 | 51 | ?> |
52 | 52 | |
53 | -<p> | |
53 | + | |
54 | 54 | |
55 | 55 | <?php echo Html::submitButton( |
56 | - 'Search', | |
56 | + \Yii::t('app', 'Искать'), | |
57 | 57 | [ |
58 | 58 | 'class' => 'btn btn-primary', |
59 | 59 | ] |
60 | 60 | ) ?> |
61 | 61 | |
62 | -</p> | |
63 | -<div class="row"> | |
62 | +<?php echo Html::button(\Yii::t('app', 'Скрыть/Показать'), [ | |
63 | + 'data-toggle' => 'collapse', | |
64 | + 'data-target' => '#search-fields', | |
65 | + 'class' => 'btn btn-default' | |
66 | +])?> | |
67 | +<div class="row collapse in" id="search-fields"> | |
64 | 68 | <div class="col-md-4"> |
65 | 69 | <?php |
66 | 70 | echo $searchForm->field($searchModel, 'label') |
... | ... | @@ -78,7 +82,7 @@ JS; |
78 | 82 | ->indexBy('id') |
79 | 83 | ->asArray() |
80 | 84 | ->column(), |
81 | - 'options' => [ 'placeholder' => 'Select a state ...' ], | |
85 | + 'options' => [ 'placeholder' => 'Выберите метки ...' ], | |
82 | 86 | 'pluginOptions' => [ |
83 | 87 | 'allowClear' => true, |
84 | 88 | 'multiple' => true, |
... | ... | @@ -97,7 +101,7 @@ JS; |
97 | 101 | ->indexBy('id') |
98 | 102 | ->asArray() |
99 | 103 | ->column(), |
100 | - 'options' => [ 'placeholder' => 'Select a state ...' ], | |
104 | + 'options' => [ 'placeholder' => 'Выберите способ доставки ...' ], | |
101 | 105 | 'pluginOptions' => [ |
102 | 106 | 'allowClear' => true, |
103 | 107 | 'multiple' => true, |
... | ... | @@ -261,7 +265,12 @@ JS; |
261 | 265 | } |
262 | 266 | }, |
263 | 267 | ], |
264 | - 'phone', | |
268 | + [ | |
269 | + 'attribute' => 'phone', | |
270 | + 'content' => function($model) { | |
271 | + return $model->phone . '<br>' . $model->phone2; | |
272 | + } | |
273 | + ], | |
265 | 274 | [ |
266 | 275 | 'attribute' => 'adress', |
267 | 276 | 'content' => function($model) { | ... | ... |