change UI set menu and add lateset order no in receipt bill for QuickService

This commit is contained in:
phyusin
2018-09-06 15:15:28 +06:30
parent 6af0c40456
commit e450927d81
9 changed files with 468 additions and 432 deletions

View File

@@ -64,7 +64,17 @@ $(document).ready(function() {
$('#modal-set-slimscroll').slimScroll({ $('#modal-set-slimscroll').slimScroll({
height: height-$('#modal-set-slimscroll').attr('data-height'), height: height-$('#modal-set-slimscroll').attr('data-height'),
size: '5px', size: '10px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 45
});
$('#set-menu-item-slimscroll').slimScroll({
height: height-$('#set-menu-item-slimscroll').attr('data-height'),
size: '10px',
color: 'rgba(0,0,0,0.5)', color: 'rgba(0,0,0,0.5)',
alwaysVisible: false, alwaysVisible: false,
borderRadius: '0', borderRadius: '0',

View File

@@ -91,7 +91,7 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount) filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount,nil)
result = { result = {
:filepath => filename, :filepath => filename,
@@ -111,6 +111,7 @@ class Origami::PaymentsController < BaseOrigamiController
type = params[:type] type = params[:type]
tax_type = params[:tax_type] tax_type = params[:tax_type]
path = request.fullpath path = request.fullpath
latest_order_no = nil
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
@@ -204,6 +205,11 @@ class Origami::PaymentsController < BaseOrigamiController
table_id = 0 table_id = 0
end end
latest_order = booking.booking_orders.order("order_id DESC").limit(1).first()
if !latest_order.nil?
latest_order_no = latest_order.order_id
end
booking.booking_orders.each do |order| booking.booking_orders.each do |order|
# Order.pay_process_order_queue(order.order_id, table_id) # Order.pay_process_order_queue(order.order_id, table_id)
oqs = OrderQueueStation.new oqs = OrderQueueStation.new
@@ -237,7 +243,7 @@ class Origami::PaymentsController < BaseOrigamiController
other_amount = SaleItem.calculate_other_charges(sale_items) other_amount = SaleItem.calculate_other_charges(sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data,other_amount) filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data,other_amount,latest_order_no)
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name}) render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
@@ -442,11 +448,17 @@ class Origami::PaymentsController < BaseOrigamiController
def reprint def reprint
sale_id = params[:sale_id] sale_id = params[:sale_id]
member_info = nil member_info = nil
latest_order_no = nil
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
# For Cashier by Zone # For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'") bookings = Booking.where("sale_id='#{sale_id}'")
booking = Booking.find_by_sale_id(sale_id)
latest_order = booking.booking_orders.joins(" JOIN orders ON orders.order_id = booking_orders.order_id").where("orders.source = 'quick_service'").order("order_id DESC").limit(1).first()
if !latest_order.nil?
latest_order_no = latest_order.order_id
end
# if bookings.count > 1 # if bookings.count > 1
# # for Multiple Booking # # for Multiple Booking
# table = DiningFacility.find(bookings[0].dining_facility_id) # table = DiningFacility.find(bookings[0].dining_facility_id)
@@ -514,7 +526,7 @@ class Origami::PaymentsController < BaseOrigamiController
other_amount = SaleItem.calculate_other_charges(saleObj.sale_items) other_amount = SaleItem.calculate_other_charges(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Re-print",current_balance,card_data,other_amount) filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Re-print",current_balance,card_data,other_amount,latest_order_no)
result = { result = {
:status => true, :status => true,
@@ -600,7 +612,7 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "FOC",nil,nil,other_amount) filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "FOC",nil,nil,other_amount,nil)
result = { result = {
:status => true, :status => true,
:filepath => filename, :filepath => filename,

View File

@@ -126,7 +126,7 @@ class Origami::VoidController < BaseOrigamiController
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items) discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
other_amount = SaleItem.calculate_other_charges(sale.sale_items) other_amount = SaleItem.calculate_other_charges(sale.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount) filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount,nil)
result = { result = {
:filepath => filename, :filepath => filename,
:printer_model => print_settings.brand_name, :printer_model => print_settings.brand_name,

View File

@@ -107,7 +107,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items) discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
other_amount = SaleItem.calculate_other_charges(sale.sale_items) other_amount = SaleItem.calculate_other_charges(sale.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, remark,current_balance,nil,other_amount) filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, remark,current_balance,nil,other_amount,nil)
result = { result = {
:filepath => filename, :filepath => filename,
:printer_model => print_settings.brand_name, :printer_model => print_settings.brand_name,

View File

@@ -363,7 +363,7 @@ class Transactions::SalesController < ApplicationController
other_amount = SaleItem.calculate_other_charges(sale.sale_items) #other charges other_amount = SaleItem.calculate_other_charges(sale.sale_items) #other charges
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount) filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount,nil)
result = { result = {
:filepath => filename, :filepath => filename,
:printer_model => print_settings.brand_name, :printer_model => print_settings.brand_name,

View File

@@ -188,19 +188,19 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end end
#Bill Receipt Print #Bill Receipt Print
def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data,other_amount) def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data,other_amount,latest_order_no)
#Use CUPS service #Use CUPS service
#Generate PDF #Generate PDF
#Print #Print
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount) pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no)
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
if !receipt_bill_a5_pdf.empty? if !receipt_bill_a5_pdf.empty?
receipt_bill_a5_pdf.each do |receipt_bilA5| receipt_bill_a5_pdf.each do |receipt_bilA5|
if receipt_bilA5[0] == 'ReceiptBillA5Pdf' if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
if receipt_bilA5[1] == '1' if receipt_bilA5[1] == '1'
pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount) pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no)
else else
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount) pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no)
end end
end end
end end

