Commit 1228053e56e2100eb2fc4bcb89360c1f71f5b1a1
1 parent
bfa66d3d
event order
Showing
3 changed files
with
10 additions
and
3 deletions
Show diff stats
controllers/OrderController.php
views/order/_form.php
| @@ -283,13 +283,13 @@ JS; | @@ -283,13 +283,13 @@ JS; | ||
| 283 | </div> | 283 | </div> |
| 284 | 284 | ||
| 285 | <div id="products"></div> | 285 | <div id="products"></div> |
| 286 | - | 286 | + |
| 287 | <?php | 287 | <?php |
| 288 | } | 288 | } |
| 289 | ?> | 289 | ?> |
| 290 | 290 | ||
| 291 | <div class="ln_solid"></div> | 291 | <div class="ln_solid"></div> |
| 292 | - <div class="form-group">Всего: <?=$sum?></div> | 292 | + <div class="form-group sum_all">Всего: <p><?=$sum?></p></div> |
| 293 | <div class="form-group"> | 293 | <div class="form-group"> |
| 294 | <?= Html::submitButton( | 294 | <?= Html::submitButton( |
| 295 | $model->isNewRecord ? Yii::t('order', 'Create') : Yii::t('order', 'Update'), | 295 | $model->isNewRecord ? Yii::t('order', 'Create') : Yii::t('order', 'Update'), |
web/js/order.js
| @@ -20,11 +20,15 @@ $(function() { | @@ -20,11 +20,15 @@ $(function() { | ||
| 20 | id: id.val(), | 20 | id: id.val(), |
| 21 | count: count.val(), | 21 | count: count.val(), |
| 22 | order: order | 22 | order: order |
| 23 | - }, function() { | 23 | + }, function(data) { |
| 24 | $.pjax.reload(selector, { | 24 | $.pjax.reload(selector, { |
| 25 | timeout: 5000, | 25 | timeout: 5000, |
| 26 | fragment: selector | 26 | fragment: selector |
| 27 | }); | 27 | }); |
| 28 | + | ||
| 29 | + var sum = $(".sum_all").children('p').text(); | ||
| 30 | + $(".sum_all").children('p').html(parseInt(sum)+parseInt(data)); | ||
| 31 | + | ||
| 28 | }); | 32 | }); |
| 29 | id.val(null) | 33 | id.val(null) |
| 30 | .trigger('change'); | 34 | .trigger('change'); |