update addorder menu
This commit is contained in:
@@ -67,6 +67,8 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_menu()
|
def get_menu()
|
||||||
|
puts "sssssssssssssss"
|
||||||
|
puts params[:id]
|
||||||
if (params[:id])
|
if (params[:id])
|
||||||
#Pull this menu
|
#Pull this menu
|
||||||
@menu = Menu.find_by_id(params[:id])
|
@menu = Menu.find_by_id(params[:id])
|
||||||
|
|||||||
@@ -650,11 +650,58 @@
|
|||||||
$(document).on('click', '.menu_click', function(event){
|
$(document).on('click', '.menu_click', function(event){
|
||||||
var menu_id = $(this).attr("data-id");
|
var menu_id = $(this).attr("data-id");
|
||||||
var name = $(this).attr("data-name");
|
var name = $(this).attr("data-name");
|
||||||
var url = "get_menu/"+menu_id;
|
var menus = JSON.parse(localStorage.getItem("menus"));
|
||||||
show_menu_cat_list(name, url);
|
if (menus != null) {
|
||||||
|
menu_click_cache_append(name,menus,menu_id);
|
||||||
|
}else{
|
||||||
|
var url = "get_menu/"+menu_id;
|
||||||
|
show_menu_cat_list(name, url);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
//End menu category Click
|
//End menu category Click
|
||||||
|
|
||||||
|
function menu_click_cache_append(name,menus,menu_id) {
|
||||||
|
var menu_list = $('.menu_items_list');
|
||||||
|
menu_list.empty();
|
||||||
|
|
||||||
|
var menu_cat = $('.category_list');
|
||||||
|
menu_cat.empty();
|
||||||
|
|
||||||
|
$(".main_menu").text(name);
|
||||||
|
for(var i in menus) {
|
||||||
|
console.log(menus)
|
||||||
|
console.log(menus[i]["id"]);
|
||||||
|
console.log(menus[i]["is_active"]);
|
||||||
|
console.log(menu_id);
|
||||||
|
if (menu_id == menus[i]["id"] && menus[i]["is_active"] == true) {
|
||||||
|
// menu_list_template(menus[i]);
|
||||||
|
var category = menus[i]["categories"];
|
||||||
|
|
||||||
|
for(var ii in category) {
|
||||||
|
if (category[ii]["is_available"]== true){
|
||||||
|
if (category[ii]["valid_time"]== true){
|
||||||
|
if (category[ii]["parent_id"] == null ){
|
||||||
|
if(type){
|
||||||
|
if (category[ii]["code"].includes("SPL") != true) {
|
||||||
|
category_list_template(category[ii]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if ($("#table_get_current").text()) {
|
||||||
|
if (category[ii]["code"].includes("SPL") != true) {
|
||||||
|
category_list_template(category[ii]);
|
||||||
|
}else {
|
||||||
|
category_list_template(category[ii]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//show menu item list when click menu category
|
//show menu item list when click menu category
|
||||||
function show_menu_cat_list(name, url_item){
|
function show_menu_cat_list(name, url_item){
|
||||||
var menu_list = $('.menu_items_list');
|
var menu_list = $('.menu_items_list');
|
||||||
@@ -663,15 +710,18 @@
|
|||||||
var menu_cat = $('.category_list');
|
var menu_cat = $('.category_list');
|
||||||
menu_cat.empty();
|
menu_cat.empty();
|
||||||
|
|
||||||
$(".main_menu").text(name)
|
$(".main_menu").text(name);
|
||||||
if (modify_order=="true" && type =="true") {
|
cashier_type = window.location.href.indexOf("quick_service");
|
||||||
|
modify_order = window.location.href.indexOf("modify_order");
|
||||||
|
if (cashier_type != -1 && modify_order != -1) {
|
||||||
url_item = '../../../addorders/'+url_item;
|
url_item = '../../../addorders/'+url_item;
|
||||||
}if(modify_order=="false" && type =="true"){
|
|
||||||
url_item = 'addorders/'+url_item
|
|
||||||
}else{
|
|
||||||
url_item = url_item;
|
|
||||||
}
|
}
|
||||||
|
if(modify_order == -1 && cashier_type != -1){
|
||||||
|
url_item = 'addorders/'+url_item
|
||||||
|
}
|
||||||
|
if (cashier_type ==-1 && modify_order == -1){
|
||||||
|
url_item = url_item;
|
||||||
|
}
|
||||||
//Start Ajax
|
//Start Ajax
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
@@ -679,10 +729,8 @@
|
|||||||
data: {},
|
data: {},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
|
||||||
for(var i in data) {
|
for(var i in data) {
|
||||||
if (data[i].is_available == true) {
|
if (data[i].is_available == true) {
|
||||||
|
|
||||||
row = '<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="'+ data[i].id +'">'
|
row = '<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="'+ data[i].id +'">'
|
||||||
+' <div class="card-block custom-card-block">'
|
+' <div class="card-block custom-card-block">'
|
||||||
+' <p>'+ data[i].name +'<p>'
|
+' <p>'+ data[i].name +'<p>'
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ class ActionController::Base
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
#check for license file
|
#check for license file
|
||||||
if check_license
|
# if check_license
|
||||||
current_license(ENV["SX_PROVISION_URL"])
|
# current_license(ENV["SX_PROVISION_URL"])
|
||||||
else
|
# else
|
||||||
redirect_to activate_path
|
# redirect_to activate_path
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user