e0906f08
Alexey Boroda
-Fixing existing ...
|
1
2
|
<?php
|
bb962a6d
Alexey Boroda
-Order in process
|
3
|
use artweb\artbox\ecommerce\models\Label;
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
4
|
use artweb\artbox\ecommerce\models\Order;
|
30b799f2
Alexey Boroda
-Order in process 2
|
5
|
use artweb\artbox\ecommerce\models\OrderPayment;
|
2ad65823
Alexey Boroda
-Added date range...
|
6
|
use artweb\artbox\ecommerce\models\OrderProduct;
|
01185786
Alexey Boroda
-Sms in process
|
7
|
use backend\models\SmsTemplate;
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
8
|
use kartik\grid\GridView;
|
bb962a6d
Alexey Boroda
-Order in process
|
9
|
use kartik\widgets\DatePicker;
|
2ad65823
Alexey Boroda
-Added date range...
|
10
|
use kartik\widgets\Select2;
|
bb962a6d
Alexey Boroda
-Order in process
|
11
|
use kartik\widgets\SwitchInput;
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
12
|
use yii\data\ActiveDataProvider;
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
13
14
|
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
|
6f14188b
Alexey Boroda
-Product card fixed
|
15
16
|
use yii\helpers\ArrayHelper;
use artweb\artbox\ecommerce\models\Delivery;
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
17
|
use yii\web\View;
|
2ad65823
Alexey Boroda
-Added date range...
|
18
|
use yii\web\JsExpression;
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
19
|
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
20
21
22
23
24
25
|
/**
* @var View $this
* @var Order $model
* @var ActiveForm $form
* @var ActiveDataProvider $dataProvider
*/
|
2ad65823
Alexey Boroda
-Added date range...
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
$js = <<< JS
$(document).on('submit', '#add-product-form', function(e) {
e.preventDefault();
var addFormData = $(this).serializeArray();
var addFormAction = this.action;
$.ajax({
url: addFormAction,
type: "POST",
data: addFormData,
success: function (data) {
if (data.status === "success") {
$.pjax.reload({container:"#order-products-grid"}); //Reload GridView
}
},
error: function () {
}
});
});
JS;
$this->registerJs($js, View::POS_READY);
|
bb962a6d
Alexey Boroda
-Order in process
|
48
49
50
51
52
53
54
55
|
$js = <<< JS
$('#order-phone, #order-phone2').mask('+38(000)000-00-00', {
placeholder: '+38(___)___-__-__'
});
JS;
$this->registerJs($js, View::POS_READY);
|
01185786
Alexey Boroda
-Sms in process
|
56
57
58
59
|
$js = <<< JS
$(document).on('change', '#sms-template-selector', function(event) {
var text = $('#select2-sms-template-selector-container').attr('title');
|
db3040d3
Alexey Boroda
-Order module alm...
|
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
var val = $('option:contains(' + text + ')').attr('value');
$('#sms-text-area').val(val);
});
$(document).on('click', '#send-sms-action', function(event) {
console.log('click');
var content = $('#sms-text-area').val()
var phone = $('input#order-phone').val();
$.ajax({
url: "/admin/ecommerce/order/send-sms",
method: "POST",
data: {
phone: phone,
content: content
},
success: function(data) {
console.log(data);
var newButton = document.createElement('button');
newButton.classList.add('btn', 'btn-default');
newButton.innerText = 'Отправлено';
var current = document.getElementById("send-sms-action");
var parentDiv = current.parentNode;
parentDiv.replaceChild(newButton, current);
}
});
|
01185786
Alexey Boroda
-Sms in process
|
85
86
87
88
|
});
JS;
$this->registerJs($js, View::POS_READY);
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
89
90
91
|
?>
<?php $form = ActiveForm::begin(); ?>
|
6f14188b
Alexey Boroda
-Product card fixed
|
92
|
<div class="container">
|
eb15a89c
Alexey Boroda
-Dancing with com...
|
93
94
|
<div class="form-group">
<div class="row">
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
95
|
<?= Html::submitButton(
|
db3040d3
Alexey Boroda
-Order module alm...
|
96
97
|
$model->isNewRecord ? \Yii::t('app', 'Создать') : \Yii::t('app', 'Обновить'),
[ 'class' => $model->isNewRecord ? 'btn btn-success btn-lg' : 'btn btn-primary btn-lg' ]
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
98
|
) ?>
|
eb15a89c
Alexey Boroda
-Dancing with com...
|
99
100
|
<?= Html::a(
\Yii::t('app', 'Печать'),
|
01185786
Alexey Boroda
-Sms in process
|
101
102
103
104
105
106
|
yii\helpers\Url::to(
[
'order/print',
'order_id' => $model->id,
]
),
|
eb15a89c
Alexey Boroda
-Dancing with com...
|
107
|
[
|
db3040d3
Alexey Boroda
-Order module alm...
|
108
|
'class' => $model->isNewRecord ? 'btn btn-info disabled btn-lg' : 'btn btn-info btn-lg',
|
eb15a89c
Alexey Boroda
-Dancing with com...
|
109
110
111
|
'target' => '_blank',
]
) ?>
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
112
|
</div>
|
db3040d3
Alexey Boroda
-Order module alm...
|
113
|
<br>
|
eb15a89c
Alexey Boroda
-Dancing with com...
|
114
115
|
<div class="row">
<div class="col-sm-6">
|
bb962a6d
Alexey Boroda
-Order in process
|
116
|
|
eb15a89c
Alexey Boroda
-Dancing with com...
|
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
<?= $form->field($model, 'deadline')
->widget(
DatePicker::className(),
[
]
) ?>
<?php
echo $form->field($model, 'pay')
->widget(
SwitchInput::className(),
[
'name' => 'pay',
'pluginOptions' => [
'onText' => \Yii::t('app', 'Оплачено'),
'offText' => \Yii::t('app', 'Не оплачено'),
],
]
); ?>
<?= $form->field($model, 'reason')
->dropDownList(
|
db3040d3
Alexey Boroda
-Order module alm...
|
140
|
Order::REASONS,
|
eb15a89c
Alexey Boroda
-Dancing with com...
|
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
[ 'prompt' => 'Выберите причину' ]
) ?>
<?= $form->field($model, 'label')
->dropDownList(
ArrayHelper::map(
Label::find()
->asArray()
->all(),
'id',
'label'
),
[ 'prompt' => 'Выберите метку' ]
); ?>
<?= $form->field($model, 'name') ?>
<?= $form->field($model, 'phone') ?>
<?= $form->field($model, 'phone2') ?>
<?= $form->field($model, 'email') ?>
<?= $form->field(
$model,
'numbercard'
)
->textInput([ 'readonly' => true ]) ?>
<?= $form->field($model, 'comment')
->textarea([ 'rows' => '3' ]) ?>
<?= $form->field($model, 'delivery')
->dropDownList(
ArrayHelper::map(
Delivery::find()
|
30b799f2
Alexey Boroda
-Order in process 2
|
176
|
->joinWith('lang')
|
30b799f2
Alexey Boroda
-Order in process 2
|
177
178
|
->asArray()
->all(),
|
eb15a89c
Alexey Boroda
-Dancing with com...
|
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
'id',
'lang.title'
),
[ 'prompt' => \Yii::t('app', 'Выберите доставку ...') ]
) ?>
</div>
<div class="col-sm-6">
<?= $form->field($model, 'declaration') ?>
<?= $form->field($model, 'stock') ?>
<?= $form->field($model, 'consignment') ?>
<?= $form->field($model, 'payment')
->dropDownList(
ArrayHelper::map(
OrderPayment::find()
->joinWith('lang')
->where([ 'status' => OrderPayment::ACTIVE ])
->asArray()
->all(),
'id',
'lang.title'
),
[ 'prompt' => 'Способ оплаты ...' ]
); ?>
<?= $form->field($model, 'insurance') ?>
<?= $form->field($model, 'amount_imposed') ?>
<?= $form->field($model, 'shipping_by')
->dropDownList(
ArrayHelper::getColumn(Order::SHIPPING_BY, 'label'),
[ 'prompt' => 'Оплата доставки ...' ]
); ?>
<?= $form->field($model, 'city') ?>
<?= $form->field($model, 'adress') ?>
<?= $form->field($model, 'body')
->textarea([ 'rows' => '3' ]) ?>
<?= $form->field($model, 'check') ?>
<?= $form->field($model, 'sms') ?>
|
6f14188b
Alexey Boroda
-Product card fixed
|
228
|
|
eb15a89c
Alexey Boroda
-Dancing with com...
|
229
|
</div>
|
6f14188b
Alexey Boroda
-Product card fixed
|
230
|
</div>
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
231
232
|
</div>
</div>
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
233
|
<?php ActiveForm::end(); ?>
|
2ad65823
Alexey Boroda
-Added date range...
|
234
235
|
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
236
237
238
239
240
241
|
<div class="container">
<div class="row">
<?php
echo GridView::widget(
[
'dataProvider' => $dataProvider,
|
bb962a6d
Alexey Boroda
-Order in process
|
242
|
'layout' => '{items}{pager}',
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
243
244
|
'columns' => [
'id',
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
245
|
'sku',
|
01185786
Alexey Boroda
-Sms in process
|
246
247
248
249
|
'product_name',
'productVariant.product.brand.lang.title',
'productVariant.lang.title',
'price',
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
250
251
252
253
|
[
'class' => 'kartik\grid\EditableColumn',
'attribute' => 'count',
'editableOptions' => [
|
01185786
Alexey Boroda
-Sms in process
|
254
255
256
|
'header' => \Yii::t('app', 'Количество'),
'inputType' => kartik\editable\Editable::INPUT_SPIN,
'options' => [
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
257
258
259
260
261
|
'pluginOptions' => [
'min' => 0,
'max' => 5000,
],
],
|
01185786
Alexey Boroda
-Sms in process
|
262
263
264
|
'pluginEvents' => [
'editableSuccess' => 'function(event) { $.pjax.reload({container:"#order-products-grid"}); }',
],
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
265
|
],
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
266
267
|
'format' => [
'decimal',
|
2ad65823
Alexey Boroda
-Added date range...
|
268
|
0,
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
269
|
],
|
2ad65823
Alexey Boroda
-Added date range...
|
270
|
'pageSummary' => false,
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
271
|
],
|
01185786
Alexey Boroda
-Sms in process
|
272
|
'sum_cost',
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
273
|
[
|
0893579c
Alexey Boroda
-Bug fixed
|
274
275
276
277
278
279
280
281
282
283
284
|
'class' => 'kartik\grid\EditableColumn',
'attribute' => 'booking',
'editableOptions' => [
'header' => \Yii::t('app', 'Бронь'),
'inputType' => kartik\editable\Editable::INPUT_TEXT,
'options' => [
'pluginOptions' => [
'min' => 0,
'max' => 20,
],
],
|
0893579c
Alexey Boroda
-Bug fixed
|
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
],
'format' => [
'text',
],
'pageSummary' => false,
],
[
'class' => 'kartik\grid\EditableColumn',
'attribute' => 'status',
'editableOptions' => [
'header' => \Yii::t('app', 'Статус'),
'inputType' => kartik\editable\Editable::INPUT_TEXT,
'options' => [
'pluginOptions' => [
'min' => 0,
'max' => 20,
],
],
|
0893579c
Alexey Boroda
-Bug fixed
|
303
304
305
306
307
308
|
],
'format' => [
'text',
],
'pageSummary' => false,
],
|
db3040d3
Alexey Boroda
-Order module alm...
|
309
310
311
312
313
314
315
316
317
318
319
320
321
|
[
'class' => 'kartik\grid\EditableColumn',
'attribute' => 'return',
'editableOptions' => [
'header' => \Yii::t('app', 'Возврат'),
'inputType' => kartik\editable\Editable::INPUT_CHECKBOX,
'options' => [],
],
'format' => [
'boolean',
],
'pageSummary' => false,
],
|
0893579c
Alexey Boroda
-Bug fixed
|
322
|
[
|
2ad65823
Alexey Boroda
-Added date range...
|
323
|
'class' => 'yii\grid\ActionColumn',
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
324
325
326
327
328
|
'template' => '{delete}',
],
],
'responsive' => true,
'hover' => true,
|
2ad65823
Alexey Boroda
-Added date range...
|
329
330
331
332
|
'pjax' => true,
'pjaxSettings' => [
'options' => [
'scrollTo' => 'false',
|
bb962a6d
Alexey Boroda
-Order in process
|
333
|
'id' => 'order-products-grid',
|
2ad65823
Alexey Boroda
-Added date range...
|
334
335
|
],
],
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
336
337
338
|
]
);
?>
|
6f14188b
Alexey Boroda
-Product card fixed
|
339
|
</div>
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
340
|
</div>
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
341
|
|
2ad65823
Alexey Boroda
-Added date range...
|
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
<div class="container">
<div class="row">
<?php $newProductForm = ActiveForm::begin(
[
'action' => yii\helpers\Url::to([ 'add' ]),
'id' => 'add-product-form',
]
);
$newOrderProduct = new OrderProduct();
?>
<div class="col-md-8">
<?php echo $newProductForm->field($newOrderProduct, 'id')
->widget(
Select2::className(),
[
'options' => [ 'placeholder' => 'Search for a product ...' ],
'pluginOptions' => [
'allowClear' => true,
|
bb962a6d
Alexey Boroda
-Order in process
|
360
|
'disabled' => $model->isNewRecord ? true : false,
|
2ad65823
Alexey Boroda
-Added date range...
|
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
|
'minimumInputLength' => 3,
'language' => [
'errorLoading' => new JsExpression(
"function () { return 'Waiting for results...'; }"
),
],
'ajax' => [
'url' => \yii\helpers\Url::to([ 'find-product' ]),
'dataType' => 'json',
'data' => new JsExpression(
'function(params) { return {q:params.term}; }'
),
],
'escapeMarkup' => new JsExpression(
'function (markup) { return markup; }'
),
'templateResult' => new JsExpression(
'function(data) { return data.sku; }'
),
'templateSelection' => new JsExpression(
'function (data) { return data.sku; }'
),
],
]
);
?>
</div>
<div class="col-md-2">
|
db3040d3
Alexey Boroda
-Order module alm...
|
390
391
392
393
394
395
396
397
398
399
|
<?php echo $newProductForm->field(
$newOrderProduct,
'count'
)
->input(
'number',
[
'disabled' => $model->isNewRecord ? true : false,
]
); ?>
|
2ad65823
Alexey Boroda
-Added date range...
|
400
|
</div>
|
db3040d3
Alexey Boroda
-Order module alm...
|
401
|
<div class="col-md-2" style="margin-top: 23px">
|
2ad65823
Alexey Boroda
-Added date range...
|
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
|
<?php echo Html::submitButton(
'Add',
[
'class' => $model->isNewRecord ? 'btn btn-primary disabled' : 'btn btn-primary',
]
) ?>
</div>
<?php echo $newProductForm->field($newOrderProduct, 'order_id')
->hiddenInput(
[
'value' => $model->id,
]
)
->label(false) ?>
<?php ActiveForm::end(); ?>
</div>
</div>
|
01185786
Alexey Boroda
-Sms in process
|
419
420
|
<br>
<br>
|
01185786
Alexey Boroda
-Sms in process
|
421
|
<div class="container">
|
db3040d3
Alexey Boroda
-Order module alm...
|
422
|
<h2><?php echo \Yii::t('app', 'Отправить смс'); ?></h2>
|
01185786
Alexey Boroda
-Sms in process
|
423
424
425
426
|
<div class="row">
<?php
echo Select2::widget(
[
|
db3040d3
Alexey Boroda
-Order module alm...
|
427
|
'id' => 'sms-template-selector',
|
01185786
Alexey Boroda
-Sms in process
|
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
|
'name' => 'select-sms-template',
'data' => ArrayHelper::map(
SmsTemplate::find()
->asArray()
->all(),
'text',
'title'
),
'options' => [ 'placeholder' => \Yii::t('app', 'Выберите шаблон') ],
'pluginOptions' => [
'allowClear' => true,
],
]
);
?>
|
db3040d3
Alexey Boroda
-Order module alm...
|
444
|
<br>
|
01185786
Alexey Boroda
-Sms in process
|
445
446
447
448
449
|
<?php
echo Html::textarea(
'sms-text',
'',
[
|
db3040d3
Alexey Boroda
-Order module alm...
|
450
451
452
|
'rows' => 3,
'id' => 'sms-text-area',
'class' => 'form-control',
|
01185786
Alexey Boroda
-Sms in process
|
453
454
455
|
]
);
?>
|
db3040d3
Alexey Boroda
-Order module alm...
|
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
|
<br>
<?php
if ($model->isNewRecord) {
echo Html::button(
\Yii::t('app', 'Отправить'),
[
'class' => 'btn btn-warning disabled',
]
);
} else {
echo Html::button(
\Yii::t('app', 'Отправить'),
[
'class' => 'btn btn-warning',
'id' => 'send-sms-action',
]
);
}
?>
|
01185786
Alexey Boroda
-Sms in process
|
475
476
|
</div>
</div>
|