added instant delivery to gui / added RUC as abbr tag and details tag on mobile

This commit is contained in:
Senad Uka
2015-08-02 18:47:48 +02:00
parent 68b25bf491
commit 69f6c86aee
4 changed files with 66 additions and 36 deletions

View File

@@ -46,8 +46,8 @@ var CartPage = React.createClass({
<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}/>
<CartTotal deliveryCosts={this.state.deliveryCosts} instantDelivery={this.state.deliveryDestination.get('instant_delivery')}/><br />
<CartTotal items={this.state.items} itemCounts={this.state.itemCounts} deliveryCosts={this.state.deliveryCosts} instantDelivery={this.state.deliveryDestination.get('instant_delivery')}/>
</div>
</div>
@@ -60,6 +60,12 @@ var CartPage = React.createClass({
</div>
);
var instantDelivery = (<div className="text-center">
<input type="checkbox"
checked={this.state.deliveryDestination.get('instant_delivery')} onChange={this._onInstantDeliveryChange}/>
{" Hitna dostava (ako naručite toku radnog dana do 16h) ili ujutru (ako naručite poslije 16h)"}
</div>);
var buySomethingMessage = (<div></div>);
var content;
@@ -91,6 +97,7 @@ var CartPage = React.createClass({
</tbody>
</table>
{buySomethingMessage}
{instantDelivery}
{cartTotal}
</div>)
}
@@ -133,9 +140,7 @@ var CartPage = React.createClass({
{i.get('name')}
</p>
</td>
<td className="cart-price-bigger text-center">{ Globals.FormatCurrency(price) }
<div className="cart-commision-tiny text-center">{ Globals.FormatPercentage(commission) } RUC</div>
<td className="cart-price-bigger text-center"> <abbr title={ Globals.FormatPercentage(commission) + " RUC"}>{ Globals.FormatCurrency(price) } </abbr>
</td>
<td >
<select style={{textAlign: 'center'}} value={count} className="form-control"
@@ -179,9 +184,12 @@ var CartPage = React.createClass({
{i.get('name')}
</p>
<p>
<details>
<summary>
{ Globals.FormatCurrency(price) }
</summary>
<div className="cart-commision-tiny text-left">{ Globals.FormatPercentage(commission) } RUC</div>
</details>
</p>
</td>
<td className="col-sm-2 col-xs-2 col-md-2">
@@ -223,6 +231,10 @@ var CartPage = React.createClass({
}
},
_onInstantDeliveryChange: function () {
CartActions.changeDeliveryDestinationProperty("instant_delivery", !this.state.deliveryDestination.get('instant_delivery'));
},
_onOrderClick: function () {
NavigationActions.goToCheckout();
},

View File

@@ -9,11 +9,11 @@ var CartTotal = React.createClass({
render: function() {
var counts = this.props.itemCounts;
var total = 0;
if (counts && this.props.items) {
var items = this.props.items.models;
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');
@@ -22,7 +22,11 @@ var CartTotal = React.createClass({
};
}
if (this.props.deliveryCosts) {
total += Number(this.props.deliveryCosts.get('delivery_price'))
if (this.props.instantDelivery) {
total += Number(this.props.deliveryCosts.get('instant_delivery_price'))
} else {
total += Number(this.props.deliveryCosts.get('delivery_price'))
}
}
return ( < span > {

View File

@@ -6,16 +6,15 @@ var FREE_SHIPPING_LIMIT = 50;
var Place = Backbone.Model.extend({
initialize: function(options) {
options || (options = {});
this.postalCode = options.postalCode;
initialize: function(options) {
options || (options = {});
this.postalCode = options.postalCode;
},
url: function() {
var postalCode = this.postalCode || "00000";
return Globals.ApiUrl + '/place/' + postalCode.trim();
}
url: function() {
var postalCode = this.postalCode || "00000";
return Globals.ApiUrl + '/place/' + postalCode.trim();
}
});

File diff suppressed because one or more lines are too long