void
This commit is contained in:
186
app/assets/javascripts/foodcourt.js
Normal file
186
app/assets/javascripts/foodcourt.js
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
//= require jquery
|
||||||
|
//= require tether
|
||||||
|
//= require jquery_ujs
|
||||||
|
//= require bootstrap/js/popper.min
|
||||||
|
//= require bootstrap/js/bootstrap-material-design.min
|
||||||
|
//= require momentjs/moment
|
||||||
|
//= require bootstrap-material-datetimepicker/js/bootstrap-material-datetimepicker
|
||||||
|
//= require jquery-slimscroll/jquery.slimscroll.js
|
||||||
|
//= require bootstrap-notify/bootstrap-notify.js
|
||||||
|
//= require node-waves/waves.js
|
||||||
|
//= require sweetalert/sweetalert.min.js
|
||||||
|
//= require fileinput.min
|
||||||
|
//= require cable
|
||||||
|
//= require turbolinks
|
||||||
|
//= require BSBMaterial/turbolink_admin.js
|
||||||
|
//= require BSBMaterial/demo.js
|
||||||
|
|
||||||
|
/* Constant Varaibles */
|
||||||
|
_CREDIT_PAYMENTS_ = "/ CREDIT PAYMENTS";
|
||||||
|
_CUSTOMERS_ = "/ CUSTOMERS";
|
||||||
|
_DISCOUNTS_ = "/ DISCOUNTS";
|
||||||
|
_IN_DUTIES_ = "/ IN DUTIES";
|
||||||
|
_JCB_ = "/ JCB PAYMENT";
|
||||||
|
_MASTER_ = "/ MASTER PAYMENT";
|
||||||
|
_MPU_ = "/ MPU PAYMENT";
|
||||||
|
_ALIPAY_ = "/ Alipay";
|
||||||
|
_JUNCTIONPAY_ = "/ JunctionPay";
|
||||||
|
_PAYMAL_ = "/ PAYMAL";
|
||||||
|
_DINGA_ = "/ DINGA PAYMENT";
|
||||||
|
_GIFT_VOUCHER_ = "/ GIFT VOUCHER";
|
||||||
|
_OTHER_CHARGES_ = "/ CHARGES";
|
||||||
|
_OTHER_PAYMENTS_ = "/ OTHER PAYMENT";
|
||||||
|
_PAYMENTS_ = "/ PAYMENT";
|
||||||
|
_PAYPAR_PAYMENT_ = "/ PAYPAR PAYMENT";
|
||||||
|
_COMMISSIONS_ = "/ COMMISSIONS";
|
||||||
|
_REDEEM_PAYMENT_ = "/ REDEEM PAYMENT";
|
||||||
|
_SALE_EDIT_ = "/ SALE EDIT";
|
||||||
|
_SPLIT_BILL_ = "/ SPLIT BILL";
|
||||||
|
_UNION_ = "/ UNION PAYMENT";
|
||||||
|
_VISA_ = "/ VISA PAYMENT";
|
||||||
|
_VOUCHER_ = "/ VOUCHER";
|
||||||
|
_SURVEY_ = "/ SURVEY";
|
||||||
|
/* Constant Varaibles */
|
||||||
|
|
||||||
|
$(document).on('turbolinks:load', function() {
|
||||||
|
|
||||||
|
$("#customer_image_path").fileinput({
|
||||||
|
previewFileType: "image",
|
||||||
|
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||||
|
browseClass: "btn btn-success",
|
||||||
|
browseLabel: "Pick Image",
|
||||||
|
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||||
|
removeClass: "btn btn-danger",
|
||||||
|
removeLabel: "Delete",
|
||||||
|
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||||
|
showUpload: false,
|
||||||
|
// uploadClass: "btn btn-info",
|
||||||
|
// uploadLabel: "Upload",
|
||||||
|
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||||
|
previewTemplates: {
|
||||||
|
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||||
|
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||||
|
'</div>\n',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.datetimepicker').bootstrapMaterialDatePicker({
|
||||||
|
format: 'DD-MM-YYYY - HH:mm',
|
||||||
|
clearButton: true,
|
||||||
|
weekStart: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.datepicker').bootstrapMaterialDatePicker({
|
||||||
|
format: 'DD-MM-YYYY',
|
||||||
|
clearButton: true,
|
||||||
|
weekStart: 1,
|
||||||
|
time: false
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.timepicker').bootstrapMaterialDatePicker({
|
||||||
|
format: 'HH:mm',
|
||||||
|
clearButton: true,
|
||||||
|
date: false
|
||||||
|
});
|
||||||
|
|
||||||
|
// For selected order return
|
||||||
|
var order_status = "";
|
||||||
|
order_status = $(".selected-item").children().find(".orders-order-status").text().substr(0,6).trim();
|
||||||
|
|
||||||
|
|
||||||
|
$(document).on('click', '.access_modal', function(event){
|
||||||
|
type = $(this).data("type");
|
||||||
|
$(".ok").attr("data-action",type);
|
||||||
|
$('#AccessCodeModal').modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.access_number', function(event){
|
||||||
|
if(event.handled !== true) {
|
||||||
|
var original_value = $('#access_code').val();
|
||||||
|
var input_type = $(this).attr("data-type");
|
||||||
|
|
||||||
|
switch (input_type) {
|
||||||
|
case 'num':
|
||||||
|
var input_value = $(this).attr("data-value");
|
||||||
|
if (original_value){
|
||||||
|
$('#access_code').val(original_value + input_value);
|
||||||
|
}else{
|
||||||
|
$('#access_code').val(original_value + input_value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'ok':
|
||||||
|
var type = $(this).attr("data-action");
|
||||||
|
code = $('#access_code').val();
|
||||||
|
check_emp_access_code(code,type)
|
||||||
|
break;
|
||||||
|
case 'clr':
|
||||||
|
$('#access_code').val("");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
event.handled = true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function setHeaderBreadCrumb(params){
|
||||||
|
$("#others_payment").html(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
//show hide nav bar for webview
|
||||||
|
function showHideNavbar(webview,page){
|
||||||
|
if(webview){
|
||||||
|
$("nav.navbar").addClass("hidden");
|
||||||
|
$("section").addClass("section-margin");
|
||||||
|
$(".page-loader-wrapper").addClass("hidden");
|
||||||
|
if(page!=undefined){
|
||||||
|
$("#back").hide();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$("nav.navbar").removeClass("hidden");
|
||||||
|
$("section").removeClass("section-margin");
|
||||||
|
$(".page-loader-wrapper").removeClass("hidden");
|
||||||
|
if(page!=undefined){
|
||||||
|
$("#back").show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createAccessCode(code) {
|
||||||
|
localStorage.setItem("access_code",code);
|
||||||
|
}
|
||||||
|
function check_emp_access_code(access_code,type) {
|
||||||
|
var url = "/foodcourt/check_emp_access_code/" + access_code ;
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: url,
|
||||||
|
data: {},
|
||||||
|
success: function (result) {
|
||||||
|
if (result.status == true) {
|
||||||
|
createAccessCode(code);
|
||||||
|
if (type == "edit") {
|
||||||
|
var dining_id = $('#dining').text();
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
if (dining_id) {
|
||||||
|
window.location.href = '/foodcourt/table/' + dining_id + "/sale/" + sale_id + "/food_court/edit";
|
||||||
|
}else{
|
||||||
|
window.location.href = "/foodcourt/table/sale/" + sale_id + "/food_court/edit";
|
||||||
|
}
|
||||||
|
}else if(type == "void"){
|
||||||
|
$('#AccessCodeModal').modal('hide');
|
||||||
|
$('#voidModal').modal('show');
|
||||||
|
}else if(type == "waste") {
|
||||||
|
waste_and_spoilage("waste")
|
||||||
|
}else if(type == "spoile") {
|
||||||
|
waste_and_spoilage("spoile")
|
||||||
|
}else if(type == "foc"){
|
||||||
|
$('#AccessCodeModal').modal('hide');
|
||||||
|
$('#focModal').modal('show');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
swal("Oops",result.message,"warning");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class Api::PaymentsController < Api::ApiController
|
class Api::PaymentsController < Api::ApiController
|
||||||
# skip_before_action :authenticate
|
skip_before_action :authenticate
|
||||||
|
|
||||||
#Payment by Invoice ID
|
#Payment by Invoice ID
|
||||||
# Payment Method - [Cash | CreditNote | VISA | MASTER | etc..]
|
# Payment Method - [Cash | CreditNote | VISA | MASTER | etc..]
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
|||||||
.joins("JOIN orders ON orders.order_id=booking_orders.order_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 order_items ON orders.order_id=order_items.order_id")
|
||||||
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
|
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
|
||||||
.where("orders.source='app' and bookings.shop_code='#{Shop.current_shop.shop_code}' and DATE(bookings.created_at) = '#{Date.today}'").order("bookings.created_at desc").uniq
|
.where("orders.source='app' and bookings.shop_code='#{Shop.current_shop.shop_code}'").order("bookings.created_at desc").uniq
|
||||||
|
# .where("orders.source='app' and bookings.shop_code='#{Shop.current_shop.shop_code}' and DATE(bookings.created_at) = '#{Date.today}'").order("bookings.created_at desc").uniq
|
||||||
end
|
end
|
||||||
def completed
|
def completed
|
||||||
customer =Customer.find_by_customer_id(params[:customer_id])
|
customer =Customer.find_by_customer_id(params[:customer_id])
|
||||||
|
|||||||
@@ -33,15 +33,6 @@ class Foodcourt::VoidController < BaseFoodcourtController
|
|||||||
sale.sale_status = 'void'
|
sale.sale_status = 'void'
|
||||||
sale.save
|
sale.save
|
||||||
|
|
||||||
# No Need
|
|
||||||
# bookings = sale.bookings
|
|
||||||
# bookings.each do |booking|
|
|
||||||
# orders = booking.orders
|
|
||||||
# orders.each do |order|
|
|
||||||
# # order.status = 'void'
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
||||||
if sale.bookings[0].dining_facility_id.to_i > 0
|
if sale.bookings[0].dining_facility_id.to_i > 0
|
||||||
table_avaliable = true
|
table_avaliable = true
|
||||||
table_count = 0
|
table_count = 0
|
||||||
@@ -79,8 +70,14 @@ class Foodcourt::VoidController < BaseFoodcourtController
|
|||||||
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
||||||
sale_audit = SaleAudit.record_audit_for_edit(sale_id,current_user.name, action_by,remark,"SALEVOID" )
|
sale_audit = SaleAudit.record_audit_for_edit(sale_id,current_user.name, action_by,remark,"SALEVOID" )
|
||||||
|
|
||||||
# For Print
|
#call paymal to void
|
||||||
|
if sale.sale_payments
|
||||||
|
membership_response =sale.paymal_payment_void
|
||||||
|
end
|
||||||
|
Rails.logger.debug "---------Paymal Payment Void response in VoidController"
|
||||||
|
Rails.logger.debug membership_response.to_json
|
||||||
|
|
||||||
|
# For Print
|
||||||
member_info = nil
|
member_info = nil
|
||||||
rebate_amount = nil
|
rebate_amount = nil
|
||||||
current_balance = nil
|
current_balance = nil
|
||||||
@@ -102,17 +99,6 @@ class Foodcourt::VoidController < BaseFoodcourtController
|
|||||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
|
||||||
# get printer info
|
|
||||||
# print_settings = PrintSetting.find_by_unique_code('ReceiptBillPdf') # SaleItemsPdf
|
|
||||||
#
|
|
||||||
# if !print_settings.nil?
|
|
||||||
# unique_code = 'ReceiptBillPdf'
|
|
||||||
# elsif
|
|
||||||
# unique_code = 'ReceiptBillStarPdf'
|
|
||||||
# end
|
|
||||||
|
|
||||||
customer= Customer.find(sale.customer_id)
|
customer= Customer.find(sale.customer_id)
|
||||||
|
|
||||||
# get member information
|
# get member information
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Origami::RequestBillsController < ApplicationController
|
|||||||
# Print Request Bill and add to sale tables
|
# Print Request Bill and add to sale tables
|
||||||
def print
|
def print
|
||||||
@shop = Shop.current_shop
|
@shop = Shop.current_shop
|
||||||
if !ShiftSale.current_shift(@shop.shop_code).nil?
|
if !ShiftSale.current_shift.nil?
|
||||||
order_id = params[:id] # order_id
|
order_id = params[:id] # order_id
|
||||||
order = Order.find(order_id)
|
order = Order.find(order_id)
|
||||||
booking = order.booking
|
booking = order.booking
|
||||||
@@ -46,7 +46,7 @@ class Origami::RequestBillsController < ApplicationController
|
|||||||
sale_audit = SaleAudit.record_audit_sale(sale_data.sale_id,remark,action_by,type )
|
sale_audit = SaleAudit.record_audit_sale(sale_data.sale_id,remark,action_by,type )
|
||||||
|
|
||||||
# Promotion Activation
|
# Promotion Activation
|
||||||
Promotion.promo_activate(sale_data,@shop.shop_code)
|
Promotion.promo_activate(sale_data)
|
||||||
|
|
||||||
#bill channel
|
#bill channel
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Promotion.promo_activate(sale_data,@shop.shop_code)
|
Promotion.promo_activate(sale_data)
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
from = request.subdomain + "." + request.domain
|
from = request.subdomain + "." + request.domain
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -38,20 +38,20 @@ class Printer::PrinterWorker
|
|||||||
end
|
end
|
||||||
|
|
||||||
def print(file_path,printer_destination = nil )
|
def print(file_path,printer_destination = nil )
|
||||||
if printer_destination.nil?
|
# if printer_destination.nil?
|
||||||
printer_destination = self.printer_destination
|
# printer_destination = self.printer_destination
|
||||||
end
|
# end
|
||||||
|
#
|
||||||
puts printer_destination
|
# puts printer_destination
|
||||||
puts '........Printer Destination..........'
|
# puts '........Printer Destination..........'
|
||||||
|
#
|
||||||
copy = self.print_copies
|
# copy = self.print_copies
|
||||||
#Print only when printer information is not null
|
# #Print only when printer information is not null
|
||||||
if !self.printer_destination.nil?
|
# if !self.printer_destination.nil?
|
||||||
(1..copy).each do
|
# (1..copy).each do
|
||||||
page = Cups::PrintJob.new(file_path, printer_destination)
|
# page = Cups::PrintJob.new(file_path, printer_destination)
|
||||||
page.print
|
# page.print
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2430,7 +2430,48 @@ def self.get_check_sale_data(transaction_date)
|
|||||||
.where("DATE(sales.receipt_date) = ? AND sales.sale_status != ?", transaction_date, :void)
|
.where("DATE(sales.receipt_date) = ? AND sales.sale_status != ?", transaction_date, :void)
|
||||||
.group("sales.receipt_no,sales.sale_status")
|
.group("sales.receipt_no,sales.sale_status")
|
||||||
end
|
end
|
||||||
|
def paymal_payment_void
|
||||||
|
puts self.sale_payments.to_json
|
||||||
|
membership_setting = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",self.shop_code)
|
||||||
|
membership_actions_data = MembershipAction.find_by_membership_type_and_shop_code("void",self.shop_code)
|
||||||
|
if !membership_actions_data.nil?
|
||||||
|
sale_payments =self.sale_payments.where("payment_reference is not null")
|
||||||
|
account_no =sale_payments[0].payment_reference
|
||||||
|
url = membership_setting.gateway_url.to_s + membership_actions_data.gateway_url.to_s
|
||||||
|
merchant_uid = membership_actions_data.merchant_account_id
|
||||||
|
auth_token = membership_actions_data.auth_token
|
||||||
|
params = { receipt_no:self.receipt_no,
|
||||||
|
account_no:account_no,
|
||||||
|
merchant_uid:merchant_uid,
|
||||||
|
auth_token:auth_token}.to_json
|
||||||
|
|
||||||
|
# Control for Paypar Cloud
|
||||||
|
begin
|
||||||
|
response = HTTParty.post(url,
|
||||||
|
:body => params,
|
||||||
|
:headers => {
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
'Accept' => 'application/json; version=3'
|
||||||
|
},
|
||||||
|
:timeout => 10
|
||||||
|
)
|
||||||
|
rescue Errno::ECONNREFUSED
|
||||||
|
response = { "status" => false, "message" => "Can't open membership server"}
|
||||||
|
rescue Net::OpenTimeout
|
||||||
|
response = { "status" => false, "message" => "No internet connection " }
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
response = { "status" => false, "message" => "No internet connection "}
|
||||||
|
rescue SocketError
|
||||||
|
response = { "status" => false, "message" => "No internet connection "}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
response = { "status" => false}
|
||||||
|
end
|
||||||
|
|
||||||
|
Rails.logger.debug "Void Payment response"
|
||||||
|
Rails.logger.debug response.to_json
|
||||||
|
return response;
|
||||||
|
end
|
||||||
# Loader Service SFTP End
|
# Loader Service SFTP End
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -533,11 +533,8 @@ class SalePayment < ApplicationRecord
|
|||||||
payment_status = false
|
payment_status = false
|
||||||
|
|
||||||
#Next time - validate if the vochure number is valid - within
|
#Next time - validate if the vochure number is valid - within
|
||||||
# customer_data = Customer.find_by_customer_id(self.sale.customer_id)
|
|
||||||
account_no = self.payment_reference
|
account_no = self.payment_reference
|
||||||
# if account_no.to_i <= 0
|
# self.sale.customer.update_attributes(paypar_account_no: )
|
||||||
# account_no = customer_data.membership_id
|
|
||||||
# end
|
|
||||||
membership_setting = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",self.sale.shop_code)
|
membership_setting = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",self.sale.shop_code)
|
||||||
membership_data = SalePayment.create_payment(membership_setting.gateway_url,"PAYMAL",account_no,self.received_amount,self.sale.sale_id)
|
membership_data = SalePayment.create_payment(membership_setting.gateway_url,"PAYMAL",account_no,self.received_amount,self.sale.sale_id)
|
||||||
|
|
||||||
@@ -548,7 +545,7 @@ class SalePayment < ApplicationRecord
|
|||||||
if membership_data["status"]==true
|
if membership_data["status"]==true
|
||||||
self.payment_method = "paymal"
|
self.payment_method = "paymal"
|
||||||
self.payment_amount = self.received_amount
|
self.payment_amount = self.received_amount
|
||||||
self.payment_reference = self.voucher_no
|
# self.payment_reference = self.voucher_no
|
||||||
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||||
self.payment_status = "paid"
|
self.payment_status = "paid"
|
||||||
payment_status = self.save!
|
payment_status = self.save!
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<%= javascript_include_tag 'custom', 'data-turbolinks-track': 'reload' %>
|
<%= javascript_include_tag 'custom', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<%= javascript_include_tag 'foodcourt', 'data-turbolinks-track': 'reload' %>
|
||||||
<% if @booking.nil?%>
|
<% if @booking.nil?%>
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
@@ -24,7 +25,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row m-t--20">
|
<div class="row m-t--20">
|
||||||
<% if !@booking.nil?%>
|
<% if !@booking.nil?%>
|
||||||
<div class="col-md-9 col-lg-9 col-sm-12 m-t-10">
|
<div class="col-md-8 col-lg-8 col-sm-12 m-t-10">
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="col-md-12 col-lg-12 col-sm-12 m-t-10">
|
<div class="col-md-12 col-lg-12 col-sm-12 m-t-10">
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -57,80 +58,168 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% if !@booking.nil?%>
|
<% if !@booking.nil?%>
|
||||||
<div class="col-md-3 col-lg-3 col-sm-12 m-t-10">
|
<span id="sale_id" style="display:none"><%= @booking.sale_id %></span>
|
||||||
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
<div class="col-md-3 col-lg-3 col-sm-12 m-t-10">
|
||||||
<div class="row" style="margin:auto">
|
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
||||||
<div class="col-md-9 col-lg-9 col-sm-9">
|
<div class="row" style="margin:auto">
|
||||||
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@booking.dining_facility.name%></span><br>
|
<div class="col-md-12 col-lg-12 col-sm-12">
|
||||||
<strong class="font-14 p-l-10">Booking - <%=@booking.booking_id%></strong><br>
|
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@booking.dining_facility.name%></span><br>
|
||||||
<strong class="font-14 p-l-10">Order No- <%=@booking.order_id%></strong>
|
<strong class="font-14 p-l-10">Booking - <%=@booking.booking_id%></strong><br>
|
||||||
|
<strong class="font-14 p-l-10">Order No- <%=@booking.order_id%></strong>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 col-lg-3 col-sm-3">
|
<div class="card-block">
|
||||||
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
<div class="card-text" id="order-detail-slimscroll" data-height="250">
|
||||||
<i class="material-icons">reply</i>
|
<table class="table table-striped summary-items">
|
||||||
Back
|
<thead>
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-block">
|
|
||||||
<div class="card-text" id="order-detail-slimscroll" data-height="250">
|
|
||||||
<table class="table table-striped summary-items">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>#</th>
|
|
||||||
<th class="item-name">Items</th>
|
|
||||||
<th class="item-qty">Qty</th>
|
|
||||||
<th class="item-attr">Price</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="font-13">
|
|
||||||
<% sub_total = 0
|
|
||||||
count = 0
|
|
||||||
%>
|
|
||||||
<% @sale_data.sale_items.each do |sale_item|
|
|
||||||
count += 1
|
|
||||||
%>
|
|
||||||
<% sub_total += sale_item.price%>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= count %></td>
|
<th>#</th>
|
||||||
<td class="item-name"><%=sale_item.product_name%>@<%=number_with_precision( sale_item.unit_price, precision: precision.to_i )%></td>
|
<th class="item-name">Items</th>
|
||||||
<td class=""><%=sale_item.qty%></td>
|
<th class="item-qty">Qty</th>
|
||||||
<td class="item-attr"><%=(number_with_precision(sale_item.price, precision: precision.to_i ))%></td>
|
<th class="item-attr">Price</th>
|
||||||
</tr>
|
</tr>
|
||||||
<%end %>
|
</thead>
|
||||||
</tbody>
|
<tbody class="font-13">
|
||||||
</table>
|
<% sub_total = 0
|
||||||
|
count = 0
|
||||||
|
%>
|
||||||
|
<% @sale_data.sale_items.each do |sale_item|
|
||||||
|
count += 1
|
||||||
|
%>
|
||||||
|
<% sub_total += sale_item.price%>
|
||||||
|
<tr>
|
||||||
|
<td><%= count %></td>
|
||||||
|
<td class="item-name"><%=sale_item.product_name%>@<%=number_with_precision( sale_item.unit_price, precision: precision.to_i )%></td>
|
||||||
|
<td class=""><%=sale_item.qty%></td>
|
||||||
|
<td class="item-attr"><%=(number_with_precision(sale_item.price, precision: precision.to_i ))%></td>
|
||||||
|
</tr>
|
||||||
|
<%end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer custom-card-footer" style="padding: 0.35rem 0.15rem !important;">
|
||||||
|
<table class="table" id="order-charges-table" border="0">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Sub Total</strong></td>
|
||||||
|
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%=number_with_precision(sub_total, precision: precision.to_i)%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>(Discount)</strong></td>
|
||||||
|
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">(<%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>)</strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total Tax</strong></td>
|
||||||
|
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Rounding Adj</strong></td>
|
||||||
|
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%= number_with_precision(@sale_data.rounding_adjustment, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Grand Total</strong></td>
|
||||||
|
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<button type="button" class="btn btn-primary action-btn create col-md-12" id="done_order" style="padding-top:4px !important;padding-bottom:4px !important;">DONE</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer custom-card-footer" style="padding: 0.35rem 0.15rem !important;">
|
</div>
|
||||||
<table class="table" id="order-charges-table" border="0">
|
</div>
|
||||||
<tr>
|
<div class="col-md-1 col-lg-1 col-sm-12">
|
||||||
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Sub Total</strong></td>
|
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%=number_with_precision(sub_total, precision: precision.to_i)%></strong></td>
|
<i class="material-icons">reply</i>
|
||||||
</tr>
|
Back
|
||||||
<tr>
|
</button>
|
||||||
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>(Discount)</strong></td>
|
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">(<%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>)</strong></td>
|
</div>
|
||||||
</tr>
|
<% end %>
|
||||||
<tr>
|
</div>
|
||||||
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total Tax</strong></td>
|
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
|
<div class="modal-dialog" role="document">
|
||||||
</tr>
|
<div class="modal-content">
|
||||||
<tr>
|
<div class="modal-header">
|
||||||
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Rounding Adj</strong></td>
|
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%= number_with_precision(@sale_data.rounding_adjustment, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
|
</div>
|
||||||
</tr>
|
<div class="modal-body">
|
||||||
<tr>
|
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||||
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Grand Total</strong></td>
|
</div>
|
||||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
|
<div class="modal-footer ">
|
||||||
</tr>
|
<div class="row p-r-20">
|
||||||
</table>
|
<div class="col-md-5">
|
||||||
<button type="button" class="btn btn-primary action-btn create col-md-12" id="done_order" style="padding-top:4px !important;padding-bottom:4px !important;">DONE</button>
|
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect " id="void" active="true">VOID</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
</div>
|
||||||
|
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog modal-sm" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
|
||||||
|
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
|
||||||
|
<input type="password" id="access_code" class="access_code form-control col-md-12 ">
|
||||||
|
<div class="row bottom p-l-15 p-r-15 m-t-10">
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
|
||||||
|
</div>
|
||||||
|
<div class="row bottom p-l-15 p-r-15">
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
|
||||||
|
</div>
|
||||||
|
<div class="row bottom p-l-15 p-r-15">
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
|
||||||
|
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog modal-sm" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
|
||||||
|
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
|
||||||
|
<input type="password" id="access_code" class="access_code form-control col-md-12 ">
|
||||||
|
<div class="row bottom p-l-15 p-r-15 m-t-10">
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
|
||||||
|
</div>
|
||||||
|
<div class="row bottom p-l-15 p-r-15">
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
|
||||||
|
</div>
|
||||||
|
<div class="row bottom p-l-15 p-r-15">
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
|
||||||
|
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -168,4 +257,37 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
$('#void').on('click', function () {
|
||||||
|
var access_code = localStorage.getItem("access_code");
|
||||||
|
swal({
|
||||||
|
title: "Alert",
|
||||||
|
text: "Are you sure want to Void?",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes, void it!",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
|
$('.confirm').prop("disabled",true);
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
var remark = $("#remark").val();
|
||||||
|
var ajax_url = "/foodcourt/sale/" + sale_id +'/food_court/void';
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: ajax_url,
|
||||||
|
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
|
||||||
|
success: function (result) {
|
||||||
|
// For Server Print - from jade
|
||||||
|
if ($("#server_mode").val() == "cloud") {
|
||||||
|
if(typeof code2lab != 'undefined'){
|
||||||
|
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.location.href = '/foodcourt/app_orders';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -389,53 +389,22 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
|
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
|
||||||
<button type="button" class="btn btn-block btn-default waves-effect" id='refresh'>
|
<button type="button" class="btn btn-block btn-default waves-effect" id='refresh'>
|
||||||
<!-- <i class="material-icons">reply</i> -->
|
|
||||||
Refresh
|
Refresh
|
||||||
</button>
|
</button>
|
||||||
<!-- -->
|
<% if @sale_payment.nil? %>
|
||||||
<% if current_login_employee.role == "cashier" %>
|
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||||
<% if @other_payment <= 0 && @sale_payment.nil? %>
|
<% if @other_payment <= 0 %>
|
||||||
<%if @sale_data.total_discount == 0 %>
|
<%if @sale_data.total_discount == 0 %>
|
||||||
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="foc"> FOC</a>
|
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')">Waste</button>
|
||||||
<% end %>
|
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button>
|
||||||
<%end %>
|
|
||||||
<% if @sale_payment.nil? %>
|
|
||||||
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
|
||||||
<% if @other_payment <= 0 %>
|
|
||||||
<%if @sale_data.total_discount == 0 %>
|
|
||||||
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="waste"> Waste</a>
|
|
||||||
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="spoile"> Spoile</a>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<% else %>
|
|
||||||
<% if @other_payment <= 0 && @sale_payment.nil?%>
|
|
||||||
<%if @sale_data.total_discount == 0 %>
|
|
||||||
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
|
|
||||||
<%end %>
|
|
||||||
<%end %>
|
|
||||||
<% if @sale_payment.nil? %>
|
|
||||||
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
|
||||||
<% if @other_payment <= 0 %>
|
|
||||||
<%if @sale_data.total_discount == 0 %>
|
|
||||||
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')">Waste</button>
|
|
||||||
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if @sale_payment.nil? %>
|
||||||
<% if (@cashier_type=="quick_service" || @cashier_type=="food_court") && @sale_payment.nil? %>
|
<hr>
|
||||||
<hr>
|
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||||
<% if current_login_employee.role == "cashier" %>
|
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
|
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||||
<% else %>
|
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
|
||||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
|
||||||
<!-- Waiter Buttons -->
|
|
||||||
<%end %>
|
<%end %>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||||
@@ -1313,55 +1282,6 @@ $(document).ready(function(){
|
|||||||
var sale_id = $("#sale_id").text() || 0;
|
var sale_id = $("#sale_id").text() || 0;
|
||||||
update_sale("", customer_id, customer_name, sale_id);
|
update_sale("", customer_id, customer_name, sale_id);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.access_modal', function(event){
|
|
||||||
type = $(this).data("type");
|
|
||||||
$(".ok").attr("data-action",type)
|
|
||||||
$('#AccessCodeModal').modal('show');
|
|
||||||
});
|
|
||||||
|
|
||||||
function check_emp_access_code(access_code,type) {
|
|
||||||
var url = "/foodcourt/check_emp_access_code/" + access_code ;
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: url,
|
|
||||||
data: {},
|
|
||||||
success: function (result) {
|
|
||||||
// console.log(result)
|
|
||||||
if (result.status == true) {
|
|
||||||
createAccessCode(code);
|
|
||||||
if (type == "edit") {
|
|
||||||
var dining_id = $('#dining').text();
|
|
||||||
var sale_id = $('#sale_id').text();
|
|
||||||
if (dining_id) {
|
|
||||||
window.location.href = '/foodcourt/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
|
|
||||||
}else{
|
|
||||||
window.location.href = "/foodcourt/table/sale/" + sale_id + "/"+cashier_type+"/edit";
|
|
||||||
}
|
|
||||||
}else if(type == "void"){
|
|
||||||
$('#AccessCodeModal').modal('hide');
|
|
||||||
$('#voidModal').modal('show');
|
|
||||||
// overall_void();
|
|
||||||
}else if(type == "waste") {
|
|
||||||
// $('#AccessCodeModal').modal('hide');
|
|
||||||
// $('#focModal').modal('show');
|
|
||||||
waste_and_spoilage("waste")
|
|
||||||
}else if(type == "spoile") {
|
|
||||||
// $('#AccessCodeModal').modal('hide');
|
|
||||||
// $('#voidModal').modal('show');
|
|
||||||
waste_and_spoilage("spoile")
|
|
||||||
}else if(type == "foc"){
|
|
||||||
$('#AccessCodeModal').modal('hide');
|
|
||||||
$('#focModal').modal('show');
|
|
||||||
// overall_foc();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
swal("Oops",result.message,"warning");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#foc').on('click', function () {
|
$('#foc').on('click', function () {
|
||||||
var access_code = localStorage.getItem("access_code");
|
var access_code = localStorage.getItem("access_code");
|
||||||
var remark = $("#foc_remark").val();
|
var remark = $("#foc_remark").val();
|
||||||
@@ -1417,50 +1337,6 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#void').on('click', function () {
|
|
||||||
var access_code = localStorage.getItem("access_code");
|
|
||||||
swal({
|
|
||||||
title: "Alert",
|
|
||||||
text: "Are you sure want to Void?",
|
|
||||||
type: "warning",
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonColor: "#DD6B55",
|
|
||||||
confirmButtonText: "Yes, void it!",
|
|
||||||
closeOnConfirm: false
|
|
||||||
}, function (isConfirm) {
|
|
||||||
if (isConfirm) {
|
|
||||||
$('.confirm').prop("disabled",true);
|
|
||||||
var sale_id = $('#sale_id').text();
|
|
||||||
var remark = $("#remark").val();
|
|
||||||
var ajax_url = "/foodcourt/sale/" + sale_id +'/'+cashier_type+ '/void';
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: ajax_url,
|
|
||||||
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
|
|
||||||
success: function (result) {result
|
|
||||||
customer_display_view(null,"reload");
|
|
||||||
// For Server Print - from jade
|
|
||||||
if ($("#server_mode").val() == "cloud") {
|
|
||||||
if(typeof code2lab != 'undefined'){
|
|
||||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var flag = localStorage.getItem("trans_flag");
|
|
||||||
if((flag!=null) && (flag != "true")){
|
|
||||||
window.location.href = '/transactions/sales/'+sale_id;
|
|
||||||
}else{
|
|
||||||
if (cashier_type=="cashier") {
|
|
||||||
window.location.href = '/foodcourt';
|
|
||||||
}else{
|
|
||||||
window.location.href = '/foodcourt/'+cashier_type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function waste_and_spoilage(remark) {
|
function waste_and_spoilage(remark) {
|
||||||
var access_code = localStorage.getItem("access_code");
|
var access_code = localStorage.getItem("access_code");
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
@@ -1784,4 +1660,39 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
},100);
|
},100);
|
||||||
});
|
});
|
||||||
|
$('#void').on('click', function () {
|
||||||
|
alert("in void");
|
||||||
|
var access_code = localStorage.getItem("access_code");
|
||||||
|
swal({
|
||||||
|
title: "Alert",
|
||||||
|
text: "Are you sure want to Void?",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes, void it!",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
|
$('.confirm').prop("disabled",true);
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
var remark = $("#remark").val();
|
||||||
|
var ajax_url = "/foodcourt/sale/" + sale_id +'/food_court/void';
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: ajax_url,
|
||||||
|
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
|
||||||
|
success: function (result) {result
|
||||||
|
customer_display_view(null,"reload");
|
||||||
|
// For Server Print - from jade
|
||||||
|
if ($("#server_mode").val() == "cloud") {
|
||||||
|
if(typeof code2lab != 'undefined'){
|
||||||
|
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.location.href = '/foodcourt/food_court';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -62,3 +62,5 @@ Rails.application.config.assets.precompile += %w( reservation.css )
|
|||||||
Rails.application.config.assets.precompile += %w( reservation.js )
|
Rails.application.config.assets.precompile += %w( reservation.js )
|
||||||
|
|
||||||
Rails.application.config.assets.precompile += %w( custom.js )
|
Rails.application.config.assets.precompile += %w( custom.js )
|
||||||
|
|
||||||
|
Rails.application.config.assets.precompile += %w( foodcourt.js )
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
application_path="#{File.expand_path("../..", __FILE__)}"
|
# application_path="#{File.expand_path("../..", __FILE__)}"
|
||||||
directory application_path
|
# directory application_path
|
||||||
#environment ENV.fetch("RAILS_ENV") { "production" }
|
# #environment ENV.fetch("RAILS_ENV") { "production" }
|
||||||
environment "production"
|
# environment "production"
|
||||||
pidfile "#{application_path}/tmp/puma/pid"
|
# pidfile "#{application_path}/tmp/puma/pid"
|
||||||
state_path "#{application_path}/tmp/puma/state"
|
# state_path "#{application_path}/tmp/puma/state"
|
||||||
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||||
port ENV.fetch("PORT") { 62158 }
|
# port ENV.fetch("PORT") { 62158 }
|
||||||
workers 2
|
# workers 2
|
||||||
preload_app!
|
# preload_app!
|
||||||
threads 1,1
|
# threads 1,1
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
12343
|
3072
|
||||||
Reference in New Issue
Block a user