From 2b595ba2122a11ccee2a4679b556096105f7efac Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 21 Nov 2017 16:49:23 +0630 Subject: [PATCH 1/3] update addorder for not have instance in item --- app/assets/javascripts/addorder.js | 153 +++++++++++++++-------------- 1 file changed, 80 insertions(+), 73 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 8db28bd9..4b546105 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -22,9 +22,7 @@ $(function() { product = data; for(var field in product) { - console.log(product[field].name); if (product[field].unit_price > 0) { - console.log("hi"); qty = 1; options = []; item_attributes = []; @@ -97,86 +95,95 @@ $(function() { var menu_items_list = $('.menu_items_list'); menu_items_list.empty(); menu_items = data.menu_items; + console.log(menu_items); for(var field in menu_items) { if (menu_items[field].is_sub_item == false) { instances = menu_items[field].instances ; - qty = 1; - options = []; - - if (JSON.stringify(menu_items[field].item_sets)!='[]') { - fa_plus = ''; - add = ''; - menu_item_box = 'set_item_box'; - data_target = 'sx_item_set_detailModal'; - - code = menu_items[field].code; - name = menu_items[field].name; - price = 0;//parseFloat( menu_items[field].price).toFixed(2); - is_available = menu_items[field].is_available ; - is_on_promotion = 0; - item_attributes = menu_items[field].attributes; - promotion_price = menu_items[field].promotion_price; - }else{ - fa_plus = 'material-icons'; - add = 'add' - menu_item_box = 'menu_item_box'; - data_target = 'sx_item_detailModal'; - - $(instances).each(function(i){ - if (instances[i].is_default === true) { - code = instances[i].code; - name = instances[i].name; - price = parseFloat(instances[i].price).toFixed(2); - is_available = instances[i].is_available ; - is_on_promotion = instances[i].is_on_promotion; - item_attributes = instances[i].values; - promotion_price = instances[i].promotion_price; - code = instances[i].code; - } - }); - + + if (!instances.length > 0) { + swal("Hello Please!","doesn't not have instance item in this menu items ("+ menu_items[field].name+")","warning"); } + if (instances.length > 0) { + qty = 1; + options = []; + price = 0; - if (menu_items[field].image) { - image_path = menu_items[field].image; - }else{ - image_path = "/image/logo.png"; - } + if (JSON.stringify(menu_items[field].item_sets)!='[]') { + fa_plus = ''; + add = ''; + menu_item_box = 'set_item_box'; + data_target = 'sx_item_set_detailModal'; - row = '
' - +'
' - +'
'+ menu_items[field].name +'
' - +"
" - +"" - +add+ '' + code = menu_items[field].code; + name = menu_items[field].name; + price = 0;//parseFloat( menu_items[field].price).toFixed(2); + is_available = menu_items[field].is_available ; + is_on_promotion = 0; + item_attributes = menu_items[field].attributes; + promotion_price = menu_items[field].promotion_price; + }else{ + fa_plus = 'material-icons'; + add = 'add' + menu_item_box = 'menu_item_box'; + data_target = 'sx_item_detailModal'; + + $(instances).each(function(i){ + if (instances[i].is_default === true) { + code = instances[i].code; + name = instances[i].name; + price = parseFloat(instances[i].price).toFixed(2); + is_available = instances[i].is_available ; + is_on_promotion = instances[i].is_on_promotion; + item_attributes = instances[i].values; + promotion_price = instances[i].promotion_price; + code = instances[i].code; + } + }); + } + + if (menu_items[field].image) { + image_path = menu_items[field].image; + }else{ + image_path = "/image/logo.png"; + } + + row = '
' + +'
' + +'
'+ menu_items[field].name +'
' + +"
" + +"" + +add+ '' + +'
' + +'
' + + +"
" + + +"
" + +"" + +"
" + + +'' - +'
' - - +"
" - - +"
" - +"" - +"
" - - +'' - +'
'; - $('.menu_items_list').append(row); + +'
'; + $('.menu_items_list').append(row); + } + //end instances in menu-items alest 1 instance } + //end is_sub_item false } } }); From 789cc179d7f0d7092d4e22768bd5f1842a53d7da Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 21 Nov 2017 17:00:20 +0630 Subject: [PATCH 2/3] update addorder adn survey form select for foreigner --- app/assets/javascripts/addorder.js | 4 ++-- app/views/origami/surveys/_form.html.erb | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 4b546105..64003b8b 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -100,9 +100,9 @@ $(function() { for(var field in menu_items) { if (menu_items[field].is_sub_item == false) { instances = menu_items[field].instances ; - + if (!instances.length > 0) { - swal("Hello Please!","doesn't not have instance item in this menu items ("+ menu_items[field].name+")","warning"); + swal("Hello Please Check!","doesn't not have instance item in this menu items ("+ menu_items[field].name+")","warning"); } if (instances.length > 0) { qty = 1; diff --git a/app/views/origami/surveys/_form.html.erb b/app/views/origami/surveys/_form.html.erb index 0a2088ad..321ec745 100755 --- a/app/views/origami/surveys/_form.html.erb +++ b/app/views/origami/surveys/_form.html.erb @@ -16,7 +16,13 @@
- + +
@@ -30,7 +36,6 @@
- @@ -100,7 +105,13 @@ var text_box = '
' +'
' +'
' - +' ' + +' ' +'
' +'
' +'
' From 01bf7caeb5f9394555f159e169678c39065c819d Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 21 Nov 2017 17:21:31 +0630 Subject: [PATCH 3/3] update oragimi view --- app/views/origami/home/show.html.erb | 2 +- app/views/origami/rooms/show.html.erb | 2 +- app/views/settings/dining_charges/_form.html.erb | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 9b129534..fc340d2c 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -187,7 +187,7 @@
"> -
+
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 3285d1bf..aaf7ad58 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -162,7 +162,7 @@
"> -
+
diff --git a/app/views/settings/dining_charges/_form.html.erb b/app/views/settings/dining_charges/_form.html.erb index a64ceb22..30d59290 100755 --- a/app/views/settings/dining_charges/_form.html.erb +++ b/app/views/settings/dining_charges/_form.html.erb @@ -15,7 +15,7 @@ access_time <% if !@dining_charge.minimum_free_time.nil?%> - + <% else %> <% end %> @@ -28,7 +28,7 @@ access_time <% if !@dining_charge.charge_block.nil?%> - + <% else %> <% end %> @@ -43,7 +43,7 @@ access_time <% if !@dining_charge.time_rounding_block.nil?%> - + <% else %> <% end %>