Skip to content

Commit

Permalink
- fixed issue with recalculation not being triggered when items in th…
Browse files Browse the repository at this point in the history
…e advised grid are either updated with an amount or quantity

- added additional trigger / listener to trigger the recalculation in this collection
  • Loading branch information
24198 committed Jun 29, 2020
1 parent 6490937 commit f26ffdd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ define(function(require) {
var currencyLabel = this.priceEl.closest('.control-group').find('label').text();
var start_pos = currencyLabel.indexOf('(') + 1;
var end_pos = currencyLabel.indexOf(')',start_pos);
this.currencySymbol = currencyLabel.substring(start_pos,end_pos)
this.currencySymbol = currencyLabel.substring(start_pos,end_pos);
this.priceEl.change(_.bind(this.updateRowTotal, this));
PurchaseOrderItemView.__super__.initialize.apply(this, arguments);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ define(function(require) {
}
});
mediator.trigger('po:items:total:changed', {'value': total.toFixed(2), 'currency': data.currency, 'type': 'additional', 'label': 'Additional items Total'});
},

}
});

return PurchaseOrderItemsView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ define(function(require) {
this.addedCollectionItems = [];
this.removedCollectionItems = [];

mediator.on('po:row:total:changed', this.triggerTotalsUpdateEvent, this);
this.render();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ define(function(require) {
const _ = require('underscore');
const Backbone = require('backbone');
const DialogWidget = require('oro/dialog-widget');
const mediator = require('oroui/js/mediator');

/**
* @export oroform/js/multiple-entity/view
Expand Down Expand Up @@ -102,12 +103,14 @@ define(function(require) {
this.model.set('purchasePrice', price);

let rowTotal = parseFloat(amount) * parseFloat(price);
let currencySymbol = this.model.get('currency');
if (!isNaN(rowTotal)) {
let currencySymbol = this.model.get('currency');
this.$el.find('td.purchase-order-line-item-row-total').html(currencySymbol + rowTotal.toFixed(2));
} else {
this.$el.find('td.purchase-order-line-item-row-total').html('');
}

mediator.trigger('po:row:total:changed', {'currency': currencySymbol});
}
});

Expand Down

0 comments on commit f26ffdd

Please sign in to comment.