add loading and change css file
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
//= require turbolinks
|
//= require turbolinks
|
||||||
//= require BSBMaterial/turbolink_admin.js
|
//= require BSBMaterial/turbolink_admin.js
|
||||||
//= require BSBMaterial/demo.js
|
//= require BSBMaterial/demo.js
|
||||||
|
//= require custom.js
|
||||||
|
|
||||||
/* Constant Varaibles */
|
/* Constant Varaibles */
|
||||||
_CREDIT_PAYMENTS_ = "/ CREDIT PAYMENTS";
|
_CREDIT_PAYMENTS_ = "/ CREDIT PAYMENTS";
|
||||||
@@ -42,79 +43,205 @@ _VOUCHER_ = "/ VOUCHER";
|
|||||||
_SURVEY_ = "/ SURVEY";
|
_SURVEY_ = "/ SURVEY";
|
||||||
/* Constant Varaibles */
|
/* Constant Varaibles */
|
||||||
|
|
||||||
$(document).on('turbolinks:load', function() {
|
$(document).on("turbolinks:load", function () {
|
||||||
|
|
||||||
$("#customer_image_path").fileinput({
|
$("#customer_image_path").fileinput({
|
||||||
previewFileType: "image",
|
previewFileType: "image",
|
||||||
allowedFileExtensions: ["jpg", "gif", "png"],
|
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||||
browseClass: "btn btn-success",
|
browseClass: "btn btn-success",
|
||||||
browseLabel: "Pick Image",
|
browseLabel: "Pick Image",
|
||||||
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
browseIcon: '<i class="fa fa-image"></i> ',
|
||||||
removeClass: "btn btn-danger",
|
removeClass: "btn btn-danger",
|
||||||
removeLabel: "Delete",
|
removeLabel: "Delete",
|
||||||
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
removeIcon: '<i class="fa fa-trash"></i> ',
|
||||||
showUpload: false,
|
showUpload: false,
|
||||||
// uploadClass: "btn btn-info",
|
// uploadClass: "btn btn-info",
|
||||||
// uploadLabel: "Upload",
|
// uploadLabel: "Upload",
|
||||||
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||||
previewTemplates: {
|
previewTemplates: {
|
||||||
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
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' +
|
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||||
'</div>\n',
|
"</div>\n",
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.datetimepicker').bootstrapMaterialDatePicker({
|
$(".datetimepicker").bootstrapMaterialDatePicker({
|
||||||
format: 'DD-MM-YYYY - HH:mm',
|
format: "DD-MM-YYYY - HH:mm",
|
||||||
clearButton: true,
|
|
||||||
weekStart: 1
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.datepicker').bootstrapMaterialDatePicker({
|
|
||||||
format: 'DD-MM-YYYY',
|
|
||||||
clearButton: true,
|
clearButton: true,
|
||||||
weekStart: 1,
|
weekStart: 1,
|
||||||
time: false
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.timepicker').bootstrapMaterialDatePicker({
|
$(".datepicker").bootstrapMaterialDatePicker({
|
||||||
format: 'HH:mm',
|
format: "DD-MM-YYYY",
|
||||||
clearButton: true,
|
clearButton: true,
|
||||||
date: false
|
weekStart: 1,
|
||||||
|
time: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".timepicker").bootstrapMaterialDatePicker({
|
||||||
|
format: "HH:mm",
|
||||||
|
clearButton: true,
|
||||||
|
date: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// For selected order return
|
// For selected order return
|
||||||
var order_status = "";
|
var order_status = "";
|
||||||
order_status = $(".selected-item").children().find(".orders-order-status").text().substr(0,6).trim();
|
order_status = $(".selected-item")
|
||||||
|
.children()
|
||||||
|
.find(".orders-order-status")
|
||||||
|
.text()
|
||||||
|
.substr(0, 6)
|
||||||
|
.trim();
|
||||||
|
|
||||||
|
// Enable/Disable Button
|
||||||
|
//control_button(order_status);
|
||||||
|
|
||||||
$(document).on('click', '.access_modal', function(event){
|
$(".orders").on("click", function () {
|
||||||
type = $(this).data("type");
|
$("#order-sub-total").text("");
|
||||||
$(".ok").attr("data-action",type);
|
// $("#order-food").text('');
|
||||||
$('#AccessCodeModal').modal('show');
|
// $("#order-beverage").text('');
|
||||||
|
$("#order-discount").text("");
|
||||||
|
$("#order-Tax").text("");
|
||||||
|
$("#order-grand-total").text("");
|
||||||
|
|
||||||
|
var zone_name = $(this).find(".orders-table").text();
|
||||||
|
var receipt_no = $(this).find(".orders-receipt-no").text();
|
||||||
|
var unique_id = $(this).find(".orders-id").text();
|
||||||
|
var order_status = $(this).find(".orders-order-status").text().trim();
|
||||||
|
|
||||||
|
// Enable/Disable Button
|
||||||
|
//control_button(order_status);
|
||||||
|
|
||||||
|
var customer_id = $(this).find(".customer-id").text();
|
||||||
|
show_customer_details(customer_id);
|
||||||
|
|
||||||
|
$("#re-print").val(unique_id);
|
||||||
|
|
||||||
|
var cashier = "";
|
||||||
|
var receipt_date = "";
|
||||||
|
var sub_total = 0.0;
|
||||||
|
var discount_amount = 0;
|
||||||
|
var tax_amount = 0;
|
||||||
|
var grand_total_amount = 0;
|
||||||
|
|
||||||
|
$("#order-title").text("ORDER DETAILS - " + zone_name);
|
||||||
|
// clear order items
|
||||||
|
$("#order-items-table").children("tbody").empty();
|
||||||
|
|
||||||
|
// AJAX call for order
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/" + unique_id,
|
||||||
|
data: { booking_id: unique_id },
|
||||||
|
success: function (result) {
|
||||||
|
for (i = 0; i < result.length; i++) {
|
||||||
|
var data = JSON.stringify(result[i]);
|
||||||
|
var parse_data = JSON.parse(data);
|
||||||
|
var show_date = "";
|
||||||
|
|
||||||
|
// Receipt Header
|
||||||
|
receipt_no = result[i].receipt_no;
|
||||||
|
cashier = result[i].cashier_name;
|
||||||
|
if (result[i].receipt_date != null) {
|
||||||
|
receipt_date = new Date(result[i].receipt_date);
|
||||||
|
show_date =
|
||||||
|
receipt_date.getDate() +
|
||||||
|
"-" +
|
||||||
|
receipt_date.getMonth() +
|
||||||
|
"-" +
|
||||||
|
receipt_date.getFullYear() +
|
||||||
|
" " +
|
||||||
|
receipt_date.getHours() +
|
||||||
|
":" +
|
||||||
|
receipt_date.getMinutes();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Receipt Charges
|
||||||
|
sub_total += parseFloat(parse_data.price);
|
||||||
|
|
||||||
|
discount_amount =
|
||||||
|
parse_data.discount_amount == null
|
||||||
|
? "0.0"
|
||||||
|
: parse_data.discount_amount;
|
||||||
|
tax_amount = parse_data.tax_amount;
|
||||||
|
grand_total_amount = parse_data.grand_total_amount;
|
||||||
|
|
||||||
|
// Ordered Items
|
||||||
|
var order_items_rows =
|
||||||
|
"<tr>" +
|
||||||
|
"<td class='item-name'>" +
|
||||||
|
parse_data.item_name +
|
||||||
|
"</td>" +
|
||||||
|
"<td class='item-attr'>" +
|
||||||
|
parse_data.qty +
|
||||||
|
"</td>" +
|
||||||
|
"<td class='item-attr'>" +
|
||||||
|
parse_data.price +
|
||||||
|
"</td>" +
|
||||||
|
"</tr>";
|
||||||
|
|
||||||
|
$("#order-items-table").children("tbody").append(order_items_rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cashier Info
|
||||||
|
$("#receipt_no").text(receipt_no);
|
||||||
|
$("#cashier").text(cashier == null ? "" : cashier);
|
||||||
|
$("#receipt_date").text(show_date);
|
||||||
|
|
||||||
|
// Payment Info
|
||||||
|
$("#order-sub-total").text(sub_total);
|
||||||
|
// $("#order-food").text('');
|
||||||
|
// $("#order-beverage").text('');
|
||||||
|
$("#order-discount").text(discount_amount);
|
||||||
|
$("#order-Tax").text(tax_amount);
|
||||||
|
$("#order-grand-total").text(grand_total_amount);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// End AJAX Call
|
||||||
|
|
||||||
|
$(".orders").removeClass("selected-item");
|
||||||
|
$(this).addClass("selected-item");
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.access_number', function(event){
|
// Payment for Bill
|
||||||
|
$("#pay-bill").click(function () {
|
||||||
|
var sale_id = $(".selected-item").find(".orders-id").text().substr(0, 16);
|
||||||
|
if (sale_id != "") {
|
||||||
|
window.location.href = "/origami/sale/" + sale_id + "/payment";
|
||||||
|
} else {
|
||||||
|
alert("Please select an order!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$(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) {
|
if (event.handled !== true) {
|
||||||
var original_value = $('#access_code').val();
|
var original_value = $("#access_code").val();
|
||||||
var input_type = $(this).attr("data-type");
|
var input_type = $(this).attr("data-type");
|
||||||
|
|
||||||
switch (input_type) {
|
switch (input_type) {
|
||||||
case 'num':
|
case "num":
|
||||||
var input_value = $(this).attr("data-value");
|
var input_value = $(this).attr("data-value");
|
||||||
if (original_value) {
|
if (original_value) {
|
||||||
$('#access_code').val(original_value + input_value);
|
$("#access_code").val(original_value + input_value);
|
||||||
} else {
|
} else {
|
||||||
$('#access_code').val(original_value + input_value);
|
$("#access_code").val(original_value + input_value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'ok':
|
case "ok":
|
||||||
var type = $(this).attr("data-action");
|
var type = $(this).attr("data-action");
|
||||||
code = $('#access_code').val();
|
code = $("#access_code").val();
|
||||||
check_emp_access_code(code,type)
|
check_emp_access_code(code, type);
|
||||||
break;
|
break;
|
||||||
case 'clr':
|
case "clr":
|
||||||
$('#access_code').val("");
|
$("#access_code").val("");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
event.handled = true;
|
event.handled = true;
|
||||||
@@ -122,7 +249,367 @@ $(document).on('turbolinks:load', function() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on("click", ".credit_detail", function () {
|
||||||
|
var sale_id = $(this).attr("data-id");
|
||||||
|
var cashier_type = $(this).attr("data-type");
|
||||||
|
if (cashier_type == "cashier") {
|
||||||
|
window.location.href = "/origami/cashier/credit_sales/" + sale_id;
|
||||||
|
} else {
|
||||||
|
window.location.href = "/origami/quick_service/credit_sales/" + sale_id;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/* start check first bill or not funs: */
|
||||||
|
function checkReceiptNoInFirstBillData(receipt_no, payment) {
|
||||||
|
// localStorage.removeItem('receipt_lists');
|
||||||
|
var status = false;
|
||||||
|
var json_data = [];
|
||||||
|
if (receipt_no != undefined && receipt_no != "") {
|
||||||
|
if (localStorage.hasOwnProperty("receipt_lists") === true) {
|
||||||
|
var arr_data = JSON.parse(localStorage.getItem("receipt_lists"));
|
||||||
|
if (payment) {
|
||||||
|
json_data = arr_data.filter(function (e) {
|
||||||
|
return e.receipt_no == receipt_no;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
json_data = arr_data.filter(function (e) {
|
||||||
|
return e.receipt_no !== receipt_no;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arr_data.length > json_data.length) {
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (payment) {
|
||||||
|
if (json_data.length > 0) {
|
||||||
|
return json_data[0]["payment"];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createReceiptNoInFirstBillData(receipt_no, payment) {
|
||||||
|
var arr_data = [];
|
||||||
|
var json_data = [];
|
||||||
|
if (localStorage.hasOwnProperty("receipt_lists") === true) {
|
||||||
|
arr_data = JSON.parse(localStorage.getItem("receipt_lists"));
|
||||||
|
json_data = arr_data.filter(function (e) {
|
||||||
|
return e.receipt_no == receipt_no;
|
||||||
|
});
|
||||||
|
if (payment) {
|
||||||
|
jdata = arr_data.filter(function (e) {
|
||||||
|
return e.receipt_no !== receipt_no;
|
||||||
|
});
|
||||||
|
jdata.push({ receipt_no: receipt_no, payment: payment });
|
||||||
|
localStorage.setItem("receipt_lists", JSON.stringify(jdata));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
(arr_data.length == 0 && json_data.length == 0) ||
|
||||||
|
(arr_data.length > 0 && json_data.length == 0)
|
||||||
|
) {
|
||||||
|
arr_data.push({ receipt_no: receipt_no, payment: payment });
|
||||||
|
localStorage.setItem("receipt_lists", JSON.stringify(arr_data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteReceiptNoInFirstBillData(receipt_no) {
|
||||||
|
if (localStorage.hasOwnProperty("receipt_lists") === true) {
|
||||||
|
var arr_data = JSON.parse(localStorage.getItem("receipt_lists"));
|
||||||
|
var json_data = arr_data.filter(function (e) {
|
||||||
|
return e.receipt_no !== receipt_no;
|
||||||
|
});
|
||||||
|
localStorage.setItem("receipt_lists", JSON.stringify(json_data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* end check first bill or not funs: */
|
||||||
|
|
||||||
|
//start CB ECR integration
|
||||||
|
//set CB com port data
|
||||||
|
function setCommPorts(comPortLists) {
|
||||||
|
var sale_id = $("#sale_id").val();
|
||||||
|
$("#com_port_name").html("");
|
||||||
|
var jsonPortLists = $.parseJSON(comPortLists);
|
||||||
|
// alert(jsonPortLists);
|
||||||
|
if (
|
||||||
|
jsonPortLists != undefined &&
|
||||||
|
jsonPortLists != "" &&
|
||||||
|
jsonPortLists.length > 0
|
||||||
|
) {
|
||||||
|
$.each(jsonPortLists, function (key, value) {
|
||||||
|
$("#com_port_name").append(
|
||||||
|
"<option value='" + value + "'>" + value + "</option>"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
swal(
|
||||||
|
{
|
||||||
|
title: "Oops",
|
||||||
|
text: "Payment device has been disconnected! Please plug it in.",
|
||||||
|
type: "error",
|
||||||
|
html: true,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false,
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
window.location.href =
|
||||||
|
"/origami/sale/" +
|
||||||
|
sale_id +
|
||||||
|
"/" +
|
||||||
|
cashier_type +
|
||||||
|
"/payment/others_payment";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** pay with CB bank **/
|
||||||
|
function pay_withBank(cmd_type, payment_type, bnk_bill_amount,sale_id,receipt_no,cashier_type) {
|
||||||
|
$("#loading_wrapper").show();
|
||||||
|
var com_port = $("#com_port_name").val();
|
||||||
|
reqCardSaleTrans(cmd_type, payment_type, bnk_bill_amount, sale_id, receipt_no, com_port,cashier_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
//add req data to card_sale_trans table
|
||||||
|
function reqCardSaleTrans(
|
||||||
|
cmd_type,
|
||||||
|
payment_type,
|
||||||
|
bnk_bill_amount,
|
||||||
|
sale_id,
|
||||||
|
receipt_no,
|
||||||
|
com_port,
|
||||||
|
cashier_type
|
||||||
|
) {
|
||||||
|
var jobj = {
|
||||||
|
cmd_type: cmd_type,
|
||||||
|
payment_type: "CARD",
|
||||||
|
amt: bnk_bill_amount,
|
||||||
|
sale_id: sale_id,
|
||||||
|
inv_no: receipt_no,
|
||||||
|
com_port: com_port,
|
||||||
|
};
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/bank_integration/sale_trans",
|
||||||
|
data: { type: "request", data: jobj },
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.status == "success") {
|
||||||
|
card_sale_trans_id = data.card_sale_trans_id;
|
||||||
|
resCardSaleTrans(
|
||||||
|
card_sale_trans_id,
|
||||||
|
cmd_type,
|
||||||
|
payment_type,
|
||||||
|
bnk_bill_amount,
|
||||||
|
sale_id,
|
||||||
|
receipt_no,
|
||||||
|
com_port,
|
||||||
|
cashier_type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//add res data to card_sale_trans table
|
||||||
|
function resCardSaleTrans(
|
||||||
|
card_sale_trans_id,
|
||||||
|
cmd_type,
|
||||||
|
payment_type,
|
||||||
|
bnk_bill_amount,
|
||||||
|
sale_id,
|
||||||
|
receipt_no,
|
||||||
|
com_port,
|
||||||
|
cashier_type
|
||||||
|
) {
|
||||||
|
var resMsg = "";
|
||||||
|
var card_payment_type = "";
|
||||||
|
if ($("#loading_wrapper").is(":visible")) {
|
||||||
|
if (
|
||||||
|
payment_type == "mpu" ||
|
||||||
|
payment_type == "visa" ||
|
||||||
|
payment_type == "master" ||
|
||||||
|
payment_type == "jcb" ||
|
||||||
|
payment_type == "unionpay"
|
||||||
|
) {
|
||||||
|
card_payment_type = "CARD";
|
||||||
|
} else if (payment_type == "alipay") {
|
||||||
|
card_payment_type = "EWALLET";
|
||||||
|
}
|
||||||
|
|
||||||
|
bnk_bill_amount = parseFloat(bnk_bill_amount);
|
||||||
|
|
||||||
|
resMsg = code2lab.reqBankPayment(
|
||||||
|
cmd_type,
|
||||||
|
card_payment_type,
|
||||||
|
bnk_bill_amount,
|
||||||
|
receipt_no,
|
||||||
|
com_port
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resMsg.includes("STATUS")) {
|
||||||
|
var jobj = $.parseJSON(resMsg);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/bank_integration/sale_trans",
|
||||||
|
data: {
|
||||||
|
type: "response",
|
||||||
|
card_sale_trans_id: card_sale_trans_id,
|
||||||
|
data: jobj,
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.status == "success") {
|
||||||
|
resCBPay(
|
||||||
|
resMsg,
|
||||||
|
card_sale_trans_id,
|
||||||
|
cmd_type,
|
||||||
|
payment_type,
|
||||||
|
bnk_bill_amount,
|
||||||
|
sale_id,
|
||||||
|
receipt_no,
|
||||||
|
com_port,
|
||||||
|
cashier_type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (payment_type != "master") {
|
||||||
|
payment_type = payment_type.toUpperCase();
|
||||||
|
} else {
|
||||||
|
payment_type = "Master";
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#loading_wrapper").hide();
|
||||||
|
swal(
|
||||||
|
{
|
||||||
|
title: "Oops",
|
||||||
|
text: resMsg.toString(),
|
||||||
|
type: "error",
|
||||||
|
html: true,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false,
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
var url_param = "payment";
|
||||||
|
if (location.pathname.includes("credit_payment")) {
|
||||||
|
url_param = "credit_payment";
|
||||||
|
}
|
||||||
|
window.location.href =
|
||||||
|
"/origami/sale/" +
|
||||||
|
sale_id +
|
||||||
|
"/" +
|
||||||
|
cashier_type +
|
||||||
|
"/" +
|
||||||
|
url_param +
|
||||||
|
"/others_payment/" +
|
||||||
|
payment_type;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function resCBPay(
|
||||||
|
resMsg,
|
||||||
|
card_sale_trans_id,
|
||||||
|
cmd_type,
|
||||||
|
payment_type,
|
||||||
|
bnk_bill_amount,
|
||||||
|
sale_id,
|
||||||
|
receipt_no,
|
||||||
|
com_port,
|
||||||
|
cashier_type
|
||||||
|
) {
|
||||||
|
$("#loading_wrapper").hide();
|
||||||
|
var jobj = $.parseJSON(resMsg);
|
||||||
|
$("#reference_no").val(jobj.REFNUM);
|
||||||
|
if (jobj.STATUS == "Approved") {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/payment/" + payment_type,
|
||||||
|
data:
|
||||||
|
"amount=" +
|
||||||
|
bnk_bill_amount +
|
||||||
|
"&sale_id=" +
|
||||||
|
sale_id +
|
||||||
|
"&ref_no=" +
|
||||||
|
jobj.REFNUM,
|
||||||
|
success: function (result) {
|
||||||
|
if (result) {
|
||||||
|
swal(
|
||||||
|
{
|
||||||
|
title: "Information!",
|
||||||
|
text: "Payment Successfully",
|
||||||
|
html: true,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false,
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
var url_param = "payment";
|
||||||
|
if (location.pathname.includes("credit_payment")) {
|
||||||
|
url_param = "credit_payment";
|
||||||
|
}
|
||||||
|
window.location.href =
|
||||||
|
"/origami/sale/" +
|
||||||
|
sale_id +
|
||||||
|
"/" +
|
||||||
|
cashier_type +
|
||||||
|
"/" +
|
||||||
|
url_param;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (payment_type != "master") {
|
||||||
|
payment_type = payment_type.toUpperCase();
|
||||||
|
} else {
|
||||||
|
payment_type = "Master";
|
||||||
|
}
|
||||||
|
swal(
|
||||||
|
{
|
||||||
|
title: "Oops",
|
||||||
|
text: "Transaction is " + jobj.STATUS.toLowerCase(),
|
||||||
|
type: "error",
|
||||||
|
html: true,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false,
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
var url_param = "payment";
|
||||||
|
if (location.pathname.includes("credit_payment")) {
|
||||||
|
url_param = "credit_payment";
|
||||||
|
}
|
||||||
|
window.location.href =
|
||||||
|
"/origami/sale/" +
|
||||||
|
sale_id +
|
||||||
|
"/" +
|
||||||
|
cashier_type +
|
||||||
|
"/" +
|
||||||
|
url_param +
|
||||||
|
"/others_payment/" +
|
||||||
|
payment_type;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//end CB ECR integration
|
||||||
|
|
||||||
function setHeaderBreadCrumb(params) {
|
function setHeaderBreadCrumb(params) {
|
||||||
$("#others_payment").html(params);
|
$("#others_payment").html(params);
|
||||||
@@ -150,37 +637,131 @@ function showHideNavbar(webview,page){
|
|||||||
function createAccessCode(code) {
|
function createAccessCode(code) {
|
||||||
localStorage.setItem("access_code", code);
|
localStorage.setItem("access_code", code);
|
||||||
}
|
}
|
||||||
function check_emp_access_code(access_code,type) {
|
|
||||||
var url = "/foodcourt/check_emp_access_code/" + access_code ;
|
//get menu item cache
|
||||||
|
function getAllMenu() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: "GET",
|
||||||
url: url,
|
url: "/origami/get_all_menu",
|
||||||
data: {},
|
data: {},
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
if (result.status == true) {
|
console.log(result);
|
||||||
createAccessCode(code);
|
localStorage.setItem("menus", JSON.stringify(result));
|
||||||
if (type == "edit") {
|
|
||||||
var dining_id = $('#dining').text();
|
var menu = localStorage.getItem("menus");
|
||||||
var sale_id = $('#sale_id').text();
|
if (menu != null) {
|
||||||
if (dining_id) {
|
$("#loading_wrapper").hide();
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* String format */
|
||||||
|
if (!String.prototype.formatUnicorn) {
|
||||||
|
String.prototype.formatUnicorn = function () {
|
||||||
|
var e = this.toString();
|
||||||
|
if (!arguments.length) {
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
var t = typeof arguments[0],
|
||||||
|
n =
|
||||||
|
"string" == t || "number" == t
|
||||||
|
? Array.prototype.slice.call(arguments)
|
||||||
|
: arguments[0];
|
||||||
|
for (var i in n) {
|
||||||
|
e = e.replace(
|
||||||
|
new RegExp("\\{" + i + "\\}", "gi"),
|
||||||
|
n[i] == null ? "" : n[i]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return e;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/* String format */
|
||||||
|
|
||||||
|
//credit sales lists
|
||||||
|
function timeFormat(date) {
|
||||||
|
var isPM = date.getHours() >= 12;
|
||||||
|
var isMidday = date.getHours() == 12;
|
||||||
|
var time =
|
||||||
|
[
|
||||||
|
(date.getHours() > 10 ? date.getHours() : "0" + date.getHours()) -
|
||||||
|
(isPM && !isMidday ? 12 : 0),
|
||||||
|
(date.getMinutes() > 10 ? date.getMinutes() : "0" + date.getMinutes()) ||
|
||||||
|
"00",
|
||||||
|
].join(":") + (isPM ? " PM" : " AM");
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCreditData(cashier_type) {
|
||||||
|
var filter = $("#filter").val();
|
||||||
|
var customer = $("#sel_customer").val();
|
||||||
|
|
||||||
|
var receipt_no = "";
|
||||||
|
var customer_id = "";
|
||||||
|
if (filter != undefined && filter != null && filter != "") {
|
||||||
|
receipt_no = filter;
|
||||||
|
}
|
||||||
|
if (customer != undefined && customer != null && customer != "") {
|
||||||
|
customer_id = customer;
|
||||||
|
}
|
||||||
|
getCreditSales(receipt_no, customer_id, cashier_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCreditSales(filter, customer, cashier_type) {
|
||||||
|
// $(".credit_items").hide();
|
||||||
|
$(".tbd_credit_lists").empty();
|
||||||
|
var html_credit_items = $("#html_credit_items").html();
|
||||||
|
var receipt_no = "";
|
||||||
|
var customer_id = "";
|
||||||
|
if (filter != undefined && filter != null && filter != "") {
|
||||||
|
receipt_no = filter;
|
||||||
|
}
|
||||||
|
if (customer != undefined && customer != null && customer != "") {
|
||||||
|
customer_id = customer;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
data: { receipt_no: receipt_no, customer_id: customer_id },
|
||||||
|
dataType: "json",
|
||||||
|
url: "/origami/" + cashier_type + "/credit_sales",
|
||||||
|
success: function (data) {
|
||||||
|
// console.log(data);
|
||||||
|
if (data.status) {
|
||||||
|
var credit_sales = data.data;
|
||||||
|
// console.log(credit_sales);
|
||||||
|
if (credit_sales.length > 0) {
|
||||||
|
$(".credit_items").show();
|
||||||
|
for (var i = 0; i < credit_sales.length; i++) {
|
||||||
|
var sale_date = new Date(credit_sales[i].sale_date);
|
||||||
|
var receipt_date =
|
||||||
|
sale_date.getFullYear() +
|
||||||
|
"-" +
|
||||||
|
(sale_date.getMonth() > 10
|
||||||
|
? sale_date.getMonth() + 1
|
||||||
|
: "0" + (sale_date.getMonth() + 1)) +
|
||||||
|
"-" +
|
||||||
|
(sale_date.getDate() > 10
|
||||||
|
? sale_date.getDate()
|
||||||
|
: "0" + sale_date.getDate());
|
||||||
|
$(".tbd_credit_lists").append(
|
||||||
|
html_credit_items.formatUnicorn({
|
||||||
|
key: i,
|
||||||
|
sale_id: credit_sales[i].sale_id,
|
||||||
|
receipt_date: receipt_date + " " + timeFormat(sale_date),
|
||||||
|
receipt_no: credit_sales[i].receipt_no,
|
||||||
|
cashier_name: credit_sales[i].cashier_name,
|
||||||
|
customer_name: credit_sales[i].customer_name,
|
||||||
|
credit_amount: credit_sales[i].payment_amount,
|
||||||
|
cashier_type: cashier_type,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$(".tbd_credit_lists").html(data.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//End of credit sales function
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ function member_card(cardNo) {
|
|||||||
var g_membership_type = '';
|
var g_membership_type = '';
|
||||||
var sale_id = 0 ;
|
var sale_id = 0 ;
|
||||||
if(cardNo != 0){
|
if(cardNo != 0){
|
||||||
|
$("#oqs_loading_wrapper").show();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/foodcourt/"+sale_id+"/get_customer" ,
|
url: "/foodcourt/"+sale_id+"/get_customer" ,
|
||||||
@@ -108,6 +109,7 @@ function request_bill(membership_id,customer_id,customer_name){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function update_sale(membership_id, customer_id, customer_name, sale_id) {
|
function update_sale(membership_id, customer_id, customer_name, sale_id) {
|
||||||
|
$("#oqs_loading_wrapper").css("display", "none");
|
||||||
var customer="";
|
var customer="";
|
||||||
var cashier_type = 'food_court';
|
var cashier_type = 'food_court';
|
||||||
if(customer_name != ""){
|
if(customer_name != ""){
|
||||||
@@ -116,7 +118,7 @@ function update_sale(membership_id, customer_id, customer_name, sale_id) {
|
|||||||
|
|
||||||
swal({
|
swal({
|
||||||
title: "Confirmation !",
|
title: "Confirmation !",
|
||||||
text: 'Are You Sure to assign this customer' + customer + '!',
|
text: 'Are you sure to assign this customer' + customer + '!',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: "green",
|
confirmButtonColor: "green",
|
||||||
confirmButtonText: "Yes!",
|
confirmButtonText: "Yes!",
|
||||||
@@ -136,8 +138,7 @@ function update_sale(membership_id, customer_id, customer_name, sale_id) {
|
|||||||
$("#membership_id").html(membership_id);
|
$("#membership_id").html(membership_id);
|
||||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||||
}else{
|
}else{
|
||||||
swal("Alert!", "Record not found!", "error");
|
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||||
location.reload();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
@import "BSBMaterial/themes/all-themes";
|
@import "BSBMaterial/themes/all-themes";
|
||||||
@import "reset";
|
@import "reset";
|
||||||
@import "fileinput.min";
|
@import "fileinput.min";
|
||||||
|
@import "custom";
|
||||||
|
|
||||||
|
|
||||||
/* Reset */
|
/* Reset */
|
||||||
@@ -29,7 +30,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
section.content {
|
section.content {
|
||||||
margin: 70px 5px 0 225px;
|
margin: 0 5px 0 5px;
|
||||||
|
padding: 64px 0 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
@@ -112,12 +114,14 @@ select.form-control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.pay{
|
.pay{
|
||||||
width: 86%;
|
|
||||||
height:174px;
|
|
||||||
line-height:174px;
|
|
||||||
text-align:center;
|
text-align:center;
|
||||||
font-size:20px;
|
font-size:20px;
|
||||||
color:white;
|
color:white;
|
||||||
|
border-radius: 50% !important;
|
||||||
|
width: 45%;
|
||||||
|
height: 220px;
|
||||||
|
margin: 0 auto !important;
|
||||||
|
line-height: 210px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.move_table{
|
.move_table{
|
||||||
|
|||||||
@@ -191,7 +191,7 @@
|
|||||||
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
||||||
<input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>">
|
<input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>">
|
||||||
|
|
||||||
<div class="btn_paymal_member pay border-top border- border-left purple payment-left" style="border-radius: 50%; width: 45%; height: 220px; margin: 0 auto; line-height: 210px;">
|
<div class="btn_paymal_member pay border-top border- border-left purple payment-left">
|
||||||
Pay
|
Pay
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -211,17 +211,6 @@
|
|||||||
<% else %>
|
<% else %>
|
||||||
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||||
<%end %>
|
<%end %>
|
||||||
<% if @other_payment <= 0 %>
|
|
||||||
<%if @sale_data.total_discount == 0 %>
|
|
||||||
<% if current_login_employee.role == "cashier" %>
|
|
||||||
<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>
|
|
||||||
<% else %>
|
|
||||||
<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 %>
|
||||||
<% if @sale_payment.nil? %>
|
<% if @sale_payment.nil? %>
|
||||||
<hr>
|
<hr>
|
||||||
@@ -288,7 +277,7 @@
|
|||||||
<div class="modal-dialog modal-md" role="document">
|
<div class="modal-dialog modal-md" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<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="qr_code" id="qr_code" />
|
<input type="hidden" name="qr_code" id="qr_code" />
|
||||||
@@ -436,9 +425,9 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
var pdf_view = '<%=@pdf_view%>';
|
var pdf_view = '<%=@pdf_view%>';
|
||||||
var trans_flag = <%= @trans_flag %>;
|
var trans_flag = <%= @trans_flag %>;
|
||||||
var paymalcount = <%= @paymalcount %>;
|
var paymalcount = <%= @paymalcount %>;
|
||||||
|
var customer_paypar_account = '<%= @sale_data.customer.paypar_account_no %>';
|
||||||
// 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){
|
||||||
@@ -951,7 +940,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
swal({
|
swal({
|
||||||
title: "Confirmation !",
|
title: "Confirmation !",
|
||||||
text: 'Are You Sure to assign this customer' + customer + '!',
|
text: 'Are you sure to assign this customer' + customer + '!',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: "green",
|
confirmButtonColor: "green",
|
||||||
confirmButtonText: "Yes!",
|
confirmButtonText: "Yes!",
|
||||||
@@ -1044,7 +1033,7 @@ $(document).ready(function(){
|
|||||||
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':cashier_type,'access_code':access_code };
|
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':cashier_type,'access_code':access_code };
|
||||||
swal({
|
swal({
|
||||||
title: "Alert",
|
title: "Alert",
|
||||||
text: "Are you sure want to FOC This Receipt?",
|
text: "Are you sure want to FOC this receipt?",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: "#DD6B55",
|
confirmButtonColor: "#DD6B55",
|
||||||
@@ -1209,7 +1198,13 @@ $(document).ready(function(){
|
|||||||
// 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 (){
|
||||||
$(this).off('click');
|
$(this).off('click');
|
||||||
|
if(customer_paypar_account !== null && customer_paypar_account !== '') {
|
||||||
pay_with_card($("#paypar_account_no").val())
|
pay_with_card($("#paypar_account_no").val())
|
||||||
|
}else{
|
||||||
|
$("#sxModal").attr('data-for', 'member');
|
||||||
|
$("#sxModal").show();
|
||||||
|
getCardNo();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// QR Code Reader
|
// QR Code Reader
|
||||||
@@ -1288,7 +1283,7 @@ $(document).ready(function(){
|
|||||||
var access_code = localStorage.getItem("access_code");
|
var access_code = localStorage.getItem("access_code");
|
||||||
swal({
|
swal({
|
||||||
title: "Alert",
|
title: "Alert",
|
||||||
text: "Are you sure want to Void?",
|
text: "Are you sure want to void?",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: "#DD6B55",
|
confirmButtonColor: "#DD6B55",
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
<!-- Favicon-->
|
<!-- Favicon-->
|
||||||
<link rel="icon" href="/favicon.ico" type="image/x-icon">
|
<link rel="icon" href="/favicon.ico" type="image/x-icon">
|
||||||
|
|
||||||
<%= stylesheet_link_tag 'origami', media: 'all' %>
|
<%= stylesheet_link_tag 'foodcourt', media: 'all' %>
|
||||||
<%= javascript_include_tag 'origami', 'data-turbolinks-track': 'reload' %>
|
<%= javascript_include_tag 'foodcourt', 'data-turbolinks-track': 'reload' %>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="theme-indigo" style="overflow-x:hidden">
|
<body class="theme-indigo" style="overflow-x:hidden">
|
||||||
|
|||||||
Reference in New Issue
Block a user