diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js
index 71cf182e..87124f55 100755
--- a/app/assets/javascripts/addorder.js
+++ b/app/assets/javascripts/addorder.js
@@ -2,6 +2,7 @@ $(function() {
var role = $('#role').val();
type = window.location.href.indexOf("quick_service");
modify_order = window.location.href.indexOf("modify_order");
+
//click menu sidebar menu category
$(".product").on("click", function(){
var url = $(this).attr('data-ref');
@@ -101,6 +102,7 @@ $(function() {
$('.sub_category_list').addClass("hidden");
var menu_id = $(this).attr("data-id");
var url = "get_menu_category/"+menu_id;
+ console.log(menu_id);
show_menu_item_list(url,menu_id);
var sub_id = $(this).attr("data-sub-id");
if (sub_id == "true") {
@@ -133,117 +135,6 @@ $(function() {
for(var ii in categories) {
if (categories[ii]["id"] == menu_id) {
var menu_items = categories[ii]["items"];
- // 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 Check!","Does not have instance item in this menu items ("+ menu_items[field].name+")","warning");
- // }
- // if (instances.length > 0) {
- // qty = 1;
- // options = [];
- // price = 0;
-
- // if (JSON.stringify(menu_items[field].item_sets)!='[]') {
- // fa_plus = '';
- // add = '';
- // menu_item_box = 'add_icon';
- // data_target = 'sx_item_set_detailModal';
- // data_modal = 'modal'
- // add_icon = "set_item_box"
- // code = menu_items[field].code;
- // name = menu_items[field].name;
- // instances = menu_items[field].instances;
- // $(instances).each(function(i){
- // if (instances[i].is_default == true) {
- // price = parseFloat(instances[i].price).toFixed(2);
- // }else{
- // price = 0;
- // }
- // });
- // 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 = 'view_list'
- // menu_item_box = 'menu_item_box';
- // data_target = 'sx_item_detailModal';
- // data_modal = ''
- // add_icon = "add_icon"
-
- // $(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) {
- // if (modify_order) {
- // image_path = "../../"+menu_items[field].image;
- // }else{
- // image_path = menu_items[field].image;
- // }
-
- // }else{
- // if (modify_order) {
- // image_path = "../../image/logo.png";
- // }else{
- // image_path = "image/logo.png";
- // }
- // }
-
- // row = '
'
- // +'
'
- // +'
'+ menu_items[field].name +'
'
- // +"'
- // +'
'
- // +"
"
-
- // // +"
"
- // // +"

"
- // // +"
"
-
- // +''
- // +'
';
- // $('.menu_items_list').append(row);
- // }
- // //end instances in menu-items alest 1 instance
- // }
- // //end is_sub_item false
- // }
show_menu_list(menu_items);
}
}
@@ -272,118 +163,7 @@ $(function() {
var menu_items_list = $('.menu_items_list');
menu_items_list.empty();
menu_items = data.menu_items;
-show_menu_list(menu_items);
- // 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 Check!","Does not have instance item in this menu items ("+ menu_items[field].name+")","warning");
- // }
- // if (instances.length > 0) {
- // qty = 1;
- // options = [];
- // price = 0;
-
- // if (JSON.stringify(menu_items[field].item_sets)!='[]') {
- // fa_plus = '';
- // add = '';
- // menu_item_box = 'add_icon';
- // data_target = 'sx_item_set_detailModal';
- // data_modal = 'modal'
- // add_icon = "set_item_box"
- // code = menu_items[field].code;
- // name = menu_items[field].name;
- // instances = menu_items[field].instances;
- // $(instances).each(function(i){
- // if (instances[i].is_default == true) {
- // price = parseFloat(instances[i].price).toFixed(2);
- // }else{
- // price = 0;
- // }
- // });
- // 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 = 'view_list'
- // menu_item_box = 'menu_item_box';
- // data_target = 'sx_item_detailModal';
- // data_modal = ''
- // add_icon = "add_icon"
-
- // $(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) {
- // if (modify_order) {
- // image_path = "../../"+menu_items[field].image;
- // }else{
- // image_path = menu_items[field].image;
- // }
-
- // }else{
- // if (modify_order) {
- // image_path = "../../image/logo.png";
- // }else{
- // image_path = "image/logo.png";
- // }
- // }
-
- // row = '
'
- // +'
'
- // +'
'+ menu_items[field].name +'
'
- // +"'
- // +'
'
- // +"
"
-
- // // +"
"
- // // +"

"
- // // +"
"
-
- // +''
- // +'
';
- // $('.menu_items_list').append(row);
- // }
- // //end instances in menu-items alest 1 instance
- // }
- // //end is_sub_item false
- // }
+ show_menu_list(menu_items);
}
});
//end Ajax
@@ -1376,7 +1156,6 @@ show_menu_list(menu_items);
$(".keypress_qty").on('keyup change', function (){
// $('.keypress_qty').keyup(function(e){
-
id = $(this).attr('id');
value = $(this).val();
@@ -1429,11 +1208,7 @@ show_menu_list(menu_items);
for(var j in menus) {
var categories = menus[j]["categories"];
for(var ii in categories) {
- if (menu_id == categories[ii]["parent_id"]) {
- console.log("parrrrrrrrrrrrrrrrr");
- console.log(categories[ii]["parent_id"]);
- console.log(menu_id);
-
+ if (menu_id == categories[ii]["parent_id"]) {
$(sub_category).removeClass('hidden');
row = '' ;
$(sub_category).append(row);
diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb
index fd298fb3..e4e17328 100755
--- a/app/controllers/origami/addorders_controller.rb
+++ b/app/controllers/origami/addorders_controller.rb
@@ -18,14 +18,17 @@ class Origami::AddordersController < BaseOrigamiController
if check_mobile
@webview = true
end
-
- # if params[:menus].present?
- # @menus = JSON.parse(params[:menus], object_class: OpenStruct)
- # @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
- # else
- @menus = Menu.all
- @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
- # end
+puts params[:menu]
+puts "sssssssssssssssssssssssssss"
+ if params[:menus].present?
+ @menus = JSON.parse(params[:menus], object_class: OpenStruct)
+ @menu = JSON.parse(params[:category], object_class: OpenStruct)
+ puts @menus.to_json
+ puts @menu.to_json
+ else
+ @menus = Menu.all
+ @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
+ end
@table_id = params[:id]
@table = DiningFacility.find(@table_id)
diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb
index 43ab6db0..46847924 100644
--- a/app/views/origami/addorders/detail.html.erb
+++ b/app/views/origami/addorders/detail.html.erb
@@ -5,29 +5,16 @@
<% type = request.path_info.include?('quick_service')%>
<% modify_order = request.path_info.include?('modify_order')%>
-