View File

@@ -2,7 +2,7 @@ class ReceiptBillA5Pdf < Prawn::Document
include ActionView::Helpers::NumberHelper include ActionView::Helpers::NumberHelper
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount) def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount,latest_order_no)
self.page_width = printer_settings.page_width self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height self.page_height = printer_settings.page_height
self.header_font_size = printer_settings.header_font_size.to_i self.header_font_size = printer_settings.header_font_size.to_i
@@ -56,7 +56,7 @@ class ReceiptBillA5Pdf < Prawn::Document
stroke_horizontal_rule stroke_horizontal_rule
cashier_info(sale_data, customer_name) cashier_info(sale_data, customer_name, latest_order_no)
line_items(sale_items,printer_settings.precision,delimiter) line_items(sale_items,printer_settings.precision,delimiter)
all_total(sale_data,printer_settings.precision,delimiter) all_total(sale_data,printer_settings.precision,delimiter)
@@ -112,7 +112,7 @@ class ReceiptBillA5Pdf < Prawn::Document
stroke_horizontal_rule stroke_horizontal_rule
end end
def cashier_info(sale_data, customer_name) def cashier_info(sale_data, customer_name, latest_order_no)
move_down line_move move_down line_move
# move_down 2 # move_down 2
y_position = cursor y_position = cursor
@@ -160,6 +160,14 @@ class ReceiptBillA5Pdf < Prawn::Document
# :size => self.item_font_size,:align => :right # :size => self.item_font_size,:align => :right
# end # end
if !latest_order_no.nil?
y_position = cursor
move_down line_move
bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
text "OrderNo : #{ latest_order_no }",:size => self.item_font_size,:align => :left
end
end
move_down line_move move_down line_move
stroke_horizontal_rule stroke_horizontal_rule
end end

View File

@@ -3,7 +3,7 @@ class ReceiptBillPdf < Prawn::Document
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount) def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount,latest_order_no)
self.page_width = printer_settings.page_width self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height self.page_height = printer_settings.page_height
self.header_font_size = printer_settings.header_font_size.to_i self.header_font_size = printer_settings.header_font_size.to_i
@@ -57,7 +57,7 @@ class ReceiptBillPdf < Prawn::Document
stroke_horizontal_rule stroke_horizontal_rule
cashier_info(sale_data, customer_name) cashier_info(sale_data, customer_name, latest_order_no)
line_items(sale_items,printer_settings.precision,delimiter) line_items(sale_items,printer_settings.precision,delimiter)
all_total(sale_data,printer_settings.precision,delimiter) all_total(sale_data,printer_settings.precision,delimiter)
@@ -112,7 +112,7 @@ class ReceiptBillPdf < Prawn::Document
stroke_horizontal_rule stroke_horizontal_rule
end end
def cashier_info(sale_data, customer_name) def cashier_info(sale_data, customer_name, latest_order_no)
move_down line_move move_down line_move
# move_down 2 # move_down 2
@@ -153,7 +153,13 @@ class ReceiptBillPdf < Prawn::Document
# - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') })" , # - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') })" ,
# :size => self.item_font_size,:align => :right # :size => self.item_font_size,:align => :right
# end # end
if !latest_order_no.nil?
y_position = cursor
move_down line_move
bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
text "OrderNo : #{ latest_order_no }",:size => self.item_font_size,:align => :left
end
end
move_down line_move move_down line_move
stroke_horizontal_rule stroke_horizontal_rule
end end

View File

