food court and Booking ID for order and receipt

This commit is contained in:
phyusin
2018-10-08 17:41:22 +06:30
parent 5535a5db81
commit 03fd7c79b8
44 changed files with 1155 additions and 378 deletions

View File

@@ -2,7 +2,7 @@ $(function() {
var role = $('#role').val();
var second_display_lookup = $("#display_type");
console.log(second_display_lookup)
type = window.location.href.indexOf("quick_service");
type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court");
modify_order = window.location.href.indexOf("modify_order");
//click menu sidebar menu category
@@ -146,7 +146,7 @@ $(function() {
}
}else{
type = window.location.href.indexOf("quick_service");
type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court");
modify_order = window.location.href.indexOf("modify_order");
if (type != -1 && modify_order != -1) {
@@ -155,7 +155,7 @@ $(function() {
url_item = 'addorders/'+url_item;
}
if (type ==-1 && modify_order == -1){
url_item = url_item
url_item = url_item;
}
//Start Ajax
@@ -241,7 +241,7 @@ $(function() {
}
}
}else{
type = window.location.href.indexOf("quick_service");
type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court");
modify_order = window.location.href.indexOf("modify_order");
if (type != -1 && modify_order != -1) {
url = '../../../addorders/get_item_instance/'+value[i]["id"];
@@ -848,17 +848,18 @@ $(function() {
$(this).attr('disabled', 'disabled');
e.preventDefault();
$("#oqs_loading_wrapper").show();
var cashier_type = $("#link_type").val();
quick_service = window.location.href.indexOf("quick_service");
if (quick_service != -1) {
type = 'quick_service'
food_court = window.location.href.indexOf("food_court");
if (quick_service != -1 || food_court != -1) {
type = cashier_type;
var table_type = $('#table_type').text();
var table_id = $('#table_id').val();
var customer_id = $('#customer_id').val();
var booking_id = $('#booking_id').text();
var ajax_url = 'addorders/create';
}else{
type = 'cashier'
type = 'cashier';
var table_type = $('#table_type').text();
var table_id = $('#table_id').text();
var customer_id = $('#customer_id').text();
@@ -886,14 +887,14 @@ $(function() {
data: params,
dataType: "json",
success:function(result){
if (type == "quick_service") {
window.location.href = "/origami/quick_service"
if (type == "quick_service" || type=="food_court") {
window.location.href = "/origami/"+type;
}else{
if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id
window.location.href = "/origami/table/" + table_id;
}
else {
window.location.href = "/origami/room/" + table_id
window.location.href = "/origami/room/" + table_id;
}
}
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
@@ -914,11 +915,11 @@ $(function() {
$("#create_pay_order").on('click', function(e){
$(this).attr('disabled', 'disabled');
e.preventDefault();
type = "quick_service"
type = $("#link_type").val();
modify_order = window.location.href.indexOf("modify_order");
$("#oqs_loading_wrapper").show();
if (modify_order !=-1) {
var ajax_url = '../../../quick_service/update_modify_order';
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();
@@ -962,13 +963,13 @@ $(function() {
confirmButtonText: "Ok",
closeOnConfirm: false
}, function () {
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text();
});
}else if(result.data == 'OK'){
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text();
}else{
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment";
}
}
}
@@ -1096,13 +1097,14 @@ $(function() {
$("#back").on("click", function(){
var table_id = $('#table_id').text();
var table_type = $('#table_type').text();
type = window.location.href.includes("quick_service");
var cashier_type = $("#link_type").val();
type = window.location.href.includes("quick_service") || window.location.href.includes("food_court");
if (type == true) {
var table_type = $('#table_id').find("option:selected").data('type');
var table_id = $('#table_id').val();
if(window.location.href.includes("modify_order")){
var link_url = window.location.href.split("/");
window.location.href = "/origami/quick_service/pending_order/"+link_url[link_url.length - 1];
window.location.href = "/origami/"+cashier_type+"/pending_order/"+link_url[link_url.length - 1];
}else{
window.location.href = "/origami/dashboard";
}

View File

@@ -9,16 +9,18 @@ App.order = App.cable.subscriptions.create('BillChannel', {
var hostname = location.hostname.trim();
if(data.from == "" || hostname == data.from)
{
if($('.table_'+data.table.id).hasClass('blue')){
$('.table_'+data.table.id).removeClass('blue');
$('.table_'+data.table.id).removeClass('green');
$('.table_'+data.table.id).addClass('red');
}else{
$('.table_'+data.table.id).removeClass('orange');
$('.table_'+data.table.id).addClass('red');
}
$('.new_text_'+data.table.id).removeClass('hide');
$('.new_text_'+data.table.id).text('billed');
if(data.table != undefined && data.table != null && data.table!=""){
if($('.table_'+data.table.id).hasClass('blue')){
$('.table_'+data.table.id).removeClass('blue');
$('.table_'+data.table.id).removeClass('green');
$('.table_'+data.table.id).addClass('red');
}else{
$('.table_'+data.table.id).removeClass('orange');
$('.table_'+data.table.id).addClass('red');
}
$('.new_text_'+data.table.id).removeClass('hide');
$('.new_text_'+data.table.id).text('billed');
}
}
}
});

View File

@@ -228,6 +228,7 @@ function getOnlineOrderCount(){
url: "/origami/get_order_info",
dataType: "json",
success: function(data){
console.log(data);
if(parseInt(data) > 0){
count = parseInt(data);
}