add pending order
This commit is contained in:
@@ -1014,7 +1014,8 @@ $(function() {
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
if (type == "quick_service" || type=="food_court") {
|
||||
window.location.href = "/origami/"+type;
|
||||
module_name = window.location.href.includes('foodcourt') ? 'foodcourt' : 'origami'
|
||||
window.location.href = "/"+module_name+"/"+type;
|
||||
}else{
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id;
|
||||
@@ -1093,7 +1094,13 @@ $(function() {
|
||||
});
|
||||
|
||||
}else if(result.data == 'OK'){
|
||||
window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text();
|
||||
if (window.location.pathname.includes('foodcourt')) {
|
||||
order_id = $('#order_id').val()
|
||||
window.location.href = '/foodcourt/food_court/'+order_id+'/request_bill'
|
||||
}
|
||||
else {
|
||||
window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text();
|
||||
}
|
||||
}else{
|
||||
if(result.current_user_role == 'cashier'){
|
||||
window.location.href = "/foodcourt/sale/"+result.data["sale_id"]+"/"+type+"/payment";
|
||||
@@ -1601,20 +1608,22 @@ $(function() {
|
||||
image_path = menu_items[field].image;
|
||||
}
|
||||
if (out_of_stock === true) {
|
||||
oos_item = out_of_stock_item
|
||||
oos_item = '<div class="card custom-card testimonial-card fadeInRight" id="'+ code +'" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;pointer-events: none;opacity: 0.4;">'
|
||||
oos_header = '<div class="head'+code+'" style="position: absolute;z-index: 5;top: 0;left: 0;right: 0;text-align: center;background: #fb483a;margin: auto;color: #fff;padding: 8px;font-weight: bolder;">OUT OF STOCK</div>'
|
||||
// oos_item = out_of_stock_item
|
||||
oos_item = '<div class="card custom-card testimonial-card fadeInRight imageOBJ" id="'+ code +'" style="pointer-events: none; height: 100%;">'
|
||||
oos_header = '<div class="head-'+code+'" style="position: absolute;z-index: 5;bottom: 0;left: 0;right: 0;text-align: center;background: #fb483a;margin: auto;color: #fff;padding: 8px;font-weight: bolder;">OUT OF STOCK</div>'
|
||||
opacity = 0.5
|
||||
}else{
|
||||
oos_item = '<div class="card custom-card testimonial-card fadeInRight" id="'+ code +'" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
|
||||
oos_item = '<div class="card custom-card testimonial-card fadeInRight" id="'+ code +'" style="height: 100%;">'
|
||||
oos_header = ''
|
||||
opacity = ''
|
||||
}
|
||||
row = '<div class="col-md-6 col-sm-6 col-lg-3">'
|
||||
row = '<div class="col-md-6 col-sm-6 col-lg-3 m-t-2">'
|
||||
+ oos_item + oos_header
|
||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" >'
|
||||
+'<div class="custom-card-head card-head row" style="margin:0px; height: auto; font-size: 0.9em;" >'
|
||||
+'<div class="col-md-10 " style="padding:0px !important;">'+ menu_items[field].name +'</div>'
|
||||
|
||||
+'</div>'
|
||||
+"<div class='"+add_icon+" p-t-65 p-b-65 m-r-' "
|
||||
+"<div class='"+add_icon+"' "
|
||||
+" data-item-code='"+ menu_items[field].code +"' "
|
||||
+" data-name='"+ menu_items[field].name +"' "
|
||||
+" data-qty = '"+ qty +"' "
|
||||
@@ -1630,8 +1639,9 @@ $(function() {
|
||||
+" data-target='."+data_target+"' "
|
||||
+" data-item-sets = '"+JSON.stringify(menu_items[field].item_sets)+""
|
||||
+" 'data-instances = '"+JSON.stringify(menu_items[field].instances)+"'>"
|
||||
+ '<img src = "../../'+image_path+'" class="img-fluid" />'
|
||||
+'</div>'
|
||||
+'<div class="card-footer custom-card-footer custom-flex-footer" style="opacity:0.7">'
|
||||
+'<div class="card-footer custom-card-footer custom-flex-footer">'
|
||||
+'<span style="font-weight:900;flex-grow:1;">'+ price +'</span>'
|
||||
+ "<div class='offset-4 col-2 "+menu_item_box
|
||||
+ "' data-item-code='" + menu_items[field].code
|
||||
@@ -1654,15 +1664,15 @@ $(function() {
|
||||
}else{
|
||||
if (out_of_stock === true) {
|
||||
// oos_item = out_of_stock_item
|
||||
oos_item = '<div class="card custom-card testimonial-card fadeInRight" id="'+ code +'" style="height:100%; pointer-events: none;opacity: 0.4;">'
|
||||
oos_header = '<div class="head'+code+'" style="position: absolute;z-index: 5;top: 0;left: 0;right: 0;text-align: center;background: #fb483a;margin: auto;color: #fff;padding: 8px;font-weight: bolder;">OUT OF STOCK</div>'
|
||||
oos_item = '<div class="card custom-card testimonial-card fadeInRight" id="'+ code +'" style="height:100%; pointer-events: none;">'
|
||||
oos_header = '<div class="head'+code+'" style="position: absolute;z-index: 5;bottom: 0;left: 0;right: 0;text-align: center;background: #fb483a;margin: auto;color: #fff;padding: 8px;font-weight: bolder;">OUT OF STOCK</div>'
|
||||
}else{
|
||||
oos_item = '<div class="card custom-card testimonial-card fadeInRight" id="'+ code +'" style="height:100%;">'
|
||||
oos_header = ''
|
||||
}
|
||||
row = '<div class="col-md-6 col-sm-6 col-lg-3 mt-1">'
|
||||
row = '<div class="col-md-6 col-sm-6 col-lg-3 m-t-2">'
|
||||
+ oos_item + oos_header
|
||||
+'<div class="custom-card-no-img-head card-head '+add_icon+' " id="oos'+ code +'" style="margin:0px;display:flex;!important "'
|
||||
+'<div class="custom-card-no-img-head card-head h-100 '+add_icon+' " id="oos'+ code +'" style="margin:0px;display:flex;!important "'
|
||||
+" data-item-code='"+ menu_items[field].code +"' "
|
||||
+" data-name='" + menu_items[field].name +"' "
|
||||
+" data-qty = '"+ qty +"' "
|
||||
|
||||
@@ -311,7 +311,7 @@ i.logout_icon{
|
||||
text-align:center;
|
||||
font-weight:900;
|
||||
color:#fff;
|
||||
font-size:1.5em;
|
||||
font-size:1.2em;
|
||||
margin:auto;
|
||||
}
|
||||
.custom-card-no-img-head{
|
||||
|
||||
@@ -54,9 +54,6 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
||||
end
|
||||
end
|
||||
def app_orders
|
||||
# @pending_orders = Sale.pending_order('food_court')
|
||||
# @completed = Sale.completed_sale('food_court')
|
||||
|
||||
if !params[:booking_id].nil? && !params[:booking_id].blank?
|
||||
@booking = Booking.select("orders.*,bookings.*,customers.*")
|
||||
.joins("JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
|
||||
@@ -67,10 +64,203 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
||||
@booking_id =@booking.booking_id
|
||||
@order_id =@booking.order_id
|
||||
@sale_data = Sale.find_by_sale_id(@booking.sale_id)
|
||||
|
||||
elsif params[:pending_id]
|
||||
id = params[:pending_id]
|
||||
if id.include? "SAL"
|
||||
@pending = Sale.includes(:sale_items).find_by(sale_id: id)
|
||||
if @pending.sale_status == "new"
|
||||
@status = "sale"
|
||||
end
|
||||
elsif id.include? "BKI"
|
||||
@pending = Booking.includes(:order_items).find_by(booking_id: id)
|
||||
@status = "order"
|
||||
end
|
||||
end
|
||||
@current_shift = ShiftSale.current_shift
|
||||
status = ['completed', 'void']
|
||||
|
||||
@pending_sales = Sale.where('shift_sale_id = ? AND sale_status NOT IN (?)', @current_shift.id, status)
|
||||
@pending_completed = Sale.where('shift_sale_id = ? AND sale_status IN (?)', @current_shift.id, status)
|
||||
@pending_orders = Sale.pending_order('food_court')
|
||||
|
||||
@completed, @bookings = Sale.get_foodcourt_current_shift_orders
|
||||
end
|
||||
|
||||
def modify_order
|
||||
@cashier_type = "food_court"
|
||||
today = DateTime.now
|
||||
day = Date.today.wday
|
||||
|
||||
@menus = []
|
||||
@menu = []
|
||||
|
||||
if params[:id].include? "BKI"
|
||||
@table_id = nil
|
||||
@table = nil
|
||||
@booking = Booking.find(params[:id])
|
||||
else
|
||||
@table_id = params[:id]
|
||||
@table = DiningFacility.find(@table_id)
|
||||
@booking = @table.get_booking
|
||||
end
|
||||
|
||||
@completed, @bookings = Sale.get_mobile_orders
|
||||
@sale_id = @booking.sale_id
|
||||
|
||||
if @booking
|
||||
@booking_id = @booking.booking_id
|
||||
@obj_order = @booking.orders.first
|
||||
@customer = @obj_order.customer
|
||||
@date = @obj_order.created_at
|
||||
@order_items = @booking.order_items
|
||||
end
|
||||
|
||||
render "foodcourt/addorders/detail"
|
||||
end
|
||||
|
||||
def update_modify_order
|
||||
booking = Booking.find(params[:booking_id])
|
||||
sale = booking.sale
|
||||
if sale && sale.sale_status != 'new'
|
||||
render :json => { :status => false }
|
||||
end
|
||||
|
||||
is_extra_time = false
|
||||
extra_time = ''
|
||||
cashier_type = "quick_service"
|
||||
|
||||
items_arr = []
|
||||
JSON.parse(params[:order_items]).each { |i|
|
||||
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
|
||||
if i["item_instance_code"].include? "ext"
|
||||
is_extra_time = true
|
||||
arr_exts = i["item_instance_code"].split("_")
|
||||
if arr_exts[1].match(/^(\d)+$/)
|
||||
time = arr_exts[1].to_i*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
end
|
||||
end
|
||||
if i["parent_order_item_id"]
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": i["options"]}
|
||||
else
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]}
|
||||
end
|
||||
items_arr.push(items)
|
||||
}
|
||||
|
||||
# begin
|
||||
order = Order.new
|
||||
order.source = params[:order_source]
|
||||
order.order_type = params[:order_type]
|
||||
# order.customer_id = params[:customer_id].present? ? params[:customer_id] : walkin.customer_id # for no customer id from mobile
|
||||
order.items = items_arr
|
||||
order.guest = params[:guest_info]
|
||||
order.table_id = params[:table_id] # this is dining facilities's id
|
||||
order.waiters = current_login_employee.name
|
||||
order.employee_name = current_login_employee.name
|
||||
|
||||
order.is_extra_time = is_extra_time
|
||||
order.extra_time = extra_time
|
||||
|
||||
order.new_booking = false
|
||||
order.booking_id = booking.booking_id
|
||||
|
||||
if order.generate
|
||||
if sale
|
||||
Sale.add_to_existing_pending_invoice(nil, sale.sale_id, booking)
|
||||
render :json => { :status => true, :data => sale }
|
||||
else
|
||||
render :json => { :status => true, :data => 'OK' }
|
||||
end
|
||||
else
|
||||
render :json => { :status => false }
|
||||
end
|
||||
end
|
||||
|
||||
def request_bill
|
||||
sale_data =[]
|
||||
if !ShiftSale.current_shift.nil?
|
||||
order_id = params[:order_id] # order_id
|
||||
order = Order.find(order_id)
|
||||
booking = order.booking
|
||||
if booking.checkin_at.utc > Time.now.utc && booking.checkout_at.nil?
|
||||
@status = false
|
||||
@error_message = "Operation failed, Could not request bill!"
|
||||
else
|
||||
table = DiningFacility.find_by(id: booking.dining_facility_id)
|
||||
|
||||
if booking.sale_id.nil?
|
||||
if sale_data = Sale.generate_invoice_from_booking(booking, current_login_employee, current_user, order.source, params[:current_checkin_induties_count])
|
||||
# in-duty update
|
||||
in_duties = InDuty.where("booking_id=?", booking.id)
|
||||
if !in_duties.empty?
|
||||
in_duties.each do |in_duty|
|
||||
induty = InDuty.find(in_duty.id)
|
||||
induty.sale_id = sale_data.sale_id
|
||||
induty.out_time = Time.now.utc
|
||||
induty.save
|
||||
end
|
||||
end
|
||||
|
||||
action_by = current_user.name
|
||||
type = "REQUEST_BILL"
|
||||
|
||||
remark = "Request bill Receipt No #{sale_data.receipt_no}"
|
||||
sale_audit = SaleAudit.record_audit_sale(sale_data.sale_id,remark,action_by,type )
|
||||
|
||||
# Promotion Activation
|
||||
Promotion.promo_activate(sale_data)
|
||||
|
||||
#bill channel
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
else
|
||||
from = ""
|
||||
end
|
||||
|
||||
if ["quick_service", "cashier"].include? order.source
|
||||
ActionCable.server.broadcast "bill_channel", table: table, from: from
|
||||
end
|
||||
|
||||
unless ["quick_service", "food_court"].include? order.source
|
||||
#check checkInOut pdf print
|
||||
checkout_time = Lookup.collection_of('checkout_time')
|
||||
if !booking.dining_facility_id.nil?
|
||||
terminal = DiningFacility.find_by_id(booking.dining_facility_id)
|
||||
cashier_terminal = CashierTerminal.find_by_id(terminal.zone_id)
|
||||
|
||||
if (!checkout_time.empty?) && (ENV["SERVER_MODE"] != "cloud") #no print in cloud server
|
||||
unique_code = "CheckInOutPdf"
|
||||
printer = PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
# print when complete click
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(printer)
|
||||
|
||||
if !printer.nil?
|
||||
order_queue_printer.print_check_in_out(printer, cashier_terminal, booking, table)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@status = true
|
||||
sale_id = sale_data.sale_id
|
||||
else
|
||||
@status = false
|
||||
sale_id = nil
|
||||
end
|
||||
else
|
||||
@status = true
|
||||
sale_id = booking.sale_id
|
||||
end
|
||||
end
|
||||
else
|
||||
@status = false
|
||||
@error_message = "No Current Open Shift for This Employee"
|
||||
end
|
||||
if ["quick_service", "food_court"].include? order.source
|
||||
redirect_to "/foodcourt/sale/#{sale_data.sale_id}/food_court/payment#"
|
||||
end
|
||||
#
|
||||
end
|
||||
|
||||
def completed
|
||||
|
||||
@@ -67,7 +67,7 @@ class CardSaleTran < ApplicationRecord
|
||||
shift_closed_at As closing_date,")
|
||||
.order("shift_sales.id DESC")
|
||||
return query = query.where("shift_sales.shift_started_at >= ?" , from)
|
||||
byebug
|
||||
# byebug
|
||||
end
|
||||
|
||||
end
|
||||
@@ -64,6 +64,6 @@ class CardSettleTran < ApplicationRecord
|
||||
shift_closed_at As closing_date,")
|
||||
.order("shift_sales.id DESC")
|
||||
return query = query.where("shift_sales.shift_started_at >= ?" , from)
|
||||
byebug
|
||||
# byebug
|
||||
end
|
||||
end
|
||||
|
||||
@@ -673,26 +673,28 @@ class Sale < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def self.get_mobile_orders
|
||||
def self.get_foodcourt_current_shift_orders
|
||||
@current_shift = ShiftSale.current_shift
|
||||
@bookings = Booking.select("bookings.*,customers.*")
|
||||
.joins(" JOIN sales ON bookings.sale_id=sales.sale_id")
|
||||
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
|
||||
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
|
||||
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
|
||||
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
|
||||
.where("sales.sale_status =? and sales.payment_status =? and orders.source='app' and DATE(bookings.created_at)=?",'completed','paid', Date.today)
|
||||
.order("bookings.created_at desc").uniq
|
||||
.where("sales.sale_status =? and sales.payment_status =? and orders.source='app' and sales.shift_sale_id = ?",
|
||||
'completed','paid', @current_shift.id
|
||||
).order("bookings.created_at desc").uniq
|
||||
|
||||
@competed = []
|
||||
@completed = []
|
||||
@assigns = []
|
||||
@bookings.each do |b|
|
||||
if b.booking_status == 'completed'
|
||||
@competed << b
|
||||
@completed << b
|
||||
else
|
||||
@assigns << b
|
||||
end
|
||||
end
|
||||
return @competed, @assigns
|
||||
return @completed, @assigns
|
||||
end
|
||||
|
||||
#Generate new Receipt No when it is not assigned
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
<div id="oqs_loading_wrapper" style="display:none;">
|
||||
<div id="oqs_loading"></div>
|
||||
</div>
|
||||
<% @order_id = params[:order_id].gsub('"', '') if params[:order_id] %>
|
||||
<input type="hidden" name="type" id="role" value="<%= current_user.role%>">
|
||||
<input type="hidden" name="cashier_type" id="cashier_type" value="<%= type%>">
|
||||
<input type="hidden" name="link_type" id="link_type" value="<%= @cashier_type %>">
|
||||
<input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>">
|
||||
<input type="hidden" name="order_id" id="order_id" value= "<%= @order_id %>">
|
||||
<div class="row m-t--10 h-100">
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 hidden d-flex flex-column h-100" id="menu_data">
|
||||
<li class="list-menu">
|
||||
@@ -158,7 +160,7 @@
|
||||
<div class="card h-100">
|
||||
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-12" id='app_order'>
|
||||
Mobile Orders <span class="badge badge-danger" style="font-size: 0.75rem;border-radius: 5px;"><%= @app_order_new_count %></span>
|
||||
Orders
|
||||
</button>
|
||||
<div class="row ">
|
||||
<div class="col-md-9 col-lg-9 col-sm-9 ">
|
||||
@@ -198,15 +200,20 @@
|
||||
<div class="card-footer flex-grow-1 custom-card-footer" id="orders-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td colspan="2" style="padding:2px; text-align:" class="charges-name"><strong>Total:</strong></td>
|
||||
<td style="padding:2px; text-align: center;"><strong id="total_qty">0</strong></td>
|
||||
<td style="padding:2px; text-align:" class="item-attr float-right"><strong id="sub_total">0.00</strong></td>
|
||||
<td colspan="2" style="padding:2px;" class="charges-name"><strong>Total:</strong></td>
|
||||
<td style="padding:2px 20px 2px 2px;"><strong id="total_qty">0</strong></td>
|
||||
<td style="padding:2px;" class="item-attr <%= params[:modify] ? '' : 'text-right'%>"><strong id="sub_total">0.00</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% if @sale_id.nil?%>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-12" id="create_pay_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
|
||||
<% if params[:update] %>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-12 m-t-5" id="create_pay_order" disabled="disabled" style=" height: 50px; width: 100%;">Update Order & Pay</button>
|
||||
<% else %>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-12" id="add_to_existing_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
|
||||
<% if @sale_id.nil?%>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-4 d-inline" id="create_pay_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
|
||||
<% else %>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-4 d-inline" id="add_to_existing_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
|
||||
<% end %>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-7 m-l-15 d-inline" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -349,7 +356,8 @@
|
||||
<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;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="set-menu-item-slimscroll" data-height="50">
|
||||
<div class="modal-body" data-height="50">
|
||||
<!-- id="set-menu-item-slimscroll" -->
|
||||
<div class="row set-item">
|
||||
<div class="col-md-4">
|
||||
<p class="set_default_option" style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
|
||||
|
||||
@@ -8,88 +8,180 @@
|
||||
</style>
|
||||
<%= javascript_include_tag 'custom', 'data-turbolinks-track': 'reload' %>
|
||||
|
||||
<!-- <button type="button" class="btn btn-block btn-default waves-effect float-right" id='back' style="width: 112px; margin-right: -10px">
|
||||
<i class="material-icons">reply</i>
|
||||
Back
|
||||
</button> -->
|
||||
|
||||
<div class="container-fluid h-100" style="padding:0px 3px 0px 3px;margin-top:20px">
|
||||
<div id="oqs_loading_wrapper" style="display:none;">
|
||||
<div id="oqs_loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="row m-t--20 h-100">
|
||||
<% if !@booking.nil?%>
|
||||
<div class="col-md-7 col-lg-7 col-sm-12 float-left h-100 d-flex flex-column m-l-5 m-r-10" style="padding-right: 10px;">
|
||||
<% if !@booking.nil? || @pending %>
|
||||
<div class="col-md-6 col-lg-6 col-sm-12 float-left h-100 d-flex flex-column m-l-5 m-r-10" style="padding-right: 15px;">
|
||||
<% else %>
|
||||
<div class="col-md-11 col-lg-11 col-sm-12 h-100 d-flex flex-column" style="padding: 0 !important;">
|
||||
<div class="col-md-10 col-lg-10 col-sm-12 h-100 d-flex flex-column" style="padding: 0 15px 0 20px !important;">
|
||||
<% end %>
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs tab-col-teal m-t--10" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <%= 'active' if params[:active].blank? %>" data-toggle="tab" href="#mobile_orders" role="tab">Mobile Orders</a>
|
||||
<a class="nav-link <%= params[:active] == 'completed' ? 'active' : '' %>" data-toggle="tab" href="#complete" role="tab"><%= t :competed %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <%= params[:active] ? 'active' : '' %>" data-toggle="tab" href="#complete" role="tab"><%= t :competed %></a>
|
||||
<a class="nav-link <%= 'active' if params[:active].blank? %>" data-toggle="tab" href="#pending_order" role="tab">Pending Orders</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <%= params[:active] == 'mobile' ? 'active' : '' %>" data-toggle="tab" href="#mobile_orders" role="tab">Mobile Orders</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
<div class="tab-content h-100">
|
||||
<!-- Panel 0 - Mobile Orders -->
|
||||
<div class="tab-pane <%= 'active' if params[:active].blank? %>" id='mobile_orders' role='tabpanel'>
|
||||
<div id="foodcourt-slimscroll" class="flex-grow-1">
|
||||
<div class="card-columns">
|
||||
<% bk_color ='' %>
|
||||
<% @bookings.each do |bk|
|
||||
bk_status ='new'
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane h-100 <%= params[:active] == 'completed' ? 'active' : '' %>" id="complete" role="tabpanel">
|
||||
<div class="d-flex flex-column h-100">
|
||||
<div id="foodcourt-menu-slimscroll" class="flex-grow-1">
|
||||
<div class="card-columns p-l-10">
|
||||
<% bk_color ='' %>
|
||||
<% @completed.each do |c| %>
|
||||
<%
|
||||
if !@booking.nil?
|
||||
if c.booking_id == @booking.booking_id
|
||||
bg_color ='bg-secondary'
|
||||
else
|
||||
if c.sale.sale_status == 'void'
|
||||
bg_color = 'bg-danger'
|
||||
elsif c.sale.sale_status == 'completed'
|
||||
bg_color = 'bg-success'
|
||||
end
|
||||
end
|
||||
else
|
||||
if c.sale.sale_status == 'void'
|
||||
bg_color = 'bg-danger'
|
||||
elsif c.sale.sale_status == 'completed'
|
||||
bg_color = 'bg-success'
|
||||
end
|
||||
end
|
||||
%>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(booking_id: c.booking_id, active: 'completed'), class: 'item-card' do %>
|
||||
<div class="card <%= bg_color %> text-white" data-id ="<%= c.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= c.contact_no %><span style="font-size:12px;float:right;line-height:inherit;"> <%= c.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
|
||||
<%= c.orders.first.try(:order_id) %><span style="font-size:12px;float:right;line-height:inherit;"><%= c.booking_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
if !@booking.nil?
|
||||
if bk.booking_id == @booking.booking_id
|
||||
bk_color ='bg-secondary'
|
||||
<% @pending_completed.each do |pc| %>
|
||||
<% if @pending.present? %>
|
||||
<% if @pending.sale_id == pc.sale_id %>
|
||||
<% bg_color = 'bg-secondary' %>
|
||||
<% else %>
|
||||
<% if pc.sale_status == 'void' %>
|
||||
<% bg_color = 'bg-danger' %>
|
||||
<% elsif pc.sale_status == 'completed' %>
|
||||
<% bg_color = 'bg-success' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if pc.sale_status == 'void' %>
|
||||
<% bg_color = 'bg-danger' %>
|
||||
<% elsif pc.sale_status == 'completed' %>
|
||||
<% bg_color = 'bg-success' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(pending_id: pc.sale_id, active: 'completed'), class: 'item-card' do %>
|
||||
<div class="card <%= bg_color %> text-white">
|
||||
<div class="card-block">
|
||||
<%= pc.receipt_no %>
|
||||
<span class="float-right"><%= pc.created_at.strftime('%I:%M %p') %></span>
|
||||
<br>
|
||||
<span class="float-right"><%= pc.sale_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Panel 1 - Pending Orders -->
|
||||
<div class="tab-pane <%= 'active' if params[:active].blank? %> h-100" id="pending_order" role="tabpanel">
|
||||
<div class="h-100 d-flex flex-column">
|
||||
<div id="foodcourt-order-slimscroll">
|
||||
<div class="card-columns p-l-10">
|
||||
<% @pending_sales.each do |sale| %>
|
||||
<% if @pending.present? %>
|
||||
<% if @pending.sale_id == sale.sale_id %>
|
||||
<% bg_color = 'bg-secondary' %>
|
||||
<% else %>
|
||||
<% bg_color = 'bg-danger' %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% bg_color = 'bg-danger' %>
|
||||
<% end %>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(pending_id: sale.sale_id), class: 'item-card' do %>
|
||||
<div class="card sales <%= bg_color %> text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %>
|
||||
<span class="float-right"><%= sale.created_at.strftime('%I:%M %p') %></span>
|
||||
<br>
|
||||
<span class = 'float-right'>Billed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% @pending_orders.each do |order| %>
|
||||
<% if @pending.present? && @status == 'order' %>
|
||||
<% if @pending.booking_id == order.booking_id %>
|
||||
<% bg_color = 'bg-secondary' %>
|
||||
<% else %>
|
||||
<% bg_color = 'blue' %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% bg_color = 'blue' %>
|
||||
<% end %>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(pending_id: order.booking_id), class: 'item-card' do %>
|
||||
<div class="card sales <%= bg_color %> text-white" data-id = "<%= order.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.booking_id %>
|
||||
<span class="float-right"><%= order.created_at.strftime('%I:%M-%p') %></span>
|
||||
<br>
|
||||
<span class="float-right">new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Panel 2 - Mobile Orders -->
|
||||
<div class="tab-pane h-100 <%= params[:active] == 'mobile' ? 'active' : '' %>" id='mobile_orders' role='tabpanel'>
|
||||
<div class="h-100 d-flex flex-column">
|
||||
<div id="foodcourt-slimscroll" class="flex-grow-1">
|
||||
<div class="card-columns p-l-10">
|
||||
<% bk_color ='' %>
|
||||
<% @bookings.each do |bk|
|
||||
bk_status ='new'
|
||||
|
||||
if !@booking.nil?
|
||||
if bk.booking_id == @booking.booking_id
|
||||
bk_color ='bg-secondary'
|
||||
else
|
||||
bk_color =bk.booking_status
|
||||
end
|
||||
else
|
||||
bk_color =bk.booking_status
|
||||
end
|
||||
else
|
||||
bk_color =bk.booking_status
|
||||
end %>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(booking_id:bk.booking_id), class: 'item-card' do %>
|
||||
<div class="card <%= bk_color %> text-white" data-id ="<%= bk.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= bk.contact_no %><span style="font-size:12px;float:right;line-height:inherit;"> <%= bk.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
|
||||
<%= bk.orders.first.try(:order_id) %><span style="font-size:12px;float:right;line-height:inherit;"><%= bk_status %></span>
|
||||
end %>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(booking_id:bk.booking_id, active: 'mobile'), class: 'item-card' do %>
|
||||
<div class="card <%= bk_color %> text-white" data-id ="<%= bk.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= bk.contact_no %><span style="font-size:12px;float:right;line-height:inherit;"> <%= bk.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
|
||||
<%= bk.orders.first.try(:order_id) %><span style="font-size:12px;float:right;line-height:inherit;"><%= bk_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Completed Orders -->
|
||||
<div class="tab-pane <%= params[:active] ? 'active' : '' %>" id="complete" role="tabpanel">
|
||||
<div class="card-columns">
|
||||
<% bk_color ='' %>
|
||||
<% @completed.each do |c| %>
|
||||
<%
|
||||
if !@booking.nil?
|
||||
if c.booking_id == @booking.booking_id
|
||||
bk_color ='bg-secondary'
|
||||
else
|
||||
bk_color = c.booking_status
|
||||
end
|
||||
else
|
||||
bk_color = c.booking_status
|
||||
end
|
||||
%>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(booking_id: c.booking_id, active: 'completed'), class: 'item-card' do %>
|
||||
<div class="card <%= bk_color %> text-white" data-id ="<%= c.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= c.contact_no %><span style="font-size:12px;float:right;line-height:inherit;"> <%= c.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
|
||||
<%= c.orders.first.try(:order_id) %><span style="font-size:12px;float:right;line-height:inherit;">competed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -171,7 +263,133 @@
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="col-md-1 col-lg-1 col-sm-12 h-100 d-flex flex-column" style="padding-right: 10px;">
|
||||
|
||||
<% if @pending %>
|
||||
<div class="col-md-4 col-lg-4 col-sm-12 h-100 d-flex flex-column m-l--15">
|
||||
<% if @status == 'sale' %>
|
||||
<span id="sale_id" style="display:none"><%= @pending.try(:sale_id) %></span>
|
||||
<% elsif @status == 'order' %>
|
||||
<span id="sale_id" style="display:none"><%= @pending.try(:booking_id) %></span>
|
||||
<% end %>
|
||||
<div class="card" style="height: 100%">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<strong id="order-title">INVOICE DETAILS </strong>| Table - <%= @pending.dining_facility.name rescue "" %>
|
||||
</div>
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<% if @status == 'sale' || @pending.try(:sale_status) == 'completed' || @pending.try(:sale_status) == 'void' %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Receipt No:
|
||||
<span id="receipt_no">
|
||||
<%= @pending.receipt_no rescue '' %>
|
||||
</span>
|
||||
</div>
|
||||
<% else%>
|
||||
<!-- <input type="hidden" id="save_order_id" value="<%#=@bookings.booking_orders[0].order_id%>"> -->
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
Order No: <span id="receipt_no">
|
||||
<%= @pending.booking_orders.first.order_id rescue '' %></span>
|
||||
</div>
|
||||
<% end%>
|
||||
|
||||
<% if @status == 'sale' || @pending.try(:sale_status) == 'completed' || @pending.try(:sale_status) == 'void' %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
Date: <span id="receipt_date"><%= @pending.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
<% else%>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
|
||||
Date: <span id="receipt_date"><%= @pending.orders.first.created_at.strftime("%I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="row customer_detail p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<% if @status == 'sale' %>
|
||||
Customer: <%= @pending.customer.name rescue "-" %>
|
||||
<% else%>
|
||||
Customer: <%= @pending.orders.first.customer.name rescue "-" %>
|
||||
<% end%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div id="order-detail-slimscroll" data-height="140">
|
||||
<div class="card-text" style="">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</th>
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @status == 'sale' %>
|
||||
<% sub_total = 0
|
||||
@pending.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price %>
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<% sub_total = 0
|
||||
total = 0
|
||||
@pending.order_items.each do |order_item|
|
||||
total = order_item.qty * order_item.price
|
||||
sub_total = sub_total + total %>
|
||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= total %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pending-order card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<% if @status == 'sale' %>
|
||||
<tr>
|
||||
<%if @pending.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
<% else%>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
<div class="col-md-2 col-lg-2 col-sm-12 h-100 d-flex flex-column" style="padding: 0 15px 0 5px;">
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||
<i class="material-icons">reply</i>
|
||||
<%= t("views.btn.back") %>
|
||||
@@ -179,6 +397,41 @@
|
||||
<% if !@booking.nil?%>
|
||||
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||
<% end %>
|
||||
|
||||
<!-- pending order button list -->
|
||||
<% if @pending && params[:active].nil? %>
|
||||
|
||||
<% if current_user.role != "waiter" || @status != "sale"%>
|
||||
<button type="button" id="addorder" class="btn bg-blue btn-block">Update Order</button>
|
||||
<%end%>
|
||||
|
||||
<% if current_user.role != "waiter" && @status != "order"%>
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
<%end%>
|
||||
|
||||
<% if @status != "sale"%>
|
||||
<!-- <button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button> -->
|
||||
<% order_id = @pending.try(:orders).try(:first).try(:order_id) if @status == 'order' %>
|
||||
<%= link_to 'Req.Bill', "/foodcourt/food_court/#{order_id}/request_bill", class: 'btn btn-block bg-blue waves-effect' %>
|
||||
<%end%>
|
||||
|
||||
<% elsif @pending && params[:active] == 'completed' %>
|
||||
<% if current_user.role != "waiter" %>
|
||||
<% if @pending.sale_status != 'void' && @pending.sale_status != 'waste' && @pending.sale_status != 'spoile' %>
|
||||
<% if current_user.role == "cashier" %>
|
||||
<% if @pending.payment_status != 'foc' %>
|
||||
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||
<% end %>
|
||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="reprint"> Re.Print</a>
|
||||
<% else %>
|
||||
<% if @pending.payment_status != 'foc' %>
|
||||
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" readonly= "<%= (can? :overall_void, :void)? 'true': 'false' %>" > Void </button>
|
||||
<% end %>
|
||||
<button type="button" id="reprint" class="btn bg-blue btn-block">Re.Print</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -239,6 +492,33 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
$('#pay').on('click', function () {
|
||||
var cashier_type = 'food_court';
|
||||
var sale_id = $('#sale_id').text();
|
||||
window.location.href = '/foodcourt/sale/' + sale_id + "/"+cashier_type+"/payment";
|
||||
});
|
||||
|
||||
$('#addorder').on('click', function () {
|
||||
var status = "<%= @status %>"
|
||||
if (status == 'sale'){
|
||||
var table_id = "<%= @pending.try(:bookings).try(:first).try(:dining_facility).try(:id) %>"
|
||||
var booking_id = "<%= @pending.try(:bookings).try(:first).try(:id) %>"
|
||||
}
|
||||
else {
|
||||
var table_id = "<%= @pending.try(:dining_facility).try(:id) %>";
|
||||
var booking_id = "<%= @pending.try(:booking_id) %>";
|
||||
var order_id = "<%= @pending.try(:orders).try(:first).try(:order_id) %>";
|
||||
}
|
||||
|
||||
var sale_id = $("#sale_id").text();
|
||||
if (table_id) {
|
||||
window.location.href = '/foodcourt/food_court/modify_order/' + table_id + "/"+sale_id +'?update=true';
|
||||
}else{
|
||||
window.location.href = '/foodcourt/food_court/modify_order/'+ booking_id+"/" +sale_id +'?update=true&order_id="'+order_id+'"'
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#back').on('click', function () {
|
||||
window.location.href ="<%=foodcourt_food_court_path %>";
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
<div class="card-block m-l-5 m-r-5 m-t--10 d-flex flex-column h-100">
|
||||
<div class="card-title">
|
||||
<div id="table-details" class="card-text">
|
||||
<div class="card-text">
|
||||
<table class="table" id="append-table">
|
||||
<tr>
|
||||
<!-- <tr> -->
|
||||
@@ -66,7 +66,7 @@
|
||||
<div id="foodcourt-slimscroll" class="h-100">
|
||||
<!-- <div id="table-details" class="card-text" style="min-height:400px; max-height:400px; overflow-x:scroll"> -->
|
||||
<div id="table-details" class="card-text m-t--10" >
|
||||
<table class="table" id="append-table">
|
||||
<table class="table summary-items" id="append-table">
|
||||
<tbody>
|
||||
<% sub_total = 0
|
||||
count = 0
|
||||
@@ -196,6 +196,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
|
||||
<%= link_to 'Back', '/foodcourt/app_orders', class: 'btn btn-block btn-default waves-effect' %>
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='refresh'>
|
||||
Refresh
|
||||
</button>
|
||||
|
||||
@@ -698,6 +698,9 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
get "food_court" => "food_court#index"
|
||||
get "app_orders" => "orders#app_orders",:as => "app_order_by_booking"
|
||||
post ':booking_id/:order_id/completed' => "orders#completed", :defaults => { :format => 'json' }
|
||||
get "food_court/modify_order/:id/:sale_id" => "orders#modify_order"
|
||||
post '/food_court/update_modify_order' => "orders#update_modify_order", :defaults => { :format => 'json' }
|
||||
get '/food_court/:order_id/request_bill' => 'orders#request_bill', :as => 'food_court_request_bill'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user