Merge branch 'foodcourt' of gitlab.com:code2lab/SXRestaurant into foodcourt
This commit is contained in:
@@ -204,7 +204,7 @@ class HomeController < ApplicationController
|
||||
shift = ShiftSale.current_open_shift(employee)
|
||||
if food_court
|
||||
if !shift.nil?
|
||||
redirect_to foodcourt_food_court_path
|
||||
redirect_to foodcourt_food_court_path(:anchor => "")
|
||||
else
|
||||
redirect_to new_foodcourt_shift_path
|
||||
end
|
||||
|
||||
@@ -408,58 +408,16 @@
|
||||
<script>
|
||||
var cashier_type = $('#cashier_type').val();
|
||||
//get menu item cache
|
||||
function getAllMenu(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/foodcourt/get_all_menu',
|
||||
data: {},
|
||||
success:function(result){
|
||||
localStorage.setItem("menus", JSON.stringify(result));
|
||||
var menu = localStorage.getItem("menus");
|
||||
if (menu != null ) {
|
||||
$( "#loading_wrapper").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
getAllMenu();
|
||||
|
||||
if (window.location.href.indexOf('#') != -1) {
|
||||
getAllMenu();
|
||||
}
|
||||
|
||||
var menus = JSON.parse(localStorage.getItem("menus"));
|
||||
if (menus != null) {
|
||||
menu_cache_append(menus);
|
||||
}else{
|
||||
$("#menu_data").removeClass("hidden");
|
||||
}
|
||||
|
||||
function menu_cache_append(menus){
|
||||
$("#menu_cache").removeClass("hidden");
|
||||
$(".menu_cache_name").text(menus[0]["name"])
|
||||
for(var i in menus) {
|
||||
menu_list_template(menus[i]);
|
||||
}
|
||||
var category = menus[0]["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(cashier_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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(".tables").on('click', function () {
|
||||
@@ -501,37 +459,45 @@ $(document).ready(function () {
|
||||
});
|
||||
//End menu category Click
|
||||
|
||||
function menu_click_cache_append(name,menus,menu_id) {
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
function getAllMenu(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/foodcourt/get_all_menu',
|
||||
data: {},
|
||||
success:function(result){
|
||||
var menus = JSON.stringify(result);
|
||||
localStorage.setItem("menus", menus);
|
||||
if (result != null ) {
|
||||
menu_cache_append(result);
|
||||
$( "#loading_wrapper").hide();
|
||||
$("#oqs_loading_wrapper").css("display", "none");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var menu_cat = $('.category_list');
|
||||
menu_cat.empty();
|
||||
function menu_cache_append(menus){
|
||||
$("#menu_cache").removeClass("hidden");
|
||||
$(".menu_cache_name").text(menus[0]["name"])
|
||||
for(var i in menus) {
|
||||
menu_list_template(menus[i]);
|
||||
}
|
||||
var category = menus[0]["categories"];
|
||||
|
||||
$(".main_menu").text(name);
|
||||
|
||||
for(var i in menus) {
|
||||
|
||||
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(cashier_type){
|
||||
for(var ii in category) {
|
||||
if (category[ii]["is_available"]== true){
|
||||
if (category[ii]["valid_time"]== true){
|
||||
if (category[ii]["parent_id"] == null ){
|
||||
if(cashier_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{
|
||||
if ($("#table_get_current").text()) {
|
||||
if (category[ii]["code"].includes("SPL") != true) {
|
||||
category_list_template(category[ii]);
|
||||
}else {
|
||||
category_list_template(category[ii]);
|
||||
}
|
||||
}else {
|
||||
category_list_template(category[ii]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -540,6 +506,46 @@ if (menu_id == menus[i]["id"] && menus[i]["is_active"] == true) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
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(cashier_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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function category_list_template(menu) {
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
data: "opening_balance=" + amount + "&cashier_terminal="+ cashier_terminal,
|
||||
success:function(result){
|
||||
if(result){
|
||||
window.location.href = "<%= foodcourt_food_court_path%>";
|
||||
window.location.href = "<%= foodcourt_food_court_path(:anchor => "") %>";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<ul class="list">
|
||||
<li class="header"><%= t :main_navigation %></li>
|
||||
<li class="active">
|
||||
<a href="<%= foodcourt_food_court_path %>">
|
||||
<a href="<%= foodcourt_food_court_path(:anchor => "") %>">
|
||||
<i class="material-icons">monetization_on</i>
|
||||
<span><%= t :origami %></span>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user