Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
<span class="main_menu" id="main_menu menu_name" >
|
||||
<%if @menu.present? %>
|
||||
<%=menu[0].name%>
|
||||
<%=@menus[0].name%>
|
||||
<% end%>
|
||||
</span>
|
||||
</a>
|
||||
@@ -650,11 +650,58 @@
|
||||
$(document).on('click', '.menu_click', function(event){
|
||||
var menu_id = $(this).attr("data-id");
|
||||
var name = $(this).attr("data-name");
|
||||
var url = "get_menu/"+menu_id;
|
||||
show_menu_cat_list(name, url);
|
||||
var menus = JSON.parse(localStorage.getItem("menus"));
|
||||
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
|
||||
|
||||
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
|
||||
function show_menu_cat_list(name, url_item){
|
||||
var menu_list = $('.menu_items_list');
|
||||
@@ -663,15 +710,18 @@
|
||||
var menu_cat = $('.category_list');
|
||||
menu_cat.empty();
|
||||
|
||||
$(".main_menu").text(name)
|
||||
if (modify_order=="true" && type =="true") {
|
||||
$(".main_menu").text(name);
|
||||
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;
|
||||
}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
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -679,10 +729,8 @@
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
|
||||
for(var i in data) {
|
||||
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 +'">'
|
||||
+' <div class="card-block custom-card-block">'
|
||||
+' <p>'+ data[i].name +'<p>'
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<div class="container-fluid">
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<div class="block-header">
|
||||
<!-- <h2><%= t :dashboard %></h2> -->
|
||||
<h2><%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></h2>
|
||||
@@ -208,23 +211,32 @@
|
||||
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
||||
<script>
|
||||
$(function() {
|
||||
$( "#loading_wrapper").show();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: 'get_all_menu',
|
||||
data: {},
|
||||
success:function(result){
|
||||
localStorage.setItem("menus", JSON.stringify(result));
|
||||
|
||||
var menu = localStorage.getItem("menus");
|
||||
|
||||
if (menu != null ) {
|
||||
$( "#loading_wrapper").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(".cashier_view").on('click', function() {
|
||||
window.location.href = '/origami';
|
||||
});
|
||||
|
||||
$(".qs_view").on('click', function() {
|
||||
if ($('#server_mode').val() != "cloud") {
|
||||
if ($('#server_mode').val() != "cloud") {
|
||||
document.getElementById('second_view').click();
|
||||
}
|
||||
}
|
||||
window.location.href = '/origami/quick_service';
|
||||
});
|
||||
|
||||
|
||||
@@ -1010,7 +1010,13 @@
|
||||
|
||||
$('#add_order').on('click', function () {
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
|
||||
var menus = JSON.parse(localStorage.getItem("menus"));
|
||||
// if (menus != null) {
|
||||
// console.log("menu");
|
||||
// menu_cache_append(menus);
|
||||
// }else{
|
||||
// $("#menu_data").removeClass("hidden");
|
||||
// }
|
||||
window.location.href = '/origami/addorders/' + dining_id;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user