Files
old-ribica/front-ui/app/components/cart/cartTotal.js

54 lines
1.1 KiB
JavaScript

var React = require('react'),
Globals = require('../../globals');
;
var Router = require('react-router');
var CartTotal = React.createClass({
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');
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>);
}
}
});
module.exports = CartTotal;