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 | 283 | </div> |
| 284 | 284 | |
| 285 | 285 | <div id="products"></div> |
| 286 | - | |
| 286 | + | |
| 287 | 287 | <?php |
| 288 | 288 | } |
| 289 | 289 | ?> |
| 290 | 290 | |
| 291 | 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 | 293 | <div class="form-group"> |
| 294 | 294 | <?= Html::submitButton( |
| 295 | 295 | $model->isNewRecord ? Yii::t('order', 'Create') : Yii::t('order', 'Update'), | ... | ... |
web/js/order.js
| ... | ... | @@ -20,11 +20,15 @@ $(function() { |
| 20 | 20 | id: id.val(), |
| 21 | 21 | count: count.val(), |
| 22 | 22 | order: order |
| 23 | - }, function() { | |
| 23 | + }, function(data) { | |
| 24 | 24 | $.pjax.reload(selector, { |
| 25 | 25 | timeout: 5000, |
| 26 | 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 | 33 | id.val(null) |
| 30 | 34 | .trigger('change'); | ... | ... |