Merge branch 'foodcourt' of gitlab.com:code2lab/SXRestaurant into foodcourt
This commit is contained in:
@@ -311,6 +311,9 @@ settings/lookups => {type:show_total_before_tax, name:Show Total Before Tax, val
|
||||
For Using Staff Meal
|
||||
settings/lookups => { type:customer_type, name: Staff, value:Staff }
|
||||
|
||||
For FoodCourt Cashier role
|
||||
settings/lookups => { type:employee_roles, name: FoodCourt Cashier, value:foodcourt_cashier }
|
||||
|
||||
* ToDo list
|
||||
|
||||
1. Migration
|
||||
|
||||
@@ -1655,4 +1655,32 @@ $(function() {
|
||||
//end is_sub_item false
|
||||
}
|
||||
}
|
||||
$("#add_to_existing_order").on('click', function(e){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
e.preventDefault();
|
||||
type = $("#link_type").val();
|
||||
$("#oqs_loading_wrapper").show();
|
||||
var ajax_url = 'addorders/add_to_existing_order';
|
||||
var table_type = $('#table_type').text();
|
||||
var table_id = $('#table_id').text();
|
||||
var customer_id = $('#customer_id').text();
|
||||
var booking_id = $('#booking_id').text();
|
||||
var sale_id = $('#sale_id').text();
|
||||
var order_items = JSON.stringify(get_order_item_rows());
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
|
||||
'table_id': table_id,
|
||||
'order_items': order_items,'sale_id': sale_id,'create_type': "create_pay" };
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
if (result.status) {
|
||||
window.location.href = "/foodcourt/table/sale/" + sale_id + "/food_court/edit";
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Api::CustomersController < ActionController::API
|
||||
|
||||
class Api::CustomersController < Api::ApiController
|
||||
skip_before_action :authenticate
|
||||
#List all active customers by name
|
||||
def index
|
||||
@customers = Customer.order("name asc")
|
||||
@@ -17,6 +17,6 @@ class Api::CustomersController < ActionController::API
|
||||
|
||||
#Show customer last five order
|
||||
def get_customer_last_orders
|
||||
@customer = Customer.find(params[:customer_id])
|
||||
@sales =Sale.where("sales.customer_id=? and sales.sale_status =?",params[:customer_id],'completed').order("created_at desc").limit(5)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -46,7 +46,7 @@ class Api::OrdersController < Api::ApiController
|
||||
@tax_profile = TaxProfile.where("lower(group_type)='cashier'")
|
||||
# end
|
||||
|
||||
#
|
||||
#
|
||||
return @shop.to_json
|
||||
end
|
||||
|
||||
@@ -122,8 +122,8 @@ class Api::OrdersController < Api::ApiController
|
||||
end
|
||||
|
||||
@status, @booking = @order.generate
|
||||
if @status && @booking
|
||||
Order.process_order_queue(@order.order_id,@order.table_id,@order.source)
|
||||
if params[:order_source] != "app"
|
||||
@order.process_order_queue(@order.order_id,@order.table_id,@order.source)
|
||||
end
|
||||
if @order.table_id.to_i > 0
|
||||
table = DiningFacility.find(@booking.dining_facility_id)
|
||||
@@ -131,12 +131,6 @@ class Api::OrdersController < Api::ApiController
|
||||
from = getCloudDomain #get sub domain in cloud mode
|
||||
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||
end
|
||||
# # for parallel order
|
||||
# remoteIP = ""
|
||||
# begin
|
||||
# @status, @booking = @order.generate
|
||||
# remoteIP = request.remote_ip
|
||||
# end while request.remote_ip != remoteIP
|
||||
if current_user.role != "waiter" && params[:create_type] == "create_pay"
|
||||
if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court') || (@order.source == 'app')
|
||||
@status, @sale = Sale.request_bill(@order,current_user,current_user)
|
||||
|
||||
@@ -5,7 +5,7 @@ class Api::VerificationsController < Api::ApiController
|
||||
|
||||
#TODO - user generate
|
||||
cus = Customer.new
|
||||
@cus = cus.draft_customer(phone_number, rand(1000..9999))
|
||||
@cus = cus.draft_customer(params, rand(1000..9999))
|
||||
if @cus.verify_status == false
|
||||
VerifyNumber.send_message(phone_number, @cus.pin_code)
|
||||
@result = true
|
||||
|
||||
@@ -305,5 +305,56 @@ class Foodcourt::AddordersController < BaseFoodcourtController
|
||||
|
||||
return from
|
||||
end
|
||||
def add_to_existing_order
|
||||
if params[:booking_id].present? && params[:sale_id].present?
|
||||
booking = Booking.find(params[:booking_id])
|
||||
saleobj =Sale.find(params[:sale_id])
|
||||
order =saleobj.orders[0]
|
||||
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": JSON.parse(i["options"])}
|
||||
else
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": JSON.parse(i["options"])}
|
||||
end
|
||||
items_arr.push(items)
|
||||
}
|
||||
order.items = items_arr
|
||||
order.new_booking = false
|
||||
order.booking_id = booking.booking_id
|
||||
@status, booking = order.generate
|
||||
order_array = []
|
||||
items_arr.each do |item|
|
||||
order_item =order.order_items.where("item_instance_code=?",item[:item_instance_code]).last
|
||||
saleobj.add_item (order_item)
|
||||
if !order_item.set_menu_items.nil?
|
||||
saleobj.add_sub_item(order_item.set_menu_items)
|
||||
end
|
||||
end
|
||||
# Re-compute for add
|
||||
saleobj.compute(order.source)
|
||||
saleobj.save
|
||||
order.save
|
||||
booking.save
|
||||
order_array.push(order.order_id)
|
||||
|
||||
receipt_no = saleobj.receipt_no
|
||||
action_by = current_user.name
|
||||
type = "ADD_TO_EXISTING"
|
||||
|
||||
remark = "#{action_by} add to existing order #{order_array} to Receipt No=>#{receipt_no}"
|
||||
sale_audit = SaleAudit.record_audit_sale(saleobj.sale_id,remark,action_by,type )
|
||||
end
|
||||
result = {:status=> @status}
|
||||
render :json => result.to_json
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,6 +8,15 @@ class Foodcourt::FoodCourtController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
if params[:sale_id].present?
|
||||
sale =Sale.find(params[:sale_id])
|
||||
if sale
|
||||
@sale_id =sale.sale_id
|
||||
@booking_id =sale.bookings[0].booking_id
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
today = DateTime.now
|
||||
day = Date.today.wday
|
||||
@menus = []
|
||||
|
||||
@@ -6,7 +6,7 @@ class Foodcourt::HomeController < BaseFoodcourtController
|
||||
@webview = check_mobile
|
||||
@tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
|
||||
@rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
|
||||
@complete = Sale.completed_sale("cashier",@shop.shop_code)
|
||||
@complete = Sale.completed_sale("cashier")
|
||||
@orders = Order.includes("sale_orders").where("shop_code='#{@shop.shop_code}' and DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
@@ -21,7 +21,7 @@ class Foodcourt::HomeController < BaseFoodcourtController
|
||||
@webview = check_mobile
|
||||
@tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
|
||||
@rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
|
||||
@complete = Sale.completed_sale("cashier",@shop.shop_code)
|
||||
@complete = Sale.completed_sale("cashier")
|
||||
@orders = Order.includes("sale_orders").where("shop_code='#{@shop.shop_code}' and DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
@shift = ShiftSale.current_open_shift(current_user)
|
||||
|
||||
@@ -38,19 +38,6 @@ class Foodcourt::SaleEditController < BaseFoodcourtController
|
||||
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
|
||||
|
||||
# booking = Booking.find_by_sale_id(saleitemObj.sale_id)
|
||||
# booking.booking_orders.each do |bo|
|
||||
# order = Order.find(bo.order_id)
|
||||
# order.order_items.each do |o|
|
||||
# if saleitemObj.product_code == o.item_code
|
||||
# o.qty = saleitemObj.qty * -1
|
||||
# o.price = saleitemObj.price * -1
|
||||
# o.save
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# FOr Sale Audit
|
||||
action_by = current_user.name
|
||||
if access_code != "null" && current_user.role == "cashier"
|
||||
@@ -99,26 +86,6 @@ class Foodcourt::SaleEditController < BaseFoodcourtController
|
||||
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
|
||||
end
|
||||
|
||||
# def item_edit
|
||||
# saleitemId = params[:sale_item_id]
|
||||
# update_qty = params[:update_qty]
|
||||
# update_price = params[:update_price]
|
||||
# saleitemObj = SaleItem.find(saleitemId)
|
||||
# saleitemObj.status = 'void'
|
||||
# saleitemObj.save
|
||||
# @newsaleitem = SaleItem.new
|
||||
# @newsaleitem = saleitemObj.dup
|
||||
# @newsaleitem.save
|
||||
# @newsaleitem.qty = update_qty
|
||||
# @newsaleitem.price = update_price
|
||||
# @newsaleitem.unit_price = update_price
|
||||
# @newsaleitem.taxable_price = update_price
|
||||
# @newsaleitem.is_taxable = 0
|
||||
# @newsaleitem.remark = 'edit'
|
||||
# @newsaleitem.product_name = saleitemObj.product_name + " - updated"
|
||||
# @newsaleitem.save
|
||||
# end
|
||||
|
||||
def item_edit
|
||||
saleitemId = params[:sale_item_id]
|
||||
update_qty = params[:update_qty]
|
||||
@@ -149,20 +116,6 @@ class Foodcourt::SaleEditController < BaseFoodcourtController
|
||||
|
||||
saleitemObj.save
|
||||
|
||||
# re-calc tax
|
||||
# saleObj = Sale.find(saleitemObj.sale_id)
|
||||
|
||||
# order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id
|
||||
# order = Order.find(order_id)
|
||||
|
||||
# order.order_items.each do |o|
|
||||
# if saleitemObj.product_code == o.item_code
|
||||
# o.qty = update_qty
|
||||
# o.price = update_price
|
||||
# o.save
|
||||
# end
|
||||
# end
|
||||
|
||||
sale.compute_by_sale_items(sale.total_discount, nil, order_source)
|
||||
|
||||
ProductCommission.edit_product_commission(saleitemObj,sale.shop_code)
|
||||
|
||||
@@ -5,7 +5,7 @@ class Origami::PendingOrderController < BaseOrigamiController
|
||||
@cashier_type = params[:type]
|
||||
@sale = Sale.pending_sale(@cashier_type)
|
||||
@order = Sale.pending_order(@cashier_type)
|
||||
@completed = Sale.completed_sale(@cashier_type,@shop.shop_code)
|
||||
@completed = Sale.completed_sale(@cashier_type)
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
|
||||
@occupied_table = @sale.count.length + @order.count.length
|
||||
@@ -36,7 +36,7 @@ class Origami::PendingOrderController < BaseOrigamiController
|
||||
@cashier_type = params[:type]
|
||||
@sales = Sale.pending_sale(@cashier_type)
|
||||
@orders = Sale.pending_order(@cashier_type)
|
||||
@completed = Sale.completed_sale(@cashier_type,@shop.shop_code)
|
||||
@completed = Sale.completed_sale(@cashier_type)
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
|
||||
@occupied_table = @sales.count.length + @orders.count.length
|
||||
@@ -46,7 +46,7 @@ class Origami::PendingOrderController < BaseOrigamiController
|
||||
@cashier_type = params[:type]
|
||||
@sales = Sale.pending_sale(@cashier_type)
|
||||
@orders = Sale.pending_order(@cashier_type)
|
||||
@completed = Sale.completed_sale(@cashier_type,@shop.shop_code)
|
||||
@completed = Sale.completed_sale(@cashier_type)
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
|
||||
@occupied_table = @sales.count.length + @orders.count.length
|
||||
@@ -81,7 +81,7 @@ class Origami::PendingOrderController < BaseOrigamiController
|
||||
@cashier_type = params[:type]
|
||||
@sales = Sale.pending_sale(@cashier_type)
|
||||
@orders = Sale.pending_order(@cashier_type)
|
||||
@completed = Sale.completed_sale(@cashier_type,@shop.shop_code)
|
||||
@completed = Sale.completed_sale(@cashier_type)
|
||||
|
||||
@occupied_table = @sales.count.length + @orders.count.length
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class Settings::OrderQueueStationsController < ApplicationController
|
||||
# GET /settings/order_queue_stations
|
||||
# GET /settings/order_queue_stations.json
|
||||
def index
|
||||
@settings_order_queue_stations = OrderQueueStation.all
|
||||
@settings_order_queue_stations = OrderQueueStation.where("shop_code=?",@shop.shop_code)
|
||||
@settings_order_queue_stations = Kaminari.paginate_array(@settings_order_queue_stations).page(params[:page]).per(50)
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ class Settings::OrderQueueStationsController < ApplicationController
|
||||
# POST /settings/order_queue_stations
|
||||
# POST /settings/order_queue_stations.json
|
||||
def create
|
||||
|
||||
|
||||
@settings_order_queue_station = OrderQueueStation.new(settings_order_queue_station_params)
|
||||
@settings_order_queue_station.created_by = current_login_employee.name
|
||||
@settings_order_queue_station.processing_items = "[]"
|
||||
|
||||
@@ -17,11 +17,11 @@ class Customer < ApplicationRecord
|
||||
|
||||
paginates_per 50
|
||||
|
||||
def draft_customer(phone, pin)
|
||||
cus = Customer.find_by_contact_no(phone)
|
||||
def draft_customer(params, pin)
|
||||
cus = Customer.find_by_contact_no(params[:phone_number])
|
||||
if cus.nil?
|
||||
self.name = "User " + pin.to_s
|
||||
self.contact_no = phone
|
||||
self.name = params[:name]
|
||||
self.contact_no = params[:phone_number]
|
||||
self.email = pin.to_s + "@gmail.com"
|
||||
self.pin_code = pin.to_s
|
||||
self.pin_sent_at = Time.now
|
||||
|
||||
@@ -37,11 +37,13 @@ class Order < ApplicationRecord
|
||||
:checkin_at => Time.now.utc,:checkout_at => Time.now.utc + self.extra_time.to_i,
|
||||
:checkin_by => self.employee_name,
|
||||
:booking_status => "assign",
|
||||
:customer_id => self.customer_id,
|
||||
:shop_code=>self.shop_code})
|
||||
else
|
||||
booking = Booking.create({:dining_facility_id => table_id,:type => "TableBooking",
|
||||
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
|
||||
:booking_status => "assign",
|
||||
:customer_id => self.customer_id,
|
||||
:shop_code=>self.shop_code })
|
||||
end
|
||||
#end extra time
|
||||
|
||||
@@ -38,20 +38,20 @@ class Printer::PrinterWorker
|
||||
end
|
||||
|
||||
def print(file_path,printer_destination = nil )
|
||||
# if printer_destination.nil?
|
||||
# printer_destination = self.printer_destination
|
||||
# end
|
||||
#
|
||||
# puts printer_destination
|
||||
# puts '........Printer Destination..........'
|
||||
#
|
||||
# copy = self.print_copies
|
||||
# #Print only when printer information is not null
|
||||
# if !self.printer_destination.nil?
|
||||
# (1..copy).each do
|
||||
# page = Cups::PrintJob.new(file_path, printer_destination)
|
||||
# page.print
|
||||
# end
|
||||
# end
|
||||
if printer_destination.nil?
|
||||
printer_destination = self.printer_destination
|
||||
end
|
||||
|
||||
puts printer_destination
|
||||
puts '........Printer Destination..........'
|
||||
|
||||
copy = self.print_copies
|
||||
#Print only when printer information is not null
|
||||
if !self.printer_destination.nil?
|
||||
(1..copy).each do
|
||||
page = Cups::PrintJob.new(file_path, printer_destination)
|
||||
page.print
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -527,6 +527,8 @@ class Sale < ApplicationRecord
|
||||
|
||||
if order_source.to_s == "emenu"
|
||||
order_source = "cashier"
|
||||
elsif order_source.to_s == "app"
|
||||
order_source = "food_court"
|
||||
end
|
||||
|
||||
tax_profiles = unique_tax_profiles(order_source, self.customer_id)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
if(@sales)
|
||||
json.sales @sales do |sale|
|
||||
json.sale_id sale.sale_id
|
||||
json.customer_id sale.customer_id
|
||||
json.receipt_no sale.receipt_no
|
||||
json.grand_total sale.grand_total
|
||||
json.sale_items sale.sale_items
|
||||
end
|
||||
end
|
||||
@@ -151,63 +151,17 @@
|
||||
</button>
|
||||
<br>
|
||||
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
||||
<% if type %>
|
||||
<div class="row clearfix">
|
||||
<div class="col-md-6 col-lg-6 col-sm-12">
|
||||
<strong id="order-title" class="font-13">ORDER DETAILS </strong>
|
||||
</div>
|
||||
|
||||
<% if modify_order %>
|
||||
<% 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>
|
||||
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : '---'%></p>
|
||||
<p class="hidden" id="sale_id"><%=@sale_id%></p>
|
||||
|
||||
<div class="col-md-1 col-lg-1 col-sm-1">
|
||||
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear
|
||||
</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 %>
|
||||
<div class="row ">
|
||||
<div class="col-md-9 col-lg-9 col-sm-9 ">
|
||||
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@table.name%></span>
|
||||
|
||||
|
||||
<p class="hidden" id="table_id"><%=@table_id%></p>
|
||||
<p class="hidden" id="table_type"><%=@table.type%></p>
|
||||
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>
|
||||
<p class="hidden" id="booking_id"><%=@booking_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="sale_id"><%=@sale_id%></p>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
<% end%>
|
||||
|
||||
</div>
|
||||
<div class="card-block">
|
||||
@@ -237,7 +191,11 @@
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-11" 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 @sale_id.nil?%>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-11" 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-11" 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 %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -360,7 +318,7 @@
|
||||
<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 add_to_order " data-dismiss="modal" id="add_to_order">Add to Order</button>
|
||||
<button type="button" class="btn btn-primary add_to_order " data-dismiss="modal" id="add_to_order">Add to Order</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -727,4 +685,5 @@ var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
<% end %>
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -8,22 +8,17 @@ json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
||||
if (menu.menu_categories)
|
||||
order_by = Lookup.find_by_lookup_type("order_by")
|
||||
# if !order_by.nil? && order_by.value == "name"
|
||||
# categories = MenuCategory.unscoped.where("menu_id ='#{menu.id}'").order("name asc")
|
||||
# categories = MenuCategory.unscope(:order).where("menu_id ='#{menu.id}'").order("name asc")
|
||||
# else
|
||||
# categories = menu.menu_categories
|
||||
# end
|
||||
categories = menu.menu_categories
|
||||
json.categories categories do |category|
|
||||
if category.is_available
|
||||
parent_category = category.parent
|
||||
if !parent_category.nil?
|
||||
json.sub_category "true"
|
||||
else
|
||||
json.sub_category "false"
|
||||
end
|
||||
json.sub_category category.children.present?
|
||||
|
||||
valid_time = category.valid_time
|
||||
json.valid_time valid_time
|
||||
|
||||
json.id category.id
|
||||
json.code category.code
|
||||
json.order_by category.order_by
|
||||
@@ -80,7 +75,7 @@ if (menu.menu_categories)
|
||||
alt_name: its.alt_name,
|
||||
min_selectable_qty: its.min_selectable_qty,
|
||||
max_selectable_qty: its.max_selectable_qty,
|
||||
instances: its.menu_item_instances.pluck(:id).map { |id| {id: id}}
|
||||
instances: its.menu_item_instances.map { |i| {id: i.id} }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +95,7 @@ if (menu.menu_categories)
|
||||
json.is_default is.is_default
|
||||
json.is_on_promotion is.is_on_promotion
|
||||
json.promotion_price is.promotion_price
|
||||
json.out_of_stock is.is_out_of_stock
|
||||
json.values instance_attr
|
||||
end
|
||||
end
|
||||
|
||||
@@ -155,6 +155,7 @@
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-block btn-lg bg-default waves-effect" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
|
||||
<button type="button" class="btn btn-danger btn- action-btn" id='cancel_all_void'>Cancel All Void</button>
|
||||
<button type="button" class="btn btn-block btn-lg bg-blue waves-effect" id='apply'>Apply</button>
|
||||
</div>
|
||||
@@ -421,7 +422,7 @@ var access_code = localStorage.getItem("access_code");
|
||||
}
|
||||
}
|
||||
|
||||
function checkPrice(obj_value,sale_item_id) {
|
||||
|
||||
}
|
||||
$('#add_order').on('click', function () {
|
||||
window.location.href = '/foodcourt/food_court?sale_id=<%=@saleobj.sale_id %>';
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -31,7 +31,7 @@ div.form-inputs span{
|
||||
<%= f.input :print_copy %>
|
||||
<%= f.hidden_field :processing_items %>
|
||||
<%= f.label "Select Zones", :class => 'control-label' %>
|
||||
<%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'checkbox'%>
|
||||
<%= f.collection_check_boxes :zone_ids , Zone.shop, :id, :name , :class => 'checkbox'%>
|
||||
<%= f.input :cut_per_item %>
|
||||
<%= f.input :use_alternate_name %>
|
||||
<%= f.input :processing_items, as: :hidden %>
|
||||
@@ -69,24 +69,24 @@ div.form-inputs span{
|
||||
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.order_queue_stations_txt") %> <br>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var serverMode = "<%= @server_mode %>";
|
||||
var serverMode = "<%= @server_mode %>";
|
||||
if(serverMode == 'cloud'){
|
||||
var printers = code2lab.getPrinters();
|
||||
var printerInfo = JSON.parse([printers]);
|
||||
var select = $("#order_queue_station_printer_name");
|
||||
var printers = code2lab.getPrinters();
|
||||
var printerInfo = JSON.parse([printers]);
|
||||
var select = $("#order_queue_station_printer_name");
|
||||
|
||||
$.each(printerInfo, function(key, value) {
|
||||
$.each(printerInfo, function(key, value) {
|
||||
$('#order_queue_station_printer_name')
|
||||
.append($("<option></option>")
|
||||
.attr("value",value.target)
|
||||
.text(value.deviceName));
|
||||
});
|
||||
}
|
||||
.text(value.deviceName));
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# application_path="#{File.expand_path("../..", __FILE__)}"
|
||||
# directory application_path
|
||||
# #environment ENV.fetch("RAILS_ENV") { "production" }
|
||||
# environment "production"
|
||||
# pidfile "#{application_path}/tmp/puma/pid"
|
||||
# state_path "#{application_path}/tmp/puma/state"
|
||||
# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||
# port ENV.fetch("PORT") { 62158 }
|
||||
# workers 2
|
||||
# preload_app!
|
||||
# threads 1,1
|
||||
application_path="#{File.expand_path("../..", __FILE__)}"
|
||||
directory application_path
|
||||
#environment ENV.fetch("RAILS_ENV") { "production" }
|
||||
environment "production"
|
||||
pidfile "#{application_path}/tmp/puma/pid"
|
||||
state_path "#{application_path}/tmp/puma/state"
|
||||
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||
port ENV.fetch("PORT") { 62158 }
|
||||
workers 2
|
||||
preload_app!
|
||||
threads 1,1
|
||||
|
||||
@@ -83,7 +83,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
get "customers/get_order/:id" => "customers#get_customer_order"
|
||||
|
||||
#get customer last five orders
|
||||
get "customers/get_orders/:customer_id" => "customers#get_customer_last_orders"
|
||||
get "get_customer_last_orders" => "customers#get_customer_last_orders"
|
||||
|
||||
#Generating Invoice and making payments - output render @sale
|
||||
resources :invoices, only: [:index, :show, :create, :update, :destroy] do
|
||||
@@ -677,6 +677,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
|
||||
get '/:addorders/:id' => "addorders#detail"
|
||||
post '/:addorders/create' => "addorders#create",:as => "addorder_create", :defaults => { :format => 'json' }
|
||||
post '/:addorders/add_to_existing_order' => "addorders#add_to_existing_order",:as => "add_to_existing_order", :defaults => { :format => 'json' }
|
||||
|
||||
|
||||
get '/addorders/get_item_instance/:id' => "addorders#get_item_instance",:as => "get_item_instance", :defaults => { :format => 'json' }
|
||||
|
||||
Reference in New Issue
Block a user