app order
This commit is contained in:
@@ -1,23 +1,5 @@
|
|||||||
//middle edit
|
//middle edit
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#loading_wrapper").show();
|
|
||||||
getAllMenu();
|
|
||||||
//get menu item cache
|
|
||||||
function getAllMenu(){
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: '/foodcourt/get_all_menu',
|
|
||||||
data: {},
|
|
||||||
success:function(result){
|
|
||||||
console.log(result)
|
|
||||||
localStorage.setItem("menus", JSON.stringify(result));
|
|
||||||
var menu = localStorage.getItem("menus");
|
|
||||||
if (menu != null ) {
|
|
||||||
$( "#loading_wrapper").hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var role = $('#role').val();
|
var role = $('#role').val();
|
||||||
var second_display_lookup = $("#display_type").val();
|
var second_display_lookup = $("#display_type").val();
|
||||||
type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court");
|
type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court");
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ $(document).ready(function() {
|
|||||||
// var method = $(this).attr('data-method');
|
// var method = $(this).attr('data-method');
|
||||||
// var url = $(this).attr('data-ref');
|
// var url = $(this).attr('data-ref');
|
||||||
// var html_text = $(this).siblings( "#delete_text" ).html();
|
// var html_text = $(this).siblings( "#delete_text" ).html();
|
||||||
// //var page = url.substring(url.lastIndexOf('/') + 1);
|
// //var page = url.substring(url.lastIndexOf('/') + 1);
|
||||||
// swal({
|
// swal({
|
||||||
// title: "Confirmation",
|
// title: "Confirmation",
|
||||||
// text: html_text,
|
// text: html_text,
|
||||||
@@ -147,11 +147,11 @@ $(document).ready(function() {
|
|||||||
// if (isConfirm) {
|
// if (isConfirm) {
|
||||||
// $.ajax({
|
// $.ajax({
|
||||||
// type: method,
|
// type: method,
|
||||||
// url: url ,
|
// url: url ,
|
||||||
// success: function(data) {
|
// success: function(data) {
|
||||||
// location.href = data.url;
|
// location.href = data.url;
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
// } else {
|
// } else {
|
||||||
// swal("Cancelled", "Your imaginary file is safe :)", "error");
|
// swal("Cancelled", "Your imaginary file is safe :)", "error");
|
||||||
// }
|
// }
|
||||||
@@ -167,7 +167,7 @@ $(document).ready(function() {
|
|||||||
var text = $("#notify_message").attr('data-message');
|
var text = $("#notify_message").attr('data-message');
|
||||||
|
|
||||||
if (text != null || colorName != null){
|
if (text != null || colorName != null){
|
||||||
showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
|
showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit) {
|
function showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit) {
|
||||||
@@ -222,8 +222,8 @@ function audioPlayBackground(shop_code,audio){
|
|||||||
function getOnlineOrderCount(){
|
function getOnlineOrderCount(){
|
||||||
var count = 0;
|
var count = 0;
|
||||||
//Start Ajax
|
//Start Ajax
|
||||||
$.ajax({
|
$.ajax({
|
||||||
async: false,
|
async: false,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: "/origami/get_order_info",
|
url: "/origami/get_order_info",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@@ -234,8 +234,8 @@ function getOnlineOrderCount(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//end Ajax
|
//end Ajax
|
||||||
// alert(count);
|
// alert(count);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
/* online order count*/
|
/* online order count*/
|
||||||
|
|||||||
@@ -1,591 +0,0 @@
|
|||||||
//= 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();
|
|
||||||
|
|
||||||
// Enable/Disable Button
|
|
||||||
//control_button(order_status);
|
|
||||||
|
|
||||||
$(".orders").on('click', function(){
|
|
||||||
$("#order-sub-total").text('');
|
|
||||||
// $("#order-food").text('');
|
|
||||||
// $("#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');
|
|
||||||
});
|
|
||||||
|
|
||||||
// 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) {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$(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){
|
|
||||||
$("#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);
|
|
||||||
}
|
|
||||||
|
|
||||||
//get menu item cache
|
|
||||||
function getAllMenu(){
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: '/origami/get_all_menu',
|
|
||||||
data: {},
|
|
||||||
success:function(result){
|
|
||||||
console.log(result)
|
|
||||||
localStorage.setItem("menus", JSON.stringify(result));
|
|
||||||
|
|
||||||
var menu = localStorage.getItem("menus");
|
|
||||||
if (menu != null ) {
|
|
||||||
$( "#loading_wrapper").hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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
|
|
||||||
@@ -67,8 +67,8 @@ class Api::AuthenticateController < Api::ApiController
|
|||||||
params.permit(:emp_id, :password, :session_token)
|
params.permit(:emp_id, :password, :session_token)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def find_shop
|
def find_shop
|
||||||
@shop = Shop.find_by_shop_code(params[:shop_code])
|
@shop = Shop.find_by_shop_code(params[:shop_code])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -34,7 +34,12 @@ class Foodcourt::FoodCourtController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@app_order_new_count =Booking.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_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 customers ON orders.customer_id=customers.customer_id")
|
||||||
|
.where("orders.source='app' and bookings.shop_code='#{@shop.shop_code}' and bookings.booking_status='assign'").uniq.length
|
||||||
|
puts @app_order_new_count
|
||||||
render "foodcourt/addorders/detail"
|
render "foodcourt/addorders/detail"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -52,48 +52,31 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
|||||||
@order.order_items[order_item_index].set_menu_items = arr_instance_item_sets
|
@order.order_items[order_item_index].set_menu_items = arr_instance_item_sets
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# bookings = Booking.all
|
|
||||||
# if !bookings.today.nil?
|
|
||||||
# @order_items_count = Hash.new
|
|
||||||
# bookings.each do |booking|
|
|
||||||
# if booking.sale_id.nil? && booking.booking_status != 'moved'
|
|
||||||
# if !booking.booking_orders.empty?
|
|
||||||
# booking.booking_orders.each do |booking_order|
|
|
||||||
# order = Order.find(booking_order.order_id)
|
|
||||||
# if !order.order_items.empty?
|
|
||||||
# if !@order_items_count.key?(booking.dining_facility_id)
|
|
||||||
# @order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
|
||||||
# else
|
|
||||||
# @order_items_count[booking.dining_facility_id] += order.order_items.count
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# else
|
|
||||||
# if !booking.sale_id.nil?
|
|
||||||
# sale = Sale.find(booking.sale_id)
|
|
||||||
# if sale.sale_status !='completed'
|
|
||||||
# if !@order_items_count.key?(booking.dining_facility_id)
|
|
||||||
# @order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
|
||||||
# else
|
|
||||||
# @order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
end
|
end
|
||||||
def app_orders
|
def app_orders
|
||||||
@bookings = Booking.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
|
if !params[:booking_id].nil? && !params[:booking_id].blank?
|
||||||
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
|
@booking = Booking.select("orders.*,bookings.*,customers.*")
|
||||||
.where("orders.source='app' and bookings.shop_code='#{@shop.shop_code}'").order("created_at desc")
|
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
|
||||||
|
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
|
||||||
|
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
|
||||||
|
.where("orders.source='app' and bookings.shop_code='#{@shop.shop_code}' and bookings.booking_id='#{params[:booking_id]}'").first
|
||||||
|
@customer_id =@booking.customer_id
|
||||||
|
@booking_id =@booking.booking_id
|
||||||
|
end
|
||||||
|
@bookings = Booking.select("bookings.*,customers.*")
|
||||||
|
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_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 customers ON orders.customer_id=customers.customer_id")
|
||||||
|
.where("orders.source='app' and bookings.shop_code='#{@shop.shop_code}'").order("bookings.created_at desc").uniq
|
||||||
end
|
end
|
||||||
def app_order_by_booking
|
def completed
|
||||||
@order_items = OrderItems.joins("JOIN orders ON orders.order_id=order_items.order_id")
|
customer =Customer.find_by_customer_id(params[:customer_id])
|
||||||
.joins("JOIN booking_orders ON booking_orders.order_id=orders.order_id")
|
phone_number =customer.contact_no
|
||||||
.where("orders.source='app' and booking_orders.booking_id='#{params[:booking_id]}'").order("created_at desc")
|
if Order.send_message(phone_number,params[:booking_id])
|
||||||
|
booking =Booking.find(params[:booking_id])
|
||||||
|
booking.booking_status ='completed'
|
||||||
|
booking.save!
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -591,5 +591,19 @@ class Order < ApplicationRecord
|
|||||||
Rails.logger.debug '...... order sync completed .....'
|
Rails.logger.debug '...... order sync completed .....'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
def self.send_message(phone, booking_id)
|
||||||
|
url = "http://smspoh.com/api/http/send?key=5QfyN0OtGsFXnOqwtpVAGZCyPGP28nbX_Nm_oPsUw2ybq714T_951ycz3Ypl5URA&message=Your order "+booking_id.to_s+" is ready to pick up&recipients="+ phone.to_s
|
||||||
|
|
||||||
|
begin
|
||||||
|
@result = HTTParty.get(url.to_str)
|
||||||
|
rescue HTTParty::Error
|
||||||
|
response = {status: false, message: "Can't open membership server "}
|
||||||
|
rescue Net::OpenTimeout
|
||||||
|
response = { status: false , message: "Can't open membership server "}
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
response = { status: false, message: "Can't open membership server "}
|
||||||
|
rescue SocketError
|
||||||
|
response = { status: false, message: "Can't open membership server "}
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
<%= 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' %>
|
||||||
|
|
||||||
|
|
||||||
<% 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 " style="padding:0px 3px 0px 3px;">
|
<div class="container-fluid " style="padding:0px 3px 0px 3px;">
|
||||||
@@ -147,9 +145,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10">
|
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10">
|
||||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-12" id='app_order'>App Order
|
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-12" id='app_order'>
|
||||||
|
Application Orders <span class="badge badge-danger" style="font-size: 0.75rem;border-radius: 5px;"><%= @app_order_new_count %></span>
|
||||||
</button>
|
</button>
|
||||||
<br>
|
<br>
|
||||||
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
||||||
@@ -526,18 +524,23 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
var cashier_type = $('#cashier_type').val();
|
var cashier_type = $('#cashier_type').val();
|
||||||
jQuery(function(){
|
//get menu item cache
|
||||||
var menus = JSON.parse(localStorage.getItem("menus"));
|
function getAllMenu(){
|
||||||
if (menus != null) {
|
$.ajax({
|
||||||
var id = menus[0]["categories"][0]["id"];
|
type: "GET",
|
||||||
// console.log(id);
|
url: '/foodcourt/get_all_menu',
|
||||||
}else{
|
data: {},
|
||||||
var id = 1;
|
success:function(result){
|
||||||
}
|
localStorage.setItem("menus", JSON.stringify(result));
|
||||||
jQuery('.first_'+id).click();
|
var menu = localStorage.getItem("menus");
|
||||||
});
|
if (menu != null ) {
|
||||||
|
$( "#loading_wrapper").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
getAllMenu();
|
||||||
var menus = JSON.parse(localStorage.getItem("menus"));
|
var menus = JSON.parse(localStorage.getItem("menus"));
|
||||||
if (menus != null) {
|
if (menus != null) {
|
||||||
menu_cache_append(menus);
|
menu_cache_append(menus);
|
||||||
@@ -597,10 +600,6 @@ $(document).ready(function () {
|
|||||||
$('#table_type').text(type);
|
$('#table_type').text(type);
|
||||||
$('.select_table').text(name);
|
$('.select_table').text(name);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#pending_order').on('click', function () {
|
|
||||||
window.location.href = '/foodcourt/'+'<%= @cashier_type %>'+'/pending_order';
|
|
||||||
});
|
|
||||||
$('#app_order').on('click', function () {
|
$('#app_order').on('click', function () {
|
||||||
window.location.href = '/en/foodcourt/app_orders';
|
window.location.href = '/en/foodcourt/app_orders';
|
||||||
});
|
});
|
||||||
@@ -628,11 +627,6 @@ menu_cat.empty();
|
|||||||
|
|
||||||
$(".main_menu").text(name);
|
$(".main_menu").text(name);
|
||||||
|
|
||||||
// row = ' <li class="nav-item product" data-ref="<%= foodcourt_get_all_product_path %>">'
|
|
||||||
// +'<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>'
|
|
||||||
// +'</li>';
|
|
||||||
// $(".category_cache_list").append(row);
|
|
||||||
|
|
||||||
for(var i in menus) {
|
for(var i in menus) {
|
||||||
|
|
||||||
if (menu_id == menus[i]["id"] && menus[i]["is_active"] == true) {
|
if (menu_id == menus[i]["id"] && menus[i]["is_active"] == true) {
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
<div class="container-fluid " style="padding:0px 3px 0px 3px;">
|
|
||||||
<div id="oqs_loading_wrapper" style="display:none;">
|
|
||||||
<div id="oqs_loading"></div>
|
|
||||||
</div>
|
|
||||||
<div class="row m-t--20">
|
|
||||||
<div class="col-md-9 col-lg-9 col-sm-12 m-t-10">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3 col-lg-3 col-sm-12 m-t-10">
|
|
||||||
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
|
||||||
<div class="row ">
|
|
||||||
<div class="col-md-9 col-lg-9 col-sm-9 ">
|
|
||||||
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>
|
|
||||||
<strong class="font-14 p-l-10">Booking Id : </strong>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-block">
|
|
||||||
<div class="card-text" id="order-detail-slimscroll" data-height="140">
|
|
||||||
<table class="table table-striped summary-items" id="order-items-table" >
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>#</th>
|
|
||||||
<th class="item-name">Items</th>
|
|
||||||
<th class="item-qty">QTY</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="font-13 order_item_list" >
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer custom-card-footer" style="padding: 0.35rem 0.15rem !important;">
|
|
||||||
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
|
|
||||||
<button type="button" class="btn btn-primary action-btn create col-md-11" id="done_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">done</i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,15 +1,148 @@
|
|||||||
|
<style type ="text/css">
|
||||||
|
.assign {
|
||||||
|
background-color:blue;
|
||||||
|
}
|
||||||
|
.completed{
|
||||||
|
background-color:green;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<%= javascript_include_tag 'custom', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<% if @booking.nil?%>
|
||||||
|
<div class="page-header">
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li class="breadcrumb-item"><a href="<%= foodcourt_food_court_path %>">Foodcourt</a></li>
|
||||||
|
<li class="breadcrumb-item active">Application Orders</li>
|
||||||
|
<span class="float-right">
|
||||||
|
<%= link_to 'Back', foodcourt_food_court_path %>
|
||||||
|
</span>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
<div class="container-fluid " style="padding:0px 3px 0px 3px;">
|
<div class="container-fluid " style="padding:0px 3px 0px 3px;">
|
||||||
<div id="oqs_loading_wrapper" style="display:none;">
|
<div id="oqs_loading_wrapper" style="display:none;">
|
||||||
<div id="oqs_loading"></div>
|
<div id="oqs_loading"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row m-t--20">
|
<div class="row m-t--20">
|
||||||
<div class="col-md-9 col-lg-9 col-sm-9 m-t-10" >
|
<% if !@booking.nil?%>
|
||||||
<div class="card">
|
<div class="col-md-9 col-lg-9 col-sm-12 m-t-10">
|
||||||
<div class="card-block" style="">
|
<% else %>
|
||||||
<div class="card-text" id="custom-slimscroll">
|
<div class="col-md-12 col-lg-12 col-sm-12 m-t-10">
|
||||||
|
<% end %>
|
||||||
|
<div id="custom-slimscroll">
|
||||||
|
<div class="card-columns">
|
||||||
|
<% bk_status ='' %>
|
||||||
|
<% @bookings.each do |bk|
|
||||||
|
if !@booking.nil?
|
||||||
|
if bk.booking_id == @booking.booking_id
|
||||||
|
bk_status ='bg-red'
|
||||||
|
else
|
||||||
|
bk_status =bk.booking_status
|
||||||
|
end
|
||||||
|
else
|
||||||
|
bk_status =bk.booking_status
|
||||||
|
end %>
|
||||||
|
<%= link_to foodcourt_app_order_by_booking_path(booking_id:bk.booking_id) do %>
|
||||||
|
<div class="card <%= bk_status %> text-white" data-id ="<%= bk.booking_id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
Cus Ph :<%= bk.contact_no %><span style="font-size:12px;float:right;line-height:inherit;">Order Time :<%= bk.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
|
||||||
|
BK :<%= bk.booking_id %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% if !@booking.nil?%>
|
||||||
|
<div class="col-md-3 col-lg-3 col-sm-12 m-t-10">
|
||||||
|
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
||||||
|
<div class="row" style="margin:auto">
|
||||||
|
<div class="col-md-9 col-lg-9 col-sm-9">
|
||||||
|
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@booking.dining_facility.name%></span><br>
|
||||||
|
<strong class="font-14 p-l-10">Booking - <%=@booking.booking_id%></strong>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3 col-lg-3 col-sm-3">
|
||||||
|
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||||
|
<i class="material-icons">reply</i>
|
||||||
|
Back
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="card-block">
|
||||||
|
<div class="card-text" id="order-detail-slimscroll" data-height="140">
|
||||||
|
<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" >
|
||||||
|
<% count =0 %>
|
||||||
|
<% total_price =0 %>
|
||||||
|
<% total_qty =0 %>
|
||||||
|
<% @booking.booking_orders.each do |bo| %>
|
||||||
|
<% bo.order.order_items.each do |oi| %>
|
||||||
|
<% count +=1 %>
|
||||||
|
<% total_price += oi.price %>
|
||||||
|
<% total_qty += oi.qty.to_i%>
|
||||||
|
<tr class="item_box">
|
||||||
|
<td><%= count%></td>
|
||||||
|
<td><%= oi.item_name%></td>
|
||||||
|
<td><%= oi.qty.to_i%></td>
|
||||||
|
<td class="item-attr"><%= oi.price%></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% 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>Total:</strong></td>
|
||||||
|
<td style="padding:2px;" width="15%"><strong id="total_qty"><%=total_qty %></strong></td>
|
||||||
|
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%=total_qty * total_price %></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;"><i class="material-icons" style="font-size:34px;width:34px">done</i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<script type="text/javascript">
|
||||||
|
$('#back').on('click', function () {
|
||||||
|
window.location.href ="<%=foodcourt_food_court_path %>";
|
||||||
|
});
|
||||||
|
$('#done_order').on('click', function () {
|
||||||
|
swal({
|
||||||
|
title: "Alert !",
|
||||||
|
text: 'This order is really done!',
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes!",
|
||||||
|
cancelButtonClass: 'btn btn-danger',
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
|
$('.confirm').prop("disabled",true);
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/foodcourt/<%=@booking_id %>/completed",
|
||||||
|
data: {customer_id:"<%=@customer_id %>"},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
window.location.href ="<%=foodcourt_app_order_by_booking_path %>";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -61,6 +61,4 @@ Rails.application.config.assets.precompile += %w( order_reservation.js )
|
|||||||
Rails.application.config.assets.precompile += %w( reservation.css )
|
Rails.application.config.assets.precompile += %w( reservation.css )
|
||||||
Rails.application.config.assets.precompile += %w( reservation.js )
|
Rails.application.config.assets.precompile += %w( reservation.js )
|
||||||
|
|
||||||
# --- Foodcourt ----
|
Rails.application.config.assets.precompile += %w( custom.js )
|
||||||
Rails.application.config.assets.precompile += %w( foodcourt.css )
|
|
||||||
Rails.application.config.assets.precompile += %w( foodcourt.js )
|
|
||||||
|
|||||||
@@ -687,8 +687,8 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
|
|
||||||
post '/customer_view' => "second_display#customer_view",:as => "customer_view", :defaults => { :format => 'json' }
|
post '/customer_view' => "second_display#customer_view",:as => "customer_view", :defaults => { :format => 'json' }
|
||||||
get "food_court" => "food_court#index"
|
get "food_court" => "food_court#index"
|
||||||
get "app_orders" => "orders#app_orders"
|
get "app_orders" => "orders#app_orders",:as => "app_order_by_booking"
|
||||||
get "app_order/:booking_id" => "orders#app_order_by_booking"
|
post ':booking_id/completed' => "orders#completed", :defaults => { :format => 'json' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
15225
|
22910
|
||||||
Reference in New Issue
Block a user