diff --git a/front-ui/app/components/cart/checkoutPage.js b/front-ui/app/components/cart/checkoutPage.js
index 1f1af51..00206f4 100644
--- a/front-ui/app/components/cart/checkoutPage.js
+++ b/front-ui/app/components/cart/checkoutPage.js
@@ -24,7 +24,7 @@ var CheckoutPage = React.createClass({
amount={CartStore.getAmount()}
deliveryCost={CartStore.getDeliveryCost(false)}
disabled={!this.state.isDeliveryDestinationValid}
- cashOnDeliveryDisabled={!this.state.isDeliveryDestinationValid}
+ cashOnDeliveryDisabled={!this.state.isDeliveryDestinationValid || this.state.deliveryDestination.get('gift')}
onCashClick={this._onOrderClick}
/>
@@ -108,7 +108,7 @@ var CheckoutPage = React.createClass({
Roba:
-
+
Dostava:
Ukupno:
diff --git a/front-ui/app/stores/cartStore.js b/front-ui/app/stores/cartStore.js
index 8ecb135..7a5088c 100644
--- a/front-ui/app/stores/cartStore.js
+++ b/front-ui/app/stores/cartStore.js
@@ -2603,9 +2603,8 @@ var collapseAddressIfNeeded = function() {
}
}
-var fetchPlace = function(gift) {
- gift = gift === true;
- postalCode = gift ? _deliveryDestination.get('recipient_place') : _deliveryDestination.get('place')
+var fetchPlace = function() {
+ postalCode = _deliveryDestination.get('gift') ? _deliveryDestination.get('recipient_place') : _deliveryDestination.get('place');
_deliveryCosts = new Place({
postalCode: postalCode
@@ -2697,12 +2696,9 @@ var addNItems = function(item, count) {
var changeDeliveryDestinationProperty = function(property, value) {
_deliveryDestination.set(property, value);
- if (property === 'place') {
+ if (property === 'place' || property === 'recipient_place' || property === 'gift') {
fetchPlace();
}
- if (property === 'recipient_place') {
- fetchPlace(true);
- }
validateDeliveryDestinationForm();
};
@@ -2809,6 +2805,10 @@ var isDeliveryDestinationValid = function() {
return Object.getOwnPropertyNames(_deliveryDestinationErrors).length === 0;
}
+var getDeliveryCostTarget = function() {
+ return _deliveryDestination.get("gift") ? "recipient_place" : "place";
+}
+
// Extend CartStore with EventEmitter to add eventing capabilities
var CartStore = _.extend({}, EventEmitter.prototype, {
@@ -2874,7 +2874,8 @@ var CartStore = _.extend({}, EventEmitter.prototype, {
isDeliveryDestinationValid: isDeliveryDestinationValid(),
deliveryCosts: _deliveryCosts,
destinationValid: isDeliveryDestinationValid(),
- address_colapsed: _addressColapsed
+ address_colapsed: _addressColapsed,
+ deliveryCostsTarget: getDeliveryCostTarget()
};
return state;
},