Commit adcca6c035c9fea9df25a5a0156916f845b9cafd
Merge remote-tracking branch 'origin/master'
Showing
2 changed files
with
23 additions
and
9 deletions
Show diff stats
models/Order.php
| @@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
| 51 | * @property string $consignment | 51 | * @property string $consignment |
| 52 | * @property string $payment | 52 | * @property string $payment |
| 53 | * @property string $insurance | 53 | * @property string $insurance |
| 54 | - * @property double $amount_imposed | 54 | + * @property string $amount_imposed |
| 55 | * @property string $shipping_by | 55 | * @property string $shipping_by |
| 56 | * @property string $city | 56 | * @property string $city |
| 57 | * @property string $deliveryString | 57 | * @property string $deliveryString |
views/order/print.php
| @@ -36,9 +36,9 @@ use yii\widgets\DetailView; | @@ -36,9 +36,9 @@ use yii\widgets\DetailView; | ||
| 36 | 'id', | 36 | 'id', |
| 37 | 'created_at:date', | 37 | 'created_at:date', |
| 38 | [ | 38 | [ |
| 39 | - 'attribute' => 'user.username', | 39 | + 'attribute' => 'name', |
| 40 | 'label' => \Yii::t('app', 'Client Username'), | 40 | 'label' => \Yii::t('app', 'Client Username'), |
| 41 | - 'value' => $order->user?$order->user->username:$order->name, | 41 | + 'value' => $order->name?:null, |
| 42 | ], | 42 | ], |
| 43 | [ | 43 | [ |
| 44 | 'attribute' => 'email', | 44 | 'attribute' => 'email', |
| @@ -90,7 +90,7 @@ use yii\widgets\DetailView; | @@ -90,7 +90,7 @@ use yii\widgets\DetailView; | ||
| 90 | ], | 90 | ], |
| 91 | [ | 91 | [ |
| 92 | 'attribute' => 'shipping_by', | 92 | 'attribute' => 'shipping_by', |
| 93 | - 'value' => $order->shipping_by?function() use($order) { | 93 | + 'value' => $order->shipping_by?(function() use($order) { |
| 94 | switch ($order->shipping_by) { | 94 | switch ($order->shipping_by) { |
| 95 | case 1: | 95 | case 1: |
| 96 | return 'Отправитель'; | 96 | return 'Отправитель'; |
| @@ -100,7 +100,7 @@ use yii\widgets\DetailView; | @@ -100,7 +100,7 @@ use yii\widgets\DetailView; | ||
| 100 | break; | 100 | break; |
| 101 | } | 101 | } |
| 102 | return null; | 102 | return null; |
| 103 | - }:null, | 103 | + })():null, |
| 104 | ], | 104 | ], |
| 105 | [ | 105 | [ |
| 106 | 'attribute' => 'city', | 106 | 'attribute' => 'city', |
| @@ -178,7 +178,7 @@ echo DetailView::widget([ | @@ -178,7 +178,7 @@ echo DetailView::widget([ | ||
| 178 | 'id', | 178 | 'id', |
| 179 | 'created_at:date', | 179 | 'created_at:date', |
| 180 | [ | 180 | [ |
| 181 | - 'attribute' => 'user.username', | 181 | + 'attribute' => 'name', |
| 182 | 'label' => \Yii::t('app', 'Client Username'), | 182 | 'label' => \Yii::t('app', 'Client Username'), |
| 183 | ], | 183 | ], |
| 184 | [ | 184 | [ |
| @@ -202,6 +202,10 @@ echo DetailView::widget([ | @@ -202,6 +202,10 @@ echo DetailView::widget([ | ||
| 202 | 'value' => $order->stock?:null, | 202 | 'value' => $order->stock?:null, |
| 203 | ], | 203 | ], |
| 204 | [ | 204 | [ |
| 205 | + 'attribute' => 'consignment', | ||
| 206 | + 'value' => $order->consignment?:null, | ||
| 207 | + ], | ||
| 208 | + [ | ||
| 205 | 'attribute' => 'insurance', | 209 | 'attribute' => 'insurance', |
| 206 | 'value' => $order->insurance?:null, | 210 | 'value' => $order->insurance?:null, |
| 207 | ], | 211 | ], |
| @@ -210,9 +214,19 @@ echo DetailView::widget([ | @@ -210,9 +214,19 @@ echo DetailView::widget([ | ||
| 210 | 'value' => $order->amount_imposed?:null, | 214 | 'value' => $order->amount_imposed?:null, |
| 211 | ], | 215 | ], |
| 212 | [ | 216 | [ |
| 213 | - 'attribute' => 'shipping_by', | ||
| 214 | - 'value' => $order->shipping_by?:null, | ||
| 215 | - ], | 217 | + 'attribute' => 'shipping_by', |
| 218 | + 'value' => $order->shipping_by?(function() use($order) { | ||
| 219 | + switch ($order->shipping_by) { | ||
| 220 | + case 1: | ||
| 221 | + return 'Отправитель'; | ||
| 222 | + break; | ||
| 223 | + case 2: | ||
| 224 | + return 'Получатель'; | ||
| 225 | + break; | ||
| 226 | + } | ||
| 227 | + return null; | ||
| 228 | + })():null, | ||
| 229 | + ], | ||
| 216 | ], | 230 | ], |
| 217 | ]); | 231 | ]); |
| 218 | ?> | 232 | ?> |