delivery costs are now shown
This commit is contained in:
@@ -16,7 +16,7 @@ before do
|
||||
content_type :json
|
||||
# TODO: before running to production change this so that only specific
|
||||
# domain is allowed
|
||||
headers 'Access-Control-Allow-Origin' => 'http://192.168.1.37:3001',
|
||||
headers 'Access-Control-Allow-Origin' => 'http://192.168.1.35:3001',
|
||||
'Access-Control-Allow-Methods' => ['OPTIONS', 'GET', 'POST','PUT'],
|
||||
'Access-Control-Allow-Headers' => 'Origin, X-Requested-With, Content-Type, Accept',
|
||||
'Access-Control-Expose-Headers' => 'X-Total-Count',
|
||||
|
||||
@@ -47,7 +47,7 @@ module.exports = function(grunt) {
|
||||
dev: {
|
||||
options: {
|
||||
variables: {
|
||||
apiEndpoint: 'http://192.168.1.37:4567'
|
||||
apiEndpoint: 'http://192.168.1.35:4567'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -30,7 +30,7 @@ var CartIcon = React.createClass({
|
||||
<div>
|
||||
<ul className="nav navbar-nav navbar-right hidden-md hidden-sm hidden-xs">
|
||||
<li onClick={this._onClick} style={{borderTop: 'solid lightgray 1px', borderBottom: 'solid lightgray 1px', borderLeft: 'solid lightgray 1px', paddingBottom: 22}}><a ><div className="mycart"><span>{normalizeCount(this.state.count)}</span></div></a></li>
|
||||
<li onClick={this._onClick} style={{borderTop: 'solid lightgray 1px', borderBottom: 'solid lightgray 1px', paddingBottom: 2}}><a href="#" style={{ paddingRight: '5px', backgroundColor: 'transparent' }}><CartTotal items={this.state.items} itemCounts={this.state.itemCounts} deliveryCosts={this.state.deliveryCosts} justMerchandise={true}/> </a></li>
|
||||
<li onClick={this._onClick} style={{borderTop: 'solid lightgray 1px', borderBottom: 'solid lightgray 1px', paddingBottom: 2}}><a href="#" style={{ paddingRight: '5px', backgroundColor: 'transparent' }}><CartTotal items={this.state.items} itemCounts={this.state.itemCounts}/> </a></li>
|
||||
<li onClick={this._onClick} style={{borderTop: 'solid lightgray 1px', borderBottom: 'solid lightgray 1px', borderRight: 'solid lightgray 1px'}}>
|
||||
<a style={{marginBottom: 10, marginRight: 10}} className="mybutton" href="#">Završi narudžbu</a></li>
|
||||
|
||||
@@ -38,7 +38,7 @@ var CartIcon = React.createClass({
|
||||
|
||||
<ul className="nav navbar-nav navbar-right hidden-lg">
|
||||
<li onClick={this._onClick} style={{borderTop: 'solid lightgray 1px', borderBottom: 'solid lightgray 1px', borderLeft: 'solid lightgray 1px', paddingBottom: 22}}><a ><div className="mycart"><span>{normalizeCount(this.state.count)}</span></div></a></li>
|
||||
<li onClick={this._onClick} style={{borderTop: 'solid lightgray 1px', borderBottom: 'solid lightgray 1px',borderRight: 'solid lightgray 1px', paddingBottom: 2}}><a href="#" style={{ paddingRight: '5px', backgroundColor: 'transparent'}}><CartTotal items={this.state.items} itemCounts={this.state.itemCounts} deliveryCosts={this.state.deliveryCosts} justMerchandise={true}/> </a></li>
|
||||
<li onClick={this._onClick} style={{borderTop: 'solid lightgray 1px', borderBottom: 'solid lightgray 1px',borderRight: 'solid lightgray 1px', paddingBottom: 2}}><a href="#" style={{ paddingRight: '5px', backgroundColor: 'transparent'}}><CartTotal items={this.state.items} itemCounts={this.state.itemCounts} /> </a></li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -40,12 +40,17 @@ var CartPage = React.createClass({
|
||||
|
||||
var cartTotal = (
|
||||
<div>
|
||||
|
||||
<div className="row cart-total">
|
||||
<div className="col-lg-6">Ukupno</div>
|
||||
<div className="col-lg-6">
|
||||
<CartTotal items={this.state.items} itemCounts={this.state.itemCounts} deliveryCosts={this.state.deliveryCosts}/>
|
||||
<div className="col-lg-6">Roba:<br />Dostava:<br />Ukupno:</div>
|
||||
<div className="col-lg-6 text-right">
|
||||
|
||||
<CartTotal items={this.state.items} itemCounts={this.state.itemCounts} /><br />
|
||||
<CartTotal deliveryCosts={this.state.deliveryCosts}/><br />
|
||||
<CartTotal items={this.state.items} itemCounts={this.state.itemCounts} deliveryCosts={this.state.deliveryCosts}/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="row">
|
||||
<div className="col-lg-12 pull-left">
|
||||
<button className="mybutton" onClick={this._onOrderClick}>Završi narudžbu</button>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
var React = require('react'),
|
||||
Globals = require('../../globals');
|
||||
;
|
||||
Globals = require('../../globals');;
|
||||
|
||||
var Router = require('react-router');
|
||||
|
||||
@@ -8,29 +7,30 @@ var Router = require('react-router');
|
||||
|
||||
var CartTotal = React.createClass({
|
||||
|
||||
render: function() {
|
||||
render: function() {
|
||||
var counts = this.props.itemCounts;
|
||||
|
||||
var total = 0;
|
||||
|
||||
if (counts && this.props.items) {
|
||||
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)
|
||||
};
|
||||
}
|
||||
if (this.props.deliveryCosts) {
|
||||
total += Number(this.props.deliveryCosts.get('delivery_price'))
|
||||
}
|
||||
|
||||
|
||||
var counts = this.props.itemCounts;
|
||||
var total = 0;
|
||||
|
||||
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 ( <span>{Globals.FormatCurrency(total)}</span>);
|
||||
|
||||
return ( < span > {
|
||||
Globals.FormatCurrency(total)
|
||||
} < /span>);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
module.exports = CartTotal;
|
||||
module.exports = CartTotal;
|
||||
@@ -81,7 +81,9 @@ var CheckoutPage = React.createClass({
|
||||
<div className="form-group">
|
||||
<label className="col-md-4 control-label" htmlFor="order"></label>
|
||||
<div className="col-md-8">
|
||||
<div>Ukupno: <CartTotal items={this.state.items} itemCounts={this.state.itemCounts} deliveryCosts={this.state.deliveryCosts} /> </div>
|
||||
<div> Roba: <CartTotal items={this.state.items} itemCounts={this.state.itemCounts} /><br />
|
||||
Dostava: <CartTotal deliveryCosts={this.state.deliveryCosts} /><br />
|
||||
Ukupno: <CartTotal items={this.state.items} itemCounts={this.state.itemCounts} deliveryCosts={this.state.deliveryCosts} /></div>
|
||||
<div><button id="order" name="order" className="mybutton" disabled={!this.state.isDeliveryDestinationValid} onClick={this._onOrderClick}>Završi narudžbu</button></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -99,6 +101,8 @@ var CheckoutPage = React.createClass({
|
||||
<p className="lead">
|
||||
{address}
|
||||
<br />
|
||||
Roba: <CartTotal items={this.state.items} itemCounts={this.state.itemCounts} /><br />
|
||||
Dostava: <CartTotal deliveryCosts={this.state.deliveryCosts} /><br />
|
||||
Ukupno: <CartTotal items={this.state.items} itemCounts={this.state.itemCounts} deliveryCosts={this.state.deliveryCosts} />
|
||||
|
||||
</p>
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user