@@ -14,141 +14,141 @@
<input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>"> <input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>">
<div class="row m-t--20"> <div class="row m-t--20">
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_data"> <div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_data">
<li class="list-menu"> <li class="list-menu">
<a href="javascript:void(0);" class="menu-toggle dropdown-toggle toggled my-toggle " style=""> <a href="javascript:void(0);" class="menu-toggle dropdown-toggle toggled my-toggle " style="">
<span class="main_menu" id="main_menu menu_name" > <span class="main_menu" id="main_menu menu_name" >
<%if @menu.present? %> <%if @menu.present? %>
<%=@menus[0].name%> <%=@menus[0].name%>
<% end%> <% end%>
</span> </span>
</a>
<ul class="ml-menu menu_list aria-hidden " style="border-top: 1px solid #fff">
<% @menus.each do |menu| %>
<li class="nav-item menu_click" data-name="<%=menu.name%>" data-id="<%=menu.id%>" style="">
<a class="nav-link" data-toggle="tab" href="" role="tab" style="text-transform: lowercase;"><%=menu.name%></a>
</li>
<%end%>
</ul>
</li>
<div id="menu1-slimscroll" data-height="0">
<ul class="nav nav-tabs flex-column category_list" role="tablist" id="ul-navbar">
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
</li>
<% @menu.each do |menu| %>
<% if !menu.valid_time.nil? %>
<% if menu.menu_category_id.nil? %>
<!--if type quick_service or cashier for table -->
<% if type %>
<% if !menu.code.include? "SPL" %>
<li class="nav-item">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
</a> </a>
<ul class="ml-menu menu_list aria-hidden " style="border-top: 1px solid #fff"> <ul class="sub_category_list hidden fadeInTop animated" id="sub_category_list">
<% @menus.each do |menu| %>
<li class="nav-item menu_click" data-name="<%=menu.name%>" data-id="<%=menu.id%>" style="">
<a class="nav-link" data-toggle="tab" href="" role="tab" style="text-transform: lowercase;"><%=menu.name%></a>
</li>
<%end%>
</ul> </ul>
</li> </li>
<div id="menu1-slimscroll" data-height="0"> <% end%>
<ul class="nav nav-tabs flex-column category_list" role="tablist" id="ul-navbar"> <!-- else quick_service or cashier for table -->
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>"> <% else %>
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a> <% if @table.get_current_checkout_booking.nil? %>
</li> <% if !menu.code.include? "SPL" %>
<% @menu.each do |menu| %> <li class="nav-item ">
<% if !menu.valid_time.nil? %> <p class="hidden menu-id"><%= menu.id %></p>
<% if menu.menu_category_id.nil? %> <a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
<!--if type quick_service or cashier for table --> </a>
<% if type %> <ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
<% if !menu.code.include? "SPL" %> </ul>
<li class="nav-item"> </li>
<p class="hidden menu-id"><%= menu.id %></p> <% end%>
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%> <% else %>
</a> <li class="nav-item ">
<ul class="sub_category_list hidden fadeInTop animated" id="sub_category_list"> <p class="hidden menu-id"><%= menu.id %></p>
</ul> <a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
</li> </a>
<% end%> <ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
<!-- else quick_service or cashier for table --> </ul>
<% else %> </li>
<% if @table.get_current_checkout_booking.nil? %> <% end%>
<% if !menu.code.include? "SPL" %> <!-- end quick_service or cashier for table -->
<li class="nav-item "> <% end %>
<p class="hidden menu-id"><%= menu.id %></p> <% end%>
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%> <% end %>
</a> <%end %>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list"> </ul>
</ul> </div>
</li> </div>
<% end%>
<% else %>
<li class="nav-item "> <div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_cache">
<p class="hidden menu-id"><%= menu.id %></p> <li class="list-menu">
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%> <a href="javascript:void(0);" class="menu-toggle dropdown-toggle toggled my-toggle " style="">
</a> <span class="main_menu menu_cache_name" id="main_menu menu_cache_name"></span>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list"> </a>
</ul> <ul class="ml-menu menu_list aria-hidden menu_cache_list" style="border-top: 1px solid #fff">
</li> </ul>
</li>
<div id="menu-slimscroll" data-height="0">
<ul class="nav nav-tabs flex-column category_list category_cache_list" role="tablist" id="ul-navbar">
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
</li>
</ul>
</div>
</div>
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10" >
<div class="card">
<div class="card-block" style="">
<div class="card-text" id="custom-slimscroll">
<div class="row menu_items_list" style="margin:0px 1px 0px 1px ;">
<!-- append data -->
<% @menu.each do |menu| %>
<% if !menu.valid_time.nil? %>
<% if menu.menu_category_id.nil? %>
<!--if type quick_service or cashier for table -->
<% if type %>
<% if !menu.code.include? "SPL" %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%>
<!-- else quick_service or cashier for table -->
<% else %>
<% if @table.get_current_checkout_booking.nil? %>
<% if !menu.code.include? "SPL" %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%>
<% else %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%> <% end%>
<!-- end quick_service or cashier for table --> <!-- end quick_service or cashier for table -->
<% end %>
<% end%>
<% end %>
<%end %>
</ul>
</div>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_cache">
<li class="list-menu">
<a href="javascript:void(0);" class="menu-toggle dropdown-toggle toggled my-toggle " style="">
<span class="main_menu menu_cache_name" id="main_menu menu_cache_name"></span>
</a>
<ul class="ml-menu menu_list aria-hidden menu_cache_list" style="border-top: 1px solid #fff">
</ul>
</li>
<div id="menu-slimscroll" data-height="0">
<ul class="nav nav-tabs flex-column category_list category_cache_list" role="tablist" id="ul-navbar">
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
</li>
</ul>
</div>
</div>
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10" >
<div class="card">
<div class="card-block" style="">
<div class="card-text" id="custom-slimscroll">
<div class="row menu_items_list" style="margin:0px 1px 0px 1px ;">
<!-- append data -->
<% @menu.each do |menu| %>
<% if !menu.valid_time.nil? %>
<% if menu.menu_category_id.nil? %>
<!--if type quick_service or cashier for table -->
<% if type %>
<% if !menu.code.include? "SPL" %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%>
<!-- else quick_service or cashier for table -->
<% else %>
<% if @table.get_current_checkout_booking.nil? %>
<% if !menu.code.include? "SPL" %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%>
<% else %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%>
<!-- end quick_service or cashier for table -->
<% end %>
<% end%>
<% end %> <% end %>
<%end %> <% end%>
<% end %>
<%end %>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10"> <div class="col-md-3 col-lg-3 col-sm-3 m-t-10">
<% if type && modify_order%> <% if type && modify_order%>
<button type="button" class="btn btn-lg btn-default waves-effect col-md-4" id='back'> <button type="button" class="btn btn-lg btn-default waves-effect col-md-4" id='back'>
@@ -179,45 +179,45 @@
<br> <br>
<div class="card-header" style="padding: 0.12rem 0.25rem"> <div class="card-header" style="padding: 0.12rem 0.25rem">
<% if type %> <% if type %>
<div class="row clearfix"> <div class="row clearfix">
<div class="col-md-6 col-lg-6 col-sm-12"> <div class="col-md-6 col-lg-6 col-sm-12">
<strong id="order-title" class="font-13">ORDER DETAILS </strong> <strong id="order-title" class="font-13">ORDER DETAILS </strong>
</div> </div>
<% if modify_order %> <% if modify_order %>
<% if @table.nil? %> <% if @table.nil? %>
<div class="col-md-3 col-lg-3 col-sm-3">Table : </div>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"></p>
<p class="hidden" id="table_get_current"></p>
<% else%>
<div class="col-md-3 col-lg-3 col-sm-3">Table : <%=@table.name%></div>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"><%=@table.type%></p>
<p class="hidden" id="table_get_current"><%=@table.get_current_checkout_booking%></p>
<% end%>
<p class="hidden" id="booking_id"><%=@booking_id%></p> <div class="col-md-3 col-lg-3 col-sm-3">Table : </div>
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : '---'%></p> <p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="sale_id"><%=@sale_id%></p> <p class="hidden" id="table_type"></p>
<p class="hidden" id="table_get_current"></p>
<% else%>
<div class="col-md-1 col-lg-1 col-sm-1"> <div class="col-md-3 col-lg-3 col-sm-3">Table : <%=@table.name%></div>
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear <p class="hidden" id="table_id"><%=@table_id%></p>
</button> <p class="hidden" id="table_type"><%=@table.type%></p>
</div> <p class="hidden" id="table_get_current"><%=@table.get_current_checkout_booking%></p>
<% else%> <% end%>
<p class="hidden" id="table_type"></p>
<div class="col-md-2 col-lg-2 col-sm-2">
</div> <p class="hidden" id="booking_id"><%=@booking_id%></p>
<div class="col-md-3 col-lg-3 col-sm-3"> <p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : '---'%></p>
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear <p class="hidden" id="sale_id"><%=@sale_id%></p>
</button>
</div> <div class="col-md-1 col-lg-1 col-sm-1">
<% end%> <button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear
</div> </button>
</div>
<% else%>
<p class="hidden" id="table_type"></p>
<div class="col-md-2 col-lg-2 col-sm-2">
</div>
<div class="col-md-3 col-lg-3 col-sm-3">
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear
</button>
</div>
<% end%>
</div>
<% else %> <% else %>
<div class="row "> <div class="row ">
<div class="col-md-9 col-lg-9 col-sm-9 "> <div class="col-md-9 col-lg-9 col-sm-9 ">
@@ -228,7 +228,7 @@
<p class="hidden" id="table_type"><%=@table.type%></p> <p class="hidden" id="table_type"><%=@table.type%></p>
<p class="hidden" id="booking_id"><%=@booking_id%></p> <p class="hidden" id="booking_id"><%=@booking_id%></p>
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p> <p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p>
<p class="hidden" id="table_get_current"><%=@table.get_current_checkout_booking%></p> <p class="hidden" id="table_get_current"><%=@table.get_current_checkout_booking%></p>
</div> </div>
<div class="col-md-3 col-lg-3 col-sm-3"> <div class="col-md-3 col-lg-3 col-sm-3">
<button type="button" class="btn btn-xs btn-danger waves-effect" id='clear_all'>Clear <button type="button" class="btn btn-xs btn-danger waves-effect" id='clear_all'>Clear
@@ -311,7 +311,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="row bottom p-l-15 p-r-15 m-t-10"> <div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 cashier_number border-top border-left" data-value="1" data-type="num">1</div> <div class="col-md-3 cashier_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 cashier_number border-top border-left" data-value="2" data-type="num">2</div> <div class="col-md-3 cashier_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 cashier_number border-top border-left" data-value="3" data-type="num">3</div> <div class="col-md-3 cashier_number border-top border-left" data-value="3" data-type="num">3</div>
@@ -327,7 +327,7 @@
<div class="col-md-3 cashier_number border-top border-left" data-value="9" data-type="num">9</div> <div class="col-md-3 cashier_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 cashier_number border-top border-left" data-value="0" data-type="num">0</div> <div class="col-md-3 cashier_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 cashier_number border-top border-left" data-value="00" data-type="num">00</div> <div class="col-md-3 cashier_number border-top border-left" data-value="00" data-type="num">00</div>
<div class="col-md-3 cashier_number border-top border-left bg-orange" data-type="clr">Clr</div> <div class="col-md-3 cashier_number border-top border-left bg-orange" data-type="clr">Clr</div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@@ -413,164 +413,164 @@
<!-- Large modal --> <!-- Large modal -->
<div class=" modal sx_item_set_detailModal" id="sx_item_set_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" > <div class="modal sx_item_set_detailModal" id="sx_item_set_detailModal" tabindex="-1" role="dialog" aria-labelledby="sx_item_set_detailLabel" aria-hidden="true" >
<div class="modal-dialog custom-modal-dialog modal-lg"> <div class="modal-dialog custom-modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;"> <div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;">
<h4 class="modal-title" style="color:#fff;" id="set_name"></h4> <h4 class="modal-title" style="color:#fff;" id="set_name"></h4>
<!-- <button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">&times;</button> --> <button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">&times;</button>
<div class="row">
<div class="col-md-4">
<button type="button" class="btn btn-default" data-dismiss="modal" id="close">Close</button>
</div>
<div class="col-md-6">
<button type="button" class="btn btn-primary set_order" data-dismiss="modal" id="set_order">Add to Order</button>
</div>
</div>
</div> </div>
<div class="modal-body"> <div class="modal-body" id="set-menu-item-slimscroll" data-height="50">
<div class="row set-item"> <div class="row set-item">
<div class="col-md-4"> <div class="col-md-4">
<p class="set_default_option" style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p> <p class="set_default_option" style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
<!-- <div class="form-group"> <!-- <div class="form-group">
<label class="col-md-6" style="margin-top:5px">Quantity</label> <label class="col-md-6" style="margin-top:5px">Quantity</label>
<input type="number" name="qty" class="form-control col-md-5 input-number change_qty" id="set_change_qty" value="" min="1" max="100"> <input type="number" name="qty" class="form-control col-md-5 input-number change_qty" id="set_change_qty" value="" min="1" max="100">
</div> --> </div> -->
<div class="input-group"> <div class="input-group">
<span class="input-group-btn"> <span class="input-group-btn">
<button type="button" class="btn btn-danger btn-number" value="-" id="set_minus"> <button type="button" class="btn btn-danger btn-number" value="-" id="set_minus">
<i class="material-icons">remove</i> <i class="material-icons">remove</i>
</button> </button>
</span> </span>
<input type="text" value="1" id="set_count" class="set_change_qty keypress_qty form-control col-md-12 "> <input type="text" value="1" id="set_count" class="set_change_qty keypress_qty form-control col-md-12 ">
<span class="input-group-btn"> <span class="input-group-btn">
<button type="button" class="btn btn-success btn-number" value="+" id="set_plus"> <button type="button" class="btn btn-success btn-number" value="+" id="set_plus">
<i class="material-icons">add</i> <i class="material-icons">add</i>
</button> </button>
</span> </span>
</div>
<p class="hidden" id="set_unit_price"></p>
<p class="hidden" id="set_instance_code"></p>
<p class="hidden" id="set_instance_name"></p>
<p class="hidden" id="set_promotion_price"></p>
<p class="hidden" id="set_item_instances"></p>
<p class="hidden" id="set_item_code"></p>
<p></p>
<div class="" id="modal-slimscroll" data-height="100">
<div class="options-list" style="margin-top:-5px">
</div>
<div class='selected-set-list'>
</div>
</div>
</div>
<div class="col-md-8">
<div class="instance-list row"></div>
</div>
</div>
</div>
<div class="modal-footer">
<div class="mr-auto">
<h4 class=" pull-left">Total : <span id="set_total_price"></span></h4>
</div> </div>
<p class="hidden" id="set_unit_price"></p>
<p class="hidden" id="set_instance_code"></p>
<p class="hidden" id="set_instance_name"></p>
<p class="hidden" id="set_promotion_price"></p>
<p class="hidden" id="set_item_instances"></p>
<p class="hidden" id="set_item_code"></p>
<p></p>
<div class="" id="modal-set-slimscroll" data-height="100">
<div class="options-list" style="margin-top:-5px">
</div>
<div class='selected-set-list'>
</div>
</div>
</div> </div>
<div class="col-md-8">
<div class="instance-list row"></div>
</div>
</div>
</div>
<div class="modal-footer">
<div class="mr-auto">
<h4 class=" pull-left">Total : <span id="set_total_price"></span></h4>
</div>
<div class="row">
<div class="col-md-4">
<button type="button" class="btn btn-default" data-dismiss="modal" id="close">Close</button>
</div>
<div class="col-md-6">
<button type="button" class="btn btn-primary set_order" data-dismiss="modal" id="set_order">Add to Order</button>
</div> </div>
</div> </div>
</div> </div>
</div>
<% if type && !modify_order%> </div>
<div class="modal fade" id="TableModal" tabindex="-1" role="dialog"> </div>
<div class="modal-dialog" role="document"> <% if type && !modify_order%>
<div class="modal-content"> <div class="modal fade" id="TableModal" tabindex="-1" role="dialog">
<div class="modal-header" style="margin-top: -1rem;"> <div class="modal-dialog" role="document">
<!-- <h4 class="modal-title" id="TableModalLabel">Select Table</h4> --> <div class="modal-content">
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;">&times;</button> <div class="modal-header" style="margin-top: -1rem;">
</div> <!-- <h4 class="modal-title" id="TableModalLabel">Select Table</h4> -->
<div class="modal-body" style="margin-top: -0.75rem;padding-top:5px"> <button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;">&times;</button>
<%@zone.each do |zone| %> </div>
<h5>Zone : <%=zone.name%></h5> <div class="modal-body" style="margin-top: -0.75rem;padding-top:5px">
<div class="card-columns" style="column-count: 7;"> <%@zone.each do |zone| %>
<%zone.tables.each do |table| %> <h5>Zone : <%=zone.name%></h5>
<% if table.status == 'occupied' %> <div class="card-columns" style="column-count: 7;">
<%zone.tables.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %> <% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %> <% if table.get_checkout_booking.nil? %>
<% color="red"%> <% color="red"%>
<% else %> <% else %>
<% color="orange"%> <% color="orange"%>
<% end %> <% end %>
<% else %> <% else %>
<% if table.get_checkout_booking.nil? %> <% if table.get_checkout_booking.nil? %>
<% color="blue"%> <% color="blue"%>
<% else %> <% else %>
<% color="orange"%> <% color="orange"%>
<% end %> <% end %>
<% end %> <% end %>
<% else %>
<% color="green"%>
<% end %>
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
<div class="card-block">
<%= table.name %>
</div>
</div>
<%end%>
<%zone.rooms.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<% color="red"%>
<% else %>
<% color="orange"%>
<% end %>
<% else %>
<% if table.get_checkout_booking.nil? %>
<% color="blue"%>
<% else %>
<% color="orange"%>
<% end %>
<% end %>
<% else %> <% else %>
<% color="green"%> <% color="green"%>
<% end %> <% end %>
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>"> <div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
<div class="card-block"> <div class="card-block">
<%= table.name %> <%= table.name %>
</div> </div>
</div> </div>
<%end%>
<%zone.rooms.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<% color="red"%>
<% else %>
<% color="orange"%>
<% end %>
<% else %>
<% if table.get_checkout_booking.nil? %>
<% color="blue"%>
<% else %>
<% color="orange"%>
<% end %>
<% end %>
<% else %>
<% color="green"%>
<% end %>
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
<div class="card-block">
<%= table.name %>
</div>
</div>
<%end%>
</div>
<%end%> <%end%>
</div> <div class="modal-footer p-r-30">
<%end%> <button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
<div class="modal-footer p-r-30"> &nbsp; &nbsp;
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button> <button type="button" class="btn btn-link bg-blue waves-effect confirm_table" data-dismiss="modal">Confirm</button>
&nbsp; &nbsp; </div>
<button type="button" class="btn btn-link bg-blue waves-effect confirm_table" data-dismiss="modal">Confirm</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<% end %>
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
</div> </div>
<% end %> <style type="text/css">
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode"> .fadeInRight{
</div> -webkit-animation-duration: 350ms !important;
<style type="text/css"> }
.fadeInRight{ </style>
-webkit-animation-duration: 350ms !important;
}
</style>
<script> <script>
var cashier_type = $('#cashier_type').val(); var cashier_type = $('#cashier_type').val();
jQuery(function(){ jQuery(function(){
var menus = JSON.parse(localStorage.getItem("menus")); var menus = JSON.parse(localStorage.getItem("menus"));
if (menus != null) { if (menus != null) {
var id = menus[0]["categories"][0]["id"]; var id = menus[0]["categories"][0]["id"];
// console.log(id); // console.log(id);
}else{ }else{
var id = 1; var id = 1;
@@ -578,93 +578,93 @@
jQuery('.first_'+id).click(); jQuery('.first_'+id).click();
}); });
$(document).ready(function () { $(document).ready(function () {
var menus = JSON.parse(localStorage.getItem("menus")); var menus = JSON.parse(localStorage.getItem("menus"));
if (menus != null) { if (menus != null) {
menu_cache_append(menus); menu_cache_append(menus);
}else{ }else{
$("#menu_data").removeClass("hidden"); $("#menu_data").removeClass("hidden");
} }
function menu_cache_append(menus){ function menu_cache_append(menus){
$("#menu_cache").removeClass("hidden"); $("#menu_cache").removeClass("hidden");
$(".menu_cache_name").text(menus[0]["name"]) $(".menu_cache_name").text(menus[0]["name"])
for(var i in menus) { for(var i in menus) {
menu_list_template(menus[i]); menu_list_template(menus[i]);
} }
var category = menus[0]["categories"]; var category = menus[0]["categories"];
for(var ii in category) { for(var ii in category) {
if (category[ii]["is_available"]== true){ if (category[ii]["is_available"]== true){
if (category[ii]["valid_time"]== true){ if (category[ii]["valid_time"]== true){
if (category[ii]["parent_id"] == null ){ if (category[ii]["parent_id"] == null ){
if(cashier_type){ if(cashier_type){
if (category[ii]["code"].includes("SPL") != true) { if (category[ii]["code"].includes("SPL") != true) {
category_list_template(category[ii]); category_list_template(category[ii]);
} }
}else{ }else{
if ($("#table_get_current").text()) { if ($("#table_get_current").text()) {
if (category[ii]["code"].includes("SPL") != true) { if (category[ii]["code"].includes("SPL") != true) {
category_list_template(category[ii]); category_list_template(category[ii]);
}else { }else {
category_list_template(category[ii]); category_list_template(category[ii]);
}
}
}
} }
} }
} }
} }
} }
}
}
}
$(".tables").on('click', function () { $(".tables").on('click', function () {
$('.tables').css('background-color',''); $('.tables').css('background-color','');
$('.tables').removeClass('purple') $('.tables').removeClass('purple')
var dining_id = $(this).attr("data-id"); var dining_id = $(this).attr("data-id");
var name = $(this).attr("data-name"); var name = $(this).attr("data-name");
var type = $(this).attr("data-type"); var type = $(this).attr("data-type");
$(this).css('background-color','purple'); $(this).css('background-color','purple');
$(this).addClass('purple') $(this).addClass('purple')
$('.confirm_table').attr("data-id",dining_id) $('.confirm_table').attr("data-id",dining_id)
$('.confirm_table').attr("data-name",name) $('.confirm_table').attr("data-name",name)
$('.confirm_table').attr("data-type",type) $('.confirm_table').attr("data-type",type)
}); });
$(".confirm_table").on('click', function () { $(".confirm_table").on('click', function () {
var dining_id = $(this).attr("data-id"); var dining_id = $(this).attr("data-id");
var name = $(this).attr("data-name"); var name = $(this).attr("data-name");
var type = $(this).attr("data-type"); var type = $(this).attr("data-type");
$('#table_id').val(dining_id); $('#table_id').val(dining_id);
$('#table_type').text(type); $('#table_type').text(type);
$('.select_table').text(name); $('.select_table').text(name);
}); });
$('#pending_order').on('click', function () { $('#pending_order').on('click', function () {
window.location.href = '/origami/quick_service/pending_order'; window.location.href = '/origami/quick_service/pending_order';
}); });
$(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 menus = JSON.parse(localStorage.getItem("menus")); var menus = JSON.parse(localStorage.getItem("menus"));
if (menus != null) { if (menus != null) {
menu_click_cache_append(name,menus,menu_id); menu_click_cache_append(name,menus,menu_id);
}else{ }else{
var url = "get_menu/"+menu_id; var url = "get_menu/"+menu_id;
show_menu_cat_list(name, url); show_menu_cat_list(name, url);
} }
}); });
//End menu category Click //End menu category Click
function menu_click_cache_append(name,menus,menu_id) { function menu_click_cache_append(name,menus,menu_id) {
var menu_list = $('.menu_items_list'); var menu_list = $('.menu_items_list');
menu_list.empty(); menu_list.empty();
var menu_cat = $('.category_list'); var menu_cat = $('.category_list');
menu_cat.empty(); menu_cat.empty();
$(".main_menu").text(name); $(".main_menu").text(name);
// row = ' <li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">' // row = ' <li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">'
// +'<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>' // +'<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>'
@@ -674,7 +674,7 @@
for(var i in menus) { for(var i in menus) {
if (menu_id == menus[i]["id"] && menus[i]["is_active"] == true) { if (menu_id == menus[i]["id"] && menus[i]["is_active"] == true) {
// menu_list_template(menus[i]); // menu_list_template(menus[i]);
var category = menus[i]["categories"]; var category = menus[i]["categories"];
@@ -699,33 +699,33 @@
} }
} }
} }
}
} }
} }
}
function category_list_template(menu) { function category_list_template(menu) {
row = '<li class="nav-item">' row = '<li class="nav-item">'
+'<p class="hidden menu-id">'+menu.id+'</p> ' +'<p class="hidden menu-id">'+menu.id+'</p> '
+'<a class="nav-link menu_category sub_click first_'+menu.id+'" ' +'<a class="nav-link menu_category sub_click first_'+menu.id+'" '
+'data-toggle="tab" href="" role="tab" data-id="'+menu.id+'" ' +'data-toggle="tab" href="" role="tab" data-id="'+menu.id+'" '
+'data-sub-id="'+menu.sub_category+'">'+menu.name+'' +'data-sub-id="'+menu.sub_category+'">'+menu.name+''
+'</a>' +'</a>'
+'<ul class="sub_category_list hidden fadeInTop animated" ' +'<ul class="sub_category_list hidden fadeInTop animated" '
+'id="sub_category_list">' +'id="sub_category_list">'
+'</ul>' +'</ul>'
+' </li>';
$(".category_cache_list").append(row);
}
function menu_list_template(menu) { +' </li>';
row = '<li class="nav-item menu_click" data-name="'+menu.name+'" ' $(".category_cache_list").append(row);
+' data-id="'+menu.id+'" style="">' }
+' <a class="nav-link" data-toggle="tab" href="" role="tab"'
+' style="text-transform: lowercase;">'+menu.name+'</a>' function menu_list_template(menu) {
+'</li>'; row = '<li class="nav-item menu_click" data-name="'+menu.name+'" '
$(".menu_cache_list").append(row); +' data-id="'+menu.id+'" style="">'
} +' <a class="nav-link" data-toggle="tab" href="" role="tab"'
+' style="text-transform: lowercase;">'+menu.name+'</a>'
+'</li>';
$(".menu_cache_list").append(row);
}
//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){
@@ -741,12 +741,12 @@
if (cashier_type != -1 && modify_order != -1) { if (cashier_type != -1 && modify_order != -1) {
url_item = '../../../addorders/'+url_item; url_item = '../../../addorders/'+url_item;
} }
if(modify_order == -1 && cashier_type != -1){ if(modify_order == -1 && cashier_type != -1){
url_item = 'addorders/'+url_item url_item = 'addorders/'+url_item
} }
if (cashier_type ==-1 && modify_order == -1){ if (cashier_type ==-1 && modify_order == -1){
url_item = url_item; url_item = url_item;
} }
//Start Ajax //Start Ajax
$.ajax({ $.ajax({
type: "GET", type: "GET",
@@ -796,10 +796,10 @@
switch (input_type) { switch (input_type) {
case 'num': case 'num':
var input_value = $(this).attr("data-value"); var input_value = $(this).attr("data-value");
if (original_value == "0"){ if (original_value == "0"){
$('#modal-qty').val(input_value); $('#modal-qty').val(input_value);
$('#modal-qty').attr('data-value',input_value); $('#modal-qty').attr('data-value',input_value);
// update_total_amount(); // update_total_amount();
}else{ }else{
$('#modal-qty').val(original_qty + input_value); $('#modal-qty').val(original_qty + input_value);
@@ -807,28 +807,28 @@
// update_total_amount(); // update_total_amount();
} }
break; break;
case 'add': case 'add':
case 'del' : case 'del' :
case 'clr': case 'clr':
$('#modal-qty').val(1); $('#modal-qty').val(1);
$('#modal-qty').attr('data-value',0); $('#modal-qty').attr('data-value',0);
// update_total_amount(); // update_total_amount();
break; break;
}
event.handled = true;
} else {
return false;
}
});
/* check webview loaded*/ }
var webview = ''; event.handled = true;
<%if @webview %> } else {
var webview = <%= @webview %>; return false;
showHideNavbar(webview); }
<% end %> });
});
</script> /* check webview loaded*/
var webview = '';
<%if @webview %>
var webview = <%= @webview %>;
showHideNavbar(webview);
<% end %>
});
</script>