50 lines
961 B
JavaScript
50 lines
961 B
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');
|
|
|
|
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>
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
module.exports = CartTotal;
|