route changes

This commit is contained in:
San Wai Lwin
2018-03-13 14:51:07 +06:30
parent 694feb9c06
commit 9228168ebc
49 changed files with 1906 additions and 707 deletions

View File

@@ -31,30 +31,75 @@ $(document).on('turbolinks:load', function() {
$(".oqs_append").addClass('hide')
});
$(".tables").on("click", function(){
var table_id = $(this).val();
$('#table_id').val(table_id);
oqs_id = $("#oqs_id").val();
if (table_id){
var table = table_id
}else{
var table = null
}
if (oqs_id > 0) {
$(".oqs_click").removeClass('oqs_active');
$(".queue_station").removeClass('queue_station_box');
$("#completed").addClass('hide');
$(".oqs_append").removeClass('hide');
$("#oqs_active").addClass('oqs_active');
$(".queue_station").addClass('queue_station_box');
// oqs_id = $(this).find(".oqs-id").text();
$("#oqs_active").attr('data-id',oqs_id);
var url = 'oqs/get_items/'+oqs_id;
show_details(url,table);
}else{
$("#completed").removeClass('hide')
$(".oqs_append").addClass('hide')
}
});
$(".oqs_click").on("click", function(){
$(".oqs_click").removeClass('oqs_active');
$(".queue_station").removeClass('queue_station_box');
$("#completed").addClass('hide');
$(".oqs_append").removeClass('hide');
$(this).addClass('oqs_active');
$(".queue_station").addClass('queue_station_box');
oqs_id = $(this).find(".oqs-id").text();
console.log(oqs_id);
var url = 'oqs/get_items/'+oqs_id;
show_details(url);
oqs_id = $(this).val();
var table_id = $('#table_id').val();
if (table_id){
var table = table_id
}else{
var table = null
}
if (oqs_id > 0) {
$(".oqs_click").removeClass('oqs_active');
$(".queue_station").removeClass('queue_station_box');
$("#completed").addClass('hide');
$(".oqs_append").removeClass('hide');
$("#oqs_active").addClass('oqs_active');
$(".queue_station").addClass('queue_station_box');
// oqs_id = $(this).find(".oqs-id").text();
$("#oqs_active").attr('data-id',oqs_id);
var url = 'oqs/get_items/'+oqs_id;
show_details(url,table);
}else{
$("#completed").removeClass('hide')
$(".oqs_append").addClass('hide')
}
}); //End Click
function show_details(url){
function show_details(url,table_id){
var oqs_append = $('.oqs_append');
oqs_append.empty();
var filter = $('.filter').text();
console.log(table_id)
//Start Ajax
$.ajax({
type: "GET",
url: url,
data: {'filter':filter},
data: {'filter':filter,'table_id':table_id},
dataType: "json",
success: function(data) {
for(var field in data) {
@@ -67,7 +112,8 @@ $(document).on('turbolinks:load', function() {
}
var date = new Date(data[field]["created_at"]);
var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
// var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
var show_date =date.getHours()+ ':' + date.getMinutes() +' '+(date.getHours() >= 12 ? 'PM' : 'AM');
var set_menu_items = data[field]["set_menu_items"];
var set_instance_items = "";
if(set_menu_items!=null){
@@ -100,7 +146,7 @@ $(document).on('turbolinks:load', function() {
+set_instance_items
+'</p>'
+'<br/><p class="card-text item-options">'+ options +'</p>'
+'<p class="card-text item-options">'+ options +'</p>'
+'<span class="card-text">'
+'<span class="text-muted">Order at - '

View File

@@ -46,8 +46,8 @@ $(function() {
+ product[field].name +"' data-promotion-price = '"+ 1 +"' data-attributes = '"
+ JSON.stringify(item_attributes) +"' data-options = '"
+ options +"' data-image='"+image_path+"'>"
+"<i class='fa fa-plus material-icons'>"
+'add</i>'
+"<i class='fa fa-bars material-icons'>"
+'view_list</i>'
+'</div>'
+'</div>'
@@ -146,7 +146,7 @@ $(function() {
promotion_price = menu_items[field].promotion_price;
}else{
fa_plus = 'material-icons';
add = 'add'
add = 'view_list'
menu_item_box = 'menu_item_box';
data_target = 'sx_item_detailModal';
data_modal = ''
@@ -760,7 +760,6 @@ $(function() {
$("#oqs_loading_wrapper").show();
type = window.location.href.indexOf("quick_service");
if (type != -1) {
type = 'quick_service'
var table_type = $('#table_type').text();
@@ -985,19 +984,19 @@ $(function() {
$("#back").on("click", function(){
var table_id = $('#table_id').text();
var table_type = $('#table_type').text();
type = window.location.href.indexOf("quick_service");
if (type == 'true') {
type = window.location.href.includes("quick_service");
if (type == true) {
var table_type = $('#table_id').find("option:selected").data('type');
var table_id = $('#table_id').val();
window.location.href = "/origami/dashboard"
window.location.href = "/origami/dashboard";
}else{
var table_type = $('#table_type').text();
var table_id = $('#table_id').text();
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;
}
}
});

View File

@@ -5,8 +5,7 @@ App.order_queue_station = App.cable.subscriptions.create('OrderQueueStationChann
disconnected: function() {},
received: function(data) {
// console.log(data.order);
received: function(data) {
var oqs_id = $('.oqs_active').attr('data-id');
items = data.order;
for(var field in items) {

View File

@@ -20,33 +20,33 @@ $(document).ready(function() {
borderRadius: '0',
railBorderRadius: '0'
});
$('.delete').click(function(){
var method = $(this).attr('data-method');
var url = $(this).attr('data-ref');
var html_text = $(this).siblings( "#delete_text" ).html();
//var page = url.substring(url.lastIndexOf('/') + 1);
swal({
title: "Confirmation",
text: html_text,
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
html: true
}, function (isConfirm) {
if (isConfirm) {
$.ajax({
type: method,
url: url ,
success: function(data) {
location.href = data.url;
}
});
} else {
swal("Cancelled", "Your imaginary file is safe :)", "error");
}
});
});
// $('.delete').click(function(){
// var method = $(this).attr('data-method');
// var url = $(this).attr('data-ref');
// var html_text = $(this).siblings( "#delete_text" ).html();
// //var page = url.substring(url.lastIndexOf('/') + 1);
// swal({
// title: "Confirmation",
// text: html_text,
// type: "warning",
// showCancelButton: true,
// confirmButtonColor: "#DD6B55",
// html: true
// }, function (isConfirm) {
// if (isConfirm) {
// $.ajax({
// type: method,
// url: url ,
// success: function(data) {
// location.href = data.url;
// }
// });
// } else {
// swal("Cancelled", "Your imaginary file is safe :)", "error");
// }
// });
// });
// for Notificaiotn message
var placementFrom = $("#notify_message").attr('data-placement-from');

View File

@@ -255,14 +255,14 @@ function setCommPorts(comPortLists) {
}
/** pay with CB bank **/
function pay_withBank(cmd_type, payment_type, bnk_bill_amount,sale_id,receipt_no) {
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);
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) {
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",
@@ -272,14 +272,14 @@ function reqCardSaleTrans(cmd_type, payment_type, bnk_bill_amount, sale_id, rece
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);
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) {
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="";
@@ -306,7 +306,7 @@ function resCardSaleTrans(card_sale_trans_id,cmd_type,payment_type, bnk_bill_amo
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);
resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amount,sale_id,receipt_no,com_port,cashier_type);
}
}
});
@@ -317,7 +317,7 @@ function resCardSaleTrans(card_sale_trans_id,cmd_type,payment_type, bnk_bill_amo
}
function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amount,sale_id,receipt_no,com_port) {
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);
if(jobj.STATUS == "Approved"){
@@ -334,7 +334,7 @@ function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amoun
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment";
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment";
});
}
}
@@ -352,7 +352,7 @@ function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amoun
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment/"+payment_type;
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/"+payment_type;
});
}
}