update waiter view add order
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
|
var role = $('#role').val();
|
||||||
type = $('#type').val();
|
type = $('#type').val();
|
||||||
modify_order = $('#modify_order').val();
|
modify_order = $('#modify_order').val();
|
||||||
//click menu sidebar menu category
|
//click menu sidebar menu category
|
||||||
@@ -758,7 +758,11 @@ $(function() {
|
|||||||
|
|
||||||
type = $('#type').val();
|
type = $('#type').val();
|
||||||
if (type == 'true') {
|
if (type == 'true') {
|
||||||
type = 'cashier'
|
// if (role == 'waiter') {
|
||||||
|
type = 'quick_service'
|
||||||
|
// }else{
|
||||||
|
// type = 'cashier'
|
||||||
|
// }
|
||||||
|
|
||||||
var table_type = $('#table_type').text();
|
var table_type = $('#table_type').text();
|
||||||
var table_id = $('#table_id').val();
|
var table_id = $('#table_id').val();
|
||||||
@@ -773,28 +777,30 @@ $(function() {
|
|||||||
var booking_id = $('#booking_id').text();
|
var booking_id = $('#booking_id').text();
|
||||||
var ajax_url = '../addorders/create';
|
var ajax_url = '../addorders/create';
|
||||||
}
|
}
|
||||||
if (!booking_id.length > 0) {
|
var order_items = JSON.stringify(get_order_item_rows());
|
||||||
|
if (booking_id.length > 0) {
|
||||||
|
|
||||||
var params = {'order_source': type, 'order_type': "dine_in",
|
var params = {'order_source': type, 'order_type': "dine_in",
|
||||||
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
|
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
|
||||||
'table_id': table_id,
|
'table_id': table_id,
|
||||||
'order_items': order_items };
|
'order_items': order_items };
|
||||||
}
|
}else{
|
||||||
|
|
||||||
var order_items = JSON.stringify(get_order_item_rows());
|
|
||||||
|
|
||||||
var params = {'order_source': type, 'order_type': "dine_in",
|
var params = {'order_source': type, 'order_type': "dine_in",
|
||||||
'customer_id': customer_id, 'guest_info': "",
|
'customer_id': customer_id, 'guest_info': "",
|
||||||
'table_id': table_id,
|
'table_id': table_id,
|
||||||
'order_items': order_items };
|
'order_items': order_items };
|
||||||
if (table_id.length>0) {
|
}
|
||||||
|
|
||||||
|
if (table_id.length>0 || role == 'waiter') {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: params,
|
data: params,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success:function(result){
|
success:function(result){
|
||||||
|
if (type == "quick_service") {
|
||||||
|
window.location.href = "/origami/quick_service"
|
||||||
|
}else{
|
||||||
if(table_type == "Table"){
|
if(table_type == "Table"){
|
||||||
window.location.href = "/origami/table/" + table_id
|
window.location.href = "/origami/table/" + table_id
|
||||||
}
|
}
|
||||||
@@ -802,6 +808,7 @@ $(function() {
|
|||||||
window.location.href = "/origami/room/" + table_id
|
window.location.href = "/origami/room/" + table_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
$(this).removeAttr('disabled', '');
|
$(this).removeAttr('disabled', '');
|
||||||
@@ -835,21 +842,20 @@ $(function() {
|
|||||||
var booking_id = $('#booking_id').text();
|
var booking_id = $('#booking_id').text();
|
||||||
var sale_id = ""
|
var sale_id = ""
|
||||||
}
|
}
|
||||||
|
var order_items = JSON.stringify(get_order_item_rows());
|
||||||
if (!booking_id.length > 0) {
|
if (booking_id.length > 0) {
|
||||||
|
|
||||||
var params = {'order_source': type, 'order_type': "dine_in",
|
var params = {'order_source': type, 'order_type': "dine_in",
|
||||||
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
|
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
|
||||||
'table_id': table_id,
|
'table_id': table_id,
|
||||||
'order_items': order_items };
|
'order_items': order_items,'sale_id': sale_id };
|
||||||
}
|
}else{
|
||||||
var order_items = JSON.stringify(get_order_item_rows());
|
|
||||||
|
|
||||||
var params = {'order_source': type, 'order_type': "dine_in",
|
var params = {'order_source': type, 'order_type': "dine_in",
|
||||||
'customer_id': customer_id, 'guest_info': "",
|
'customer_id': customer_id, 'guest_info': "",
|
||||||
'table_id': table_id,
|
'table_id': table_id,
|
||||||
'order_items': order_items,'sale_id': sale_id };
|
'order_items': order_items,'sale_id': sale_id };
|
||||||
console.log(params)
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
@@ -858,9 +864,13 @@ $(function() {
|
|||||||
success:function(result){
|
success:function(result){
|
||||||
console.log(result)
|
console.log(result)
|
||||||
if (result.status) {
|
if (result.status) {
|
||||||
|
if (result.data == null){
|
||||||
|
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
|
||||||
|
}else{
|
||||||
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"
|
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -153,13 +153,18 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
@status, @booking = @order.generate
|
@status, @booking = @order.generate
|
||||||
|
if current_user.role != "waiter"
|
||||||
if @status && @booking && @order.source == 'quick_service'
|
if @status && @booking && @order.source == 'quick_service'
|
||||||
|
|
||||||
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
||||||
result = {:status=> @status, :data => @sale }
|
result = {:status=> @status, :data => @sale }
|
||||||
render :json => result.to_json
|
render :json => result.to_json
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
result = {:status=> @status, :data => 0 }
|
||||||
|
render :json => result.to_json
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# render json for http status code
|
# render json for http status code
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
#end rounding adjustment
|
#end rounding adjustment
|
||||||
|
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
sale_payment.process_payment(saleObj, @usercurrent_user.name, cash, "cash")
|
sale_payment.process_payment(saleObj, current_user.name, cash, "cash")
|
||||||
|
|
||||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error "})
|
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error "})
|
||||||
rebate_amount = nil
|
rebate_amount = nil
|
||||||
|
|||||||
@@ -2,21 +2,46 @@ class Origami::PendingOrderController < BaseOrigamiController
|
|||||||
def index
|
def index
|
||||||
# @dining= DiningFacility.where("status = 'occupied'")
|
# @dining= DiningFacility.where("status = 'occupied'")
|
||||||
# @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d'))
|
# @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d'))
|
||||||
@sale = Sale.pending_order
|
@sale = Sale.pending_sale
|
||||||
|
@order = Sale.pending_order
|
||||||
|
|
||||||
end
|
end
|
||||||
def show
|
def show
|
||||||
@sales = Sale.pending_order
|
@sales = Sale.pending_sale
|
||||||
@sale = Sale.find(params[:sale_id])
|
@orders = Sale.pending_order
|
||||||
|
@id = params[:sale_id]
|
||||||
|
if(@id[0,3] == "SAL")
|
||||||
|
@sale = Sale.find(@id)
|
||||||
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
||||||
@booking = BookingOrder.find_by_order_id(@order).booking_id
|
@booking = BookingOrder.find_by_order_id(@order).booking_id
|
||||||
if Booking.find(@booking).dining_facility_id.to_i > 0
|
@bookings = Booking.find(@booking)
|
||||||
@table_id = Booking.find(@booking).dining_facility_id
|
@status = "sale"
|
||||||
|
else
|
||||||
|
# @booking = BookingOrder.find_by_order_id(@order).booking_id
|
||||||
|
@bookings = Booking.find(@id)
|
||||||
|
@status = "order"
|
||||||
|
|
||||||
|
@order_items = Array.new
|
||||||
|
@bookings.booking_orders.each do |booking_order|
|
||||||
|
order = Order.find(booking_order.order_id)
|
||||||
|
if (order.status == "new")
|
||||||
|
order.order_items.each do |item|
|
||||||
|
@order_items.push(item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if @bookings.dining_facility_id.to_i > 0
|
||||||
|
@table_id = Booking.find(@bookings.booking_id).dining_facility_id
|
||||||
@dining = DiningFacility.find(@table_id)
|
@dining = DiningFacility.find(@table_id)
|
||||||
else
|
else
|
||||||
@table_id = nil
|
@table_id = nil
|
||||||
@dining = nil
|
@dining = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
helper_method :shop_detail
|
helper_method :shop_detail
|
||||||
def shop_detail
|
def shop_detail
|
||||||
@shop = Shop.first
|
@shop = Shop.first
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ class Origami::QuickServiceController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
@status, @booking = @order.generate
|
@status, @booking = @order.generate
|
||||||
|
if(params[:sale_id][0,3] == "SAL")
|
||||||
if @status && @booking && @order.source == 'quick_service'
|
if @status && @booking && @order.source == 'quick_service'
|
||||||
if params[:sale_id]
|
if params[:sale_id]
|
||||||
@sale = Sale.find(params[:sale_id])
|
@sale = Sale.find(params[:sale_id])
|
||||||
@@ -149,6 +149,11 @@ class Origami::QuickServiceController < ApplicationController
|
|||||||
result = {:status=> true, :data => @sale }
|
result = {:status=> true, :data => @sale }
|
||||||
render :json => result.to_json
|
render :json => result.to_json
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
result = {:status=> true, :data => nil }
|
||||||
|
render :json => result.to_json
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_menu_category ()
|
def get_menu_category ()
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ class Origami::RequestBillsController < ApplicationController
|
|||||||
if !ShiftSale.current_shift.nil?
|
if !ShiftSale.current_shift.nil?
|
||||||
order_id = params[:id] # order_id
|
order_id = params[:id] # order_id
|
||||||
bk_order = BookingOrder.find_by_order_id(order_id)
|
bk_order = BookingOrder.find_by_order_id(order_id)
|
||||||
|
puts params[:id]
|
||||||
|
puts bk_order
|
||||||
|
puts bk_order.booking_id
|
||||||
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
||||||
|
|
||||||
if check_booking.sale_id.nil?
|
if check_booking.sale_id.nil?
|
||||||
|
|||||||
@@ -1315,12 +1315,19 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.pending_order
|
def self.pending_sale
|
||||||
query = Sale.all
|
query = Sale.all
|
||||||
query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id")
|
query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id")
|
||||||
.joins("join orders as orders on orders.order_id = sale_orders.order_id")
|
.joins("join orders as orders on orders.order_id = sale_orders.order_id")
|
||||||
query = query.where("sales.sale_status = 'new' AND orders.status = 'billed' AND orders.source =? ","quick_service")
|
query = query.where("sales.sale_status = 'new' AND orders.status = 'billed' AND orders.source =? ","quick_service")
|
||||||
end
|
end
|
||||||
|
def self.pending_order
|
||||||
|
query = Booking.all
|
||||||
|
query = query.joins("join booking_orders as booking_orders on booking_orders.booking_id = bookings.booking_id")
|
||||||
|
.joins("join orders as orders on orders.order_id = booking_orders.order_id")
|
||||||
|
query = query.where("bookings.booking_status = 'assign' AND orders.status = 'new' AND orders.source =? ","quick_service")
|
||||||
|
.group("bookings.booking_id")
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
<% modify_order = request.path_info.include?('modify_order')%>
|
<% modify_order = request.path_info.include?('modify_order')%>
|
||||||
<input type="hidden" name="type" id="type" value="<%=type%>">
|
<input type="hidden" name="type" id="type" value="<%=type%>">
|
||||||
<input type="hidden" name="type" id="modify_order" value="<%=modify_order%>">
|
<input type="hidden" name="type" id="modify_order" value="<%=modify_order%>">
|
||||||
|
<input type="hidden" name="type" id="role" value="<%= current_user.role%>">
|
||||||
|
|
||||||
<div class="row m-t--20">
|
<div class="row m-t--20">
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
<!-- <a href="javascript:void(0);" class="dropdown-toggle waves-block p-t-15 p-l-15 p-b-15" data-toggle="dropdown" aria-haspopup="" aria-expanded="true" style="background-color: #eeeeee;border-bottom: .214rem solid #fff;border-left: 1px solid #54A5AF;
|
<!-- <a href="javascript:void(0);" class="dropdown-toggle waves-block p-t-15 p-l-15 p-b-15" data-toggle="dropdown" aria-haspopup="" aria-expanded="true" style="background-color: #eeeeee;border-bottom: .214rem solid #fff;border-left: 1px solid #54A5AF;
|
||||||
@@ -133,19 +135,19 @@
|
|||||||
<!-- <i class="material-icons">reply</i> -->
|
<!-- <i class="material-icons">reply</i> -->
|
||||||
Back
|
Back
|
||||||
</button>
|
</button>
|
||||||
<% if current_user.role != "waiter"%>
|
|
||||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-7" id='pending_order'>Pending Order
|
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-7" id='pending_order'>Pending Order
|
||||||
</button>
|
</button>
|
||||||
<%end%>
|
|
||||||
<%elsif !modify_order && type%>
|
<%elsif !modify_order && type%>
|
||||||
<button type="button" class="btn btn-lg btn-default waves-effect col-md-2" id='back' style=" padding: .5rem 0.15rem !important;">
|
<button type="button" class="btn btn-lg btn-default waves-effect col-md-2" id='back' style=" padding: .5rem 0.15rem !important;">
|
||||||
<!-- <i class="material-icons">reply</i> -->
|
<!-- <i class="material-icons">reply</i> -->
|
||||||
Back
|
Back
|
||||||
</button>
|
</button>
|
||||||
<% if current_user.role != "waiter"%>
|
|
||||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
|
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
|
||||||
</button>
|
</button>
|
||||||
<%end%>
|
|
||||||
<a class="btn btn-lg bg-blue waves-effect select_table col-md-3" data-toggle="modal" data-target="#TableModal" style=" padding: .5rem 0.15rem !important;">Select</a>
|
<a class="btn btn-lg bg-blue waves-effect select_table col-md-3" data-toggle="modal" data-target="#TableModal" style=" padding: .5rem 0.15rem !important;">Select</a>
|
||||||
<input type="hidden" name="table_id" value="" id="table_id">
|
<input type="hidden" name="table_id" value="" id="table_id">
|
||||||
|
|
||||||
@@ -225,10 +227,13 @@
|
|||||||
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
|
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
|
||||||
<% if current_user.role != "waiter"%>
|
<% if current_user.role != "waiter"%>
|
||||||
<button type="button" class="btn btn-primary action-btn create col-md-4" 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>
|
<button type="button" class="btn btn-primary action-btn create col-md-4" 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>
|
||||||
|
<button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
|
||||||
|
<%end%>
|
||||||
|
<% if current_user.role == "waiter"%>
|
||||||
|
<button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
|
||||||
<%end%>
|
<%end%>
|
||||||
<button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Create Order</button>
|
|
||||||
<%else%>
|
<%else%>
|
||||||
<button type="button" class="btn btn-primary action-btn create col-md-11" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Create Order</button>
|
<button type="button" class="btn btn-primary action-btn create col-md-11" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -276,11 +276,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
# end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if @status_order == 'order' && @status_sale != 'sale'
|
if @status_order == 'order' && @status_sale != 'sale'
|
||||||
|
puts
|
||||||
unless @order_items.nil? || @order_items.empty?
|
unless @order_items.nil? || @order_items.empty?
|
||||||
count = 0
|
count = 0
|
||||||
@order_items.each do |order_item|
|
@order_items.each do |order_item|
|
||||||
|
|||||||
@@ -734,15 +734,11 @@ console.log("fffffffffffff")
|
|||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||||
success: function () {
|
success: function () {
|
||||||
<<<<<<< HEAD
|
|
||||||
if (cashier_type=="cashier") {
|
if (cashier_type=="cashier") {
|
||||||
window.location.href = '/origami';
|
window.location.href = '/origami';
|
||||||
}else{
|
}else{
|
||||||
window.location.href = '/origami/quick_service';
|
window.location.href = '/origami/quick_service';
|
||||||
}
|
}
|
||||||
=======
|
|
||||||
window.location.href = '/origami/';
|
|
||||||
>>>>>>> 77a66d726bc48a7c5d8be7c12728c1d0a9a5621e
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -782,29 +778,6 @@ console.log("fffffffffffff")
|
|||||||
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark };
|
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark };
|
||||||
|
|
||||||
if ($(this).attr('active')=== "true") {
|
if ($(this).attr('active')=== "true") {
|
||||||
<<<<<<< HEAD
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: "<%= origami_payment_foc_path %>",
|
|
||||||
data: params,
|
|
||||||
success:function(result){
|
|
||||||
|
|
||||||
//$( "#loading_wrapper" ).hide();
|
|
||||||
|
|
||||||
if (cash >= 0) {
|
|
||||||
swal({
|
|
||||||
title: "Information!",
|
|
||||||
text: 'Thank You !',
|
|
||||||
}, function () {
|
|
||||||
if (cashier_type=="cashier") {
|
|
||||||
window.location.href = '/origami';
|
|
||||||
}else{
|
|
||||||
window.location.href = '/origami/quick_service';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
=======
|
|
||||||
swal({
|
swal({
|
||||||
title: "Alert",
|
title: "Alert",
|
||||||
text: "Are you sure want to FOC This Receipt?",
|
text: "Are you sure want to FOC This Receipt?",
|
||||||
@@ -830,7 +803,6 @@ console.log("fffffffffffff")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
>>>>>>> 77a66d726bc48a7c5d8be7c12728c1d0a9a5621e
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,14 @@
|
|||||||
<% @sale.each do |sale| %>
|
<% @sale.each do |sale| %>
|
||||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% @order.each do |order| %>
|
||||||
|
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -12,7 +12,14 @@
|
|||||||
<% @sales.each do |sale| %>
|
<% @sales.each do |sale| %>
|
||||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% @orders.each do |order| %>
|
||||||
|
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -31,19 +38,38 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="card-title row p-l-5 p-r-5">
|
<div class="card-title row p-l-5 p-r-5">
|
||||||
|
|
||||||
|
<% if @status == 'sale' %>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
Receipt No: <span id="receipt_no">
|
Receipt No: <span id="receipt_no">
|
||||||
<%= @sale.receipt_no rescue '' %>
|
<%= @sale.receipt_no rescue '' %></span>
|
||||||
</span>
|
|
||||||
</div>
|
</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">
|
||||||
|
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
|
||||||
|
</div>
|
||||||
|
<% end%>
|
||||||
|
|
||||||
|
|
||||||
|
<% if @status == 'sale' %>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> </span>
|
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> </span>
|
||||||
</div>
|
</div>
|
||||||
|
<% else%>
|
||||||
|
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
|
||||||
|
Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> </span>
|
||||||
|
</div>
|
||||||
|
<% end%>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-title row customer_detail p-l-5 p-r-5">
|
<div class="card-title row customer_detail p-l-5 p-r-5">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<% if @status == 'sale' %>
|
||||||
Customer : <%= @sale.customer.name rescue "-" %>
|
Customer : <%= @sale.customer.name rescue "-" %>
|
||||||
|
<% else%>
|
||||||
|
Customer : <%= @order.customer.name rescue "-" %>
|
||||||
|
<% end%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -58,34 +84,37 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<%
|
<% if @status == 'sale' %>
|
||||||
sub_total = 0
|
<% sub_total = 0
|
||||||
@sale.sale_items.each do |sale_item|
|
@sale.sale_items.each do |sale_item|
|
||||||
sub_total = sub_total + sale_item.price
|
sub_total = sub_total + sale_item.price %>
|
||||||
%>
|
|
||||||
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
||||||
<% #unless sale_item.price <= 0 %>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class='item-name'><%= sale_item.product_name %></td>
|
<td class='item-name'><%= sale_item.product_name %></td>
|
||||||
<td class='item-attr'><%= sale_item.qty %></td>
|
<td class='item-attr'><%= sale_item.qty %></td>
|
||||||
<td class='item-attr'><%= sale_item.price %></td>
|
<td class='item-attr'><%= sale_item.price %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<% end%>
|
||||||
|
<% else%>
|
||||||
|
<% sub_total = 0
|
||||||
|
@order_items.each do |order_item|
|
||||||
|
sub_total = sub_total + order_item.price %>
|
||||||
|
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
|
||||||
|
<tr>
|
||||||
|
<td class='item-name'><%= order_item.item_name %></td>
|
||||||
|
<td class='item-attr'><%= order_item.qty %></td>
|
||||||
|
<td class='item-attr'><%= order_item.price %></td>
|
||||||
|
</tr>
|
||||||
|
<% end%>
|
||||||
|
<% end%>
|
||||||
|
|
||||||
#end
|
|
||||||
end
|
|
||||||
|
|
||||||
%>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<table class="table" id="order-charges-table" border="0">
|
<table class="table" id="order-charges-table" border="0">
|
||||||
<tr>
|
<% if @status == 'sale' %>
|
||||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
|
||||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<%if @sale.discount_type == 'member_discount'%>
|
<%if @sale.discount_type == 'member_discount'%>
|
||||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||||
@@ -107,6 +136,12 @@
|
|||||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rebate_amount"></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>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -115,8 +150,15 @@
|
|||||||
<!-- Column Three -->
|
<!-- Column Three -->
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||||
|
<% if current_user.role != "waiter" || @status != "sale"%>
|
||||||
<button type="button" id="addorder" class="btn bg-blue btn-block">Add Order</button>
|
<button type="button" id="addorder" class="btn bg-blue btn-block">Add Order</button>
|
||||||
|
<%end%>
|
||||||
|
<% if current_user.role != "waiter"%>
|
||||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
<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>
|
||||||
|
<%end%>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -135,7 +177,7 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
$('#addorder').on('click', function () {
|
$('#addorder').on('click', function () {
|
||||||
var table_id = "<%=@table_id%>";
|
var table_id = "<%=@table_id%>";
|
||||||
var booking_id = "<%=@booking%>";
|
var booking_id = "<%=@bookings.booking_id%>";
|
||||||
if (table_id) {
|
if (table_id) {
|
||||||
window.location.href = '/origami/quick_service/modify_order/' + table_id+"/"+$('#sale_id').val();
|
window.location.href = '/origami/quick_service/modify_order/' + table_id+"/"+$('#sale_id').val();
|
||||||
}else{
|
}else{
|
||||||
@@ -143,5 +185,23 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
// Bill Request
|
||||||
|
$('#request_bills').click(function () {
|
||||||
|
var order_id = $('#save_order_id').val();
|
||||||
|
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: ajax_url,
|
||||||
|
// data: 'order_id='+ order_id,
|
||||||
|
success: function (result) {
|
||||||
|
if (!result.status) {
|
||||||
|
swal("Information!", result.error_message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user