Commit 1ce566496c300710f190f2e86dbc16dd2e628844

Authored by Administrator
2 parents dc6b03e4 52c27888

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 149  
150 150 public function actionAdd()
151 151 {
152   - if (!empty( \Yii::$app->request->post() )) {
  152 + if (!empty(\Yii::$app->request->post())) {
153 153 $id = \Yii::$app->request->post('OrderProduct')[ 'id' ];
154 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 156 $count = \Yii::$app->request->post('OrderProduct')[ 'count' ];
157 157 } else {
158 158 $count = 1;
... ... @@ -172,7 +172,7 @@
172 172 )
173 173 ->one();
174 174  
175   - if (!empty( $model )) {
  175 + if (!empty($model)) {
176 176 $model->count += $count;
177 177 } else {
178 178 $model = new OrderProduct();
... ... @@ -217,7 +217,7 @@
217 217 if ($orderProduct->load($post)) {
218 218 $orderProduct->save();
219 219 $output = '';
220   - if (isset( $posted[ 'count' ] )) {
  220 + if (isset($posted[ 'count' ])) {
221 221 $output = Yii::$app->formatter->asDecimal($orderProduct->count, 0);
222 222 }
223 223 $out = Json::encode(
... ... @@ -269,7 +269,7 @@
269 269 public function actionPrint()
270 270 {
271 271 $orderId = Yii::$app->request->get("order_id");
272   - if (!empty( $orderId )) {
  272 + if (!empty($orderId)) {
273 273 $order = $this->findModel($orderId);
274 274 return $this->renderPartial(
275 275 '@frontend/views/cabinet/order_print',
... ... @@ -301,7 +301,7 @@
301 301 if ($orderProduct->load($post)) {
302 302 $orderProduct->save();
303 303 $output = '';
304   - if (isset( $posted[ 'count' ] )) {
  304 + if (isset($posted[ 'count' ])) {
305 305 $output = Yii::$app->formatter->asDecimal($orderProduct->count, 0);
306 306 }
307 307 $out = Json::encode(
... ... @@ -331,10 +331,11 @@
331 331 [
332 332 'query' => $model->getProducts()
333 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 339 $model->manager_id = \Yii::$app->user->id;
339 340 }
340 341  
... ... @@ -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 364 \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
364 365 $out = [
... ... @@ -414,7 +415,7 @@
414 415  
415 416 protected function findModel($id)
416 417 {
417   - if (( $model = Order::findOne($id) ) !== null) {
  418 + if (( $model = Order::findOne($id) ) !== NULL) {
418 419 return $model;
419 420 } else {
420 421 throw new NotFoundHttpException('The requested page does not exist.');
... ... @@ -440,7 +441,7 @@
440 441  
441 442 public function actionBlockOrder()
442 443 {
443   - if (!empty( \Yii::$app->request->post() )) {
  444 + if (!empty(\Yii::$app->request->post())) {
444 445 \Yii::$app->response->format = Response::FORMAT_JSON;
445 446  
446 447 $model = $this->findModel(\Yii::$app->request->post('id'));
... ... @@ -457,7 +458,7 @@
457 458 if ($model->save()) {
458 459 return [
459 460 'time' => $date,
460   - 'user' => !empty( $user ) ? $user->username : '',
  461 + 'user' => !empty($user) ? $user->username : '',
461 462 ];
462 463 } else {
463 464 return [
... ...
views/order/index.php
... ... @@ -206,7 +206,7 @@ JS;
206 206 ],
207 207 [
208 208 'attribute' => 'created_at',
209   - 'format' => 'date',
  209 + 'format' => ['date', 'php:d/m/Y G:i'],
210 210 'filter' => $searchForm->field($searchModel, 'date_range')
211 211 ->widget(
212 212 DateRangePicker::className(),
... ...