remove comment data
This commit is contained in:
@@ -834,7 +834,6 @@ $(function() {
|
|||||||
option_name = ' ';
|
option_name = ' ';
|
||||||
data_option = '[]';
|
data_option = '[]';
|
||||||
}
|
}
|
||||||
console.log(d_option)
|
|
||||||
var rowCount = $('.summary-items tbody tr').length+1;
|
var rowCount = $('.summary-items tbody tr').length+1;
|
||||||
var item_row = $('.summary-items tbody tr');
|
var item_row = $('.summary-items tbody tr');
|
||||||
|
|
||||||
@@ -842,7 +841,7 @@ console.log(d_option)
|
|||||||
item_code = $(item_row[i]).attr('data-code');
|
item_code = $(item_row[i]).attr('data-code');
|
||||||
instance_code = $(item_row[i]).attr('data-instance-code');
|
instance_code = $(item_row[i]).attr('data-instance-code');
|
||||||
r_option = $(item_row[i]).attr('data-opt');
|
r_option = $(item_row[i]).attr('data-opt');
|
||||||
console.log(r_option)
|
|
||||||
if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')&&r_option == d_option) {
|
if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')&&r_option == d_option) {
|
||||||
if (qty > 1) {
|
if (qty > 1) {
|
||||||
qty = parseInt($(item_row[i]).children('#item_qty').text()) + qty;
|
qty = parseInt($(item_row[i]).children('#item_qty').text()) + qty;
|
||||||
|
|||||||
40
app/assets/javascripts/channels/check_new_order.js
Normal file
40
app/assets/javascripts/channels/check_new_order.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
|
||||||
|
connected: function() {},
|
||||||
|
|
||||||
|
disconnected: function() {},
|
||||||
|
|
||||||
|
received: function(data) {
|
||||||
|
var order = data.data;
|
||||||
|
if(order.length > 0){
|
||||||
|
var order_lists = "";
|
||||||
|
$.each(order, function(key, value){
|
||||||
|
if(key==0){
|
||||||
|
order_lists = value.order_reservation_id;
|
||||||
|
}else if(key == (order.length - 1)){
|
||||||
|
order_lists += ' and ' + value.order_reservation_id;
|
||||||
|
}else{
|
||||||
|
order_lists += ', ' + value.order_reservation_id;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// alert(order_lists);
|
||||||
|
swal({
|
||||||
|
html: true,
|
||||||
|
title: 'Information',
|
||||||
|
target: document.getElementById('notify_new_order'),
|
||||||
|
text: "You have new orders. <br/>"+
|
||||||
|
"Are you accept or reject for these orders <b>"+order_lists+"</b>?",
|
||||||
|
type: 'success',
|
||||||
|
timer: 1000,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false
|
||||||
|
},function(isConfirm){
|
||||||
|
if(isConfirm){
|
||||||
|
swal.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderReadyToDeliveryChannel', {
|
||||||
|
connected: function() {},
|
||||||
|
|
||||||
|
disconnected: function() {},
|
||||||
|
|
||||||
|
received: function(data) {
|
||||||
|
var order = data.data;
|
||||||
|
if(order.length > 0){
|
||||||
|
var order_lists = "";
|
||||||
|
$.each(order, function(key, value){
|
||||||
|
if(key==0){
|
||||||
|
order_lists = value.order_reservation_id;
|
||||||
|
}else if(key == (order.length - 1)){
|
||||||
|
order_lists += ' and ' + value.order_reservation_id;
|
||||||
|
}else{
|
||||||
|
order_lists += ', ' + value.order_reservation_id;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// alert(order_lists);
|
||||||
|
swal({
|
||||||
|
html: true,
|
||||||
|
title: 'Information',
|
||||||
|
target: document.getElementById('notify_order_ready_to_delivery'),
|
||||||
|
text: "You have orders that are ready to deliver. <br/>"+
|
||||||
|
"Could you ready these orders <b>"+order_lists+"</b> to deliver?",
|
||||||
|
type: 'success',
|
||||||
|
timer: 1000,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false
|
||||||
|
},function(isConfirm){
|
||||||
|
if(isConfirm){
|
||||||
|
swal.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSendToKitchenChannel', {
|
||||||
|
connected: function() {},
|
||||||
|
|
||||||
|
disconnected: function() {},
|
||||||
|
|
||||||
|
received: function(data) {
|
||||||
|
var order = data.data;
|
||||||
|
if(order.length > 0){
|
||||||
|
var order_lists = "";
|
||||||
|
$.each(order, function(key, value){
|
||||||
|
if(key==0){
|
||||||
|
order_lists = value.order_reservation_id;
|
||||||
|
}else if(key == (order.length - 1)){
|
||||||
|
order_lists += ' and ' + value.order_reservation_id;
|
||||||
|
}else{
|
||||||
|
order_lists += ', ' + value.order_reservation_id;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// alert(order_lists);
|
||||||
|
swal({
|
||||||
|
html: true,
|
||||||
|
title: 'Information',
|
||||||
|
target: document.getElementById('notify_order_send_to_kitchen'),
|
||||||
|
text: "You have to send order to kitchen. <br/>"+
|
||||||
|
"Could you send these orders <b>"+order_lists+"</b> to kitchen?",
|
||||||
|
type: 'success',
|
||||||
|
timer: 1000,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false
|
||||||
|
},function(isConfirm){
|
||||||
|
if(isConfirm){
|
||||||
|
swal.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
|
App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel', {
|
||||||
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
|
|
||||||
|
|
||||||
connected: function() {},
|
connected: function() {},
|
||||||
|
|
||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
@@ -9,27 +7,28 @@ App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
|
|||||||
var order = data.data;
|
var order = data.data;
|
||||||
if(order.length > 0){
|
if(order.length > 0){
|
||||||
$('.order_reserve_cable tbody').html("");
|
$('.order_reserve_cable tbody').html("");
|
||||||
|
$(".nav-item.red > a > p.num").text(order.length);
|
||||||
$.each(order, function(key,value){
|
$.each(order, function(key,value){
|
||||||
|
var active_class = "";
|
||||||
|
if(key==0){
|
||||||
|
active_class = "tr-active";
|
||||||
|
showNewOrder(order[key]);
|
||||||
|
}
|
||||||
var rowCount = key+1;
|
var rowCount = key+1;
|
||||||
var date = new Date(value.created_at);
|
var date = new Date(value.created_at);
|
||||||
var deliveries = value["delivery"];
|
var time = timeFormat(date);
|
||||||
var isPM = date.getHours() >= 12;
|
var created_at = date.getFullYear() +'-'+ (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate()>10?date.getDate() : '0'+date.getDate());
|
||||||
var isMidday = date.getHours() == 12;
|
|
||||||
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
|
|
||||||
date.getMinutes() || '00'].join(':') +
|
|
||||||
(isPM ? ' PM' : 'AM');
|
|
||||||
var created_at = date.getFullYear() +'-'+ (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ date.getDate();
|
|
||||||
|
|
||||||
var delivery_type = "";
|
var delivery_type = "";
|
||||||
if(deliveries.delivery_type == "service"){
|
if(value.delivery_type == "service"){
|
||||||
delivery_type = "DELIVERY";
|
delivery_type = "DELIVERY";
|
||||||
}else if(deliveries.delivery_type == "pick_up"){
|
}else if(value.delivery_type == "pick_up"){
|
||||||
delivery_type = "PICK-UP";
|
delivery_type = "PICK-UP";
|
||||||
}else{
|
}else{
|
||||||
delivery_type = "DIRECT DELIVERY";
|
delivery_type = "DIRECT DELIVERY";
|
||||||
}
|
}
|
||||||
|
|
||||||
row = '<tr class="custom-tr first-'+rowCount+'" style="" data-id="'+value.order_reservation_id+'" data-sr-no="'+rowCount+'">'
|
row = '<tr class="custom-tr first-'+rowCount+' '+active_class+'" style="" data-id="'+value.order_reservation_id+'" data-sr-no="'+rowCount+'">'
|
||||||
+'<td width ="5%" class="align-left">'+rowCount
|
+'<td width ="5%" class="align-left">'+rowCount
|
||||||
+'</td>'
|
+'</td>'
|
||||||
+'<td width ="20%" class="align-center">'+created_at
|
+'<td width ="20%" class="align-center">'+created_at
|
||||||
@@ -41,13 +40,13 @@ App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
|
|||||||
+'<td width ="30%" class="align-center">'
|
+'<td width ="30%" class="align-center">'
|
||||||
+'<span class="font-10 col-blue">'+ delivery_type +'</span>'
|
+'<span class="font-10 col-blue">'+ delivery_type +'</span>'
|
||||||
+'</td>'
|
+'</td>'
|
||||||
+' </tr>'
|
+' </tr>';
|
||||||
|
|
||||||
$('.order_reserve_cable tbody').append(row);
|
$('.custom-table.order_reserve_cable tbody').append(row);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
customTableClick();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
$("#discount").hide();
|
||||||
|
$(".expected_time").hide();
|
||||||
|
$(function() {
|
||||||
|
$('.first-1').click();
|
||||||
|
});
|
||||||
|
|
||||||
|
customTableClick();
|
||||||
|
|
||||||
$(".nav-item").on("click", function(){
|
$(".nav-item").on("click", function(){
|
||||||
type = $(this).attr("data-type");
|
type = $(this).attr("data-type");
|
||||||
refreshDetailData();
|
refreshDetailData();
|
||||||
if (type == "pending") {
|
if (type == "pending") {
|
||||||
$(".first-1").click();
|
$(".first-1").click();
|
||||||
$('#accepted').text("Accepted");
|
$('#accepted').text("ACCEPT");
|
||||||
$('#accepted').attr("data-value","accepted");
|
$('#accepted').attr("data-value","accepted");
|
||||||
}else if(type == "processing"){
|
}else if(type == "processing"){
|
||||||
$(".second-1").click();
|
$(".second-1").click();
|
||||||
@@ -24,152 +31,19 @@ $(function() {
|
|||||||
// console.log(type);
|
// console.log(type);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(function(){
|
|
||||||
$('.first-1').click();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".custom-tr").on("click", function(){
|
|
||||||
$(".custom-tr").removeClass("tr-active");
|
|
||||||
$(this).addClass("tr-active");
|
|
||||||
var order_id = $(this).attr("data-id");
|
|
||||||
var sr_no = $(this).attr("data-sr-no");
|
|
||||||
var url = "order_reservation/get_order/"+order_id;
|
|
||||||
show_order_detail(url,sr_no);
|
|
||||||
});
|
|
||||||
|
|
||||||
function refreshDetailData(){
|
|
||||||
$('#requested_date_time').text("");
|
|
||||||
$("#sr_number").text("");
|
|
||||||
$("#delivery_info").text("");
|
|
||||||
$("#contact_info").text("");
|
|
||||||
$('.summary-items').html("");
|
|
||||||
$('#sub_total').text("0.00");
|
|
||||||
$('#delivery_fee').text("0.00");
|
|
||||||
$('#total_charges').text("0.00");
|
|
||||||
$('#discount_amount').text("0.00");
|
|
||||||
$('#total_tax').text("0.00");
|
|
||||||
$('#grand_total').text("0.00");
|
|
||||||
}
|
|
||||||
|
|
||||||
//show order list
|
|
||||||
function show_order_detail(url,sr_no){
|
|
||||||
$('.summary-items').html("");
|
|
||||||
//Start Ajax
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: url,
|
|
||||||
data: {},
|
|
||||||
dataType: "json",
|
|
||||||
success: function(data) {
|
|
||||||
// console.log(data);
|
|
||||||
var delivery = data["delivery"];
|
|
||||||
var items = data["order_items"];
|
|
||||||
var item_list = $('.summary-items');
|
|
||||||
|
|
||||||
var newDate = new Date(data.requested_time);
|
|
||||||
var isPM = newDate.getHours() >= 12;
|
|
||||||
var isMidday = newDate.getHours() == 12;
|
|
||||||
var time = [newDate.getHours() - (isPM && !isMidday ? 12 : 0),
|
|
||||||
newDate.getMinutes() || '00'].join(':') +
|
|
||||||
(isPM ? ' PM' : 'AM');
|
|
||||||
var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() > 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() > 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time;
|
|
||||||
|
|
||||||
if((data.expected_waiting_time!=undefined) && (data.expected_waiting_time!=null)){
|
|
||||||
var expDate = new Date(data.expected_waiting_time);
|
|
||||||
var isPM = expDate.getHours() >= 12;
|
|
||||||
var isMidday = expDate.getHours() == 12;
|
|
||||||
var exptime = [expDate.getHours() - (isPM && !isMidday ? 12 : 0),
|
|
||||||
expDate.getMinutes() || '00'].join(':') +
|
|
||||||
(isPM ? ' PM' : 'AM');
|
|
||||||
var expected_time = expDate.getFullYear() + '-' + (expDate.getMonth() > 10? expDate.getMonth() : '0' + (expDate.getMonth() + 1)) +'-'+ (expDate.getDate() > 10? expDate.getDate() : '0' + expDate.getDate()) +' '+exptime;
|
|
||||||
$('.expected_time').show();
|
|
||||||
$('#expected_time').text(expected_time? expected_time : '');
|
|
||||||
}else{
|
|
||||||
$('.expected_time').hide();
|
|
||||||
$('#expected_time').text('');
|
|
||||||
}
|
|
||||||
|
|
||||||
item_list.empty();
|
|
||||||
|
|
||||||
if(items!=undefined && items!=""){
|
|
||||||
if(items.length > 0){
|
|
||||||
for(var i in items) {
|
|
||||||
var item_price = 0;
|
|
||||||
if(items[i].price > 0){
|
|
||||||
item_price = items[i].price;
|
|
||||||
}else{
|
|
||||||
item_price = items[i].unit_price;
|
|
||||||
}
|
|
||||||
var total = items[i].qty * item_price;
|
|
||||||
row = '<tr>'
|
|
||||||
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
|
|
||||||
+' <br><span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>'
|
|
||||||
+'</td>'
|
|
||||||
+'<td width ="30%" class="body-td align-right">'+ total +'</td>'
|
|
||||||
+'</tr>';
|
|
||||||
$('.summary-items').append(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(data.discount_amount > 0){
|
|
||||||
$("#discount").show();
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#requested_date_time').text(requested_date);
|
|
||||||
$('#sub_total').text(data.total_amount);
|
|
||||||
$('#delivery_fee').text((parseFloat(delivery.delivery_fee) > 0)? delivery.delivery_fee : '0.0');
|
|
||||||
$('#total_charges').text((parseFloat(data.convenience_charge) > 0)? data.convenience_charge : '0.0');
|
|
||||||
$('#discount_amount').text((parseFloat(data.discount_amount) > 0)? data.discount_amount : '0.0');
|
|
||||||
$('#total_tax').text(data.total_tax);
|
|
||||||
$('#grand_total').text(data.grand_total);
|
|
||||||
|
|
||||||
var address = delivery.address;
|
|
||||||
if(delivery.township != null && delivery.township!=""){
|
|
||||||
address += ', ' +delivery.township;
|
|
||||||
}else if(delivery.direction_address!=null && delivery.direction_address!=""){
|
|
||||||
address += ", (" +delivery.direction_address+")";
|
|
||||||
}
|
|
||||||
$('#requested_time').text(requested_date);
|
|
||||||
$('#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);
|
|
||||||
|
|
||||||
if(delivery.delivery_type == "service"){
|
|
||||||
$("#delivery_info").text("(DELIVERY)");
|
|
||||||
}else if(delivery.delivery_type == "pick_up"){
|
|
||||||
$("#delivery_info").text("(PICK-UP)");
|
|
||||||
}else{
|
|
||||||
$("#delivery_info").text("(DIRECT DELIVERY)");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(data.order_remark!=null && data.order_remark!=""){
|
|
||||||
$("#order_remark").text(data.order_remark);
|
|
||||||
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
|
|
||||||
$("#order_remark").text(data.reservation_remark);
|
|
||||||
}
|
|
||||||
$("#sr_number").text("NO."+sr_no);
|
|
||||||
if (data["receipt_no"]) {
|
|
||||||
$("#contact_info").text(data["receipt_no"]);
|
|
||||||
}else{
|
|
||||||
$("#contact_info").text(data["order_reservation_id"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//end Ajax
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#accepted").on("click", function(){
|
$("#accepted").on("click", function(){
|
||||||
var requested_time = $("#requested_date_time").text();
|
if($(this).text().trim() == "ACCEPT"){
|
||||||
$("#requested_order_time").text(requested_time);
|
var requested_time = $("#requested_date_time").text();
|
||||||
showTimePicker(requested_time);
|
$("#requested_order_time").text(requested_time);
|
||||||
$("#waiting_timeModal").modal({show : true, backdrop: false, keyboard : false});
|
showTimePicker(requested_time);
|
||||||
|
$("#waiting_timeModal").modal({show : true, backdrop: false, keyboard : false});
|
||||||
|
}else{
|
||||||
|
var status = $(this).attr("data-value");
|
||||||
|
var order_id = $('#order_id').text();
|
||||||
|
var callback = $('#callback_url').text();
|
||||||
|
var ref_no = $('#ref_no').text();
|
||||||
|
callback_url(callback,ref_no,order_id,status);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#cancel").on("click", function(){
|
$("#cancel").on("click", function(){
|
||||||
@@ -180,78 +54,6 @@ $(function() {
|
|||||||
callback_url(callback,ref_no,order_id,status);
|
callback_url(callback,ref_no,order_id,status);
|
||||||
});
|
});
|
||||||
|
|
||||||
function showTimePicker(requested_time){
|
|
||||||
// var date = new Date(requested_time);
|
|
||||||
// var isPM = date.getHours() >= 12;
|
|
||||||
// var isMidday = date.getHours() == 12;
|
|
||||||
// var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
|
|
||||||
// date.getMinutes() || '00'].join(':') +
|
|
||||||
// (isPM ? 'pm' : 'am');
|
|
||||||
// console.log(time);
|
|
||||||
$('.timepicker').bootstrapMaterialDatePicker({
|
|
||||||
format: 'HH:mm',
|
|
||||||
useSeconds: false,
|
|
||||||
clearButton: true,
|
|
||||||
date: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function callback_url(callback,ref_no,order_id,status,time,exptime){
|
|
||||||
var url = 'order_reservation/update';
|
|
||||||
var post_url = "order_reservation/send_status";
|
|
||||||
var waiting_time = "";
|
|
||||||
if(time!=undefined && time!=""){
|
|
||||||
waiting_time = time;
|
|
||||||
}
|
|
||||||
var expected_time = "";
|
|
||||||
if(exptime!=undefined && exptime!=""){
|
|
||||||
expected_time = exptime;
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: post_url,
|
|
||||||
data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time},
|
|
||||||
dataType: "json",
|
|
||||||
success: function(data) {
|
|
||||||
if(data.status){
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
data: {'order_id': order_id, 'status': status, 'expected_time' : expected_time},
|
|
||||||
dataType: "json",
|
|
||||||
success: function(data) {
|
|
||||||
if (data.status) {
|
|
||||||
swal({
|
|
||||||
title: 'Information',
|
|
||||||
text: "Order has been "+data.message,
|
|
||||||
type: 'success',
|
|
||||||
html: true,
|
|
||||||
closeOnConfirm: false,
|
|
||||||
closeOnCancel: false,
|
|
||||||
allowOutsideClick: false
|
|
||||||
}, 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';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#save").on("click",function(){
|
$("#save").on("click",function(){
|
||||||
$("#waiting_timeErr").text("");
|
$("#waiting_timeErr").text("");
|
||||||
var status = $("#status").text();
|
var status = $("#status").text();
|
||||||
@@ -271,7 +73,231 @@ $(function() {
|
|||||||
$("#waiting_time").val("");
|
$("#waiting_time").val("");
|
||||||
$("#waiting_timeErr").text("Expected waiting time is greater than requested time!");
|
$("#waiting_timeErr").text("Expected waiting time is greater than requested time!");
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function customTableClick(){
|
||||||
|
$(".custom-table .custom-tr").on("click", function(){
|
||||||
|
$(".custom-tr").removeClass("tr-active");
|
||||||
|
$(this).addClass("tr-active");
|
||||||
|
var order_id = $(this).attr("data-id");
|
||||||
|
var sr_no = $(this).attr("data-sr-no");
|
||||||
|
var url = "order_reservation/get_order/"+order_id;
|
||||||
|
show_order_detail(url,sr_no);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshDetailData(){
|
||||||
|
$('#requested_date_time').text("");
|
||||||
|
$("#sr_number").text("");
|
||||||
|
$("#delivery_info").text("");
|
||||||
|
$("#contact_info").text("");
|
||||||
|
$('.summary-items').html("");
|
||||||
|
$('#sub_total').text("0.00");
|
||||||
|
$('#delivery_fee').text("0.00");
|
||||||
|
$('#total_charges').text("0.00");
|
||||||
|
$('#discount_amount').text("0.00");
|
||||||
|
$('#total_tax').text("0.00");
|
||||||
|
$('#grand_total').text("0.00");
|
||||||
|
}
|
||||||
|
|
||||||
|
//show order list
|
||||||
|
function show_order_detail(url,sr_no){
|
||||||
|
$('.summary-items').html("");
|
||||||
|
//Start Ajax
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: url,
|
||||||
|
data: {},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
// console.log(data);
|
||||||
|
var delivery = data["delivery"];
|
||||||
|
var items = data["order_items"];
|
||||||
|
var item_list = $('.summary-items');
|
||||||
|
|
||||||
|
var newDate = new Date(data.requested_time);
|
||||||
|
var time = timeFormat(newDate);
|
||||||
|
var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() > 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() > 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time;
|
||||||
|
|
||||||
|
if((data.expected_waiting_time!=undefined) && (data.expected_waiting_time!=null)){
|
||||||
|
var expDate = new Date(data.expected_waiting_time);
|
||||||
|
var exptime = timeFormat(expDate);
|
||||||
|
var expected_time = expDate.getFullYear() + '-' + (expDate.getMonth() > 10? expDate.getMonth() : '0' + (expDate.getMonth() + 1)) +'-'+ (expDate.getDate() > 10? expDate.getDate() : '0' + expDate.getDate()) +' '+exptime;
|
||||||
|
$('.expected_time').show();
|
||||||
|
$('#expected_time').text(expected_time? expected_time : '');
|
||||||
|
}else{
|
||||||
|
$('.expected_time').hide();
|
||||||
|
$('#expected_time').text('');
|
||||||
|
}
|
||||||
|
|
||||||
|
item_list.empty();
|
||||||
|
|
||||||
|
if(items!=undefined && items!=""){
|
||||||
|
if(items.length > 0){
|
||||||
|
for(var i in items) {
|
||||||
|
var item_price = 0;
|
||||||
|
if(items[i].price > 0){
|
||||||
|
item_price = items[i].price;
|
||||||
|
}else{
|
||||||
|
item_price = items[i].unit_price;
|
||||||
|
}
|
||||||
|
var total = items[i].qty * item_price;
|
||||||
|
row = '<tr>'
|
||||||
|
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
|
||||||
|
+' <br><span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>'
|
||||||
|
+'</td>'
|
||||||
|
+'<td width ="30%" class="body-td align-right">'+ total +'</td>'
|
||||||
|
+'</tr>';
|
||||||
|
$('.summary-items').append(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data.discount_amount > 0){
|
||||||
|
$("#discount").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#requested_date_time').text(requested_date);
|
||||||
|
$('#sub_total').text(data.total_amount);
|
||||||
|
$('#delivery_fee').text((parseFloat(delivery.delivery_fee) > 0)? delivery.delivery_fee : '0.0');
|
||||||
|
$('#total_charges').text((parseFloat(data.convenience_charge) > 0)? data.convenience_charge : '0.0');
|
||||||
|
$('#discount_amount').text((parseFloat(data.discount_amount) > 0)? data.discount_amount : '0.0');
|
||||||
|
$('#total_tax').text(data.total_tax);
|
||||||
|
$('#grand_total').text(data.grand_total);
|
||||||
|
|
||||||
|
var address = delivery.address;
|
||||||
|
if(delivery.township != null && delivery.township!=""){
|
||||||
|
address += ', ' +delivery.township;
|
||||||
|
}else if(delivery.direction_address!=null && delivery.direction_address!=""){
|
||||||
|
address += ", (" +delivery.direction_address+")";
|
||||||
|
}
|
||||||
|
$('#requested_time').text(requested_date);
|
||||||
|
$('#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);
|
||||||
|
|
||||||
|
if(delivery.delivery_type == "service"){
|
||||||
|
$("#delivery_info").text("(DELIVERY)");
|
||||||
|
}else if(delivery.delivery_type == "pick_up"){
|
||||||
|
$("#delivery_info").text("(PICK-UP)");
|
||||||
|
}else{
|
||||||
|
$("#delivery_info").text("(DIRECT DELIVERY)");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data.order_remark!=null && data.order_remark!=""){
|
||||||
|
$("#order_remark").text(data.order_remark);
|
||||||
|
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
|
||||||
|
$("#order_remark").text(data.reservation_remark);
|
||||||
|
}
|
||||||
|
$("#sr_number").text("NO."+sr_no);
|
||||||
|
if (data["receipt_no"]) {
|
||||||
|
$("#contact_info").text(data["receipt_no"]);
|
||||||
|
}else{
|
||||||
|
$("#contact_info").text(data["order_reservation_id"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//end Ajax
|
||||||
|
}
|
||||||
|
|
||||||
|
function showTimePicker(requested_time){
|
||||||
|
// var date = new Date(requested_time);
|
||||||
|
// var time = timeFormat(date);
|
||||||
|
// console.log(time);
|
||||||
|
$('.timepicker').bootstrapMaterialDatePicker({
|
||||||
|
format: 'HH:mm',
|
||||||
|
useSeconds: false,
|
||||||
|
clearButton: true,
|
||||||
|
date: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function callback_url(callback,ref_no,order_id,status,time,exptime){
|
||||||
|
var url = 'order_reservation/update';
|
||||||
|
var post_url = "order_reservation/send_status";
|
||||||
|
var waiting_time = "";
|
||||||
|
if(time!=undefined && time!=""){
|
||||||
|
waiting_time = time;
|
||||||
|
}
|
||||||
|
var expected_time = "";
|
||||||
|
if(exptime!=undefined && exptime!=""){
|
||||||
|
expected_time = exptime;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: post_url,
|
||||||
|
data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if(data.status){
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url,
|
||||||
|
data: {'order_id': order_id, 'status': status, 'expected_time' : expected_time},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if (data.status) {
|
||||||
|
swal({
|
||||||
|
title: 'Information',
|
||||||
|
text: "Order has been "+data.message,
|
||||||
|
type: 'success',
|
||||||
|
html: true,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false
|
||||||
|
}, 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';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function timeFormat(date){
|
||||||
|
var isPM = date.getHours() >= 12;
|
||||||
|
var isMidday = date.getHours() == 12;
|
||||||
|
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
|
||||||
|
date.getMinutes() || '00'].join(':') +
|
||||||
|
(isPM ? ' PM' : 'AM');
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
function showNewOrder(order_reservation){
|
||||||
|
// console.log(order_reservation);
|
||||||
|
if((order_reservation!=undefined) && (order_reservation!=null) && (order_reservation!="")){
|
||||||
|
var date = new Date(order_reservation.requested_time);
|
||||||
|
var time = timeFormat(date);
|
||||||
|
var requested_date = date.getFullYear() + '-' + (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() > 10? date.getDate() : '0' + date.getDate()) +' '+time;
|
||||||
|
swal({
|
||||||
|
html: true,
|
||||||
|
title: 'Information',
|
||||||
|
text: "You have new order <b>" + order_reservation.order_reservation_id + "</b> at <b>"+requested_date+"</b>",
|
||||||
|
type: 'success',
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -192,6 +192,41 @@ $(document).on('turbolinks:load', function() {
|
|||||||
|
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/* start check first bill or not funs: */
|
/* start check first bill or not funs: */
|
||||||
@@ -424,3 +459,8 @@ function showHideNavbar(webview,page){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createAccessCode(code) {
|
||||||
|
localStorage.setItem("access_code",code);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,19 @@ select.form-control {
|
|||||||
// cursor:pointer;
|
// cursor:pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.access_number{
|
||||||
|
width: 33%;
|
||||||
|
height:58px;
|
||||||
|
line-height:58px;
|
||||||
|
text-align:center;
|
||||||
|
background:#54A5AF;
|
||||||
|
// float:left;
|
||||||
|
// margin:2px;
|
||||||
|
font-size:20px;
|
||||||
|
color:white;
|
||||||
|
// cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.del_cashier_number{
|
.del_cashier_number{
|
||||||
opacity:0.6,
|
opacity:0.6,
|
||||||
}
|
}
|
||||||
|
|||||||
10
app/channels/check_new_order_channel.rb
Normal file
10
app/channels/check_new_order_channel.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class CheckNewOrderChannel < ApplicationCable::Channel
|
||||||
|
def subscribed
|
||||||
|
stream_from "check_new_order_channel"
|
||||||
|
end
|
||||||
|
|
||||||
|
def unsubscribed
|
||||||
|
stop_all_streams
|
||||||
|
# Any cleanup needed when channel is unsubscribed
|
||||||
|
end
|
||||||
|
end
|
||||||
10
app/channels/check_order_ready_to_delivery_channel.rb
Normal file
10
app/channels/check_order_ready_to_delivery_channel.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class CheckOrderReadyToDeliveryChannel < ApplicationCable::Channel
|
||||||
|
def subscribed
|
||||||
|
stream_from "check_order_ready_to_delivery_channel"
|
||||||
|
end
|
||||||
|
|
||||||
|
def unsubscribed
|
||||||
|
stop_all_streams
|
||||||
|
# Any cleanup needed when channel is unsubscribed
|
||||||
|
end
|
||||||
|
end
|
||||||
10
app/channels/check_order_send_to_kitchen_channel.rb
Normal file
10
app/channels/check_order_send_to_kitchen_channel.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class CheckOrderSendToKitchenChannel < ApplicationCable::Channel
|
||||||
|
def subscribed
|
||||||
|
stream_from "check_order_send_to_kitchen_channel"
|
||||||
|
end
|
||||||
|
|
||||||
|
def unsubscribed
|
||||||
|
stop_all_streams
|
||||||
|
# Any cleanup needed when channel is unsubscribed
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -59,9 +59,8 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
|||||||
order_reservation = params
|
order_reservation = params
|
||||||
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
|
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
|
||||||
|
|
||||||
order_reservation = OrderReservation.get_pending_orders #find(order_reservation_id)
|
|
||||||
|
|
||||||
if flag #&& ENV["SERVER_MODE"] != 'cloud'
|
if flag #&& ENV["SERVER_MODE"] != 'cloud'
|
||||||
|
order_reservation = OrderReservation.get_pending_orders #find(order_reservation_id)
|
||||||
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
|
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ class BaseOrigamiController < ActionController::Base
|
|||||||
before_action :check_user
|
before_action :check_user
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
protect_from_forgery with: :exception
|
|
||||||
|
|
||||||
helper_method :shop_detail, :current_token
|
helper_method :shop_detail, :current_token
|
||||||
|
|
||||||
@@ -23,6 +22,10 @@ class BaseOrigamiController < ActionController::Base
|
|||||||
}.to_json
|
}.to_json
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
if ENV["SERVER_MODE"] != 'cloud'
|
||||||
|
protect_from_forgery with: :exception
|
||||||
|
end
|
||||||
|
|
||||||
if current_user.nil?
|
if current_user.nil?
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -129,6 +129,18 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_emp_access_code
|
||||||
|
pin_code = params[:code]
|
||||||
|
employee = Employee.find_by_emp_id(pin_code)
|
||||||
|
if employee && employee.role == "manager"
|
||||||
|
result = {:status=> true, :message=>"Success" }
|
||||||
|
else
|
||||||
|
result = {:status=> false, :message=>"Invalid Access Code" }
|
||||||
|
end
|
||||||
|
render :json => result.to_json
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_dining
|
def set_dining
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ class Origami::MoveroomController < BaseOrigamiController
|
|||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
|
|
||||||
def move_dining
|
def move_dining
|
||||||
|
@webview = check_mobile
|
||||||
|
|
||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.all.active.order('status desc')
|
||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.all.active.order('status desc')
|
||||||
@complete = Sale.all
|
@complete = Sale.all
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ class Origami::MovetableController < BaseOrigamiController
|
|||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
|
|
||||||
def move_dining
|
def move_dining
|
||||||
|
@webview = check_mobile
|
||||||
|
|
||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.all.active.order('status desc')
|
||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.all.active.order('status desc')
|
||||||
@complete = Sale.all
|
@complete = Sale.all
|
||||||
|
|||||||
@@ -446,8 +446,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
|
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
|
||||||
puts "FOC"
|
|
||||||
puts saleObj.to_json
|
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
sale_payment.process_payment(saleObj, current_user.name, cash, "foc" ,remark)
|
sale_payment.process_payment(saleObj, current_user.name, cash, "foc" ,remark)
|
||||||
# For Cashier by Zone
|
# For Cashier by Zone
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ class Origami::PendingOrderController < BaseOrigamiController
|
|||||||
# @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d'))
|
# @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d'))
|
||||||
@sale = Sale.pending_sale
|
@sale = Sale.pending_sale
|
||||||
@order = Sale.pending_order
|
@order = Sale.pending_order
|
||||||
|
@completed = Sale.completed_sale
|
||||||
end
|
end
|
||||||
def show
|
def show
|
||||||
@sales = Sale.pending_sale
|
@sales = Sale.pending_sale
|
||||||
@orders = Sale.pending_order
|
@orders = Sale.pending_order
|
||||||
|
@completed = Sale.completed_sale
|
||||||
@id = params[:sale_id]
|
@id = params[:sale_id]
|
||||||
if(@id[0,3] == "SAL")
|
if(@id[0,3] == "SAL")
|
||||||
@sale = Sale.find(@id)
|
@sale = Sale.find(@id)
|
||||||
@@ -41,4 +42,27 @@ class Origami::PendingOrderController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def completed_sale
|
||||||
|
@sales = Sale.pending_sale
|
||||||
|
@orders = Sale.pending_order
|
||||||
|
@completed = Sale.completed_sale
|
||||||
|
@id = params[:sale_id]
|
||||||
|
|
||||||
|
@sale = Sale.find(@id)
|
||||||
|
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
||||||
|
@booking = BookingOrder.find_by_order_id(@order).booking_id
|
||||||
|
@bookings = Booking.find(@booking)
|
||||||
|
@status = "sale"
|
||||||
|
|
||||||
|
if @bookings.dining_facility_id.to_i > 0
|
||||||
|
@table_id = Booking.find(@bookings.booking_id).dining_facility_id
|
||||||
|
@dining = DiningFacility.find(@table_id)
|
||||||
|
else
|
||||||
|
@table_id = nil
|
||||||
|
@dining = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
def item_void
|
def item_void
|
||||||
saleitemId = params[:sale_item_id]
|
saleitemId = params[:sale_item_id]
|
||||||
remark = params[:remark]
|
remark = params[:remark]
|
||||||
|
access_code = params[:access_code]
|
||||||
saleitemObj = SaleItem.find(saleitemId)
|
saleitemObj = SaleItem.find(saleitemId)
|
||||||
saleitemObj.status = 'void'
|
saleitemObj.status = 'void'
|
||||||
saleitemObj.remark = remark
|
saleitemObj.remark = remark
|
||||||
@@ -48,8 +49,9 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
action_by = current_user.id
|
action_by = current_user.id
|
||||||
|
approved_by = Employee.find_by_emp_id(access_code)
|
||||||
remark = "Void Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}"
|
remark = "Void Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}"
|
||||||
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMVOID" )
|
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, approved_by.name,remark,"SALEITEMVOID" )
|
||||||
|
|
||||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount)
|
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount)
|
||||||
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
|
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
|
||||||
@@ -58,6 +60,7 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
def item_foc
|
def item_foc
|
||||||
saleitemId = params[:sale_item_id]
|
saleitemId = params[:sale_item_id]
|
||||||
remark = params[:remark]
|
remark = params[:remark]
|
||||||
|
access_code = params[:access_code]
|
||||||
saleitemObj = SaleItem.find(saleitemId)
|
saleitemObj = SaleItem.find(saleitemId)
|
||||||
saleitemObj.status = 'foc'
|
saleitemObj.status = 'foc'
|
||||||
saleitemObj.remark = remark
|
saleitemObj.remark = remark
|
||||||
@@ -80,8 +83,9 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
order = Order.find(order_id)
|
order = Order.find(order_id)
|
||||||
|
|
||||||
action_by = current_user.id
|
action_by = current_user.id
|
||||||
|
approved_by = Employee.find_by_emp_id(access_code)
|
||||||
remark = "FOC Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}Receipt No #{saleObj.receipt_no}"
|
remark = "FOC Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}Receipt No #{saleObj.receipt_no}"
|
||||||
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMFOC" )
|
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, approved_by.name,remark,"SALEITEMFOC" )
|
||||||
|
|
||||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount,order.source)
|
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount,order.source)
|
||||||
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
|
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
|
||||||
@@ -111,6 +115,7 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
saleitemId = params[:sale_item_id]
|
saleitemId = params[:sale_item_id]
|
||||||
update_qty = params[:update_qty]
|
update_qty = params[:update_qty]
|
||||||
update_price = params[:update_price]
|
update_price = params[:update_price]
|
||||||
|
access_code = params[:access_code]
|
||||||
saleitemObj = SaleItem.find(saleitemId)
|
saleitemObj = SaleItem.find(saleitemId)
|
||||||
sale = Sale.find(saleitemObj.sale_id)
|
sale = Sale.find(saleitemObj.sale_id)
|
||||||
|
|
||||||
@@ -120,8 +125,9 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
saleitemObj.taxable_price = update_qty.to_f * update_price.to_f
|
saleitemObj.taxable_price = update_qty.to_f * update_price.to_f
|
||||||
|
|
||||||
action_by = current_user.id
|
action_by = current_user.id
|
||||||
|
approved_by = Employee.find_by_emp_id(access_code)
|
||||||
remark = "Update Qty #{update_qty} Price [#{saleitemObj.price}]| Receipt No #{sale.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}"
|
remark = "Update Qty #{update_qty} Price [#{saleitemObj.price}]| Receipt No #{sale.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}"
|
||||||
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,sale.cashier_id, action_by,remark,"SALEITEMEDIT" )
|
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,sale.cashier_id, approved_by.name,remark,"SALEITEMEDIT" )
|
||||||
# saleitemObj.remark = 'edit'
|
# saleitemObj.remark = 'edit'
|
||||||
|
|
||||||
unless saleitemObj.product_name.include? 'updated'
|
unless saleitemObj.product_name.include? 'updated'
|
||||||
@@ -152,6 +158,7 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
# make cancel void item
|
# make cancel void item
|
||||||
def item_void_cancel
|
def item_void_cancel
|
||||||
saleitemId = params[:sale_item_id]
|
saleitemId = params[:sale_item_id]
|
||||||
|
access_code = params[:access_code]
|
||||||
saleitemObj = SaleItem.find(saleitemId)
|
saleitemObj = SaleItem.find(saleitemId)
|
||||||
both = SaleItem.where('product_code=?', saleitemObj.product_code)
|
both = SaleItem.where('product_code=?', saleitemObj.product_code)
|
||||||
both.each do |item|
|
both.each do |item|
|
||||||
@@ -169,8 +176,9 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
order = Order.find(order_id)
|
order = Order.find(order_id)
|
||||||
|
|
||||||
action_by = current_user.id
|
action_by = current_user.id
|
||||||
|
approved_by = Employee.find_by_emp_id(access_code)
|
||||||
remark = "Cancle Void Sale Item ID #{saleitemObj.sale_item_id} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}|Receipt No #{saleObj.receipt_no}"
|
remark = "Cancle Void Sale Item ID #{saleitemObj.sale_item_id} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}|Receipt No #{saleObj.receipt_no}"
|
||||||
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"ITEMCANCELVOID" )
|
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, approved_by.name,remark,"ITEMCANCELVOID" )
|
||||||
|
|
||||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount, order.source)
|
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount, order.source)
|
||||||
ProductCommission.remove_product_commission(saleitemObj)
|
ProductCommission.remove_product_commission(saleitemObj)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
remark = params[:remark]
|
remark = params[:remark]
|
||||||
order_source = params[:type] #tax profile source
|
order_source = params[:type] #tax profile source
|
||||||
|
access_code = params[:access_code]
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
sale = Sale.find_by_sale_id(sale_id)
|
sale = Sale.find_by_sale_id(sale_id)
|
||||||
|
|
||||||
@@ -71,8 +72,9 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
|
|
||||||
# FOr Sale Audit
|
# FOr Sale Audit
|
||||||
action_by = current_user.name
|
action_by = current_user.name
|
||||||
|
approved_by = Employee.find_by_emp_id(access_code)
|
||||||
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
||||||
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" )
|
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, approved_by.name,remark,"SALEVOID" )
|
||||||
|
|
||||||
# For Print
|
# For Print
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
|||||||
|
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
remark = params[:remark]
|
remark = params[:remark]
|
||||||
order_source = params[:type] #tax profile source
|
order_source = params[:type]
|
||||||
|
access_code = params[:access_code] #tax profile source
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
sale = Sale.find_by_sale_id(sale_id)
|
sale = Sale.find_by_sale_id(sale_id)
|
||||||
SaleTax.where("sale_id='#{sale_id}'").find_each do |existing_tax|
|
SaleTax.where("sale_id='#{sale_id}'").find_each do |existing_tax|
|
||||||
@@ -54,8 +55,9 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
|||||||
|
|
||||||
# FOr Sale Audit
|
# FOr Sale Audit
|
||||||
action_by = current_user.name
|
action_by = current_user.name
|
||||||
|
approved_by = Employee.find_by_emp_id(access_code)
|
||||||
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
||||||
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,remark )
|
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, approved_by.name,remark,remark )
|
||||||
|
|
||||||
# For Print
|
# For Print
|
||||||
|
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ class Ability
|
|||||||
# can :overall_void, :void
|
# can :overall_void, :void
|
||||||
can :index, :home
|
can :index, :home
|
||||||
can :show, :home
|
can :show, :home
|
||||||
|
can :check_emp_access_code, :home
|
||||||
can :read, Order
|
can :read, Order
|
||||||
can :update, Order
|
can :update, Order
|
||||||
can :manage, Booking
|
can :manage, Booking
|
||||||
@@ -151,6 +152,7 @@ class Ability
|
|||||||
can :create, :payment
|
can :create, :payment
|
||||||
can :reprint, :payment
|
can :reprint, :payment
|
||||||
can :rounding_adj, :payment
|
can :rounding_adj, :payment
|
||||||
|
can :foc, :payment
|
||||||
can :print, :payment
|
can :print, :payment
|
||||||
|
|
||||||
can :move_dining, :movetable
|
can :move_dining, :movetable
|
||||||
@@ -183,6 +185,16 @@ class Ability
|
|||||||
|
|
||||||
can :print, :print
|
can :print, :print
|
||||||
can :print_order_summary, :print
|
can :print_order_summary, :print
|
||||||
|
|
||||||
|
can :edit, :sale_edit
|
||||||
|
can :item_void, :sale_edit
|
||||||
|
can :item_void_cancel, :sale_edit
|
||||||
|
can :cancel_all_void, :sale_edit
|
||||||
|
can :apply_void, :sale_edit
|
||||||
|
can :item_foc, :sale_edit
|
||||||
|
can :item_edit, :sale_edit
|
||||||
|
|
||||||
|
can :overall_void, :void
|
||||||
|
|
||||||
elsif user.role == "account"
|
elsif user.role == "account"
|
||||||
|
|
||||||
|
|||||||
@@ -45,16 +45,21 @@ class MenuCategory < ApplicationRecord
|
|||||||
from_t = Time.parse(menu.valid_time_from.strftime("%H:%M:%S"))
|
from_t = Time.parse(menu.valid_time_from.strftime("%H:%M:%S"))
|
||||||
to_t = Time.parse(menu.valid_time_to.strftime("%H:%M:%S"))
|
to_t = Time.parse(menu.valid_time_to.strftime("%H:%M:%S"))
|
||||||
current_t = Time.parse(Time.now.utc.getlocal.strftime("%H:%M:%S"))
|
current_t = Time.parse(Time.now.utc.getlocal.strftime("%H:%M:%S"))
|
||||||
|
|
||||||
from = from_t.hour * 3600 + from_t.min*60 + from_t.sec
|
from = from_t.hour * 3600 + from_t.min*60 + from_t.sec
|
||||||
to = to_t.hour * 3600 + to_t.min* 60 + to_t.sec
|
to = to_t.hour * 3600 + to_t.min* 60 + to_t.sec
|
||||||
current = current_t.hour * 3600 + current_t.min*60+current_t.sec
|
current = current_t.hour * 3600 + current_t.min*60+current_t.sec
|
||||||
|
|
||||||
if from > to
|
if from > to
|
||||||
h = to_t.hour
|
h = to_t.hour
|
||||||
if h < 12 # before noon
|
if h < 12 # before noon
|
||||||
if h == 0
|
if h == 0
|
||||||
to = 24
|
to = 24
|
||||||
to = to * 3600 + to_t.min* 60 + to_t.sec
|
to = to * 3600 + to_t.min* 60 + to_t.sec
|
||||||
|
else
|
||||||
|
|
||||||
|
h += 24
|
||||||
|
to = h*3600 + to_t.min* 60 + to_t.sec
|
||||||
end
|
end
|
||||||
else # (after) noon
|
else # (after) noon
|
||||||
if h > 12
|
if h > 12
|
||||||
@@ -64,13 +69,9 @@ class MenuCategory < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# from = from.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b}
|
|
||||||
# to = to.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b}
|
|
||||||
# current = current.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b}
|
|
||||||
|
|
||||||
day = Date.today.wday
|
day = Date.today.wday
|
||||||
dayresult = menu.valid_days.include?(day.to_s)
|
dayresult = menu.valid_days.include?(day.to_s)
|
||||||
|
|
||||||
if current.between?(from, to) && menu.valid_days.include?(day.to_s)
|
if current.between?(from, to) && menu.valid_days.include?(day.to_s)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -201,12 +201,41 @@ class OrderReservation < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.get_pending_orders
|
def self.get_pending_orders
|
||||||
order_reservation = OrderReservation.select("order_reservations.*,deliveries.provider,deliveries.delivery_type")
|
order_reservation = OrderReservation.select("order_reservations.*,del.provider,del.delivery_type")
|
||||||
.joins(" JOIN deliveries as del on del.order_reservation_id=order_reservations.order_reservation_id")
|
.joins(" JOIN deliveries as del on del.order_reservation_id=order_reservations.order_reservation_id")
|
||||||
.where("order_reservations.status='new'")
|
.where("order_reservations.status='new'")
|
||||||
.order("order_reservations.order_reservation_id desc, order_reservations.created_at desc")
|
.order("order_reservations.order_reservation_id desc, order_reservations.created_at desc")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.check_new_order
|
||||||
|
order_reservation = OrderReservation.where("status='new'")
|
||||||
|
if order_reservation.length > 0
|
||||||
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.check_order_send_to_kitchen
|
||||||
|
today = Time.now.utc
|
||||||
|
order_reservation = OrderReservation.where("status='accepted' and requested_time > '#{today}'")
|
||||||
|
if order_reservation.length > 0
|
||||||
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.check_order_ready_to_delivery
|
||||||
|
today = Time.now.utc
|
||||||
|
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time > '#{today}'")
|
||||||
|
if order_reservation.length > 0
|
||||||
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "ODRS")
|
self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "ODRS")
|
||||||
|
|||||||
@@ -1139,10 +1139,6 @@ def self.get_wastes_and_spoilages(from,to,status)
|
|||||||
else
|
else
|
||||||
type = "and sales.sale_status = 'waste'"
|
type = "and sales.sale_status = 'waste'"
|
||||||
end
|
end
|
||||||
# query = Sale.all.where("sales.receipt_date between ? and ? #{type}",from,to)
|
|
||||||
# .group("sales.receipt_no")
|
|
||||||
# sales.receipt_no,menu_categories.id,sale_items.item_instance_code
|
|
||||||
|
|
||||||
query = Sale.select("sales.sale_id,sales.receipt_no,sales.created_at,sales.total_amount,sales.grand_total,sales.rounding_adjustment,sales.shift_sale_id,sale_items.product_name,sale_items.product_code,sale_items.item_instance_code,sale_items.qty,sale_items.price,sale_items.unit_price,menu_categories.name")
|
query = Sale.select("sales.sale_id,sales.receipt_no,sales.created_at,sales.total_amount,sales.grand_total,sales.rounding_adjustment,sales.shift_sale_id,sale_items.product_name,sale_items.product_code,sale_items.item_instance_code,sale_items.qty,sale_items.price,sale_items.unit_price,menu_categories.name")
|
||||||
.joins("JOIN sale_items ON sales.sale_id = sale_items.sale_id" +
|
.joins("JOIN sale_items ON sales.sale_id = sale_items.sale_id" +
|
||||||
" JOIN menu_item_instances ON sale_items.item_instance_code = menu_item_instances.item_instance_code" +
|
" JOIN menu_item_instances ON sale_items.item_instance_code = menu_item_instances.item_instance_code" +
|
||||||
@@ -2614,6 +2610,13 @@ end
|
|||||||
query = query.where("bookings.booking_status = 'assign' AND orders.status = 'new' AND orders.source =? ","quick_service")
|
query = query.where("bookings.booking_status = 'assign' AND orders.status = 'new' AND orders.source =? ","quick_service")
|
||||||
.group("bookings.booking_id")
|
.group("bookings.booking_id")
|
||||||
end
|
end
|
||||||
|
def self.completed_sale
|
||||||
|
query = Sale.all
|
||||||
|
query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id")
|
||||||
|
.joins("join orders as orders on orders.order_id = sale_orders.order_id")
|
||||||
|
query = query.where("sales.sale_status != 'new' AND orders.status = 'billed' AND orders.source =? ","quick_service")
|
||||||
|
.group("sales.sale_id")
|
||||||
|
end
|
||||||
|
|
||||||
def self.all_receipts
|
def self.all_receipts
|
||||||
query = Sale.select("sale_payments.created_at as receipt_close_time,
|
query = Sale.select("sale_payments.created_at as receipt_close_time,
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
total_price = item.price #item.qty*item.unit_price - comment for room charges
|
total_price = item.price #item.qty*item.unit_price - comment for room charges
|
||||||
price = item.unit_price
|
price = item.unit_price
|
||||||
product_name = item.product_name
|
product_name = item.product_name
|
||||||
|
total_qty += item.qty
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
|
|||||||
977
app/views/origami/addorders/detail.html.erb
Executable file → Normal file
977
app/views/origami/addorders/detail.html.erb
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
@@ -485,8 +485,10 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
|
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
|
||||||
<% if current_login_employee.role != "waiter" %>
|
<% if current_login_employee.role != "waiter" %>
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
|
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button> -->
|
||||||
|
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
|
||||||
|
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if current_login_employee.role != "waiter" %>
|
<% if current_login_employee.role != "waiter" %>
|
||||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||||
@@ -579,26 +581,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal fade" id="waste_spoileModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog modal-sm" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="waste_spoileModalLabel">Are you sure Waste or Spoile ?</h4>
|
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
|
||||||
|
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">×</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
|
||||||
<div class="row p-r-20">
|
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
|
||||||
<div class="col-md-3">
|
<div class="row bottom p-l-15 p-r-15 m-t-10">
|
||||||
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')"><strong>Waste</strong></button>
|
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
|
||||||
</div>
|
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
|
||||||
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')"><strong>Spoile</strong></button>
|
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="row bottom p-l-15 p-r-15">
|
||||||
<button type="button" class="btn btn-lg bg-blue waves-effect" data-dismiss="modal"><strong>CLOSE</strong></button>
|
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
|
||||||
</div>
|
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
|
||||||
</div>
|
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
|
||||||
</div>
|
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
|
||||||
<div class="modal-footer ">
|
</div>
|
||||||
|
<div class="row bottom p-l-15 p-r-15">
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
|
||||||
|
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -957,6 +968,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#void').on('click', function () {
|
$('#void').on('click', function () {
|
||||||
|
var access_code = localStorage.getItem("access_code");
|
||||||
if ($(this).attr('active')=== "true") {
|
if ($(this).attr('active')=== "true") {
|
||||||
swal({
|
swal({
|
||||||
title: "Alert",
|
title: "Alert",
|
||||||
@@ -975,7 +987,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
// For Server Print - from jade
|
// For Server Print - from jade
|
||||||
if ($("#server_mode").val() == "cloud") {
|
if ($("#server_mode").val() == "cloud") {
|
||||||
@@ -1052,6 +1064,12 @@
|
|||||||
return attribute_arr;
|
return attribute_arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(document).on('click', '.access_modal', function(event){
|
||||||
|
type = $(this).data("type");
|
||||||
|
$(".ok").attr("data-action",type)
|
||||||
|
$('#AccessCodeModal').modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
function waste_and_spoilage(remark) {
|
function waste_and_spoilage(remark) {
|
||||||
swal({
|
swal({
|
||||||
title: "Alert",
|
title: "Alert",
|
||||||
@@ -1081,4 +1099,34 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function check_emp_access_code(access_code,type) {
|
||||||
|
var url = "/origami/check_emp_access_code/" + access_code ;
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: url,
|
||||||
|
data: {},
|
||||||
|
success: function (result) {
|
||||||
|
console.log(result);
|
||||||
|
if (result.status == true) {
|
||||||
|
createAccessCode(code);
|
||||||
|
if (type == "edit") {
|
||||||
|
var dining_id = "<%= @dining.id %>";
|
||||||
|
var sale_id = "<%= @obj_sale.sale_id rescue "" %>";
|
||||||
|
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type +"/edit";
|
||||||
|
}else if(type == "void"){
|
||||||
|
$('#AccessCodeModal').modal('hide');
|
||||||
|
$('#voidModal').modal('show');
|
||||||
|
|
||||||
|
// overall_void();
|
||||||
|
}else if(type == "waste_and_spoilage"){
|
||||||
|
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
swal("Opps",result.message,"warning")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -166,6 +166,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
/* check webview loaded*/
|
||||||
|
var webview = <%= @webview %>;
|
||||||
|
showHideNavbar(webview);
|
||||||
|
|
||||||
$(".tables").on('click', function(){
|
$(".tables").on('click', function(){
|
||||||
$('.tables').removeClass('selected-item');
|
$('.tables').removeClass('selected-item');
|
||||||
$(this).addClass('selected-item');
|
$(this).addClass('selected-item');
|
||||||
|
|||||||
@@ -284,6 +284,10 @@ end
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
/* check webview loaded*/
|
||||||
|
var webview = <%= @webview %>;
|
||||||
|
showHideNavbar(webview);
|
||||||
|
|
||||||
$(".tables").on('click', function(){
|
$(".tables").on('click', function(){
|
||||||
$('.tables').removeClass('selected-item');
|
$('.tables').removeClass('selected-item');
|
||||||
$(this).addClass('selected-item');
|
$(this).addClass('selected-item');
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
<%=i%>
|
<%=i%>
|
||||||
</td>
|
</td>
|
||||||
<td width ="20%" class="align-center">
|
<td width ="20%" class="align-center">
|
||||||
<%= order.created_at.utc.getlocal.strftime("%d-%m-%Y") %>
|
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
|
||||||
</td>
|
</td>
|
||||||
<td width ="20%" class="align-center">
|
<td width ="20%" class="align-center">
|
||||||
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
|
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
|
||||||
@@ -197,7 +197,6 @@
|
|||||||
</td>
|
</td>
|
||||||
<td width ="30%" class="align-center">
|
<td width ="30%" class="align-center">
|
||||||
<span class="font-10 col-blue">
|
<span class="font-10 col-blue">
|
||||||
<%= order.delivery.to_json %>
|
|
||||||
<% if order.delivery.delivery_type == 'service' %>
|
<% if order.delivery.delivery_type == 'service' %>
|
||||||
DELIVERY
|
DELIVERY
|
||||||
<% elsif order.delivery.delivery_type == 'pick_up' %>
|
<% elsif order.delivery.delivery_type == 'pick_up' %>
|
||||||
@@ -351,7 +350,7 @@
|
|||||||
<b id="phone"></b>
|
<b id="phone"></b>
|
||||||
</td>
|
</td>
|
||||||
<td class="body-td align-right expected_time">
|
<td class="body-td align-right expected_time">
|
||||||
<span class="font-13">EXPECTED WAITING TIME</span><br>
|
<span class="font-13">EXPECTED TIME</span><br>
|
||||||
<b id="expected_time"></b>
|
<b id="expected_time"></b>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -410,11 +409,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<div id="notify_new_order"></div>
|
||||||
$(function(){
|
<div id="notify_order_send_to_kitchen"></div>
|
||||||
$("#discount").hide();
|
<div id="notify_order_ready_to_delivery"></div>
|
||||||
$(".expected_time").hide();
|
|
||||||
$('.first-1').click();
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
@@ -350,16 +350,20 @@
|
|||||||
<i class="material-icons">reply</i>
|
<i class="material-icons">reply</i>
|
||||||
Back
|
Back
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
|
<!-- <button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
|
||||||
<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>
|
||||||
<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="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>
|
<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> -->
|
||||||
<% if @cashier_type=="quick_service" %>
|
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="foc"> FOC</a>
|
||||||
|
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||||
|
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="waste"> Waste</a>
|
||||||
|
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="spoile"> Spoile</a>
|
||||||
|
<% if @cashier_type=="quick_service" %>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
||||||
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
|
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
|
||||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||||
<!-- Waiter Buttons -->
|
<!-- Waiter Buttons -->
|
||||||
@@ -487,7 +491,40 @@
|
|||||||
<div class="modal-footer"></div>
|
<div class="modal-footer"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog modal-sm" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
|
||||||
|
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
|
||||||
|
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
|
||||||
|
<div class="row bottom p-l-15 p-r-15 m-t-10">
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
|
||||||
|
</div>
|
||||||
|
<div class="row bottom p-l-15 p-r-15">
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
|
||||||
|
</div>
|
||||||
|
<div class="row bottom p-l-15 p-r-15">
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
|
||||||
|
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
|
||||||
|
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="sxModal">
|
<div id="sxModal">
|
||||||
<div id="sxModal-Content">
|
<div id="sxModal-Content">
|
||||||
@@ -730,44 +767,7 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
// swal("Opps","You are not authorized for void","warning")
|
// swal("Opps","You are not authorized for void","warning")
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
$('#void').on('click', function () {
|
|
||||||
if ($(this).attr('active')=== "true") {
|
|
||||||
swal({
|
|
||||||
title: "Alert",
|
|
||||||
text: "Are you sure want to Void?",
|
|
||||||
type: "warning",
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonColor: "#DD6B55",
|
|
||||||
confirmButtonText: "Yes, void it!",
|
|
||||||
closeOnConfirm: false
|
|
||||||
}, function (isConfirm) {
|
|
||||||
if (isConfirm) {
|
|
||||||
var sale_id = $('#sale_id').text();
|
|
||||||
var remark = $("#remark").val();
|
|
||||||
var ajax_url = "/origami/sale/" + sale_id +'/'+cashier_type+ '/void';
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: ajax_url,
|
|
||||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
|
||||||
success: function (result) {result
|
|
||||||
customer_display_view(null,"reload");
|
|
||||||
// For Server Print - from jade
|
|
||||||
if ($("#server_mode").val() == "cloud") {
|
|
||||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
|
||||||
}
|
|
||||||
if (cashier_type=="cashier") {
|
|
||||||
window.location.href = '/origami';
|
|
||||||
}else{
|
|
||||||
window.location.href = '/origami/quick_service';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
swal("Oops","You are not authorized for void","warning")
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// bind survey to order or sale
|
// bind survey to order or sale
|
||||||
@@ -940,59 +940,6 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
$('#balance').text(parseFloat(result));
|
$('#balance').text(parseFloat(result));
|
||||||
<% end %>
|
<% end %>
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#foc').click(function() {
|
|
||||||
//$( "#loading_wrapper" ).show();
|
|
||||||
// payment
|
|
||||||
var remark = $("#foc_remark").val();
|
|
||||||
var cash = $('#grand_total').text();
|
|
||||||
var sub_total = $('#sub-total').text();
|
|
||||||
var sale_id = $('#sale_id').text();
|
|
||||||
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':cashier_type };
|
|
||||||
|
|
||||||
if ($(this).attr('active')=== "true") {
|
|
||||||
swal({
|
|
||||||
title: "Alert",
|
|
||||||
text: "Are you sure want to FOC This Receipt?",
|
|
||||||
type: "warning",
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonColor: "#DD6B55",
|
|
||||||
confirmButtonText: "Yes, FOC it!",
|
|
||||||
closeOnConfirm: false
|
|
||||||
}, function (isConfirm) {
|
|
||||||
if (isConfirm) {
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: "/origami/payment/"+cashier_type+"/foc",
|
|
||||||
data: params,
|
|
||||||
success:function(result){
|
|
||||||
customer_display_view(null,"reload");
|
|
||||||
if (cash >= 0) {
|
|
||||||
swal({
|
|
||||||
title: "Information!",
|
|
||||||
text: 'Thank You !',
|
|
||||||
}, function () {
|
|
||||||
// For Server Print - from jade
|
|
||||||
if ($("#server_mode").val() == "cloud") {
|
|
||||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
|
||||||
}
|
|
||||||
if (cashier_type=="cashier") {
|
|
||||||
window.location.href = '/origami';
|
|
||||||
}else{
|
|
||||||
window.location.href = '/origami/quick_service';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}else{
|
|
||||||
swal("Oops","You are not authorized for foc","warning")
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function customer_display_view(data,status) {
|
function customer_display_view(data,status) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@@ -1220,28 +1167,157 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
update_sale("", customer_id, customer_name, sale_id);
|
update_sale("", customer_id, customer_name, sale_id);
|
||||||
});
|
});
|
||||||
|
|
||||||
function waste_and_spoilage(remark) {
|
$(document).on('click', '.access_modal', function(event){
|
||||||
|
type = $(this).data("type");
|
||||||
|
$(".ok").attr("data-action",type)
|
||||||
|
$('#AccessCodeModal').modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
function check_emp_access_code(access_code,type) {
|
||||||
|
var url = "/origami/check_emp_access_code/" + access_code ;
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: url,
|
||||||
|
data: {},
|
||||||
|
success: function (result) {
|
||||||
|
console.log(result)
|
||||||
|
if (result.status == true) {
|
||||||
|
createAccessCode(code);
|
||||||
|
if (type == "edit") {
|
||||||
|
var dining_id = $('#dining').text();
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
if (dining_id) {
|
||||||
|
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
|
||||||
|
}else{
|
||||||
|
window.location.href = "/origami/table/sale/" + sale_id + "/"+cashier_type+"/edit";
|
||||||
|
}
|
||||||
|
}else if(type == "void"){
|
||||||
|
$('#AccessCodeModal').modal('hide');
|
||||||
|
$('#voidModal').modal('show');
|
||||||
|
// overall_void();
|
||||||
|
}else if(type == "waste") {
|
||||||
|
// $('#AccessCodeModal').modal('hide');
|
||||||
|
// $('#focModal').modal('show');
|
||||||
|
waste_and_spoilage("waste")
|
||||||
|
}else if(type == "spoile") {
|
||||||
|
// $('#AccessCodeModal').modal('hide');
|
||||||
|
// $('#voidModal').modal('show');
|
||||||
|
waste_and_spoilage("spoile")
|
||||||
|
}else if(type == "foc"){
|
||||||
|
$('#AccessCodeModal').modal('hide');
|
||||||
|
$('#focModal').modal('show');
|
||||||
|
// overall_foc();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
swal("Opps",result.message,"warning")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#foc').on('click', function () {
|
||||||
|
var access_code = localStorage.getItem("access_code");
|
||||||
|
var remark = $("#foc_remark").val();
|
||||||
|
var cash = $('#grand_total').text();
|
||||||
|
var sub_total = $('#sub-total').text();
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':cashier_type,'access_code':access_code };
|
||||||
|
swal({
|
||||||
|
title: "Alert",
|
||||||
|
text: "Are you sure want to FOC This Receipt?",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes, FOC it!",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/payment/"+cashier_type+"/foc",
|
||||||
|
data: params,
|
||||||
|
success:function(result){
|
||||||
|
customer_display_view(null,"reload");
|
||||||
|
if (cash >= 0) {
|
||||||
|
swal({
|
||||||
|
title: "Information!",
|
||||||
|
text: 'Thank You !',
|
||||||
|
}, function () {
|
||||||
|
// For Server Print - from jade
|
||||||
|
if ($("#server_mode").val() == "cloud") {
|
||||||
|
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||||
|
}
|
||||||
|
if (cashier_type=="cashier") {
|
||||||
|
window.location.href = '/origami';
|
||||||
|
}else{
|
||||||
|
window.location.href = '/origami/quick_service';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#void').on('click', function () {
|
||||||
|
var access_code = localStorage.getItem("access_code");
|
||||||
|
swal({
|
||||||
|
title: "Alert",
|
||||||
|
text: "Are you sure want to Void?",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes, void it!",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
console.log(sale_id)
|
var remark = $("#remark").val();
|
||||||
swal({
|
var ajax_url = "/origami/sale/" + sale_id +'/'+cashier_type+ '/void';
|
||||||
title: "Alert",
|
$.ajax({
|
||||||
text: "Are you sure want to " + remark +" ?",
|
type: 'POST',
|
||||||
type: "warning",
|
url: ajax_url,
|
||||||
showCancelButton: true,
|
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
|
||||||
confirmButtonColor: "#DD6B55",
|
success: function (result) {result
|
||||||
confirmButtonText: "Yes, " +remark+ " it!",
|
customer_display_view(null,"reload");
|
||||||
closeOnConfirm: false
|
// For Server Print - from jade
|
||||||
}, function (isConfirm) {
|
if ($("#server_mode").val() == "cloud") {
|
||||||
if (isConfirm) {
|
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||||
var url = "/origami/sale/" + sale_id +'/'+cashier_type+'/waste_and_spoilage';
|
}
|
||||||
$.ajax({
|
if (cashier_type=="cashier") {
|
||||||
type: 'POST',
|
window.location.href = '/origami';
|
||||||
url: url,
|
}else{
|
||||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
window.location.href = '/origami/quick_service';
|
||||||
success: function (result) {
|
}
|
||||||
console.log(result)
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function waste_and_spoilage(remark) {
|
||||||
|
var access_code = localStorage.getItem("access_code");
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
swal({
|
||||||
|
title: "Alert",
|
||||||
|
text: "Are you sure want to " + remark +" ?",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes, " +remark+ " it!",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
|
var url = "/origami/sale/" + sale_id +'/'+cashier_type+'/waste_and_spoilage';
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: url,
|
||||||
|
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
|
||||||
|
success: function (result) {
|
||||||
|
console.log(result)
|
||||||
// For Server Print - from jade
|
// For Server Print - from jade
|
||||||
if ($("#server_mode").val() == "cloud") {
|
if ($("#server_mode").val() == "cloud") {
|
||||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||||
}
|
}
|
||||||
if (cashier_type=="cashier") {
|
if (cashier_type=="cashier") {
|
||||||
@@ -1251,8 +1327,8 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
customer_display_view(null,"reload");
|
customer_display_view(null,"reload");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
207
app/views/origami/pending_order/completed_sale.html.erb
Normal file
207
app/views/origami/pending_order/completed_sale.html.erb
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<!-- Column One -->
|
||||||
|
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||||
|
<ul class="nav nav-tabs tab-col-teal" role="tablist">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link " data-toggle="tab" href="#pending_order" role="tab">Pending</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div id="custom-slimscroll">
|
||||||
|
<div class="tab-content m-t-15">
|
||||||
|
<div class="tab-pane active" id="completed" role="tabpanel">
|
||||||
|
<div class="card-columns">
|
||||||
|
<% @completed.each do |sale| %>
|
||||||
|
<div class="card completed bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane " id="pending_order" role="tabpanel">
|
||||||
|
<div class="card-columns">
|
||||||
|
<% @sales.each do |sale| %>
|
||||||
|
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% @orders.each do |order| %>
|
||||||
|
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Column One -->
|
||||||
|
|
||||||
|
<!-- Column Two -->
|
||||||
|
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||||
|
<div class="card" >
|
||||||
|
<div class="card-header">
|
||||||
|
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
|
||||||
|
</div>
|
||||||
|
<div class="card-block">
|
||||||
|
<div class="card-title row p-l-5 p-r-5">
|
||||||
|
|
||||||
|
<% if @status == 'sale' %>
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
Receipt No: <span id="receipt_no">
|
||||||
|
<%= @sale.receipt_no rescue '' %></span>
|
||||||
|
</div>
|
||||||
|
<% else%>
|
||||||
|
<input type="hidden" id="save_order_id" value="<%=@bookings.booking_orders[0].order_id%>">
|
||||||
|
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||||
|
Order No: <span id="receipt_no">
|
||||||
|
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
|
||||||
|
</div>
|
||||||
|
<% end%>
|
||||||
|
|
||||||
|
|
||||||
|
<% if @status == 'sale' %>
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
|
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> </span>
|
||||||
|
</div>
|
||||||
|
<% else%>
|
||||||
|
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
|
||||||
|
Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> </span>
|
||||||
|
</div>
|
||||||
|
<% end%>
|
||||||
|
</div>
|
||||||
|
<div class="card-title row customer_detail p-l-5 p-r-5">
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<% if @status == 'sale' %>
|
||||||
|
Customer : <%= @sale.customer.name rescue "-" %>
|
||||||
|
<% else%>
|
||||||
|
Customer : <%= @order.customer.name rescue "-" %>
|
||||||
|
<% end%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="order-detail-slimscroll" data-height="160">
|
||||||
|
<div class="card-text" style="">
|
||||||
|
<table class="table table-striped" id="order-items-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="item-name">Items</th>
|
||||||
|
<th class="item-attr">QTY</th>
|
||||||
|
<th class="item-attr">Price</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% if @status == 'sale' %>
|
||||||
|
<% sub_total = 0
|
||||||
|
@sale.sale_items.each do |sale_item|
|
||||||
|
sub_total = sub_total + sale_item.price %>
|
||||||
|
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
||||||
|
<tr>
|
||||||
|
<td class='item-name'><%= sale_item.product_name %></td>
|
||||||
|
<td class='item-attr'><%= sale_item.qty %></td>
|
||||||
|
<td class='item-attr'><%= sale_item.price %></td>
|
||||||
|
</tr>
|
||||||
|
<% end%>
|
||||||
|
<% else%>
|
||||||
|
<% sub_total = 0
|
||||||
|
total = 0
|
||||||
|
@order_items.each do |order_item|
|
||||||
|
total = order_item.qty * order_item.price
|
||||||
|
sub_total = sub_total + total %>
|
||||||
|
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
|
||||||
|
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
||||||
|
<td class='item-name'><%= order_item.item_name %></td>
|
||||||
|
<td class='item-attr'><%= order_item.qty %></td>
|
||||||
|
<td class='item-attr'><%= total %></td>
|
||||||
|
</tr>
|
||||||
|
<% end%>
|
||||||
|
<% end%>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<table class="table" id="order-charges-table" border="0">
|
||||||
|
<% if @status == 'sale' %>
|
||||||
|
<tr>
|
||||||
|
<%if @sale.discount_type == 'member_discount'%>
|
||||||
|
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||||
|
<%else%>
|
||||||
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
|
<%end%>
|
||||||
|
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rebate_amount"></tr>
|
||||||
|
<% else%>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||||
|
</tr>
|
||||||
|
<% end%>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Column Three -->
|
||||||
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
|
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||||
|
<button type="button" id="reprint" class="btn bg-blue btn-block">Reprint</button>
|
||||||
|
<% if current_user.role != "waiter" %>
|
||||||
|
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var cashier_type = "quick_service";
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".sales").on('click',function(){
|
||||||
|
var sale_id = $(this).attr("data-id");
|
||||||
|
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
|
||||||
|
})
|
||||||
|
$(".completed").on('click',function(){
|
||||||
|
var sale_id = $(this).attr("data-id");
|
||||||
|
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
|
||||||
|
})
|
||||||
|
$('#reprint').on('click', function () {
|
||||||
|
var sale_id = $('#sale_id').val();
|
||||||
|
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||||
|
|
||||||
|
});
|
||||||
|
$('#back').on('click', function () {
|
||||||
|
window.location.href = '/origami/quick_service/pending_order';
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#close_cashier').on('click',function(e){
|
||||||
|
e.preventDefault(); // Prevent the href from redirecting directly
|
||||||
|
var linkURL = '/origami/shift/quick_service/close';
|
||||||
|
warnBeforeRedirect(linkURL);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -2,31 +2,50 @@
|
|||||||
<div class="row clearfix">
|
<div class="row clearfix">
|
||||||
<!-- Column One -->
|
<!-- Column One -->
|
||||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||||
<div class="card">
|
<!-- Nav tabs -->
|
||||||
<div class="card-header">
|
<ul class="nav nav-tabs tab-col-teal" role="tablist">
|
||||||
<strong id="order-title"> PENDING ORDER </strong>
|
<li class="nav-item">
|
||||||
</div>
|
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
|
||||||
<div class="card-block">
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="tab" href="#pending_order" role="tab">Pending</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!-- Nav tabs - End -->
|
||||||
<div id="custom-slimscroll">
|
<div id="custom-slimscroll">
|
||||||
<div class="card-columns">
|
<div class="tab-content m-t-15">
|
||||||
<% @sale.each do |sale| %>
|
<div class="tab-pane" id="completed" role="tabpanel">
|
||||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
<div class="card-columns">
|
||||||
<div class="card-block">
|
<% @completed.each do |sale| %>
|
||||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
<div class="card completed bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
</div>
|
<div class="card-block">
|
||||||
</div>
|
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||||
<% end %>
|
</div>
|
||||||
<% @order.each do |order| %>
|
</div>
|
||||||
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
<% end %>
|
||||||
<div class="card-block">
|
</div>
|
||||||
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
</div>
|
||||||
</div>
|
|
||||||
|
<div class="tab-pane active" id="pending_order" role="tabpanel">
|
||||||
|
<div class="card-columns">
|
||||||
|
<% @sale.each do |sale| %>
|
||||||
|
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
</div>
|
||||||
</div>
|
<% end %>
|
||||||
|
<% @order.each do |order| %>
|
||||||
|
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Column Three -->
|
<!-- Column Three -->
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
@@ -46,6 +65,10 @@
|
|||||||
var sale_id = $(this).attr("data-id");
|
var sale_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
|
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
|
||||||
})
|
})
|
||||||
|
$(".completed").on('click',function(){
|
||||||
|
var sale_id = $(this).attr("data-id");
|
||||||
|
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
|
||||||
|
})
|
||||||
$('#pay').on('click', function () {
|
$('#pay').on('click', function () {
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
|
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
|
||||||
|
|||||||
@@ -1,154 +1,171 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- Column One -->
|
<!-- Column One -->
|
||||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||||
<div class="card">
|
<ul class="nav nav-tabs tab-col-teal" role="tablist">
|
||||||
<div class="card-header">
|
<li class="nav-item">
|
||||||
<strong id="order-title"> PENDING ORDER </strong>
|
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
|
||||||
</div>
|
</li>
|
||||||
<div class="card-block">
|
<li class="nav-item">
|
||||||
<div id="custom-slimscroll">
|
<a class="nav-link active" data-toggle="tab" href="#pending_order" role="tab">Pending</a>
|
||||||
<div class="card-columns">
|
</li>
|
||||||
<% @sales.each do |sale| %>
|
</ul>
|
||||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
<div id="custom-slimscroll">
|
||||||
<div class="card-block">
|
<div class="tab-content m-t-15">
|
||||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
<div class="tab-pane" id="completed" role="tabpanel">
|
||||||
</div>
|
<div class="card-columns">
|
||||||
|
<% @completed.each do |sale| %>
|
||||||
|
<div class="card completed bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
</div>
|
||||||
<% @orders.each do |order| %>
|
|
||||||
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
<div class="tab-pane active" id="pending_order" role="tabpanel">
|
||||||
<div class="card-block">
|
<div class="card-columns">
|
||||||
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
<% @sales.each do |sale| %>
|
||||||
</div>
|
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% @orders.each do |order| %>
|
||||||
|
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!-- Column One -->
|
||||||
</div>
|
|
||||||
<!-- Column One -->
|
|
||||||
|
|
||||||
<!-- Column Two -->
|
<!-- Column Two -->
|
||||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||||
<div class="card" >
|
<div class="card" >
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
|
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
|
||||||
</div>
|
|
||||||
<div class="card-block">
|
|
||||||
<div class="card-title row p-l-5 p-r-5">
|
|
||||||
|
|
||||||
<% if @status == 'sale' %>
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
|
||||||
Receipt No: <span id="receipt_no">
|
|
||||||
<%= @sale.receipt_no rescue '' %></span>
|
|
||||||
</div>
|
|
||||||
<% else%>
|
|
||||||
<input type="hidden" id="save_order_id" value="<%=@bookings.booking_orders[0].order_id%>">
|
|
||||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
|
||||||
Order No: <span id="receipt_no">
|
|
||||||
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
|
|
||||||
</div>
|
|
||||||
<% end%>
|
|
||||||
|
|
||||||
|
|
||||||
<% if @status == 'sale' %>
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
|
||||||
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> </span>
|
|
||||||
</div>
|
|
||||||
<% else%>
|
|
||||||
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
|
|
||||||
Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> </span>
|
|
||||||
</div>
|
|
||||||
<% end%>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-title row customer_detail p-l-5 p-r-5">
|
<div class="card-block">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="card-title row p-l-5 p-r-5">
|
||||||
<% if @status == 'sale' %>
|
|
||||||
Customer : <%= @sale.customer.name rescue "-" %>
|
<% if @status == 'sale' %>
|
||||||
<% else%>
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
Customer : <%= @order.customer.name rescue "-" %>
|
Receipt No: <span id="receipt_no">
|
||||||
<% end%>
|
<%= @sale.receipt_no rescue '' %></span>
|
||||||
</div>
|
</div>
|
||||||
|
<% else%>
|
||||||
</div>
|
<input type="hidden" id="save_order_id" value="<%=@bookings.booking_orders[0].order_id%>">
|
||||||
<div id="order-detail-slimscroll" data-height="160">
|
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||||
<div class="card-text" style="">
|
Order No: <span id="receipt_no">
|
||||||
<table class="table table-striped" id="order-items-table">
|
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
|
||||||
<thead>
|
</div>
|
||||||
<tr>
|
<% end%>
|
||||||
<th class="item-name">Items</th>
|
|
||||||
<th class="item-attr">QTY</th>
|
|
||||||
<th class="item-attr">Price</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% if @status == 'sale' %>
|
|
||||||
<% sub_total = 0
|
|
||||||
@sale.sale_items.each do |sale_item|
|
|
||||||
sub_total = sub_total + sale_item.price %>
|
|
||||||
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
|
||||||
<tr>
|
|
||||||
<td class='item-name'><%= sale_item.product_name %></td>
|
|
||||||
<td class='item-attr'><%= sale_item.qty %></td>
|
|
||||||
<td class='item-attr'><%= sale_item.price %></td>
|
|
||||||
</tr>
|
|
||||||
<% end%>
|
|
||||||
<% else%>
|
|
||||||
<% sub_total = 0
|
|
||||||
total = 0
|
|
||||||
@order_items.each do |order_item|
|
|
||||||
total = order_item.qty * order_item.price
|
|
||||||
sub_total = sub_total + total %>
|
|
||||||
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
|
|
||||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
|
||||||
<td class='item-name'><%= order_item.item_name %></td>
|
|
||||||
<td class='item-attr'><%= order_item.qty %></td>
|
|
||||||
<td class='item-attr'><%= total %></td>
|
|
||||||
</tr>
|
|
||||||
<% end%>
|
|
||||||
<% end%>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer">
|
|
||||||
<table class="table" id="order-charges-table" border="0">
|
|
||||||
<% if @status == 'sale' %>
|
<% if @status == 'sale' %>
|
||||||
<tr>
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
<%if @sale.discount_type == 'member_discount'%>
|
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> </span>
|
||||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
</div>
|
||||||
<%else%>
|
|
||||||
<td class="charges-name"><strong>Discount:</strong></td>
|
|
||||||
<%end%>
|
|
||||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="charges-name"><strong>Tax:</strong></td>
|
|
||||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
|
||||||
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
|
||||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="rebate_amount"></tr>
|
|
||||||
<% else%>
|
<% else%>
|
||||||
<tr>
|
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
|
||||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> </span>
|
||||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
</div>
|
||||||
</tr>
|
|
||||||
<% end%>
|
<% end%>
|
||||||
</table>
|
</div>
|
||||||
|
<div class="card-title row customer_detail p-l-5 p-r-5">
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<% if @status == 'sale' %>
|
||||||
|
Customer : <%= @sale.customer.name rescue "-" %>
|
||||||
|
<% else%>
|
||||||
|
Customer : <%= @order.customer.name rescue "-" %>
|
||||||
|
<% end%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="order-detail-slimscroll" data-height="160">
|
||||||
|
<div class="card-text" style="">
|
||||||
|
<table class="table table-striped" id="order-items-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="item-name">Items</th>
|
||||||
|
<th class="item-attr">QTY</th>
|
||||||
|
<th class="item-attr">Price</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% if @status == 'sale' %>
|
||||||
|
<% sub_total = 0
|
||||||
|
@sale.sale_items.each do |sale_item|
|
||||||
|
sub_total = sub_total + sale_item.price %>
|
||||||
|
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
||||||
|
<tr>
|
||||||
|
<td class='item-name'><%= sale_item.product_name %></td>
|
||||||
|
<td class='item-attr'><%= sale_item.qty %></td>
|
||||||
|
<td class='item-attr'><%= sale_item.price %></td>
|
||||||
|
</tr>
|
||||||
|
<% end%>
|
||||||
|
<% else%>
|
||||||
|
<% sub_total = 0
|
||||||
|
total = 0
|
||||||
|
@order_items.each do |order_item|
|
||||||
|
total = order_item.qty * order_item.price
|
||||||
|
sub_total = sub_total + total %>
|
||||||
|
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
|
||||||
|
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
||||||
|
<td class='item-name'><%= order_item.item_name %></td>
|
||||||
|
<td class='item-attr'><%= order_item.qty %></td>
|
||||||
|
<td class='item-attr'><%= total %></td>
|
||||||
|
</tr>
|
||||||
|
<% end%>
|
||||||
|
<% end%>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<table class="table" id="order-charges-table" border="0">
|
||||||
|
<% if @status == 'sale' %>
|
||||||
|
<tr>
|
||||||
|
<%if @sale.discount_type == 'member_discount'%>
|
||||||
|
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||||
|
<%else%>
|
||||||
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
|
<%end%>
|
||||||
|
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rebate_amount"></tr>
|
||||||
|
<% else%>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||||
|
</tr>
|
||||||
|
<% end%>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<!-- Column Three -->
|
<!-- Column Three -->
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||||
@@ -182,6 +199,10 @@ $(document).ready(function(){
|
|||||||
var sale_id = $(this).attr("data-id");
|
var sale_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
|
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
|
||||||
})
|
})
|
||||||
|
$(".completed").on('click',function(){
|
||||||
|
var sale_id = $(this).attr("data-id");
|
||||||
|
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
|
||||||
|
})
|
||||||
$('#pay').on('click', function () {
|
$('#pay').on('click', function () {
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
|
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
|
||||||
|
|||||||
@@ -187,6 +187,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var cashier_type = "<%= @cashier_type %>";
|
var cashier_type = "<%= @cashier_type %>";
|
||||||
|
var access_code = localStorage.getItem("access_code");
|
||||||
// Bill Request
|
// Bill Request
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
@@ -201,7 +202,6 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
var sale_item_id = $(this).attr('data-id');
|
var sale_item_id = $(this).attr('data-id');
|
||||||
var qty = $('#' + sale_item_id + "_qty").val();
|
var qty = $('#' + sale_item_id + "_qty").val();
|
||||||
var price = $('#' + sale_item_id + "_price").val();
|
var price = $('#' + sale_item_id + "_price").val();
|
||||||
console.log(qty + "|" + price);
|
|
||||||
var qty_status = true;
|
var qty_status = true;
|
||||||
var price_status = true;
|
var price_status = true;
|
||||||
if((qty > 0) && (price > 0)){
|
if((qty > 0) && (price > 0)){
|
||||||
@@ -240,7 +240,7 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price,
|
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price+ "&access_code=" + access_code,
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
swal({
|
swal({
|
||||||
title: "Information!",
|
title: "Information!",
|
||||||
@@ -293,7 +293,7 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark,
|
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark+ "&access_code=" + access_code,
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
@@ -306,7 +306,7 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: 'sale_item_id=' + sale_item_id,
|
data: 'sale_item_id=' + sale_item_id + '&access_code=' + access_code,
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,12 +94,15 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
#--------- Cashier ------------#
|
#--------- Cashier ------------#
|
||||||
namespace :origami do
|
namespace :origami do
|
||||||
|
|
||||||
|
post '/check_emp_access_code/:code' => 'home#check_emp_access_code', :defaults => { :format => 'json' }
|
||||||
|
|
||||||
get "dashboard" => "dashboard#index"
|
get "dashboard" => "dashboard#index"
|
||||||
|
|
||||||
get "quick_service" => "quick_service#index"
|
get "quick_service" => "quick_service#index"
|
||||||
|
|
||||||
get "quick_service/pending_order" => "pending_order#index"
|
get "quick_service/pending_order" => "pending_order#index"
|
||||||
get "quick_service/pending_order/:sale_id" => "pending_order#show"
|
get "quick_service/pending_order/:sale_id" => "pending_order#show"
|
||||||
|
get "quick_service/completed_sale/:sale_id" => "pending_order#completed_sale"
|
||||||
|
|
||||||
get "quick_service/modify_order/:id/:sale_id" => "quick_service#modify_order"
|
get "quick_service/modify_order/:id/:sale_id" => "quick_service#modify_order"
|
||||||
get "quick_service/modify_order/:sale_id" => "quick_service#modify_order"
|
get "quick_service/modify_order/:sale_id" => "quick_service#modify_order"
|
||||||
@@ -274,6 +277,9 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
get 'order_reservation/get_order/:id' => "order_reservation#get_order",:as => "get_order", :defaults => { :format => 'json' }
|
get 'order_reservation/get_order/:id' => "order_reservation#get_order",:as => "get_order", :defaults => { :format => 'json' }
|
||||||
post 'order_reservation/update', to: "order_reservation#update" , :defaults => { :format => 'json' }
|
post 'order_reservation/update', to: "order_reservation#update" , :defaults => { :format => 'json' }
|
||||||
post 'order_reservation/send_status', to: "order_reservation#send_status", :defaults => { :format => 'json' }
|
post 'order_reservation/send_status', to: "order_reservation#send_status", :defaults => { :format => 'json' }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#--------- Waiter/Ordering Station ------------#
|
#--------- Waiter/Ordering Station ------------#
|
||||||
|
|||||||
@@ -12,4 +12,16 @@ end
|
|||||||
|
|
||||||
every 1.minutes do
|
every 1.minutes do
|
||||||
runner "DiningFacility.checkin_time"
|
runner "DiningFacility.checkin_time"
|
||||||
|
end
|
||||||
|
|
||||||
|
every 3.minutes do
|
||||||
|
runner "OrderReservation.check_new_order"
|
||||||
|
end
|
||||||
|
|
||||||
|
every 5.minutes do
|
||||||
|
runner "OrderReservation.check_order_send_to_kitchen"
|
||||||
|
end
|
||||||
|
|
||||||
|
every 5.minutes do
|
||||||
|
runner "OrderReservation.check_order_ready_to_delivery"
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user