Commit b12f37d7021251bceeccfc3e86d09da10784b783
1 parent
653d2c43
-Order products started
Showing
2 changed files
with
72 additions
and
4 deletions
Show diff stats
views/order/_form.php
@@ -75,7 +75,7 @@ | @@ -75,7 +75,7 @@ | ||
75 | ?> | 75 | ?> |
76 | </div> | 76 | </div> |
77 | </div> | 77 | </div> |
78 | - | 78 | + |
79 | <?php | 79 | <?php |
80 | foreach ($model->orderProducts as $index => $orderProduct) { | 80 | foreach ($model->orderProducts as $index => $orderProduct) { |
81 | ?> | 81 | ?> |
@@ -182,9 +182,77 @@ | @@ -182,9 +182,77 @@ | ||
182 | </div> | 182 | </div> |
183 | </div> | 183 | </div> |
184 | <?php | 184 | <?php |
185 | + } else { | ||
186 | + ?> | ||
187 | + | ||
188 | + <div class="row"> | ||
189 | + <div class="col-md-8"> | ||
190 | + <?php | ||
191 | + echo Select2::widget( | ||
192 | + [ | ||
193 | + 'name' => 'add-to-order', | ||
194 | + 'options' => [ | ||
195 | + 'placeholder' => \Yii::t('order', 'Select product'), | ||
196 | + ], | ||
197 | + 'pluginOptions' => [ | ||
198 | + 'allowClear' => true, | ||
199 | + 'minimumInputLength' => 3, | ||
200 | + 'language' => [ | ||
201 | + 'errorLoading' => new JsExpression( | ||
202 | + "function() {return '" . \Yii::t('order', 'Waiting for results') . "'; }" | ||
203 | + ), | ||
204 | + ], | ||
205 | + 'ajax' => [ | ||
206 | + 'url' => Url::to([ 'product-list' ]), | ||
207 | + 'dataType' => 'json', | ||
208 | + 'data' => new JsExpression('function(params) { return {q:params.term}; }'), | ||
209 | + ], | ||
210 | + 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), | ||
211 | + 'templateResult' => new JsExpression('function(city) { return city.text; }'), | ||
212 | + 'templateSelection' => new JsExpression('function (city) { return city.text; }'), | ||
213 | + ], | ||
214 | + 'id' => 'add-to-order', | ||
215 | + ] | ||
216 | + ); | ||
217 | + ?> | ||
218 | + </div> | ||
219 | + <div class="col-md-3"> | ||
220 | + <?php | ||
221 | + echo Html::textInput( | ||
222 | + 'count-to-order', | ||
223 | + null, | ||
224 | + [ | ||
225 | + 'class' => 'form-control', | ||
226 | + 'id' => 'count-to-order', | ||
227 | + ] | ||
228 | + ); | ||
229 | + ?> | ||
230 | + </div> | ||
231 | + <div class="col-md-1"> | ||
232 | + <?php | ||
233 | + echo Html::a( | ||
234 | + Html::icon( | ||
235 | + 'plus-circle', | ||
236 | + [ | ||
237 | + 'prefix' => 'fa fa-', | ||
238 | + ] | ||
239 | + ), | ||
240 | + '#', | ||
241 | + [ | ||
242 | + 'class' => 'variant-to-order', | ||
243 | + 'data-id' => $model->id, | ||
244 | + ] | ||
245 | + ); | ||
246 | + ?> | ||
247 | + </div> | ||
248 | + </div> | ||
249 | + | ||
250 | + <?php | ||
185 | } | 251 | } |
186 | ?> | 252 | ?> |
187 | 253 | ||
254 | + <div class="ln_solid"></div> | ||
255 | + | ||
188 | <div class="form-group"> | 256 | <div class="form-group"> |
189 | <?= Html::submitButton( | 257 | <?= Html::submitButton( |
190 | $model->isNewRecord ? Yii::t('order', 'Create') : Yii::t('order', 'Update'), | 258 | $model->isNewRecord ? Yii::t('order', 'Create') : Yii::t('order', 'Update'), |
views/order/index.php
@@ -54,9 +54,9 @@ | @@ -54,9 +54,9 @@ | ||
54 | }, | 54 | }, |
55 | ], | 55 | ], |
56 | 56 | ||
57 | - [ 'class' => 'yii\grid\ActionColumn', | ||
58 | - 'template' => '{view} {update} {delete}{print}', | ||
59 | - 'buttons' => [ | 57 | + [ 'class' => 'yii\grid\ActionColumn', |
58 | + 'template' => '{view} {update} {delete} {print}', | ||
59 | + 'buttons' => [ | ||
60 | 'print' => function ($url) { | 60 | 'print' => function ($url) { |
61 | return Html::a( | 61 | return Html::a( |
62 | '<span class="glyphicon glyphicon-print"></span>', | 62 | '<span class="glyphicon glyphicon-print"></span>', |