Commit 3bee34454a1e3929cbc5c747836491f85fe25cbd
1 parent
44747138
-Order history ready
Showing
8 changed files
with
392 additions
and
85 deletions
Show diff stats
controllers/OrderController.php
| ... | ... | @@ -3,19 +3,18 @@ |
| 3 | 3 | namespace artweb\artbox\ecommerce\controllers; |
| 4 | 4 | |
| 5 | 5 | use artweb\artbox\components\SmsSender; |
| 6 | + use artweb\artbox\ecommerce\models\OrderLabelHistory; | |
| 6 | 7 | use artweb\artbox\ecommerce\models\OrderSearch; |
| 7 | 8 | use common\models\User; |
| 8 | - use phpDocumentor\Reflection\Types\Null_; | |
| 9 | 9 | use Yii; |
| 10 | 10 | use yii\data\ArrayDataProvider; |
| 11 | - use yii\helpers\ArrayHelper; | |
| 11 | + use yii\db\ActiveQuery; | |
| 12 | 12 | use yii\helpers\Json; |
| 13 | 13 | use yii\helpers\VarDumper; |
| 14 | 14 | use yii\web\Controller; |
| 15 | 15 | use yii\filters\VerbFilter; |
| 16 | 16 | use yii\data\ActiveDataProvider; |
| 17 | 17 | use yii\web\ForbiddenHttpException; |
| 18 | - use yii\web\HttpException; | |
| 19 | 18 | use artweb\artbox\ecommerce\models\Order; |
| 20 | 19 | use artweb\artbox\ecommerce\models\OrderProduct; |
| 21 | 20 | use artweb\artbox\ecommerce\models\ProductVariant; |
| ... | ... | @@ -107,6 +106,11 @@ |
| 107 | 106 | public function actionView($id) |
| 108 | 107 | { |
| 109 | 108 | $model = $this->findModel($id); |
| 109 | + | |
| 110 | + $historyData = new ActiveDataProvider([ | |
| 111 | + 'query' => $model->getLabelsHistory()->with('order', 'label', 'user'), | |
| 112 | + ]); | |
| 113 | + | |
| 110 | 114 | $dataProvider = new ActiveDataProvider( |
| 111 | 115 | [ |
| 112 | 116 | 'query' => $model->getProducts(), |
| ... | ... | @@ -117,6 +121,7 @@ |
| 117 | 121 | [ |
| 118 | 122 | 'model' => $model, |
| 119 | 123 | 'products' => $dataProvider, |
| 124 | + 'historyData' => $historyData, | |
| 120 | 125 | ] |
| 121 | 126 | ); |
| 122 | 127 | } |
| ... | ... | @@ -151,10 +156,10 @@ |
| 151 | 156 | |
| 152 | 157 | public function actionAdd() |
| 153 | 158 | { |
| 154 | - if (!empty( \Yii::$app->request->post() )) { | |
| 159 | + if (!empty(\Yii::$app->request->post())) { | |
| 155 | 160 | $id = \Yii::$app->request->post('OrderProduct')[ 'id' ]; |
| 156 | 161 | $order_id = \Yii::$app->request->post('OrderProduct')[ 'order_id' ]; |
| 157 | - if (!empty( \Yii::$app->request->post('OrderProduct')[ 'count' ] )) { | |
| 162 | + if (!empty(\Yii::$app->request->post('OrderProduct')[ 'count' ])) { | |
| 158 | 163 | $count = \Yii::$app->request->post('OrderProduct')[ 'count' ]; |
| 159 | 164 | } else { |
| 160 | 165 | $count = 1; |
| ... | ... | @@ -174,7 +179,7 @@ |
| 174 | 179 | ) |
| 175 | 180 | ->one(); |
| 176 | 181 | |
| 177 | - if (!empty( $model )) { | |
| 182 | + if (!empty($model)) { | |
| 178 | 183 | $model->count += $count; |
| 179 | 184 | } else { |
| 180 | 185 | $model = new OrderProduct(); |
| ... | ... | @@ -219,7 +224,7 @@ |
| 219 | 224 | if ($orderProduct->load($post)) { |
| 220 | 225 | $orderProduct->save(); |
| 221 | 226 | $output = ''; |
| 222 | - if (isset( $posted[ 'count' ] )) { | |
| 227 | + if (isset($posted[ 'count' ])) { | |
| 223 | 228 | $output = Yii::$app->formatter->asDecimal($orderProduct->count, 0); |
| 224 | 229 | } |
| 225 | 230 | $out = Json::encode( |
| ... | ... | @@ -281,7 +286,7 @@ |
| 281 | 286 | return $this->renderPartial( |
| 282 | 287 | 'print', |
| 283 | 288 | [ |
| 284 | - 'order' => $order, | |
| 289 | + 'order' => $order, | |
| 285 | 290 | 'dataProvider' => $dataProvider, |
| 286 | 291 | ] |
| 287 | 292 | ); |
| ... | ... | @@ -307,7 +312,7 @@ |
| 307 | 312 | $orderProduct->save(); |
| 308 | 313 | $orderProduct->order->totalRecount(); |
| 309 | 314 | $output = ''; |
| 310 | - if (isset( $posted[ 'count' ] )) { | |
| 315 | + if (isset($posted[ 'count' ])) { | |
| 311 | 316 | $output = Yii::$app->formatter->asDecimal($orderProduct->count, 0); |
| 312 | 317 | } |
| 313 | 318 | $out = Json::encode( |
| ... | ... | @@ -342,7 +347,7 @@ |
| 342 | 347 | ] |
| 343 | 348 | ); |
| 344 | 349 | |
| 345 | - if (empty( $model->manager_id )) { | |
| 350 | + if (empty($model->manager_id)) { | |
| 346 | 351 | $model->manager_id = \Yii::$app->user->id; |
| 347 | 352 | } |
| 348 | 353 | |
| ... | ... | @@ -369,7 +374,7 @@ |
| 369 | 374 | } |
| 370 | 375 | } |
| 371 | 376 | |
| 372 | - public function actionFindProduct($q = null, $id = null) | |
| 377 | + public function actionFindProduct($q = NULL, $id = NULL) | |
| 373 | 378 | { |
| 374 | 379 | \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; |
| 375 | 380 | $out = [ |
| ... | ... | @@ -428,7 +433,7 @@ |
| 428 | 433 | |
| 429 | 434 | protected function findModel($id) |
| 430 | 435 | { |
| 431 | - if (( $model = Order::findOne($id) ) !== null) { | |
| 436 | + if (( $model = Order::findOne($id) ) !== NULL) { | |
| 432 | 437 | return $model; |
| 433 | 438 | } else { |
| 434 | 439 | throw new NotFoundHttpException('The requested page does not exist.'); |
| ... | ... | @@ -471,7 +476,7 @@ |
| 471 | 476 | |
| 472 | 477 | public function actionBlockOrder() |
| 473 | 478 | { |
| 474 | - if (!empty( \Yii::$app->request->post() )) { | |
| 479 | + if (!empty(\Yii::$app->request->post())) { | |
| 475 | 480 | \Yii::$app->response->format = Response::FORMAT_JSON; |
| 476 | 481 | |
| 477 | 482 | $model = $this->findModel(\Yii::$app->request->post('id')); |
| ... | ... | @@ -488,7 +493,7 @@ |
| 488 | 493 | if ($model->save()) { |
| 489 | 494 | return [ |
| 490 | 495 | 'time' => $date, |
| 491 | - 'user' => !empty( $user ) ? $user->username : '', | |
| 496 | + 'user' => !empty($user) ? $user->username : '', | |
| 492 | 497 | ]; |
| 493 | 498 | } else { |
| 494 | 499 | return [ |
| ... | ... | @@ -516,6 +521,18 @@ |
| 516 | 521 | } |
| 517 | 522 | $model->published = true; |
| 518 | 523 | $model->save(); |
| 524 | + | |
| 525 | + /** | |
| 526 | + * Add order to history | |
| 527 | + */ | |
| 528 | + $history = new OrderLabelHistory(); | |
| 529 | + | |
| 530 | + $history->label_id = (integer) $model->label; | |
| 531 | + $history->order_id = (integer) $model->id; | |
| 532 | + $history->user_id = (integer) \Yii::$app->user->identity->id; | |
| 533 | + | |
| 534 | + $history->save(); | |
| 535 | + | |
| 519 | 536 | /** |
| 520 | 537 | * @var SmsSender $sender |
| 521 | 538 | */ | ... | ... |
controllers/StatisticsController.php
| ... | ... | @@ -69,20 +69,15 @@ |
| 69 | 69 | ] |
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | - $chartData = []; | |
| 73 | - foreach ($labelStatistics as $statistic) { | |
| 74 | - $chartData[] = $statistic[ 'sum' ]; | |
| 75 | - } | |
| 76 | - $chartLabels = []; | |
| 77 | - foreach ($labelStatistics as $name => $statistic) { | |
| 78 | - $chartLabels[] = $name; | |
| 79 | - } | |
| 80 | 72 | $labelChartData = [ |
| 81 | - 'labels' => $chartLabels, | |
| 73 | + 'labels' => array_keys($labelStatistics), | |
| 82 | 74 | 'datasets' => [ |
| 83 | 75 | [ |
| 84 | - 'label' => 'На сумму, грн.', | |
| 85 | - 'data' => $chartData, | |
| 76 | + 'label' => 'На сумму, грн.', | |
| 77 | + 'data' => ArrayHelper::getColumn($labelStatistics, 'sum', false), | |
| 78 | + 'backgroundColor' => 'rgba(255, 99, 132, 0.2)', | |
| 79 | + 'borderColor' => 'rgba(255,99,132,1)', | |
| 80 | + 'borderWidth' => 1, | |
| 86 | 81 | ], |
| 87 | 82 | ], |
| 88 | 83 | ]; | ... | ... |
models/Order.php
| ... | ... | @@ -55,6 +55,9 @@ |
| 55 | 55 | * @property string $city |
| 56 | 56 | * @property string $deliveryString |
| 57 | 57 | * @property boolean $published |
| 58 | + * @property Label $orderLabel | |
| 59 | + * @property Delivery $orderDelivery | |
| 60 | + * @property OrderPayment $orderPayment | |
| 58 | 61 | */ |
| 59 | 62 | class Order extends ActiveRecord |
| 60 | 63 | { |
| ... | ... | @@ -92,7 +95,7 @@ |
| 92 | 95 | { |
| 93 | 96 | return 'order'; |
| 94 | 97 | } |
| 95 | - | |
| 98 | + | |
| 96 | 99 | /** |
| 97 | 100 | * @param array $where |
| 98 | 101 | * |
| ... | ... | @@ -113,12 +116,17 @@ |
| 113 | 116 | [ |
| 114 | 117 | 'reason' => $id, |
| 115 | 118 | ] |
| 116 | - )->andFilterWhere($where)->one(); | |
| 119 | + ) | |
| 120 | + ->andFilterWhere($where) | |
| 121 | + ->one(); | |
| 117 | 122 | } |
| 118 | 123 | |
| 119 | 124 | return $result; |
| 120 | 125 | } |
| 121 | 126 | |
| 127 | + /** | |
| 128 | + * @inheritdoc | |
| 129 | + */ | |
| 122 | 130 | public function behaviors() |
| 123 | 131 | { |
| 124 | 132 | return [ |
| ... | ... | @@ -131,6 +139,9 @@ |
| 131 | 139 | ]; |
| 132 | 140 | } |
| 133 | 141 | |
| 142 | + /** | |
| 143 | + * @inheritdoc | |
| 144 | + */ | |
| 134 | 145 | public function rules() |
| 135 | 146 | { |
| 136 | 147 | return [ |
| ... | ... | @@ -209,6 +220,27 @@ |
| 209 | 220 | ]; |
| 210 | 221 | } |
| 211 | 222 | |
| 223 | + public function afterSave($insert, $changedAttributes) | |
| 224 | + { | |
| 225 | + if (!empty($changedAttributes[ 'label' ])) { | |
| 226 | + if ($this->label != (string) $changedAttributes[ 'label' ]) { | |
| 227 | + $history = new OrderLabelHistory(); | |
| 228 | + | |
| 229 | + $history->label_id = (integer) $this->label; | |
| 230 | + $history->order_id = (integer) $this->id; | |
| 231 | + $history->user_id = (integer) \Yii::$app->user->identity->id; | |
| 232 | + | |
| 233 | + if ($history->save()) { | |
| 234 | + \Yii::$app->session->setFlash('label_update', 'Статус заказа обновлен'); | |
| 235 | + } | |
| 236 | + } | |
| 237 | + } | |
| 238 | + parent::afterSave($insert, $changedAttributes); | |
| 239 | + } | |
| 240 | + | |
| 241 | + /** | |
| 242 | + * @inheritdoc | |
| 243 | + */ | |
| 212 | 244 | public function afterFind() |
| 213 | 245 | { |
| 214 | 246 | parent::afterFind(); |
| ... | ... | @@ -216,6 +248,9 @@ |
| 216 | 248 | |
| 217 | 249 | } |
| 218 | 250 | |
| 251 | + /** | |
| 252 | + * @inheritdoc | |
| 253 | + */ | |
| 219 | 254 | public function beforeSave($insert) |
| 220 | 255 | { |
| 221 | 256 | if (parent::beforeSave($insert)) { |
| ... | ... | @@ -227,6 +262,9 @@ |
| 227 | 262 | |
| 228 | 263 | } |
| 229 | 264 | |
| 265 | + /** | |
| 266 | + * Convert some date | |
| 267 | + */ | |
| 230 | 268 | protected function convertDate() |
| 231 | 269 | { |
| 232 | 270 | if (!empty($this->deadline)) { |
| ... | ... | @@ -239,6 +277,9 @@ |
| 239 | 277 | |
| 240 | 278 | } |
| 241 | 279 | |
| 280 | + /** | |
| 281 | + * @inheritdoc | |
| 282 | + */ | |
| 242 | 283 | public function attributeLabels() |
| 243 | 284 | { |
| 244 | 285 | return [ |
| ... | ... | @@ -276,6 +317,9 @@ |
| 276 | 317 | ]; |
| 277 | 318 | } |
| 278 | 319 | |
| 320 | + /** | |
| 321 | + * @return \yii\db\ActiveQuery | |
| 322 | + */ | |
| 279 | 323 | public function getUser() |
| 280 | 324 | { |
| 281 | 325 | return $this->hasOne(Customer::className(), [ 'id' => 'user_id' ]); |
| ... | ... | @@ -314,6 +358,14 @@ |
| 314 | 358 | } |
| 315 | 359 | |
| 316 | 360 | /** |
| 361 | + * @return \yii\db\ActiveQuery | |
| 362 | + */ | |
| 363 | + public function getLabelsHistory() | |
| 364 | + { | |
| 365 | + return $this->hasMany(OrderLabelHistory::className(), [ 'order_id' => 'id' ]); | |
| 366 | + } | |
| 367 | + | |
| 368 | + /** | |
| 317 | 369 | * @return string |
| 318 | 370 | */ |
| 319 | 371 | public function getDeliveryString() |
| ... | ... | @@ -345,13 +397,18 @@ |
| 345 | 397 | } |
| 346 | 398 | |
| 347 | 399 | /** |
| 348 | - * | |
| 400 | + * @return \yii\db\ActiveQuery | |
| 349 | 401 | */ |
| 350 | 402 | public function getManager() |
| 351 | 403 | { |
| 352 | 404 | return $this->hasOne(User::className(), [ 'id' => 'manager_id' ]); |
| 353 | 405 | } |
| 354 | 406 | |
| 407 | + /** | |
| 408 | + * Check if order is blocked for updating | |
| 409 | + * | |
| 410 | + * @return bool | |
| 411 | + */ | |
| 355 | 412 | public function isBlocked() |
| 356 | 413 | { |
| 357 | 414 | if ($this->edit_id === 0) { |
| ... | ... | @@ -365,6 +422,9 @@ |
| 365 | 422 | } |
| 366 | 423 | } |
| 367 | 424 | |
| 425 | + /** | |
| 426 | + * If order products changed recount te total value | |
| 427 | + */ | |
| 368 | 428 | public function totalRecount() |
| 369 | 429 | { |
| 370 | 430 | $products = $this->products; |
| ... | ... | @@ -379,6 +439,9 @@ |
| 379 | 439 | $this->save(); |
| 380 | 440 | } |
| 381 | 441 | |
| 442 | + /** | |
| 443 | + * If exit unpublished order - delete it | |
| 444 | + */ | |
| 382 | 445 | public function deleteUnpublished() |
| 383 | 446 | { |
| 384 | 447 | /** | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | + namespace artweb\artbox\ecommerce\models; | |
| 4 | + | |
| 5 | + use yii\behaviors\TimestampBehavior; | |
| 6 | + use yii\db\ActiveRecord; | |
| 7 | + use common\models\User; | |
| 8 | + use Yii; | |
| 9 | + | |
| 10 | + /** | |
| 11 | + * This is the model class for table "order_label_history". | |
| 12 | + * | |
| 13 | + * @property integer $id | |
| 14 | + * @property integer $label_id | |
| 15 | + * @property integer $order_id | |
| 16 | + * @property integer $user_id | |
| 17 | + * @property integer $created_at | |
| 18 | + * @property Order $order | |
| 19 | + * @property Label $label | |
| 20 | + * @property User $user | |
| 21 | + */ | |
| 22 | + class OrderLabelHistory extends ActiveRecord | |
| 23 | + { | |
| 24 | + /** | |
| 25 | + * @inheritdoc | |
| 26 | + */ | |
| 27 | + public static function tableName() | |
| 28 | + { | |
| 29 | + return 'order_label_history'; | |
| 30 | + } | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * @inheritdoc | |
| 34 | + */ | |
| 35 | + public function behaviors() | |
| 36 | + { | |
| 37 | + return [ | |
| 38 | + [ | |
| 39 | + 'class' => TimestampBehavior::className(), | |
| 40 | + 'updatedAtAttribute' => false, | |
| 41 | + ], | |
| 42 | + ]; | |
| 43 | + } | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * @inheritdoc | |
| 47 | + */ | |
| 48 | + public function rules() | |
| 49 | + { | |
| 50 | + return [ | |
| 51 | + [ | |
| 52 | + [ | |
| 53 | + 'label_id', | |
| 54 | + 'order_id', | |
| 55 | + 'user_id', | |
| 56 | + 'created_at', | |
| 57 | + ], | |
| 58 | + 'integer', | |
| 59 | + ], | |
| 60 | + [ | |
| 61 | + [ 'order_id' ], | |
| 62 | + 'exist', | |
| 63 | + 'skipOnError' => true, | |
| 64 | + 'targetClass' => Order::className(), | |
| 65 | + 'targetAttribute' => [ 'order_id' => 'id' ], | |
| 66 | + ], | |
| 67 | + [ | |
| 68 | + [ 'label_id' ], | |
| 69 | + 'exist', | |
| 70 | + 'skipOnError' => true, | |
| 71 | + 'targetClass' => Label::className(), | |
| 72 | + 'targetAttribute' => [ 'label_id' => 'id' ], | |
| 73 | + ], | |
| 74 | +// [ | |
| 75 | +// [ 'user_id' ], | |
| 76 | +// 'exist', | |
| 77 | +// 'skipOnError' => true, | |
| 78 | +// 'targetClass' => User::className(), | |
| 79 | +// 'targetAttribute' => [ 'user_id' => 'id' ], | |
| 80 | +// ], | |
| 81 | + ]; | |
| 82 | + } | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * @inheritdoc | |
| 86 | + */ | |
| 87 | + public function attributeLabels() | |
| 88 | + { | |
| 89 | + return [ | |
| 90 | + 'id' => Yii::t('app', 'ID'), | |
| 91 | + 'label_id' => Yii::t('app', 'Label ID'), | |
| 92 | + 'order_id' => Yii::t('app', 'Order ID'), | |
| 93 | + 'user_id' => Yii::t('app', 'User ID'), | |
| 94 | + 'created_at' => Yii::t('app', 'Created At'), | |
| 95 | + ]; | |
| 96 | + } | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * @return \yii\db\ActiveQuery | |
| 100 | + */ | |
| 101 | + public function getOrder() | |
| 102 | + { | |
| 103 | + return $this->hasOne(Order::className(), [ 'id' => 'order_id' ]); | |
| 104 | + } | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * @return \yii\db\ActiveQuery | |
| 108 | + */ | |
| 109 | + public function getLabel() | |
| 110 | + { | |
| 111 | + return $this->hasOne(Label::className(), [ 'id' => 'label_id' ]); | |
| 112 | + } | |
| 113 | + | |
| 114 | + /** | |
| 115 | + * @return \yii\db\ActiveQuery | |
| 116 | + */ | |
| 117 | + public function getUser() | |
| 118 | + { | |
| 119 | + return $this->hasOne(User::className(), [ 'id' => 'user_id' ]); | |
| 120 | + } | |
| 121 | + } | ... | ... |
| 1 | +<?php | |
| 2 | + /** | |
| 3 | + * @var OrderLabelHistory $model | |
| 4 | + */ | |
| 5 | + use artweb\artbox\ecommerce\models\OrderLabelHistory; | |
| 6 | + use yii\helpers\Html; | |
| 7 | + | |
| 8 | +?> | |
| 9 | + | |
| 10 | +<!-- timeline item --> | |
| 11 | +<li> | |
| 12 | + <!-- timeline icon --> | |
| 13 | + <i class="fa fa-tag bg-blue"></i> | |
| 14 | + <div class="timeline-item"> | |
| 15 | + <span class="time"><i class="fa fa-calendar"></i> <?=Yii::$app->formatter->asDatetime($model->created_at)?></span> | |
| 16 | + | |
| 17 | + <h3 class="timeline-header"><?=$model->label->lang->title?></h3> | |
| 18 | + | |
| 19 | + <div class="timeline-body"> | |
| 20 | + <?php | |
| 21 | + if (empty($model->user)) { | |
| 22 | + echo Html::tag('p', 'Поступил с сайта', ['class' => 'text-green']); | |
| 23 | + } else { | |
| 24 | + echo 'Статус присвоил: ' . Html::tag('p', $model->user->username, [ | |
| 25 | + 'class' => 'text-blue' | |
| 26 | + ]); | |
| 27 | + } | |
| 28 | + ?> | |
| 29 | + </div> | |
| 30 | + | |
| 31 | + </div> | |
| 32 | +</li> | ... | ... |
views/order/update.php
| ... | ... | @@ -54,7 +54,18 @@ $.ajax({ |
| 54 | 54 | '; |
| 55 | 55 | |
| 56 | 56 | $this->registerJs($js, View::POS_READY); |
| 57 | - | |
| 57 | + | |
| 58 | + if (!empty(\Yii::$app->session->getFlash('label_update'))) { | |
| 59 | + $js = ' | |
| 60 | +$.notify({ | |
| 61 | + message: "Статус заказа обновлен" | |
| 62 | +}, { | |
| 63 | + type : "warning" | |
| 64 | +}) | |
| 65 | +'; | |
| 66 | + $this->registerJs($js, View::POS_READY); | |
| 67 | + } | |
| 68 | + | |
| 58 | 69 | ?> |
| 59 | 70 | <div class="order-update"> |
| 60 | 71 | <div class="container"> | ... | ... |
views/order/view.php
| ... | ... | @@ -2,13 +2,18 @@ |
| 2 | 2 | |
| 3 | 3 | use artweb\artbox\ecommerce\models\Order; |
| 4 | 4 | use kartik\grid\GridView; |
| 5 | + use yii\data\ActiveDataProvider; | |
| 6 | + use yii\grid\SerialColumn; | |
| 5 | 7 | use yii\helpers\Html; |
| 6 | 8 | use yii\web\View; |
| 7 | 9 | use yii\widgets\DetailView; |
| 10 | + use yii\widgets\ListView; | |
| 8 | 11 | |
| 9 | 12 | /** |
| 10 | - * @var View $this | |
| 11 | - * @var Order $model | |
| 13 | + * @var View $this | |
| 14 | + * @var Order $model | |
| 15 | + * @var ActiveDataProvider $products | |
| 16 | + * @var ActiveDataProvider $historyData | |
| 12 | 17 | */ |
| 13 | 18 | |
| 14 | 19 | $this->title = 'Заказ #' . $model->id; |
| ... | ... | @@ -19,63 +24,126 @@ |
| 19 | 24 | $this->params[ 'breadcrumbs' ][] = $this->title; |
| 20 | 25 | ?> |
| 21 | 26 | <div class="order-view"> |
| 22 | - | |
| 23 | - <h1><?= Html::encode($this->title) ?></h1> | |
| 24 | - | |
| 25 | - <p> | |
| 26 | - <?= Html::a( | |
| 27 | - 'Update', | |
| 28 | - [ | |
| 29 | - 'update', | |
| 30 | - 'id' => $model->id, | |
| 31 | - ], | |
| 32 | - [ 'class' => 'btn btn-primary' ] | |
| 33 | - ) ?> | |
| 34 | - | |
| 35 | - </p> | |
| 36 | - | |
| 37 | - <?= DetailView::widget( | |
| 38 | - [ | |
| 39 | - 'model' => $model, | |
| 40 | - 'attributes' => [ | |
| 41 | - 'id', | |
| 42 | - 'deadline', | |
| 43 | - 'pay', | |
| 44 | - 'reason', | |
| 45 | - 'label', | |
| 46 | - 'name', | |
| 47 | - 'phone', | |
| 48 | - 'email', | |
| 49 | - 'comment', | |
| 50 | - 'delivery', | |
| 51 | - 'declaration', | |
| 52 | - 'stock', | |
| 53 | - 'payment', | |
| 54 | - 'insurance', | |
| 55 | - 'city', | |
| 56 | - 'adress', | |
| 57 | - 'body', | |
| 58 | - 'check', | |
| 59 | - 'sms', | |
| 60 | - ], | |
| 61 | - ] | |
| 62 | - ) ?> | |
| 63 | - | |
| 64 | - <?php | |
| 65 | - echo GridView::widget( | |
| 27 | + | |
| 28 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 29 | + | |
| 30 | + <p> | |
| 31 | + <?= Html::a( | |
| 32 | + 'Обновить', | |
| 33 | + [ | |
| 34 | + 'update', | |
| 35 | + 'id' => $model->id, | |
| 36 | + ], | |
| 37 | + [ 'class' => 'btn btn-primary' ] | |
| 38 | + ) ?> | |
| 39 | + | |
| 40 | + </p> | |
| 41 | + | |
| 42 | + <div class="box box-default"> | |
| 43 | + <div class="box-header with-border"> | |
| 44 | + <h3 class="box-title">Данные заказа</h3> | |
| 45 | + <div class="box-tools pull-right"> | |
| 46 | + <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button> | |
| 47 | + </div><!-- /.box-tools --> | |
| 48 | + </div><!-- /.box-header --> | |
| 49 | + <div class="box-body"> | |
| 50 | + <?= DetailView::widget( | |
| 66 | 51 | [ |
| 67 | - 'dataProvider' => $products, | |
| 68 | - 'columns' => [ | |
| 52 | + 'model' => $model, | |
| 53 | + 'attributes' => [ | |
| 69 | 54 | 'id', |
| 70 | - 'product_name', | |
| 55 | + 'deadline', | |
| 56 | + 'pay', | |
| 57 | + 'reason', | |
| 58 | + [ | |
| 59 | + 'label' => 'Статус', | |
| 60 | + 'value' => $model->orderLabel->lang->title, | |
| 61 | + ], | |
| 71 | 62 | 'name', |
| 72 | - 'sku', | |
| 73 | - 'price', | |
| 74 | - 'count', | |
| 75 | - 'sum_cost', | |
| 63 | + 'phone', | |
| 64 | + 'email', | |
| 65 | + 'comment', | |
| 66 | + [ | |
| 67 | + 'label' => 'Способ доставки', | |
| 68 | + 'value' => $model->orderDelivery->lang->title, | |
| 69 | + ], | |
| 70 | + 'declaration', | |
| 71 | + 'stock', | |
| 72 | + [ | |
| 73 | + 'label' => 'Способ оплаты', | |
| 74 | + 'value' => $model->orderPayment->lang->title, | |
| 75 | + ], | |
| 76 | + 'insurance', | |
| 77 | + 'city', | |
| 78 | + 'adress', | |
| 79 | + 'body', | |
| 80 | + 'check', | |
| 81 | + 'sms', | |
| 76 | 82 | ], |
| 77 | 83 | ] |
| 78 | - ); | |
| 79 | - ?> | |
| 84 | + ) ?> | |
| 85 | + </div><!-- /.box-body --> | |
| 86 | + </div><!-- /.box --> | |
| 87 | + | |
| 88 | + | |
| 89 | + <div class="box box-default"> | |
| 90 | + <div class="box-header with-border"> | |
| 91 | + <h3 class="box-title">Товары</h3> | |
| 92 | + <div class="box-tools pull-right"> | |
| 93 | + <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button> | |
| 94 | + </div><!-- /.box-tools --> | |
| 95 | + </div><!-- /.box-header --> | |
| 96 | + <div class="box-body"> | |
| 97 | + <?php | |
| 98 | + echo GridView::widget( | |
| 99 | + [ | |
| 100 | + 'dataProvider' => $products, | |
| 101 | + 'columns' => [ | |
| 102 | + [ | |
| 103 | + 'class' => SerialColumn::className(), | |
| 104 | + ], | |
| 105 | + 'product_name', | |
| 106 | + 'name', | |
| 107 | + 'sku', | |
| 108 | + 'price', | |
| 109 | + 'count', | |
| 110 | + 'sum_cost', | |
| 111 | + ], | |
| 112 | + ] | |
| 113 | + ); | |
| 114 | + ?> | |
| 115 | + </div><!-- /.box-body --> | |
| 116 | + </div><!-- /.box --> | |
| 117 | + | |
| 118 | + <div class="box box-default"> | |
| 119 | + <div class="box-header with-border"> | |
| 120 | + <h3 class="box-title">История</h3> | |
| 121 | + <div class="box-tools pull-right"> | |
| 122 | + <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button> | |
| 123 | + </div><!-- /.box-tools --> | |
| 124 | + </div><!-- /.box-header --> | |
| 125 | + <div class="box-body"> | |
| 126 | + | |
| 127 | + | |
| 128 | + <?php | |
| 129 | + echo ListView::widget( | |
| 130 | + [ | |
| 131 | + 'dataProvider' => $historyData, | |
| 132 | + 'layout' => '{items}', | |
| 133 | + 'itemView' => '_timeline_item', | |
| 134 | + 'itemOptions' => [ | |
| 135 | + 'tag' => false, | |
| 136 | + ], | |
| 137 | + 'options' => [ | |
| 138 | + 'tag' => 'ul', | |
| 139 | + 'class' => 'list-view timeline', | |
| 140 | + ], | |
| 141 | + ] | |
| 142 | + ); | |
| 143 | + ?> | |
| 144 | + | |
| 145 | + | |
| 146 | + </div><!-- /.box-body --> | |
| 147 | + </div><!-- /.box --> | |
| 80 | 148 | |
| 81 | 149 | </div> | ... | ... |
views/statistics/index.php