Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes
This commit is contained in:
@@ -1373,7 +1373,7 @@ $(function() {
|
||||
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
|
||||
fa_plus = '';
|
||||
add = '';
|
||||
menu_item_box = 'add_icon';
|
||||
menu_item_box = 'set_add_icon';
|
||||
data_target = 'sx_item_set_detailModal';
|
||||
data_modal = 'modal'
|
||||
add_icon = "set_item_box"
|
||||
|
||||
@@ -270,4 +270,8 @@ i.logout_icon{
|
||||
|
||||
.border-left{
|
||||
border-left:1px solid #fff;
|
||||
}
|
||||
|
||||
.set_add_icon{
|
||||
display:none;
|
||||
}
|
||||
@@ -67,6 +67,8 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def get_menu()
|
||||
puts "sssssssssssssss"
|
||||
puts params[:id]
|
||||
if (params[:id])
|
||||
#Pull this menu
|
||||
@menu = Menu.find_by_id(params[:id])
|
||||
|
||||
@@ -155,24 +155,28 @@ class Menu < ApplicationRecord
|
||||
|
||||
# Menu Item Attributes
|
||||
item_attrs = []
|
||||
attributes = row["Attributes"].split(',')
|
||||
attributes.each do |attr|
|
||||
attribute = MenuItemAttribute.find_by_name(attr)
|
||||
if attribute.nil?
|
||||
attribute = MenuItemAttribute.create({ attribute_type:"any", name: attr.capitalize, value: attr.downcase })
|
||||
if !row["Attributes"].nil?
|
||||
attributes = row["Attributes"].split(',')
|
||||
attributes.each do |attr|
|
||||
attribute = MenuItemAttribute.find_by_name(attr)
|
||||
if attribute.nil?
|
||||
attribute = MenuItemAttribute.create({ attribute_type:"any", name: attr.capitalize, value: attr.downcase })
|
||||
end
|
||||
item_attrs.push(attribute.id)
|
||||
end
|
||||
item_attrs.push(attribute.id)
|
||||
end
|
||||
|
||||
# Menu Item Options
|
||||
item_opts = []
|
||||
if !row["Options"].nil?
|
||||
options = row["Options"].split(',')
|
||||
options.each do |opt|
|
||||
option = MenuItemOption.find_by_name(opt)
|
||||
if option.nil?
|
||||
option = MenuItemOption.create({ option_type:"any", name: opt.capitalize, value: opt.downcase })
|
||||
options.each do |opt|
|
||||
option = MenuItemOption.find_by_name(opt)
|
||||
if option.nil?
|
||||
option = MenuItemOption.create({ option_type:"any", name: opt.capitalize, value: opt.downcase })
|
||||
end
|
||||
item_opts.push(option.id)
|
||||
end
|
||||
item_opts.push(option.id)
|
||||
end
|
||||
|
||||
menu_itm = MenuItem.find_by_item_code(row["Item Code"])
|
||||
@@ -189,7 +193,11 @@ class Menu < ApplicationRecord
|
||||
|
||||
menu_inst = MenuItemInstance.find_by_item_instance_code(row["Instance Code"])
|
||||
if !menu_inst
|
||||
imported_instance = MenuItemInstance.create(menu_item_id: menu_itm.id, item_instance_code: row["Instance Code"], item_instance_name: row["Instance Name"], item_attributes: [], price: row["Price"], is_on_promotion: false, promotion_price: 0, is_available: true, is_default: row["Is Default"])
|
||||
instance_name = ''
|
||||
if !row["Instance Name"].nil?
|
||||
instance_name = row["Instance Name"]
|
||||
end
|
||||
imported_instance = MenuItemInstance.create(menu_item_id: menu_itm.id, item_instance_code: row["Instance Code"], item_instance_name: instance_name, item_attributes: [], price: row["Price"], is_on_promotion: false, promotion_price: 0, is_available: true, is_default: row["Is Default"])
|
||||
# else
|
||||
# status = status + "Instance Code already exists for " + row["Instance Name"] + "."
|
||||
end
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
|
||||
@@ -59,16 +59,18 @@
|
||||
<% unless @sale_data.blank? %>
|
||||
<% @sale_data.each do |sale| %>
|
||||
<!-- all total qty sum -->
|
||||
<!--
|
||||
|
||||
<% if sale.status_type != "Discount" && sale.status_type != "foc"
|
||||
total_qty += sale.total_item
|
||||
end %>
|
||||
<% if sale.status_type == "foc" && sale.price > 0
|
||||
total_qty += sale.total_item
|
||||
end %>
|
||||
-->
|
||||
<% if sale.status_type == "Discount"
|
||||
total_qty += sale.total_item*(-1)
|
||||
end %>
|
||||
<!-- end all total qty -->
|
||||
<!--
|
||||
|
||||
<% if sale.status_type == "foc" && sale.grand_total < 0
|
||||
total_item_foc += sale.grand_total*(-1)
|
||||
end %>
|
||||
@@ -76,7 +78,7 @@
|
||||
<% if sale.status_type == "Discount" && sale.grand_total < 0
|
||||
total_item_dis += sale.grand_total*(-1)
|
||||
end %>
|
||||
-->
|
||||
|
||||
<% if !acc_arr.include?(sale.account_id) %>
|
||||
<tr>
|
||||
<td><b><%= sale.account_name %></b></td>
|
||||
@@ -103,7 +105,12 @@
|
||||
<% end %>
|
||||
<td><%= sale.item_code rescue '-' %></td>
|
||||
<td><%= sale.product_name rescue '-' %></td>
|
||||
<td><%= sale.total_item rescue '-' %></td>
|
||||
<% if sale.status_type != "Discount" %>
|
||||
<td><%= sale.total_item rescue '-' %></td>
|
||||
<%else%>
|
||||
<td><%= sale.total_item*(-1) rescue '-' %></td>
|
||||
<% end %>
|
||||
|
||||
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
@@ -114,10 +121,12 @@
|
||||
<% count = count + 1 %>
|
||||
<% sub_total += sale.grand_total %>
|
||||
<% #sub_qty += sale.total_item %>
|
||||
<% if sale.status_type!="Discount" && (!sale.product_name.include? "FOC")
|
||||
<% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC")
|
||||
sub_qty += sale.total_item
|
||||
end %>
|
||||
|
||||
<% if sale.status_type =="Discount"
|
||||
sub_qty += sale.total_item*(-1)
|
||||
end %>
|
||||
<% if count == value %>
|
||||
<tr>
|
||||
<td colspan="3"> </td>
|
||||
|
||||
@@ -55,5 +55,5 @@ Rails.application.configure do
|
||||
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||
|
||||
# Set Cable URL
|
||||
config.action_cable.url = "ws://192.168.1.196:3002/cable"
|
||||
# config.action_cable.url = "ws://192.168.1.196:3002/cable"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user