add customer at first
This commit is contained in:
@@ -1187,79 +1187,18 @@ $(function() {
|
|||||||
|
|
||||||
// Pay Discount for Payment
|
// Pay Discount for Payment
|
||||||
$("#create_pay_order").on('click', function(e){
|
$("#create_pay_order").on('click', function(e){
|
||||||
|
$("#sxModal").show();
|
||||||
|
$("#sxModal").attr('data-for', 'member');
|
||||||
$(this).attr('disabled', 'disabled');
|
$(this).attr('disabled', 'disabled');
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
type = $("#link_type").val();
|
getCardNo();
|
||||||
modify_order = window.location.href.indexOf("modify_order");
|
});
|
||||||
$("#oqs_loading_wrapper").show();
|
|
||||||
if (modify_order !=-1) {
|
|
||||||
var ajax_url = '../../../'+type+'/update_modify_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();
|
|
||||||
}else{
|
|
||||||
var ajax_url = 'addorders/create';
|
|
||||||
var table_type = $('#table_id').find("option:selected").data('type');
|
|
||||||
var table_id = $('#table_id').val();
|
|
||||||
var customer_id = $('#customer_id').val();
|
|
||||||
var booking_id = $('#booking_id').text();
|
|
||||||
var sale_id = ""
|
|
||||||
}
|
|
||||||
var order_items = JSON.stringify(get_order_item_rows());
|
|
||||||
if (booking_id.length > 0) {
|
|
||||||
|
|
||||||
var params = {'order_source': type, 'order_type': "dine_in",
|
$("#sxModal .btn_cancel").on('click',function(){
|
||||||
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
|
if($("#order-items-table tr").length > 1){
|
||||||
'table_id': table_id,
|
$( "#create_pay_order" ).prop( "disabled", false );
|
||||||
'order_items': order_items,'sale_id': sale_id,'create_type': "create_pay" };
|
|
||||||
}else{
|
|
||||||
var params = {'order_source': type, 'order_type': "dine_in",
|
|
||||||
'customer_id': customer_id, 'guest_info': "",
|
|
||||||
'table_id': table_id,
|
|
||||||
'order_items': order_items,'sale_id': sale_id,'create_type': "create_pay" };
|
|
||||||
}
|
}
|
||||||
|
$("#sxModal").hide();
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: ajax_url,
|
|
||||||
data: params,
|
|
||||||
dataType: "json",
|
|
||||||
success:function(result){
|
|
||||||
if (result.status) {
|
|
||||||
if (result.data == null){
|
|
||||||
swal({
|
|
||||||
title: "Please Open Shift !",
|
|
||||||
text: result.status,
|
|
||||||
type: "warning",
|
|
||||||
confirmButtonColor: "#DD6B55",
|
|
||||||
confirmButtonText: "Ok",
|
|
||||||
closeOnConfirm: false
|
|
||||||
}, function () {
|
|
||||||
window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text();
|
|
||||||
});
|
|
||||||
|
|
||||||
}else if(result.data == 'OK'){
|
|
||||||
if (window.location.pathname.includes('foodcourt')) {
|
|
||||||
order_id = $('#order_id').val()
|
|
||||||
window.location.href = '/foodcourt/food_court/'+order_id+'/request_bill'
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(result.current_user_role == 'cashier'){
|
|
||||||
window.location.href = "/foodcourt/sale/"+result.data["sale_id"]+"/"+type+"/payment";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
module_name = window.location.pathname.includes('origami') ? 'origami' : 'foodcourt'
|
|
||||||
window.location.href = "/"+module_name+"/sale/"+result.data["sale_id"]+"/"+type+"/payment";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//click item row for update qty
|
//click item row for update qty
|
||||||
@@ -1374,29 +1313,6 @@ $(function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get Item rows */
|
|
||||||
function get_order_item_rows(){
|
|
||||||
var order_items = [];
|
|
||||||
var item_row = $('.summary-items tbody tr');
|
|
||||||
$(item_row).each(function(i){
|
|
||||||
var order_item = {};
|
|
||||||
|
|
||||||
order_item.order_item_id = $(item_row[i]).attr('data-row');
|
|
||||||
order_item.item_instance_code = $(item_row[i]).attr('data-instance-code');
|
|
||||||
order_item.quantity = $(item_row[i]).children('#item_qty').text();
|
|
||||||
//parent id
|
|
||||||
if ($(item_row[i]).attr('data-parent')=="true") {
|
|
||||||
parent_id = $(item_row[i]).attr('data-row');
|
|
||||||
}
|
|
||||||
if ($(item_row[i]).attr('data-sub-item')=="true") {
|
|
||||||
order_item.parent_order_item_id = parent_id
|
|
||||||
}
|
|
||||||
//end parent id
|
|
||||||
order_item.options = $(item_row[i]).attr('data-options');
|
|
||||||
order_items.push(order_item);
|
|
||||||
});
|
|
||||||
return order_items;
|
|
||||||
}
|
|
||||||
// Get Selected Class
|
// Get Selected Class
|
||||||
function get_selected_attributes(selected_class) {
|
function get_selected_attributes(selected_class) {
|
||||||
var item_row = $('.'+selected_class);
|
var item_row = $('.'+selected_class);
|
||||||
@@ -1969,3 +1885,26 @@ $(function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
/* Get Item rows */
|
||||||
|
function get_order_item_rows(){
|
||||||
|
var order_items = [];
|
||||||
|
var item_row = $('.summary-items tbody tr');
|
||||||
|
$(item_row).each(function(i){
|
||||||
|
var order_item = {};
|
||||||
|
|
||||||
|
order_item.order_item_id = $(item_row[i]).attr('data-row');
|
||||||
|
order_item.item_instance_code = $(item_row[i]).attr('data-instance-code');
|
||||||
|
order_item.quantity = $(item_row[i]).children('#item_qty').text();
|
||||||
|
//parent id
|
||||||
|
if ($(item_row[i]).attr('data-parent')=="true") {
|
||||||
|
parent_id = $(item_row[i]).attr('data-row');
|
||||||
|
}
|
||||||
|
if ($(item_row[i]).attr('data-sub-item')=="true") {
|
||||||
|
order_item.parent_order_item_id = parent_id
|
||||||
|
}
|
||||||
|
//end parent id
|
||||||
|
order_item.options = $(item_row[i]).attr('data-options');
|
||||||
|
order_items.push(order_item);
|
||||||
|
});
|
||||||
|
return order_items;
|
||||||
|
}
|
||||||
|
|||||||
145
app/assets/javascripts/foodcourt/addorder.js
Normal file
145
app/assets/javascripts/foodcourt/addorder.js
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
function getCardNo(){
|
||||||
|
if(typeof code2lab != 'undefined'){
|
||||||
|
code2lab.readNFC();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function setCardNo(cardNo){
|
||||||
|
if(cardNo.length == 16){
|
||||||
|
$("#paypar_account_no").val(cardNo);
|
||||||
|
if ($("#sxModal").attr("data-for") == 'member') {
|
||||||
|
member_card(cardNo)
|
||||||
|
} else if ($("#sxModal").attr('data-for') == 'payment') {
|
||||||
|
pay_with_card(cardNo);
|
||||||
|
}
|
||||||
|
$("#sxModal").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function member_card(cardNo) {
|
||||||
|
var g_customer_id = '';
|
||||||
|
var g_customer_name = '';
|
||||||
|
var g_membership_id = '';
|
||||||
|
var g_membership_type = '';
|
||||||
|
var sale_id = 0 ;
|
||||||
|
if(cardNo != 0){
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/foodcourt/"+sale_id+"/get_customer" ,
|
||||||
|
data: { filter : cardNo ,type :"card"},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if (data[0].customer_id == false) {
|
||||||
|
swal("Alert!", data[0].message, "error");
|
||||||
|
}else{
|
||||||
|
g_customer_id = data[0].customer_id;
|
||||||
|
g_customer_name = data[0].name;
|
||||||
|
g_membership_id = data[0].membership_id;
|
||||||
|
g_membership_type = data[0].membership_type;
|
||||||
|
type = $("#link_type").val();
|
||||||
|
modify_order = window.location.href.indexOf("modify_order");
|
||||||
|
if(!$('.btn').hasClass('req_bill') && !$('.btn').is('#pay')){
|
||||||
|
var booking_id = $('#booking_id').text();
|
||||||
|
if (modify_order !=-1) {
|
||||||
|
var ajax_url = '../../../'+type+'/update_modify_order';
|
||||||
|
var table_type = $('#table_type').text();
|
||||||
|
var table_id = $('#table_id').text();
|
||||||
|
var customer_id = $('#customer_id').text();
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
}else{
|
||||||
|
var ajax_url = 'addorders/create';
|
||||||
|
var table_type = $('#table_id').find("option:selected").data('type');
|
||||||
|
var table_id = $('#table_id').val();
|
||||||
|
var customer_id = g_customer_id;
|
||||||
|
var sale_id = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var order_items = JSON.stringify(get_order_item_rows());
|
||||||
|
|
||||||
|
var params = {'order_source': type, 'order_type': "dine_in",
|
||||||
|
'customer_id': customer_id, 'guest_info': "",
|
||||||
|
'table_id': table_id,
|
||||||
|
'order_items': order_items,'sale_id': sale_id,'create_type': "create_pay" };
|
||||||
|
if (booking_id.length > 0) {
|
||||||
|
params.booking_id = booking_id;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: ajax_url,
|
||||||
|
data: params,
|
||||||
|
dataType: "json",
|
||||||
|
success:function(result){
|
||||||
|
if (result.data == 'OK'){
|
||||||
|
request_bill(g_membership_id, g_customer_id, g_customer_name);
|
||||||
|
}else{
|
||||||
|
if (result.data["sale_id"]){
|
||||||
|
update_sale(g_membership_id, g_customer_id, g_customer_name,result.data["sale_id"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else if($('.btn').is('#pay')){
|
||||||
|
update_sale(g_membership_id, g_customer_id, g_customer_name,$('#sale_id').text());
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
request_bill(g_membership_id, g_customer_id, g_customer_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function request_bill(membership_id,customer_id,customer_name){
|
||||||
|
if (window.location.pathname.includes('foodcourt')) {
|
||||||
|
order_id = $('#order_id').val() || $('#save_order_id').val()
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: "/foodcourt/food_court/"+order_id+"/request_bill" ,
|
||||||
|
data: {},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if(data.status == true)
|
||||||
|
{
|
||||||
|
update_sale(membership_id, customer_id, customer_name, data.sale_id);
|
||||||
|
}else{
|
||||||
|
swal("Alert!", "Error!", "error");
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function update_sale(membership_id, customer_id, customer_name, sale_id) {
|
||||||
|
var customer="";
|
||||||
|
var cashier_type = 'food_court';
|
||||||
|
if(customer_name != ""){
|
||||||
|
customer = '(' + customer_name + ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
swal({
|
||||||
|
title: "Confirmation !",
|
||||||
|
text: 'Are You Sure to assign this customer' + customer + '!',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "green",
|
||||||
|
confirmButtonText: "Yes!",
|
||||||
|
cancelButtonClass: 'btn btn-danger customer_assign_cancel',
|
||||||
|
closeOnConfirm: false,
|
||||||
|
}, function () {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/foodcourt/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
|
||||||
|
data: {customer_id:customer_id,sale_id:sale_id},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if(data.status == true)
|
||||||
|
{
|
||||||
|
//change customer detail
|
||||||
|
$("#customer_name").html(customer_name);
|
||||||
|
$("#membership_id").html(membership_id);
|
||||||
|
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||||
|
}else{
|
||||||
|
swal("Alert!", "Record not found!", "error");
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -26,6 +26,34 @@ section .content{
|
|||||||
.custom-card-block {
|
.custom-card-block {
|
||||||
padding: 0.3rem !important;
|
padding: 0.3rem !important;
|
||||||
}
|
}
|
||||||
|
#sxModal {
|
||||||
|
display: none;
|
||||||
|
overflow: auto;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #000;
|
||||||
|
background-color: rgba(0,0,0,0.4);
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1100;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sxModal-Content {
|
||||||
|
position: relative;
|
||||||
|
left: 42%;
|
||||||
|
top: 30%;
|
||||||
|
background-color: #32ad1a;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
padding-top: 5%;
|
||||||
|
border-radius: 100px;
|
||||||
|
z-index: 1101;
|
||||||
|
}
|
||||||
|
|
||||||
@media (min-width: 34em) {
|
@media (min-width: 34em) {
|
||||||
.custom-card-columns {
|
.custom-card-columns {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class Foodcourt::CustomersController < BaseFoodcourtController
|
|||||||
@crm_customers.membership_id = response["customer_data"]["id"]
|
@crm_customers.membership_id = response["customer_data"]["id"]
|
||||||
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
|
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
|
||||||
@crm_customers.customer_type = "Dinein"
|
@crm_customers.customer_type = "Dinein"
|
||||||
@crm_customers.tax_profiles = ["1", "2"]
|
@crm_customers.tax_profiles = TaxProfile.where(group_type: 'food_court').pluck(:id)
|
||||||
@crm_customers.save
|
@crm_customers.save
|
||||||
@crm_customers = Customer.search(filter)
|
@crm_customers = Customer.search(filter)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ class Foodcourt::DiscountsController < BaseFoodcourtController
|
|||||||
# if is_card != "true"
|
# if is_card != "true"
|
||||||
account_types = Account.where("discount=?",true)
|
account_types = Account.where("discount=?",true)
|
||||||
table_id = sale.bookings[0].dining_facility_id
|
table_id = sale.bookings[0].dining_facility_id
|
||||||
table_type = DiningFacility.find(table_id).type
|
# table_type = DiningFacility.find(table_id).type
|
||||||
|
|
||||||
# Get Prices for each accounts (eg: food, beverage)
|
# Get Prices for each accounts (eg: food, beverage)
|
||||||
account_price = SaleItem.calculate_price_by_accounts(sale.sale_items)
|
account_price = SaleItem.calculate_price_by_accounts(sale.sale_items)
|
||||||
@@ -279,7 +279,7 @@ class Foodcourt::DiscountsController < BaseFoodcourtController
|
|||||||
auth_token:auth_token}.to_json,
|
auth_token:auth_token}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'Accept' => 'application/json; version=3'
|
'Accept' => 'application/json; version=4'
|
||||||
}, :timeout => 10)
|
}, :timeout => 10)
|
||||||
rescue HTTParty::Error
|
rescue HTTParty::Error
|
||||||
response = {"status": false, "message": "Http party error" }
|
response = {"status": false, "message": "Http party error" }
|
||||||
@@ -304,11 +304,11 @@ class Foodcourt::DiscountsController < BaseFoodcourtController
|
|||||||
discount_amount = discount_amount + response["discount_bonus_earned"]
|
discount_amount = discount_amount + response["discount_bonus_earned"]
|
||||||
end
|
end
|
||||||
sale.compute_by_sale_items(discount_amount, 'member_discount', order_source, tax_type)
|
sale.compute_by_sale_items(discount_amount, 'member_discount', order_source, tax_type)
|
||||||
result = {:status=> "Success",:title=>"Member Discount", :table_id => table_id,:table_type => table_type }
|
result = {:status=> "Success",:title=>"Member Discount", :table_id => table_id }
|
||||||
elsif response["status"] == "500"
|
elsif response["status"] == "500"
|
||||||
result = {:status=> response["error"],:title=>"Alert", :table_id => table_id,:table_type => table_type }
|
result = {:status=> response["error"],:title=>"Alert", :table_id => table_id }
|
||||||
else
|
else
|
||||||
result = {:status=> response["message"],:title=>"Alert", :table_id => table_id,:table_type => table_type }
|
result = {:status=> response["message"],:title=>"Alert", :table_id => table_id }
|
||||||
end
|
end
|
||||||
|
|
||||||
render :json => result.to_json
|
render :json => result.to_json
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def request_bill
|
def request_bill
|
||||||
sale_data =[]
|
sale_data =[]
|
||||||
if !ShiftSale.current_shift.nil?
|
if !ShiftSale.current_shift.nil?
|
||||||
order_id = params[:order_id] # order_id
|
order_id = params[:order_id] # order_id
|
||||||
@@ -265,7 +265,7 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
|||||||
@error_message = "No Current Open Shift for This Employee"
|
@error_message = "No Current Open Shift for This Employee"
|
||||||
end
|
end
|
||||||
if ["quick_service", "food_court"].include? order.source
|
if ["quick_service", "food_court"].include? order.source
|
||||||
redirect_to "/foodcourt/sale/#{sale_data.sale_id}/food_court/payment#"
|
render :json => { :status => true, :sale_id => sale_data.sale_id }
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<%= stylesheet_link_tag 'addorder', media: 'all', 'data-turbolinks-track': 'reload' %>
|
<%= stylesheet_link_tag 'addorder', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
<%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %>
|
<%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<%= javascript_include_tag 'foodcourt/addorder', 'data-turbolinks-track': 'reload' %>
|
||||||
<% type = request.path_info.include?('quick_service') || request.path_info.include?('food_court')%>
|
<% type = request.path_info.include?('quick_service') || request.path_info.include?('food_court')%>
|
||||||
<% modify_order = request.path_info.include?('modify_order')%>
|
<% modify_order = request.path_info.include?('modify_order')%>
|
||||||
<div class="container-fluid h-100" style="padding:0px 3px 0px 3px;">
|
<div class="container-fluid h-100" style="padding:0px 3px 0px 3px;">
|
||||||
@@ -351,7 +352,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="sxModal">
|
||||||
|
<div id="sxModal-Content">
|
||||||
|
<h3>Card Tap</h3>
|
||||||
|
</div>
|
||||||
|
<div style="position: absolute; bottom: 0; margin-left: 45%; margin-bottom: 60px;">
|
||||||
|
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Large modal -->
|
<!-- Large modal -->
|
||||||
<div class="modal sx_item_set_detailModal h-100" id="sx_item_set_detailModal" tabindex="-1" role="dialog" aria-labelledby="sx_item_set_detailLabel" aria-hidden="true" >
|
<div class="modal sx_item_set_detailModal h-100" id="sx_item_set_detailModal" tabindex="-1" role="dialog" aria-labelledby="sx_item_set_detailLabel" aria-hidden="true" >
|
||||||
|
|||||||
@@ -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/addorder', 'data-turbolinks-track': 'reload' %>
|
||||||
|
|
||||||
<div class="container-fluid h-100" style="padding:0px 3px 0px 3px;margin-top:20px">
|
<div class="container-fluid h-100" style="padding:0px 3px 0px 3px;margin-top:20px">
|
||||||
<div id="oqs_loading_wrapper" style="display:none;">
|
<div id="oqs_loading_wrapper" style="display:none;">
|
||||||
@@ -355,19 +356,19 @@
|
|||||||
<%else%>
|
<%else%>
|
||||||
<td class="charges-name"><strong>Discount:</strong></td>
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
<%end%>
|
<%end%>
|
||||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
<td class="item-attr"><strong id="order-discount">(<%= @pending.total_discount rescue 0%>)</strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Tax:</strong></td>
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-Tax"><%= @pending.total_tax rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-round-adj"><%= @pending.rounding_adjustment rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-grand-total"><%= @pending.grand_total rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="rebate_amount"></tr>
|
<tr class="rebate_amount"></tr>
|
||||||
<% else%>
|
<% else%>
|
||||||
@@ -415,9 +416,10 @@
|
|||||||
<% if @status != "sale"%>
|
<% if @status != "sale"%>
|
||||||
<!-- <button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button> -->
|
<!-- <button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button> -->
|
||||||
<% order_id = @pending.try(:orders).try(:first).try(:order_id) if @status == 'order' %>
|
<% order_id = @pending.try(:orders).try(:first).try(:order_id) if @status == 'order' %>
|
||||||
<%= link_to 'Req.Bill', "/foodcourt/food_court/#{order_id}/request_bill", class: 'btn btn-block bg-blue waves-effect' %>
|
<button type="button" class="btn btn-block bg-blue waves-effect req_bill" >Req.Bill</button>
|
||||||
|
<input type="hidden" id="save_order_id" value="<%=order_id%>">
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|
||||||
<% elsif @pending && params[:active] == 'completed' %>
|
<% elsif @pending && params[:active] == 'completed' %>
|
||||||
<% if current_user.role != "waiter" %>
|
<% if current_user.role != "waiter" %>
|
||||||
<% if @pending.sale_status != 'void' && @pending.sale_status != 'waste' && @pending.sale_status != 'spoile' %>
|
<% if @pending.sale_status != 'void' && @pending.sale_status != 'waste' && @pending.sale_status != 'spoile' %>
|
||||||
@@ -494,20 +496,40 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="sxModal">
|
||||||
|
<div id="sxModal-Content">
|
||||||
|
<h3>Card Tap</h3>
|
||||||
|
</div>
|
||||||
|
<div style="position: absolute; bottom: 0; margin-left: 45%; margin-bottom: 60px;">
|
||||||
|
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var cashier_type = 'food_court';
|
||||||
$(document).ready( function() {
|
$(document).ready( function() {
|
||||||
if ("<%= @pending %>" || "<%= @booking %>") { // adjust column gap
|
if ("<%= @pending %>" || "<%= @booking %>") { // adjust column gap
|
||||||
$('.card-columns').css('column-gap', '0.3rem')
|
$('.card-columns').css('column-gap', '0.3rem')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#pay').on('click', function () {
|
$('#pay, .req_bill').on('click', function () {
|
||||||
var cashier_type = 'food_court';
|
$("#sxModal").show();
|
||||||
|
$("#sxModal").attr('data-for', 'member');
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
window.location.href = '/foodcourt/sale/' + sale_id + "/"+cashier_type+"/payment";
|
getCardNo();
|
||||||
});
|
});
|
||||||
|
// $('#pay').on('click', function () {
|
||||||
|
// // var sale_id = $('#sale_id').text();
|
||||||
|
// getCardNo();
|
||||||
|
// });
|
||||||
|
|
||||||
|
$("#sxModal .btn_cancel").on('click',function(){
|
||||||
|
if($("#order-items-table tr").length > 1){
|
||||||
|
$( "#create_pay_order" ).prop( "disabled", false );
|
||||||
|
}
|
||||||
|
$("#sxModal").hide();
|
||||||
|
});
|
||||||
|
|
||||||
$('#addorder').on('click', function () {
|
$('#addorder').on('click', function () {
|
||||||
var status = "<%= @status %>"
|
var status = "<%= @status %>"
|
||||||
if (status == 'sale'){
|
if (status == 'sale'){
|
||||||
@@ -526,7 +548,7 @@
|
|||||||
}else{
|
}else{
|
||||||
window.location.href = '/foodcourt/food_court/modify_order/' + booking_id + "/" + sale_id + '?update=true&order_id="'+order_id+'"'
|
window.location.href = '/foodcourt/food_court/modify_order/' + booking_id + "/" + sale_id + '?update=true&order_id="'+order_id+'"'
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#back').on('click', function () {
|
$('#back').on('click', function () {
|
||||||
|
|||||||
@@ -37,7 +37,9 @@
|
|||||||
<strong>Customer :</strong>
|
<strong>Customer :</strong>
|
||||||
<% if @cashier_type == 'quick_service' || @cashier_type == 'food_court' %>
|
<% if @cashier_type == 'quick_service' || @cashier_type == 'food_court' %>
|
||||||
<button type="button" class="btn bg-info waves-effect" id='customer_name'><%= @sale_data.customer.name%></button>
|
<button type="button" class="btn bg-info waves-effect" id='customer_name'><%= @sale_data.customer.name%></button>
|
||||||
|
<input type="hidden" name="paypar_account_no" id="paypar_account_no" value='<%=@sale_data.customer.paypar_account_no%>' />
|
||||||
<% else %>
|
<% else %>
|
||||||
|
<input type="hidden" name="paypar_account_no" id="paypar_account_no" value='<%=@sale_data.customer.paypar_account_no%>' />
|
||||||
<span id="customer_name"><%= @sale_data.customer.name%></span>
|
<span id="customer_name"><%= @sale_data.customer.name%></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span>
|
<span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span>
|
||||||
@@ -281,35 +283,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- pdf light box -->
|
|
||||||
<div class="modal fade" id="pdfModal" tabindex="-1" role="dialog" >
|
|
||||||
<div class="modal-dialog modal-md " role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h6 class="modal-title">
|
|
||||||
<span id="pdfModalLabel"></span>
|
|
||||||
<span id="changed_amount" class="p-l-120"></span>
|
|
||||||
</h6>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body" style="height: 400px;">
|
|
||||||
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
|
|
||||||
<input type="hidden" name="filename" id="filename">
|
|
||||||
<input type="hidden" name="printer_name" id="printer_name">
|
|
||||||
<div class="text-center">
|
|
||||||
<iframe id="receipt_pdf" src="" class="pdf-iframe" scrolling="no"></iframe>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="mr-2 m-t-5 btn-lg btn-block bg-red waves-effect print_receipt" id="print_receipt"> Print
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn-lg btn-block bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
|
|
||||||
CLOSE
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- customer light box -->
|
<!-- customer light box -->
|
||||||
<div class="modal fade" id="is_memberModal" tabindex="-1" role="dialog">
|
<div class="modal fade" id="is_memberModal" tabindex="-1" role="dialog">
|
||||||
<div class="modal-dialog modal-md" role="document">
|
<div class="modal-dialog modal-md" role="document">
|
||||||
@@ -318,7 +291,6 @@
|
|||||||
<h1 class="modal-title" id="is_memberModalLabel">Are you Member?</h1>
|
<h1 class="modal-title" id="is_memberModalLabel">Are you Member?</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
|
|
||||||
<input type="hidden" name="qr_code" id="qr_code" />
|
<input type="hidden" name="qr_code" id="qr_code" />
|
||||||
<div class="row text-center m-t-20">
|
<div class="row text-center m-t-20">
|
||||||
<% if !@customer_lists.nil? %>
|
<% if !@customer_lists.nil? %>
|
||||||
@@ -453,29 +425,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- customer light box -->
|
|
||||||
<div class="modal fade m-t-40" id="is_paymemberModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog modal-md" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<!-- <h1 class="modal-title" id="is_paymemberModalLabel">Are you Member?</h1> -->
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
|
|
||||||
<input type="hidden" name="qr_code" id="qr_code" />
|
|
||||||
<div class="row text-center m-t-20" align="center">
|
|
||||||
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3"></div>
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
|
||||||
<button type="button" class="btn btn-lg btn-link bg-primary btn_paymal_member">Card</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// //control borwser back
|
// //control borwser back
|
||||||
window.location.hash="no-back-button";
|
window.location.hash="no-back-button";
|
||||||
@@ -489,8 +438,8 @@ var trans_flag = <%= @trans_flag %>;
|
|||||||
var paymalcount = <%= @paymalcount %>;
|
var paymalcount = <%= @paymalcount %>;
|
||||||
// console.log(pdf_view)
|
// console.log(pdf_view)
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
localStorage.removeItem('sale_id')
|
||||||
$("#sxModal").hide();
|
$("#sxModal").hide();
|
||||||
|
|
||||||
/* replace url type*/
|
/* replace url type*/
|
||||||
if(!trans_flag){
|
if(!trans_flag){
|
||||||
localStorage.setItem("trans_flag", trans_flag);
|
localStorage.setItem("trans_flag", trans_flag);
|
||||||
@@ -542,105 +491,6 @@ $(document).ready(function(){
|
|||||||
// Disable click event cash to prevent
|
// Disable click event cash to prevent
|
||||||
$(".payment .cash-color").off('click');
|
$(".payment .cash-color").off('click');
|
||||||
|
|
||||||
|
|
||||||
$('#card_payment').click(function() {
|
|
||||||
localStorage.setItem("cash",$('#cash').text() );
|
|
||||||
var sale_id = $('#sale_id').text();
|
|
||||||
var url_param = "payment";
|
|
||||||
if(location.pathname.includes("credit_payment")){
|
|
||||||
url_param = "credit_payment";
|
|
||||||
}
|
|
||||||
if(cashier_type != "food_court"){
|
|
||||||
window.location.href = '/foodcourt/sale/'+ sale_id + "/"+cashier_type+"/"+url_param+"/others_payment";
|
|
||||||
return false;
|
|
||||||
}else{
|
|
||||||
if(paymalcount == 0.0){
|
|
||||||
$("#is_paymemberModal").modal({show : true, backdrop : false, keyboard : false});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#pay').click(function() {
|
|
||||||
sub_total = $('#sub-total').text();
|
|
||||||
member = $('#membership_id').text();
|
|
||||||
|
|
||||||
$( "#loading_wrapper").show();
|
|
||||||
if($('#balance').text() > 0){
|
|
||||||
swal ( "Oops", "Insufficient Amount!" , "error" );
|
|
||||||
$("#loading_wrapper").hide();
|
|
||||||
}else{
|
|
||||||
$(this).off("click");
|
|
||||||
var sale_id = $('#sale_id').text();
|
|
||||||
// var item_row = $('.is_card');
|
|
||||||
|
|
||||||
// payment
|
|
||||||
var cash = $('#cash').text();
|
|
||||||
var credit = $('#credit').text();
|
|
||||||
var card = $('#card').text();
|
|
||||||
var kbz_amt = "<%= @kbz_pay_amount %>";
|
|
||||||
var is_kbz = false;
|
|
||||||
if (kbz_amt > 0) {
|
|
||||||
is_kbz = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
|
||||||
calculate_member_discount(sale_id,tax_type);
|
|
||||||
/* check credit payment or not*/
|
|
||||||
var url = "<%= foodcourt_payment_cash_path %>";
|
|
||||||
$.ajax({type: "POST",
|
|
||||||
url: url,
|
|
||||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz,
|
|
||||||
success:function(result){
|
|
||||||
/* start delete receipt no in first bill*/
|
|
||||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
|
||||||
var receipt_no = ($("#receipt_no").html()).trim();
|
|
||||||
deleteReceiptNoInFirstBillData(receipt_no);
|
|
||||||
}
|
|
||||||
/* end delete receipt no in first bill*/
|
|
||||||
|
|
||||||
localStorage.removeItem("cash");
|
|
||||||
if (result.status) {
|
|
||||||
var msg = result.message;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
var msg = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#loading_wrapper" ).hide();
|
|
||||||
if(location.pathname.includes("credit_payment")){
|
|
||||||
payment_success_alert();
|
|
||||||
}else{
|
|
||||||
//PDF lightbox data
|
|
||||||
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
|
|
||||||
$("#sale_receipt_no").val(result.receipt_no);
|
|
||||||
$("#filename").val(result.filename);
|
|
||||||
$("#printer_name").val(result.printer_name);
|
|
||||||
$("#receipt_pdf").attr("src", pdfPath);
|
|
||||||
$("#changed_amount").text("");
|
|
||||||
if($('#balance').text() < 0){
|
|
||||||
<% if precision.to_i > 0 %>
|
|
||||||
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
|
|
||||||
<% else %>
|
|
||||||
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
|
|
||||||
<% end %>
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pdf_view == 1) {
|
|
||||||
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
|
|
||||||
$("#pdfModalLabel").text("Sale Completed");
|
|
||||||
}else{
|
|
||||||
//PDF lightbox data
|
|
||||||
print_receipt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var second_display_lookup = $("#display_type").val();
|
|
||||||
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
|
|
||||||
customer_display_view(null,"reload");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
window.customer_display_view = function(data,status) {
|
window.customer_display_view = function(data,status) {
|
||||||
url = '/foodcourt/customer_view';
|
url = '/foodcourt/customer_view';
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -842,6 +692,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function calculate_member_discount(sale_id,tax_type) {
|
function calculate_member_discount(sale_id,tax_type) {
|
||||||
|
alert('function called')
|
||||||
var sub_total = $('#sub-total').text();
|
var sub_total = $('#sub-total').text();
|
||||||
var member_id = $('#membership_id').text();
|
var member_id = $('#membership_id').text();
|
||||||
var member_discount = $('#member_discount').text();
|
var member_discount = $('#member_discount').text();
|
||||||
@@ -862,101 +713,6 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//print pdf function
|
|
||||||
// $(".print_receipt").on('click',function(){
|
|
||||||
$("#print_receipt").on('click touchstart', function(event){
|
|
||||||
$(this).off("click touchstart touchend");
|
|
||||||
print_receipt();
|
|
||||||
});
|
|
||||||
|
|
||||||
function print_receipt() {
|
|
||||||
if($('#pay').is(":visible")) {
|
|
||||||
$('#pay').prop("disabled",true);
|
|
||||||
}
|
|
||||||
|
|
||||||
var sale_id = $('#sale_id').text();
|
|
||||||
var filename = $("#filename").val();
|
|
||||||
var printer_name = $("#printer_name").val();
|
|
||||||
var receipt_no = $("#sale_receipt_no").val();
|
|
||||||
var params = { 'filename':filename, 'receipt_no':receipt_no, 'printer_name':printer_name };
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: "/foodcourt/sale/"+sale_id+"/"+cashier_type+"/payment/print",
|
|
||||||
data: params,
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pdf_view ==1) {
|
|
||||||
var flag = localStorage.getItem("trans_flag");
|
|
||||||
localStorage.removeItem("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;
|
|
||||||
customer_display_view(null,"reload");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
payment_success_alert();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function payment_success_alert(){
|
|
||||||
var title = "Payment Successful!";
|
|
||||||
if($('#balance').text() < 0){
|
|
||||||
var text = 'Changed amount ' + $('#balance').text() * (-1);
|
|
||||||
}else{
|
|
||||||
$('#pay').text("Pay");
|
|
||||||
var text = 'Thank You !';
|
|
||||||
}
|
|
||||||
var sale_id = $('#sale_id').text();
|
|
||||||
swal({
|
|
||||||
title: "Payment Successful!",
|
|
||||||
text: text,
|
|
||||||
html: true,
|
|
||||||
closeOnConfirm: false,
|
|
||||||
closeOnCancel: false,
|
|
||||||
allowOutsideClick: false
|
|
||||||
}, function () {
|
|
||||||
var flag = localStorage.getItem("trans_flag");
|
|
||||||
localStorage.removeItem("trans_flag");
|
|
||||||
customer_display_view(null,"reload");
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$(".btn_pdf_close").on('click',function(){
|
|
||||||
var flag = localStorage.getItem("trans_flag");
|
|
||||||
if((flag!=null) && (flag != "true")){
|
|
||||||
var sale_id = $('#sale_id').text();
|
|
||||||
window.location.href = "/transactions/sales/"+sale_id;
|
|
||||||
}else{
|
|
||||||
if (cashier_type=="cashier") {
|
|
||||||
window.location.href = '/foodcourt';
|
|
||||||
}else{
|
|
||||||
window.location.href = '/foodcourt/'+cashier_type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".btn_customer_yes").on('click',function(){
|
$(".btn_customer_yes").on('click',function(){
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
@@ -980,125 +736,122 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
var customer_mamber_card_no = 0;
|
var customer_mamber_card_no = 0;
|
||||||
var payment_amount = parseFloat($("#grand_total").text());
|
var payment_amount = parseFloat($("#grand_total").text());
|
||||||
|
customer_mamber_card_no = cardNo;
|
||||||
|
if (customer_mamber_card_no == 0) {
|
||||||
|
customer_mamber_card_no = $("#membership_id").text() || 0;
|
||||||
|
}
|
||||||
|
if(sale_id != 0 && customer_mamber_card_no !=0){
|
||||||
|
$("#loading_wrapper").show();
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/foodcourt/"+sale_id+"/send_account" ,
|
||||||
|
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if (data.status == true) {
|
||||||
|
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
|
||||||
|
// $("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "<%=foodcourt_payment_paymal_path%>",
|
||||||
|
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:customer_mamber_card_no},
|
||||||
|
success: function(result){
|
||||||
|
if(result.status == true){
|
||||||
|
swal({
|
||||||
|
title: "Information!",
|
||||||
|
text: result.message,
|
||||||
|
type: 'success',
|
||||||
|
html: true,
|
||||||
|
closeOnConfirm: true,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
$('.confirm').attr("disabled","disabled");
|
||||||
|
sub_total = $('#sub-total').text();
|
||||||
|
member = $('#membership_id').text();
|
||||||
|
|
||||||
|
$( "#loading_wrapper").show();
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
// var item_row = $('.is_card');
|
||||||
|
|
||||||
$("#sxModal").hide();
|
// payment
|
||||||
customer_mamber_card_no = $("#paypar_account_no").val();
|
var cash = $('#cash').text();
|
||||||
if (customer_mamber_card_no == 0) {
|
var credit = $('#credit').text();
|
||||||
customer_mamber_card_no = $("#membership_id").text() || 0;
|
var card = $('#card').text();
|
||||||
}
|
var kbz_amt = "<%= @kbz_pay_amount %>";
|
||||||
if(sale_id != 0 && customer_mamber_card_no !=0){
|
var is_kbz = false;
|
||||||
$("#loading_wrapper").show();
|
if (kbz_amt > 0) {
|
||||||
$.ajax({
|
is_kbz = true
|
||||||
type: "POST",
|
}
|
||||||
url: "/foodcourt/"+sale_id+"/send_account" ,
|
|
||||||
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
|
|
||||||
dataType: "json",
|
|
||||||
success: function(data) {
|
|
||||||
$("#loading_wrapper").hide();
|
|
||||||
if (data.status == true) {
|
|
||||||
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
|
|
||||||
// $("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: "<%=foodcourt_payment_paymal_path%>",
|
|
||||||
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:customer_mamber_card_no},
|
|
||||||
success: function(result){
|
|
||||||
if(result.status == true){
|
|
||||||
swal({
|
|
||||||
title: "Information!",
|
|
||||||
text: result.message,
|
|
||||||
type: 'success',
|
|
||||||
html: true,
|
|
||||||
closeOnConfirm: true,
|
|
||||||
closeOnCancel: false,
|
|
||||||
allowOutsideClick: false
|
|
||||||
}, function (isConfirm) {
|
|
||||||
$('.confirm').attr("disabled","disabled");
|
|
||||||
sub_total = $('#sub-total').text();
|
|
||||||
member = $('#membership_id').text();
|
|
||||||
|
|
||||||
$( "#loading_wrapper").show();
|
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
||||||
var sale_id = $('#sale_id').text();
|
// calculate_member_discount(sale_id,tax_type);
|
||||||
// var item_row = $('.is_card');
|
/* check credit payment or not*/
|
||||||
|
var url = "<%= foodcourt_payment_cash_path %>";
|
||||||
// payment
|
$.ajax({type: "POST",
|
||||||
var cash = $('#cash').text();
|
url: url,
|
||||||
var credit = $('#credit').text();
|
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz+"&account_no="+customer_mamber_card_no,
|
||||||
var card = $('#card').text();
|
success:function(result){
|
||||||
var kbz_amt = "<%= @kbz_pay_amount %>";
|
/* start delete receipt no in first bill*/
|
||||||
var is_kbz = false;
|
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||||
if (kbz_amt > 0) {
|
var receipt_no = ($("#receipt_no").html()).trim();
|
||||||
is_kbz = true
|
deleteReceiptNoInFirstBillData(receipt_no);
|
||||||
}
|
|
||||||
|
|
||||||
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
|
||||||
calculate_member_discount(sale_id,tax_type);
|
|
||||||
/* check credit payment or not*/
|
|
||||||
var url = "<%= foodcourt_payment_cash_path %>";
|
|
||||||
$.ajax({type: "POST",
|
|
||||||
url: url,
|
|
||||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz+"&account_no="+customer_mamber_card_no,
|
|
||||||
success:function(result){
|
|
||||||
/* start delete receipt no in first bill*/
|
|
||||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
|
||||||
var receipt_no = ($("#receipt_no").html()).trim();
|
|
||||||
deleteReceiptNoInFirstBillData(receipt_no);
|
|
||||||
}
|
|
||||||
/* end delete receipt no in first bill*/
|
|
||||||
localStorage.removeItem("cash");
|
|
||||||
window.location.href = "<%= foodcourt_food_court_path %>";
|
|
||||||
}
|
}
|
||||||
});
|
/* end delete receipt no in first bill*/
|
||||||
var second_display_lookup = $("#display_type").val();
|
localStorage.removeItem("cash");
|
||||||
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
|
window.location.href = "<%= foodcourt_food_court_path %>";
|
||||||
customer_display_view(null,"reload");
|
}
|
||||||
}
|
});
|
||||||
});
|
var second_display_lookup = $("#display_type").val();
|
||||||
|
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
|
||||||
|
customer_display_view(null,"reload");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
swal({
|
swal({
|
||||||
title: 'Oops',
|
title: 'Oops',
|
||||||
text: result.message,
|
text: result.message,
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
html: true,
|
html: true,
|
||||||
closeOnConfirm: false,
|
closeOnConfirm: false,
|
||||||
closeOnCancel: false,
|
closeOnCancel: false,
|
||||||
allowOutsideClick: false
|
allowOutsideClick: false
|
||||||
}, function () {
|
}, function () {
|
||||||
window.location.href = '/foodcourt/sale/'+ sale_id +"/"+cashier_type + "/payment";
|
window.location.href = '/foodcourt/sale/'+ sale_id +"/"+cashier_type + "/payment";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
$("#loading_wrapper").hide();
|
||||||
});
|
}
|
||||||
}else{
|
});
|
||||||
swal({
|
}else{
|
||||||
title: 'Oops',
|
swal({
|
||||||
text: data.message,
|
title: 'Oops',
|
||||||
type: 'error',
|
text: data.message,
|
||||||
html: true,
|
type: 'error',
|
||||||
closeOnConfirm: false,
|
html: true,
|
||||||
closeOnCancel: false,
|
closeOnConfirm: false,
|
||||||
allowOutsideClick: false
|
closeOnCancel: false,
|
||||||
}, function () {
|
allowOutsideClick: false
|
||||||
window.location.href = '/foodcourt/sale/'+ sale_id +"/"+cashier_type + "/payment";
|
}, function () {
|
||||||
});
|
window.location.href = '/foodcourt/sale/'+ sale_id +"/"+cashier_type + "/payment";
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}else{
|
});
|
||||||
swal({
|
}else{
|
||||||
title: 'Oops',
|
swal({
|
||||||
text: 'Please Check Member',
|
title: 'Oops',
|
||||||
type: 'warning',
|
text: 'Please Check Member',
|
||||||
html: true,
|
type: 'warning',
|
||||||
closeOnConfirm: false,
|
html: true,
|
||||||
closeOnCancel: false,
|
closeOnConfirm: false,
|
||||||
allowOutsideClick: false
|
closeOnCancel: false,
|
||||||
}, function () {
|
allowOutsideClick: false
|
||||||
window.location.href = '/foodcourt/sale/'+ sale_id +"/"+cashier_type + "/payment";
|
}, function () {
|
||||||
});
|
window.location.href = '/foodcourt/sale/'+ sale_id +"/"+cashier_type + "/payment";
|
||||||
}
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function member_card(cardNo) {
|
function member_card(cardNo) {
|
||||||
@@ -1447,19 +1200,16 @@ $(document).ready(function(){
|
|||||||
$("#customer_name").on("click",function(){
|
$("#customer_name").on("click",function(){
|
||||||
//start customer modal popup
|
//start customer modal popup
|
||||||
if((cashier_type=='quick_service' || cashier_type=='food_court') && (customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
|
if((cashier_type=='quick_service' || cashier_type=='food_court') && (customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
|
||||||
// if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){
|
$("#sxModal").attr('data-for', 'member');
|
||||||
$("#is_memberModal").modal({show : true, backdrop: false, keyboard : false});
|
$("#sxModal").show();
|
||||||
// }
|
getCardNo();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Read Card Reader - Paymal payment for FoodCourt
|
// Read Card Reader - Paymal payment for FoodCourt
|
||||||
$(".btn_paymal_member").on('click', function (){
|
$(".btn_paymal_member").on('click', function (){
|
||||||
console.log('btn_paymal_member');
|
$(this).off('click');
|
||||||
$("#is_paymemberModal").hide();
|
pay_with_card($("#paypar_account_no").val())
|
||||||
$("#sxModal").attr('data-for', 'payment');
|
|
||||||
$("#sxModal").show();
|
|
||||||
getCardNo();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// QR Code Reader
|
// QR Code Reader
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ Rails.application.config.assets.precompile += %w( fileinput.min.js )
|
|||||||
# --- Add order/ Add order - Crm ----
|
# --- Add order/ Add order - Crm ----
|
||||||
Rails.application.config.assets.precompile += %w( addorder.css )
|
Rails.application.config.assets.precompile += %w( addorder.css )
|
||||||
Rails.application.config.assets.precompile += %w( addorder.js )
|
Rails.application.config.assets.precompile += %w( addorder.js )
|
||||||
|
Rails.application.config.assets.precompile += %w( foodcourt/addorder.js )
|
||||||
|
|
||||||
# --- Customer/ Customer - Crm ----
|
# --- Customer/ Customer - Crm ----
|
||||||
Rails.application.config.assets.precompile += %w( wow_style.css )
|
Rails.application.config.assets.precompile += %w( wow_style.css )
|
||||||
|
|||||||
Reference in New Issue
Block a user