Get configuration from server

This commit is contained in:
adam.harbas@a-net.ba
2016-01-06 08:40:27 +01:00
parent 2b51dfcdec
commit ecd4d79ff2
2 changed files with 23 additions and 6 deletions

View File

@@ -101,3 +101,12 @@ post '/cart/confirmation' do
send_order_email(cart) send_order_email(cart)
"OK".to_json "OK".to_json
end end
get '/cart/configuration' do
configuration = {}
configuration['bam_to_euro_rate'] = Helper::get_bam_to_euro_conversion_rate
configuration['root_address'] = RibicaConfig::ROOT_ADDRESS
configuration.to_json
end

View File

@@ -27,6 +27,8 @@ var _deliveryCosts = new Place({
var _addressColapsed = false; var _addressColapsed = false;
var CartConfiguration = require('../models/cartConfiguration');
var _cartConfiguration = new CartConfiguration();
var supportedPlaces = [{ var supportedPlaces = [{
"code": "-12", "code": "-12",
@@ -2569,6 +2571,7 @@ var nameOfThePlace = function(code) {
} }
var loadCart = function() { var loadCart = function() {
loadCartConfiguration();
_itemsInCart.fetch({ _itemsInCart.fetch({
success: function() { success: function() {
@@ -2729,6 +2732,10 @@ var saveDeliveryDestination = function() {
}) })
}; };
var loadCartConfiguration = function() {
_cartConfiguration.fetch();
}
var validateDeliveryDestinationForm = function() { var validateDeliveryDestinationForm = function() {
_deliveryDestinationErrors = {}; _deliveryDestinationErrors = {};
@@ -2813,7 +2820,8 @@ var CartStore = _.extend({}, EventEmitter.prototype, {
deliveryDestinationErrors: _deliveryDestinationErrors, deliveryDestinationErrors: _deliveryDestinationErrors,
isDeliveryDestinationValid: isDeliveryDestinationValid(), isDeliveryDestinationValid: isDeliveryDestinationValid(),
deliveryCosts: _deliveryCosts, deliveryCosts: _deliveryCosts,
destinationValid: isDeliveryDestinationValid() destinationValid: isDeliveryDestinationValid(),
cartConfiguration: _cartConfiguration
}; };
return state; return state;
}, },