Get configuration from server
This commit is contained in:
@@ -55,7 +55,7 @@ post '/cart/delivery_destination', &update_delivery_destination
|
||||
|
||||
|
||||
def report_to_trello(cart)
|
||||
Thread.new do
|
||||
Thread.new do
|
||||
@cart = cart
|
||||
board = Trello::Board.find(RibicaConfig.TRELLO_BOARD_NAME)
|
||||
list = board.lists.first
|
||||
@@ -69,9 +69,9 @@ def report_to_trello(cart)
|
||||
end
|
||||
|
||||
def send_order_email(cart)
|
||||
Thread.new do
|
||||
Thread.new do
|
||||
client = SendGrid::Client.new(
|
||||
api_user: RibicaConfig.SENDGRID_API_USER,
|
||||
api_user: RibicaConfig.SENDGRID_API_USER,
|
||||
api_key: RibicaConfig.SENDGRID_API_KEY
|
||||
)
|
||||
|
||||
@@ -101,3 +101,12 @@ post '/cart/confirmation' do
|
||||
send_order_email(cart)
|
||||
"OK".to_json
|
||||
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
|
||||
|
||||
@@ -27,6 +27,8 @@ var _deliveryCosts = new Place({
|
||||
|
||||
var _addressColapsed = false;
|
||||
|
||||
var CartConfiguration = require('../models/cartConfiguration');
|
||||
var _cartConfiguration = new CartConfiguration();
|
||||
|
||||
var supportedPlaces = [{
|
||||
"code": "-12",
|
||||
@@ -37,7 +39,7 @@ var supportedPlaces = [{
|
||||
}, {
|
||||
"code": " 71000",
|
||||
"placeLabel": "Sarajevo"
|
||||
},
|
||||
},
|
||||
{
|
||||
"code": " 78000",
|
||||
"placeLabel": "Banja Luka"
|
||||
@@ -50,7 +52,7 @@ var supportedPlaces = [{
|
||||
{
|
||||
"code": " 88000",
|
||||
"placeLabel": "Mostar"
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"code": " 72000",
|
||||
@@ -2569,6 +2571,7 @@ var nameOfThePlace = function(code) {
|
||||
}
|
||||
|
||||
var loadCart = function() {
|
||||
loadCartConfiguration();
|
||||
|
||||
_itemsInCart.fetch({
|
||||
success: function() {
|
||||
@@ -2729,6 +2732,10 @@ var saveDeliveryDestination = function() {
|
||||
})
|
||||
};
|
||||
|
||||
var loadCartConfiguration = function() {
|
||||
_cartConfiguration.fetch();
|
||||
}
|
||||
|
||||
var validateDeliveryDestinationForm = function() {
|
||||
_deliveryDestinationErrors = {};
|
||||
|
||||
@@ -2813,7 +2820,8 @@ var CartStore = _.extend({}, EventEmitter.prototype, {
|
||||
deliveryDestinationErrors: _deliveryDestinationErrors,
|
||||
isDeliveryDestinationValid: isDeliveryDestinationValid(),
|
||||
deliveryCosts: _deliveryCosts,
|
||||
destinationValid: isDeliveryDestinationValid()
|
||||
destinationValid: isDeliveryDestinationValid(),
|
||||
cartConfiguration: _cartConfiguration
|
||||
};
|
||||
return state;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user