Commit adcca6c035c9fea9df25a5a0156916f845b9cafd

Authored by Alexey Boroda
2 parents b0d994cd edf70e4b

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 51 * @property string $consignment
52 52 * @property string $payment
53 53 * @property string $insurance
54   - * @property double $amount_imposed
  54 + * @property string $amount_imposed
55 55 * @property string $shipping_by
56 56 * @property string $city
57 57 * @property string $deliveryString
... ...
views/order/print.php
... ... @@ -36,9 +36,9 @@ use yii\widgets\DetailView;
36 36 'id',
37 37 'created_at:date',
38 38 [
39   - 'attribute' => 'user.username',
  39 + 'attribute' => 'name',
40 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 44 'attribute' => 'email',
... ... @@ -90,7 +90,7 @@ use yii\widgets\DetailView;
90 90 ],
91 91 [
92 92 'attribute' => 'shipping_by',
93   - 'value' => $order->shipping_by?function() use($order) {
  93 + 'value' => $order->shipping_by?(function() use($order) {
94 94 switch ($order->shipping_by) {
95 95 case 1:
96 96 return 'Отправитель';
... ... @@ -100,7 +100,7 @@ use yii\widgets\DetailView;
100 100 break;
101 101 }
102 102 return null;
103   - }:null,
  103 + })():null,
104 104 ],
105 105 [
106 106 'attribute' => 'city',
... ... @@ -178,7 +178,7 @@ echo DetailView::widget([
178 178 'id',
179 179 'created_at:date',
180 180 [
181   - 'attribute' => 'user.username',
  181 + 'attribute' => 'name',
182 182 'label' => \Yii::t('app', 'Client Username'),
183 183 ],
184 184 [
... ... @@ -202,6 +202,10 @@ echo DetailView::widget([
202 202 'value' => $order->stock?:null,
203 203 ],
204 204 [
  205 + 'attribute' => 'consignment',
  206 + 'value' => $order->consignment?:null,
  207 + ],
  208 + [
205 209 'attribute' => 'insurance',
206 210 'value' => $order->insurance?:null,
207 211 ],
... ... @@ -210,9 +214,19 @@ echo DetailView::widget([
210 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 ?>
... ...