change order reservation

This commit is contained in:
phyusin
2018-05-12 11:38:43 +06:30
parent 34e2bdb0d1
commit c7c32ffff4
10 changed files with 131 additions and 41 deletions

View File

@@ -5,6 +5,7 @@ $(function() {
$('#accepted').hide();
$('#cancel').hide();
$(".tbl_customer").hide();
$(".order_close_cashier").hide();
$(function() {
$('.first-1').click();
});
@@ -17,6 +18,7 @@ $(function() {
$('#accepted').hide();
$('#cancel').hide();
$(".tbl_customer").hide();
$(".order_close_cashier").hide();
if (type == "pending") {
$(".first-1").click();
$('#accepted').text("ACCEPT");
@@ -36,6 +38,7 @@ $(function() {
$('#accepted').attr("data-value","completed");
}else if(type == "processed"){
$(".fifth-1").click();
$(".order_close_cashier").show();
// $('#accepted').hide();
// $('#cancel').hide();
}
@@ -119,6 +122,12 @@ $(function() {
callback_url(callback,ref_no,order_id,status,type,minutes);
});
$('#order_close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/ordering/close';
warnBeforeRedirect(linkURL);
});
$(document).on('click','.access_number', function(event){
if(event.handled !== true) {
var original_value = $('#access_code').val();
@@ -148,9 +157,39 @@ $(function() {
}
});
$('button[data-dismiss="modal"]').on('click', function(){ $(this).parent().parent().parent().parent().modal('hide'); });
// $('button[data-dismiss="modal"]').on('click', function(){ $(this).parent().parent().parent().parent().modal('hide'); });
// $(".new_order_close").on("click",function(){
// var code = $(this).attr("data-value");
// $("#"+code+"_doemal_new_order").modal("hide");
// });
$("[data-dismiss='modal']").on('click', function() {
$('body').addClass('modal-open-fix');
if($('body').css("padding-right") == '15px') {
$('body').addClass('modal-open-fix-pad');
}
setTimeout(function() {
if($('body').hasClass('modal-open-fix-pad')) {
$('body').css('padding-right', '15px');
}
$('body').addClass('modal-open').removeClass('modal-open-fix, modal-open-fix-pad');
}, 1000);
});
});
function warnBeforeRedirect(linkURL) {
swal({
title: "Alert!",
text: "Are you sure you want to close cashier?",
type: "warning",
showCancelButton: true
}, function() {
// Redirect the user
window.location.href = linkURL;
});
}
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
@@ -195,6 +234,8 @@ function refreshDetailData(){
$('#discount_amount').text("0.00");
$('#total_tax').text("0.00");
$('#grand_total').text("0.00");
$(".tbl_customer").hide();
$(".order_close_cashier").hide();
}
//show order list
@@ -282,19 +323,21 @@ function show_order_detail(url,sr_no){
$('#customer_name').text(data.customer_name);
$('#phone').text(data.phone);
$('#address').text(address);
$('#delivery_to').text(delivery.provider);
$('#ref_no').text(data.transaction_ref);
$('#callback_url').text(data.callback_url);
$('#order_id').text(data.order_reservation_id);
$("#trans_ref").text(data.transaction_ref);
if(delivery.delivery_type == "service"){
if(delivery.provider == "food2u" || delivery.provider == "yangondoor2door"){
$("#delivery_info").text("(DELIVERY)");
}else if(delivery.delivery_type == "pick_up"){
$("#delivery_to").text("DELIVERY");
}else if(delivery.provider == "pick_up"){
$("#delivery_info").text("(PICK-UP)");
$("#delivery_to").text("PICK-UP");
}else{
$("#delivery_info").text("(DIRECT DELIVERY)");
$("#delivery_to").text("DIRECT DELIVERY");
}
if(data.order_remark!=null && data.order_remark!=""){
@@ -377,6 +420,18 @@ function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reas
}, function () {
window.location.href = '/origami/order_reservation';
});
}else{
swal({
title: 'Oops',
text: data.message,
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/order_reservation';
});
}
}
});
@@ -420,15 +475,17 @@ function showNewOrder(order_reservation,shop_code){
$("#new_order").text(order_reservation.order_reservation_id);
$("#new_order_date").text(requested_date);
if($("#"+shop_code+"_doemal_new_order").hasClass("hidden")){
$("#"+shop_code+"_doemal_new_order").removeClass("hidden");
}
$("#"+shop_code+"_doemal_new_order").on('show.bs.modal', function(e){
$("#notify_new_order").modal('hide');
$("#notify_order_send_to_kitchen").modal('hide');
$("#notify_order_ready_to_delivery").modal('hide');
$("#notify_new_order").addClass("hidden");
$("#notify_order_send_to_kitchen").addClass("hidden");
$("#notify_order_ready_to_delivery").addClass("hidden");
}).on('shown.bs.modal', function(e){
$("#"+shop_code+"_doemal_new_order").focus();
}).on('hide.bs.modal', function (e) {
audio.pause();
$("#"+shop_code+"_doemal_new_order").modal("hide");
$("#"+shop_code+"_doemal_new_order").addClass("hidden");
}).modal({show: true, keyboard: false, backdrop: false});
}
}