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;
|
2ad65823
Alexey Boroda
-Added date range...
|
5
|
use artweb\artbox\ecommerce\models\OrderProduct;
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
6
|
use kartik\grid\GridView;
|
bb962a6d
Alexey Boroda
-Order in process
|
7
|
use kartik\widgets\DatePicker;
|
2ad65823
Alexey Boroda
-Added date range...
|
8
|
use kartik\widgets\Select2;
|
bb962a6d
Alexey Boroda
-Order in process
|
9
|
use kartik\widgets\SwitchInput;
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
10
|
use yii\data\ActiveDataProvider;
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
11
12
|
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
|
6f14188b
Alexey Boroda
-Product card fixed
|
13
14
|
use yii\helpers\ArrayHelper;
use artweb\artbox\ecommerce\models\Delivery;
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
15
|
use yii\web\View;
|
2ad65823
Alexey Boroda
-Added date range...
|
16
|
use yii\web\JsExpression;
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
17
|
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
18
19
20
21
22
23
|
/**
* @var View $this
* @var Order $model
* @var ActiveForm $form
* @var ActiveDataProvider $dataProvider
*/
|
2ad65823
Alexey Boroda
-Added date range...
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
$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
|
46
47
48
49
50
51
52
53
54
|
$js = <<< JS
$('#order-phone, #order-phone2').mask('+38(000)000-00-00', {
placeholder: '+38(___)___-__-__'
});
JS;
$this->registerJs($js, View::POS_READY);
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
55
56
57
|
?>
<?php $form = ActiveForm::begin(); ?>
|
6f14188b
Alexey Boroda
-Product card fixed
|
58
59
|
<div class="container">
<div class="row">
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
60
61
62
63
64
65
66
67
|
<div class="form-group">
<?= Html::submitButton(
$model->isNewRecord ? 'Create' : 'Update',
[ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]
) ?>
</div>
</div>
<div class="row">
|
6f14188b
Alexey Boroda
-Product card fixed
|
68
69
|
<div class="col-sm-6">
|
bb962a6d
Alexey Boroda
-Order in process
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
<?= $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, 'label')
->dropDownList(
ArrayHelper::map(
Label::find()
->asArray()
->all(),
'id',
'label'
),
[ 'prompt' => 'Метка' ]
); ?>
|
6f14188b
Alexey Boroda
-Product card fixed
|
98
99
100
101
102
103
104
105
106
107
108
|
<?= $form->field($model, 'name') ?>
<?= $form->field($model, 'phone') ?>
<?= $form->field($model, 'phone2') ?>
<?= $form->field($model, 'email') ?>
<?= $form->field($model, 'numbercard') ?>
|
bb962a6d
Alexey Boroda
-Order in process
|
109
|
<?= $form->field($model, 'comment')
|
6f14188b
Alexey Boroda
-Product card fixed
|
110
|
->textarea([ 'rows' => '3' ]) ?>
|
bb962a6d
Alexey Boroda
-Order in process
|
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
<?= $form->field($model, 'delivery')
->dropDownList(
ArrayHelper::map(
Delivery::find()
->joinWith('lang')
->asArray()
->all(),
'id',
'lang.title'
),
[ 'prompt' => \Yii::t('app', 'Выберите доставку ...') ]
) ?>
</div>
<div class="col-sm-6">
|
6f14188b
Alexey Boroda
-Product card fixed
|
126
127
128
129
130
|
<?= $form->field($model, 'declaration') ?>
<?= $form->field($model, 'stock') ?>
|
6f14188b
Alexey Boroda
-Product card fixed
|
131
132
|
<?= $form->field($model, 'payment')
->dropDownList(
|
bb962a6d
Alexey Boroda
-Order in process
|
133
134
|
ArrayHelper::getColumn(Order::PAYMENT_LIST, 'label'),
[ 'prompt' => 'Способ оплаты ...' ]
|
6f14188b
Alexey Boroda
-Product card fixed
|
135
136
137
138
139
140
|
); ?>
<?= $form->field($model, 'insurance') ?>
<?= $form->field($model, 'amount_imposed') ?>
|
bb962a6d
Alexey Boroda
-Order in process
|
141
142
143
144
145
|
<?= $form->field($model, 'shipping_by')
->dropDownList(
ArrayHelper::getColumn(Order::SHIPPING_BY, 'label'),
[ 'prompt' => 'Оплата доставки ...' ]
); ?>
|
6f14188b
Alexey Boroda
-Product card fixed
|
146
147
148
149
150
|
<?= $form->field($model, 'city') ?>
<?= $form->field($model, 'adress') ?>
|
bb962a6d
Alexey Boroda
-Order in process
|
151
|
<?= $form->field($model, 'body')
|
6f14188b
Alexey Boroda
-Product card fixed
|
152
153
|
->textarea([ 'rows' => '3' ]) ?>
</div>
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
154
155
|
</div>
</div>
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
156
|
<?php ActiveForm::end(); ?>
|
2ad65823
Alexey Boroda
-Added date range...
|
157
158
|
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
159
160
161
162
163
164
|
<div class="container">
<div class="row">
<?php
echo GridView::widget(
[
'dataProvider' => $dataProvider,
|
bb962a6d
Alexey Boroda
-Order in process
|
165
|
'layout' => '{items}{pager}',
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
'columns' => [
'id',
'product_name',
'sku',
[
'class' => 'kartik\grid\EditableColumn',
'attribute' => 'count',
'editableOptions' => [
'header' => \Yii::t('app', 'Количество'),
'inputType' => kartik\editable\Editable::INPUT_SPIN,
'options' => [
'pluginOptions' => [
'min' => 0,
'max' => 5000,
],
],
],
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
183
184
|
'format' => [
'decimal',
|
2ad65823
Alexey Boroda
-Added date range...
|
185
|
0,
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
186
|
],
|
2ad65823
Alexey Boroda
-Added date range...
|
187
|
'pageSummary' => false,
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
188
189
|
],
[
|
2ad65823
Alexey Boroda
-Added date range...
|
190
|
'class' => 'yii\grid\ActionColumn',
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
191
192
193
194
195
|
'template' => '{delete}',
],
],
'responsive' => true,
'hover' => true,
|
2ad65823
Alexey Boroda
-Added date range...
|
196
197
198
199
|
'pjax' => true,
'pjaxSettings' => [
'options' => [
'scrollTo' => 'false',
|
bb962a6d
Alexey Boroda
-Order in process
|
200
|
'id' => 'order-products-grid',
|
2ad65823
Alexey Boroda
-Added date range...
|
201
202
|
],
],
|
7520dc0e
Alexey Boroda
-Grid with input ...
|
203
204
205
|
]
);
?>
|
6f14188b
Alexey Boroda
-Product card fixed
|
206
|
</div>
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
207
|
</div>
|
e0906f08
Alexey Boroda
-Fixing existing ...
|
208
|
|
2ad65823
Alexey Boroda
-Added date range...
|
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
<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
|
227
|
'disabled' => $model->isNewRecord ? true : false,
|
2ad65823
Alexey Boroda
-Added date range...
|
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
'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">
|
bb962a6d
Alexey Boroda
-Order in process
|
257
258
|
<?php echo $newProductForm->field($newOrderProduct, 'count')
->input('number'); ?>
|
2ad65823
Alexey Boroda
-Added date range...
|
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
</div>
<div class="col-md-2">
<?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>
|