e0906f08
Alexey Boroda
-Fixing existing ...
|
1
|
<?php
|
2ad65823
Alexey Boroda
-Added date range...
|
2
3
4
5
6
7
|
/**
* @var ActiveDataProvider $dataProvider
* @var OrderSearch $searchModel
* @var View $this
*/
|
bb962a6d
Alexey Boroda
-Order in process
|
8
9
|
use artweb\artbox\ecommerce\models\Delivery;
use artweb\artbox\ecommerce\models\Label;
|
ce75bc1d
Alexey Boroda
-Grid view half w...
|
10
|
use artweb\artbox\ecommerce\models\Order;
|
2ad65823
Alexey Boroda
-Added date range...
|
11
|
use artweb\artbox\ecommerce\models\OrderSearch;
|
01185786
Alexey Boroda
-Sms in process
|
12
|
use common\models\User;
|
2ad65823
Alexey Boroda
-Added date range...
|
13
|
use kartik\daterange\DateRangePicker;
|
bb962a6d
Alexey Boroda
-Order in process
|
14
|
use kartik\select2\Select2;
|
2ad65823
Alexey Boroda
-Added date range...
|
15
|
use yii\data\ActiveDataProvider;
|
01185786
Alexey Boroda
-Sms in process
|
16
|
use yii\helpers\ArrayHelper;
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
17
|
use yii\helpers\Html;
|
ce75bc1d
Alexey Boroda
-Grid view half w...
|
18
19
|
use kartik\grid\GridView;
use yii\helpers\StringHelper;
|
bb962a6d
Alexey Boroda
-Order in process
|
20
|
use yii\helpers\Url;
|
01185786
Alexey Boroda
-Sms in process
|
21
|
use yii\web\JsExpression;
|
2ad65823
Alexey Boroda
-Added date range...
|
22
|
use yii\web\View;
|
bb962a6d
Alexey Boroda
-Order in process
|
23
|
use yii\widgets\ActiveForm;
|
01185786
Alexey Boroda
-Sms in process
|
24
|
use yii\widgets\Pjax;
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
25
26
27
|
$this->title = 'Заказы';
$this->params[ 'breadcrumbs' ][] = $this->title;
|
ccfc5763
Alexey Boroda
-Order in process 3
|
28
29
30
31
32
33
34
35
|
$js = <<< JS
$('[name="OrderSearch[phone]"]').mask('+38(000)000-00-00', {
placeholder: '+38(___)___-__-__'
});
JS;
$this->registerJs($js, View::POS_READY);
|
db3040d3
Alexey Boroda
-Order module alm...
|
36
|
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
37
|
?>
|
2ad65823
Alexey Boroda
-Added date range...
|
38
39
40
41
|
<h1>Заказы</h1>
<p>
<?= Html::a('Add order', [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
</p>
|
01185786
Alexey Boroda
-Sms in process
|
42
|
<?php Pjax::begin(); ?>
|
bb962a6d
Alexey Boroda
-Order in process
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
<?php
$searchForm = ActiveForm::begin(
[
'method' => 'GET',
'action' => Url::to([ 'order/index' ]),
'id' => 'search-form',
]
);
?>
<p>
<?php echo Html::submitButton(
'Search',
[
'class' => 'btn btn-primary',
]
) ?>
</p>
<?php
|
01185786
Alexey Boroda
-Sms in process
|
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
echo $searchForm->field($searchModel, 'label')
->widget(
Select2::className(),
[
'data' => Label::find()
->joinWith('lang')
->select(
[
'CONCAT(order_label.label,order_label_lang.title) AS name',
'id',
]
)
->indexBy('id')
->asArray()
->column(),
'options' => [ 'placeholder' => 'Select a state ...' ],
'pluginOptions' => [
'allowClear' => true,
'multiple' => true,
],
]
);
|
bb962a6d
Alexey Boroda
-Order in process
|
87
88
89
|
?>
<br>
<?php
|
01185786
Alexey Boroda
-Sms in process
|
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
echo $searchForm->field($searchModel, 'delivery')
->widget(
Select2::className(),
[
'data' => Delivery::find()
->joinWith('lang')
->select('order_delivery_lang.title, id')
->indexBy('id')
->asArray()
->column(),
'options' => [ 'placeholder' => 'Select a state ...' ],
'pluginOptions' => [
'allowClear' => true,
'multiple' => true,
],
]
);
?>
|
0893579c
Alexey Boroda
-Bug fixed
|
109
|
<?php
|
db3040d3
Alexey Boroda
-Order module alm...
|
110
111
112
|
$query = new JsExpression(
'function(params) { return {q:params.term}; }'
);
|
0893579c
Alexey Boroda
-Bug fixed
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
echo $searchForm->field($searchModel, 'sku')
->widget(
Select2::className(),
[
'options' => [ 'placeholder' => 'Search for a product ...' ],
'pluginOptions' => [
'allowClear' => true,
'minimumInputLength' => 3,
'language' => [
'errorLoading' => new JsExpression(
"function () { return 'Waiting for results...'; }"
),
],
'ajax' => [
'url' => \yii\helpers\Url::to([ 'find-product' ]),
'dataType' => 'json',
'data' => $query,
],
'escapeMarkup' => new JsExpression(
'function (markup) { return markup; }'
),
'templateResult' => new JsExpression(
'function(data) { return data.sku; }'
),
'templateSelection' => new JsExpression(
'function (data) {
if(data.sku == undefined) {
return "sku";
} else {
return data.sku;
}
}'
),
],
]
);
|
01185786
Alexey Boroda
-Sms in process
|
149
|
|
bb962a6d
Alexey Boroda
-Order in process
|
150
|
?>
|
01185786
Alexey Boroda
-Sms in process
|
151
152
|
<?= $searchForm->field($searchModel, 'manager_id')
|
0893579c
Alexey Boroda
-Bug fixed
|
153
154
155
156
157
158
159
160
161
162
|
->dropDownList(
ArrayHelper::map(
User::find()
->asArray()
->all(),
'id',
'username'
),
[ 'prompt' => \Yii::t('app', 'Выберите менеджера ...') ]
) ?>
|
01185786
Alexey Boroda
-Sms in process
|
163
164
165
166
167
168
169
170
171
172
173
|
<?= $searchForm->field($searchModel, 'email')
->textInput() ?>
<?= $searchForm->field($searchModel, 'declaration')
->textInput() ?>
<?= $searchForm->field($searchModel, 'consignment')
->textInput() ?>
|
bb962a6d
Alexey Boroda
-Order in process
|
174
|
<p>
|
ce75bc1d
Alexey Boroda
-Grid view half w...
|
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
<?php
echo GridView::widget(
[
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'rowOptions' => function($model) {
if ($model->wasted) {
return [ 'class' => 'danger' ];
} else {
return [];
}
},
'columns' => [
[
'attribute' => 'id',
'filter' => $searchForm->field($searchModel, 'id')
->textInput(),
|
b0c7d586
Alexey Boroda
-Bykov fixes
|
192
193
194
195
196
197
198
199
|
'content' => function($model) {
$manager = $model->manager;
if (empty($manager)) {
return $model->id;
} else {
return $model->id . ' ' . $manager->username;
}
}
|
ce75bc1d
Alexey Boroda
-Grid view half w...
|
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
],
[
'attribute' => 'created_at',
'format' => 'date',
'filter' => $searchForm->field($searchModel, 'date_range')
->widget(
DateRangePicker::className(),
[
'convertFormat' => false,
'pluginOptions' => [
'locale' => [
'format' => 'D-M-Y',
'separator' => ' to ',
],
'opens' => 'left',
|
bb962a6d
Alexey Boroda
-Order in process
|
215
|
],
|
ce75bc1d
Alexey Boroda
-Grid view half w...
|
216
217
218
219
220
221
222
|
]
)
->label(false)
->render(),
],
[
'attribute' => 'deadline',
|
01185786
Alexey Boroda
-Sms in process
|
223
224
|
'content' => function($model) {
if ($model->deadline == '') {
|
ce75bc1d
Alexey Boroda
-Grid view half w...
|
225
226
227
228
|
return '';
} else {
return \Yii::$app->formatter->asDate($model->deadline);
}
|
01185786
Alexey Boroda
-Sms in process
|
229
|
},
|
ce75bc1d
Alexey Boroda
-Grid view half w...
|
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
],
'name',
'total',
[
'attribute' => 'pay',
'content' => function($model) {
if ($model->pay == false) {
return '<span class="glyphicon glyphicon-remove"></span>';
} else {
return '<span class="glyphicon glyphicon-ok"></span>';
}
},
],
'phone',
'adress',
[
'attribute' => 'label',
|
01185786
Alexey Boroda
-Sms in process
|
247
|
'filter' => false,
|
ce75bc1d
Alexey Boroda
-Grid view half w...
|
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
|
'value' => function($model) {
/**
* @var Order $modl
*/
if (empty( $model->orderLabel )) {
return '--';
} else {
return $model->orderLabel->label;
}
},
],
[
'attribute' => 'body',
'content' => function($model) {
if (!empty( $model->body )) {
|
0893579c
Alexey Boroda
-Bug fixed
|
264
|
return StringHelper::truncate($model->body, 12, '...');
|
ce75bc1d
Alexey Boroda
-Grid view half w...
|
265
266
267
268
269
270
271
272
|
} else {
return '';
}
},
],
'sms',
[
'class' => 'yii\grid\ActionColumn',
|
3e703aac
Alexey Boroda
-Order form fixes
|
273
|
'template' => \Yii::$app->user->identity->isAdmin() ? '{view} {update} {delete}' : '{view} {update}'
|
ce75bc1d
Alexey Boroda
-Grid view half w...
|
274
|
],
|
bb962a6d
Alexey Boroda
-Order in process
|
275
|
],
|
ce75bc1d
Alexey Boroda
-Grid view half w...
|
276
277
278
|
]
);
?>
|
bb962a6d
Alexey Boroda
-Order in process
|
279
280
281
282
|
</p>
<?php
ActiveForm::end();
?>
|
01185786
Alexey Boroda
-Sms in process
|
283
|
<?php Pjax::end(); ?>
|