Commit 1ce566496c300710f190f2e86dbc16dd2e628844
Merge remote-tracking branch 'origin/master'
Showing
2 changed files
with
13 additions
and
12 deletions
Show diff stats
controllers/OrderController.php
@@ -149,10 +149,10 @@ | @@ -149,10 +149,10 @@ | ||
149 | 149 | ||
150 | public function actionAdd() | 150 | public function actionAdd() |
151 | { | 151 | { |
152 | - if (!empty( \Yii::$app->request->post() )) { | 152 | + if (!empty(\Yii::$app->request->post())) { |
153 | $id = \Yii::$app->request->post('OrderProduct')[ 'id' ]; | 153 | $id = \Yii::$app->request->post('OrderProduct')[ 'id' ]; |
154 | $order_id = \Yii::$app->request->post('OrderProduct')[ 'order_id' ]; | 154 | $order_id = \Yii::$app->request->post('OrderProduct')[ 'order_id' ]; |
155 | - if (!empty( \Yii::$app->request->post('OrderProduct')[ 'count' ] )) { | 155 | + if (!empty(\Yii::$app->request->post('OrderProduct')[ 'count' ])) { |
156 | $count = \Yii::$app->request->post('OrderProduct')[ 'count' ]; | 156 | $count = \Yii::$app->request->post('OrderProduct')[ 'count' ]; |
157 | } else { | 157 | } else { |
158 | $count = 1; | 158 | $count = 1; |
@@ -172,7 +172,7 @@ | @@ -172,7 +172,7 @@ | ||
172 | ) | 172 | ) |
173 | ->one(); | 173 | ->one(); |
174 | 174 | ||
175 | - if (!empty( $model )) { | 175 | + if (!empty($model)) { |
176 | $model->count += $count; | 176 | $model->count += $count; |
177 | } else { | 177 | } else { |
178 | $model = new OrderProduct(); | 178 | $model = new OrderProduct(); |
@@ -217,7 +217,7 @@ | @@ -217,7 +217,7 @@ | ||
217 | if ($orderProduct->load($post)) { | 217 | if ($orderProduct->load($post)) { |
218 | $orderProduct->save(); | 218 | $orderProduct->save(); |
219 | $output = ''; | 219 | $output = ''; |
220 | - if (isset( $posted[ 'count' ] )) { | 220 | + if (isset($posted[ 'count' ])) { |
221 | $output = Yii::$app->formatter->asDecimal($orderProduct->count, 0); | 221 | $output = Yii::$app->formatter->asDecimal($orderProduct->count, 0); |
222 | } | 222 | } |
223 | $out = Json::encode( | 223 | $out = Json::encode( |
@@ -269,7 +269,7 @@ | @@ -269,7 +269,7 @@ | ||
269 | public function actionPrint() | 269 | public function actionPrint() |
270 | { | 270 | { |
271 | $orderId = Yii::$app->request->get("order_id"); | 271 | $orderId = Yii::$app->request->get("order_id"); |
272 | - if (!empty( $orderId )) { | 272 | + if (!empty($orderId)) { |
273 | $order = $this->findModel($orderId); | 273 | $order = $this->findModel($orderId); |
274 | return $this->renderPartial( | 274 | return $this->renderPartial( |
275 | '@frontend/views/cabinet/order_print', | 275 | '@frontend/views/cabinet/order_print', |
@@ -301,7 +301,7 @@ | @@ -301,7 +301,7 @@ | ||
301 | if ($orderProduct->load($post)) { | 301 | if ($orderProduct->load($post)) { |
302 | $orderProduct->save(); | 302 | $orderProduct->save(); |
303 | $output = ''; | 303 | $output = ''; |
304 | - if (isset( $posted[ 'count' ] )) { | 304 | + if (isset($posted[ 'count' ])) { |
305 | $output = Yii::$app->formatter->asDecimal($orderProduct->count, 0); | 305 | $output = Yii::$app->formatter->asDecimal($orderProduct->count, 0); |
306 | } | 306 | } |
307 | $out = Json::encode( | 307 | $out = Json::encode( |
@@ -331,10 +331,11 @@ | @@ -331,10 +331,11 @@ | ||
331 | [ | 331 | [ |
332 | 'query' => $model->getProducts() | 332 | 'query' => $model->getProducts() |
333 | ->joinWith('productVariant.product.brand'), | 333 | ->joinWith('productVariant.product.brand'), |
334 | + 'sort' => [ 'defaultOrder' => [ 'id' => SORT_ASC ] ], | ||
334 | ] | 335 | ] |
335 | ); | 336 | ); |
336 | 337 | ||
337 | - if (empty( $model->manager_id )) { | 338 | + if (empty($model->manager_id)) { |
338 | $model->manager_id = \Yii::$app->user->id; | 339 | $model->manager_id = \Yii::$app->user->id; |
339 | } | 340 | } |
340 | 341 | ||
@@ -358,7 +359,7 @@ | @@ -358,7 +359,7 @@ | ||
358 | } | 359 | } |
359 | } | 360 | } |
360 | 361 | ||
361 | - public function actionFindProduct($q = null, $id = null) | 362 | + public function actionFindProduct($q = NULL, $id = NULL) |
362 | { | 363 | { |
363 | \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | 364 | \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; |
364 | $out = [ | 365 | $out = [ |
@@ -414,7 +415,7 @@ | @@ -414,7 +415,7 @@ | ||
414 | 415 | ||
415 | protected function findModel($id) | 416 | protected function findModel($id) |
416 | { | 417 | { |
417 | - if (( $model = Order::findOne($id) ) !== null) { | 418 | + if (( $model = Order::findOne($id) ) !== NULL) { |
418 | return $model; | 419 | return $model; |
419 | } else { | 420 | } else { |
420 | throw new NotFoundHttpException('The requested page does not exist.'); | 421 | throw new NotFoundHttpException('The requested page does not exist.'); |
@@ -440,7 +441,7 @@ | @@ -440,7 +441,7 @@ | ||
440 | 441 | ||
441 | public function actionBlockOrder() | 442 | public function actionBlockOrder() |
442 | { | 443 | { |
443 | - if (!empty( \Yii::$app->request->post() )) { | 444 | + if (!empty(\Yii::$app->request->post())) { |
444 | \Yii::$app->response->format = Response::FORMAT_JSON; | 445 | \Yii::$app->response->format = Response::FORMAT_JSON; |
445 | 446 | ||
446 | $model = $this->findModel(\Yii::$app->request->post('id')); | 447 | $model = $this->findModel(\Yii::$app->request->post('id')); |
@@ -457,7 +458,7 @@ | @@ -457,7 +458,7 @@ | ||
457 | if ($model->save()) { | 458 | if ($model->save()) { |
458 | return [ | 459 | return [ |
459 | 'time' => $date, | 460 | 'time' => $date, |
460 | - 'user' => !empty( $user ) ? $user->username : '', | 461 | + 'user' => !empty($user) ? $user->username : '', |
461 | ]; | 462 | ]; |
462 | } else { | 463 | } else { |
463 | return [ | 464 | return [ |
views/order/index.php
@@ -206,7 +206,7 @@ JS; | @@ -206,7 +206,7 @@ JS; | ||
206 | ], | 206 | ], |
207 | [ | 207 | [ |
208 | 'attribute' => 'created_at', | 208 | 'attribute' => 'created_at', |
209 | - 'format' => 'date', | 209 | + 'format' => ['date', 'php:d/m/Y G:i'], |
210 | 'filter' => $searchForm->field($searchModel, 'date_range') | 210 | 'filter' => $searchForm->field($searchModel, 'date_range') |
211 | ->widget( | 211 | ->widget( |
212 | DateRangePicker::className(), | 212 | DateRangePicker::className(), |