fixed bug with amount not updating / solved double dispatch problem with cartAction.load / removed all console.log calls - it became too chatty / add them as needed
This commit is contained in:
@@ -8,42 +8,25 @@ var Router = require('react-router');
|
||||
|
||||
var CartTotal = React.createClass({
|
||||
|
||||
render: function() {
|
||||
render: function() {
|
||||
|
||||
|
||||
|
||||
var counts = this.props.itemCounts;
|
||||
var total = 0;
|
||||
this.props.items.map(function (i) {
|
||||
|
||||
var count = counts[i.get('id')].get('count');
|
||||
var price = i.get('list_price');
|
||||
var items = this.props.items.models;
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var item = items[i];
|
||||
var count = counts[item.get('id')].get('count');
|
||||
var price = item.get('list_price');
|
||||
total += (price * count)
|
||||
return total;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
var deliveryCosts = this.props.deliveryCosts.get('delivery_price');
|
||||
|
||||
if (!this.props.justMerchandise) {
|
||||
|
||||
return (
|
||||
<div className="col-md-3 cart-total">
|
||||
<div>
|
||||
Roba: {Globals.FormatCurrency(total)}
|
||||
</div>
|
||||
<div>
|
||||
Dostava: {Globals.FormatCurrency(deliveryCosts)}
|
||||
</div>
|
||||
<div>
|
||||
Ukupno: {Globals.FormatCurrency(total + (+deliveryCosts))}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
);
|
||||
|
||||
}
|
||||
else {
|
||||
return ( <span>{Globals.FormatCurrency(total)}</span>);
|
||||
}
|
||||
|
||||
return ( <span>{Globals.FormatCurrency(total)}</span>);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user