Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into sqa-1804-001

This commit is contained in:
phyusin
2018-05-04 10:43:36 +06:30
53 changed files with 2071 additions and 1203 deletions

View File

@@ -33,9 +33,25 @@ $(document).on('turbolinks:load', function() {
$(".tables").on("click", function(){
var table_id = $(this).val();
$('#table_id').val(table_id);
oqs_id = $("#oqs_id").val();
active = $(this).hasClass('selected-table');
if (active) {
$(this).removeClass('bg-blue');
$(this).addClass('green');
$(this).removeClass('selected-table');
}else{
$(this).removeClass('green');
$(this).addClass('bg-blue');
$(this).addClass('selected-table');
}
var list = document.getElementsByClassName('selected-table');
var i;
var table_id =[];
for (i = 0; i < list.length; i++) {
table_id.push(list[i].value);
}
$('#table_id').val(table_id);
oqs_id = $("#oqs_id").val();
if (table_id){
var table = table_id
}else{

View File

@@ -834,7 +834,6 @@ $(function() {
option_name = ' ';
data_option = '[]';
}
console.log(d_option)
var rowCount = $('.summary-items tbody tr').length+1;
var item_row = $('.summary-items tbody tr');
@@ -842,7 +841,7 @@ console.log(d_option)
item_code = $(item_row[i]).attr('data-code');
instance_code = $(item_row[i]).attr('data-instance-code');
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 (qty > 1) {
qty = parseInt($(item_row[i]).children('#item_qty').text()) + qty;

View 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();
}
});
}
}
});

View File

@@ -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();
}
});
}
}
});

View File

@@ -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();
}
});
}
}
});

View File

@@ -1,6 +1,4 @@
App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel', {
connected: function() {},
disconnected: function() {},
@@ -9,27 +7,28 @@ App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
var order = data.data;
if(order.length > 0){
$('.order_reserve_cable tbody').html("");
$(".nav-item.red > a > p.num").text(order.length);
$.each(order, function(key,value){
var active_class = "";
if(key==0){
active_class = "tr-active";
showNewOrder(order[key]);
}
var rowCount = key+1;
var date = new Date(value.created_at);
var deliveries = value["delivery"];
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');
var created_at = date.getFullYear() +'-'+ (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ date.getDate();
var time = timeFormat(date);
var created_at = date.getFullYear() +'-'+ (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate()>10?date.getDate() : '0'+date.getDate());
var delivery_type = "";
if(deliveries.delivery_type == "service"){
if(value.delivery_type == "service"){
delivery_type = "DELIVERY";
}else if(deliveries.delivery_type == "pick_up"){
}else if(value.delivery_type == "pick_up"){
delivery_type = "PICK-UP";
}else{
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>'
+'<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">'
+'<span class="font-10 col-blue">'+ delivery_type +'</span>'
+'</td>'
+' </tr>'
+' </tr>';
$('.order_reserve_cable tbody').append(row);
$('.custom-table.order_reserve_cable tbody').append(row);
});
}
customTableClick();
}
});

View File

@@ -13,6 +13,16 @@ $(document).ready(function() {
touchScrollStep : 50
});
$('#table-slimscroll').slimScroll({
height: height,
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 50
});
$('#order-detail-slimscroll').slimScroll({
height: height-$('#order-detail-slimscroll').attr('data-height'),
size: '5px',

View File

@@ -1,12 +1,19 @@
$(function() {
$("#discount").hide();
$(".expected_time").hide();
$(function() {
$('.first-1').click();
});
customTableClick();
$(".nav-item").on("click", function(){
type = $(this).attr("data-type");
refreshDetailData();
if (type == "pending") {
$(".first-1").click();
$('#accepted').text("Accepted");
$('#accepted').text("ACCEPT");
$('#accepted').attr("data-value","accepted");
}else if(type == "processing"){
$(".second-1").click();
@@ -24,152 +31,19 @@ $(function() {
// 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(){
var requested_time = $("#requested_date_time").text();
$("#requested_order_time").text(requested_time);
showTimePicker(requested_time);
$("#waiting_timeModal").modal({show : true, backdrop: false, keyboard : false});
if($(this).text().trim() == "ACCEPT"){
var requested_time = $("#requested_date_time").text();
$("#requested_order_time").text(requested_time);
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(){
@@ -180,78 +54,6 @@ $(function() {
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(){
$("#waiting_timeErr").text("");
var status = $("#status").text();
@@ -271,7 +73,231 @@ $(function() {
$("#waiting_time").val("");
$("#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
});
}
}

View File

@@ -192,6 +192,41 @@ $(document).on('turbolinks:load', function() {
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: */
@@ -361,6 +396,7 @@ function resCardSaleTrans(card_sale_trans_id,cmd_type,payment_type, bnk_bill_amo
function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amount,sale_id,receipt_no,com_port,cashier_type) {
$("#loading_wrapper").hide();
var jobj = $.parseJSON(resMsg);
$("#reference_no").val(jobj.REFNUM);
if(jobj.STATUS == "Approved"){
$.ajax({type: "POST",
url: "/origami/payment/"+payment_type,
@@ -423,3 +459,8 @@ function showHideNavbar(webview,page){
}
}
}
function createAccessCode(code) {
localStorage.setItem("access_code",code);
}

View File

@@ -87,7 +87,7 @@ select.form-control {
}
.green{
background-color: #009900;
background-color: #009900 !important;
}
.left{
margin-left:1px;
@@ -104,4 +104,20 @@ select.form-control {
i.logout_icon{
position: relative;
top: 5px;
}
.table-block{
padding: 24px 8px 0 0;
}
.label-align{
padding-left: 10px;
}
.table-float{
float: left;
}
.table-width{
width: 100%;
}

View File

@@ -93,6 +93,19 @@ select.form-control {
// 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{
opacity:0.6,
}

View 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

View 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

View 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

View File

@@ -59,9 +59,8 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
order_reservation = params
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
order_reservation = OrderReservation.get_pending_orders #find(order_reservation_id)
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
end

View File

@@ -5,7 +5,6 @@ class BaseOrigamiController < ActionController::Base
before_action :check_user
#before_action :check_installation
protect_from_forgery with: :exception
helper_method :shop_detail, :current_token
@@ -23,6 +22,10 @@ class BaseOrigamiController < ActionController::Base
}.to_json
end
else
if ENV["SERVER_MODE"] != 'cloud'
protect_from_forgery with: :exception
end
if current_user.nil?
redirect_to root_path
end

View File

@@ -39,7 +39,7 @@ class Crm::CustomersController < BaseCrmController
@membership_types = Lookup.collection_of("member_group_type")
@taxes = TaxProfile.all.order("order_by asc")
@taxes = TaxProfile.where(:group_type => 'cashier')
@filter = filter

View File

@@ -89,6 +89,7 @@ class Oqs::HomeController < BaseOqsController
# Query for OQS with delivery status
def queue_items_query(status)
byebug
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type as type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id

View File

@@ -5,7 +5,8 @@ class Oqs::HomeController < BaseOqsController
# @queue_items_details = queue_items_query(false)
# Query for OQS with delivery status true
@tables = DiningFacility.all.active.order('status desc')
# @tables = DiningFacility.all.active.order('status desc')
@tables = DiningFacility.where(:type => 'Table').order('status desc')
@rooms = Room.all.active.order('status desc')
@filter = params[:filter]
@@ -161,9 +162,9 @@ class Oqs::HomeController < BaseOqsController
oqs = "and assigned_order_items.order_queue_station_id = '#{oqs_id}' "
end
if table_id.to_i>0
table = "and df.id = '#{table_id}' "
if !table_id.empty?
tableId = table_id.to_a.map{|h| h}.join(",")
table = "and df.id IN (#{tableId})"
else
table = ''
end

View File

@@ -86,7 +86,7 @@ class Origami::CustomersController < BaseOrigamiController
@crm_customer = Customer.new
@count_customer = Customer.count_customer
@taxes = TaxProfile.all.order("order_by asc")
@taxes = TaxProfile.where(:group_type => 'cashier')
# if flash["errors"]
# @crm_customer.valid?
# end

View File

@@ -129,6 +129,18 @@ class Origami::HomeController < BaseOrigamiController
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
def set_dining

View File

@@ -3,6 +3,8 @@ class Origami::MoveroomController < BaseOrigamiController
authorize_resource :class => false
def move_dining
@webview = check_mobile
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@complete = Sale.all

View File

@@ -3,6 +3,8 @@ class Origami::MovetableController < BaseOrigamiController
authorize_resource :class => false
def move_dining
@webview = check_mobile
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@complete = Sale.all

View File

@@ -446,8 +446,7 @@ class Origami::PaymentsController < BaseOrigamiController
end
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.process_payment(saleObj, current_user.name, cash, "foc" ,remark)
# For Cashier by Zone

View File

@@ -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'))
@sale = Sale.pending_sale
@order = Sale.pending_order
@completed = Sale.completed_sale
end
def show
@sales = Sale.pending_sale
@orders = Sale.pending_order
@completed = Sale.completed_sale
@id = params[:sale_id]
if(@id[0,3] == "SAL")
@sale = Sale.find(@id)
@@ -41,4 +42,27 @@ class Origami::PendingOrderController < BaseOrigamiController
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

View File

@@ -17,6 +17,7 @@ class Origami::SaleEditController < BaseOrigamiController
def item_void
saleitemId = params[:sale_item_id]
remark = params[:remark]
access_code = params[:access_code]
saleitemObj = SaleItem.find(saleitemId)
saleitemObj.status = 'void'
saleitemObj.remark = remark
@@ -48,8 +49,9 @@ class Origami::SaleEditController < BaseOrigamiController
end
end
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}"
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)
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
@@ -58,6 +60,7 @@ class Origami::SaleEditController < BaseOrigamiController
def item_foc
saleitemId = params[:sale_item_id]
remark = params[:remark]
access_code = params[:access_code]
saleitemObj = SaleItem.find(saleitemId)
saleitemObj.status = 'foc'
saleitemObj.remark = remark
@@ -80,8 +83,9 @@ class Origami::SaleEditController < BaseOrigamiController
order = Order.find(order_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}"
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)
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
@@ -111,6 +115,7 @@ class Origami::SaleEditController < BaseOrigamiController
saleitemId = params[:sale_item_id]
update_qty = params[:update_qty]
update_price = params[:update_price]
access_code = params[:access_code]
saleitemObj = SaleItem.find(saleitemId)
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
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}"
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'
unless saleitemObj.product_name.include? 'updated'
@@ -152,6 +158,7 @@ class Origami::SaleEditController < BaseOrigamiController
# make cancel void item
def item_void_cancel
saleitemId = params[:sale_item_id]
access_code = params[:access_code]
saleitemObj = SaleItem.find(saleitemId)
both = SaleItem.where('product_code=?', saleitemObj.product_code)
both.each do |item|
@@ -169,8 +176,9 @@ class Origami::SaleEditController < BaseOrigamiController
order = Order.find(order_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}"
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)
ProductCommission.remove_product_commission(saleitemObj)

View File

@@ -5,6 +5,7 @@ class Origami::VoidController < BaseOrigamiController
sale_id = params[:sale_id]
remark = params[:remark]
order_source = params[:type] #tax profile source
access_code = params[:access_code]
if Sale.exists?(sale_id)
sale = Sale.find_by_sale_id(sale_id)
@@ -71,8 +72,9 @@ class Origami::VoidController < BaseOrigamiController
# FOr Sale Audit
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}"
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

View File

@@ -3,7 +3,8 @@ class Origami::WasteSpoileController < BaseOrigamiController
sale_id = params[:sale_id]
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)
sale = Sale.find_by_sale_id(sale_id)
SaleTax.where("sale_id='#{sale_id}'").find_each do |existing_tax|
@@ -54,8 +55,9 @@ class Origami::WasteSpoileController < BaseOrigamiController
# FOr Sale Audit
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}"
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

View File

@@ -126,6 +126,7 @@ class Ability
# can :overall_void, :void
can :index, :home
can :show, :home
can :check_emp_access_code, :home
can :read, Order
can :update, Order
can :manage, Booking
@@ -151,6 +152,7 @@ class Ability
can :create, :payment
can :reprint, :payment
can :rounding_adj, :payment
can :foc, :payment
can :print, :payment
can :move_dining, :movetable
@@ -183,6 +185,16 @@ class Ability
can :print, :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"

View File

@@ -45,16 +45,21 @@ class MenuCategory < ApplicationRecord
from_t = Time.parse(menu.valid_time_from.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"))
from = from_t.hour * 3600 + from_t.min*60 + from_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
if from > to
h = to_t.hour
if h < 12 # before noon
if h == 0
to = 24
to = to * 3600 + to_t.min* 60 + to_t.sec
else
h += 24
to = h*3600 + to_t.min* 60 + to_t.sec
end
else # (after) noon
if h > 12
@@ -64,13 +69,9 @@ class MenuCategory < ApplicationRecord
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
dayresult = menu.valid_days.include?(day.to_s)
if current.between?(from, to) && menu.valid_days.include?(day.to_s)
return true
else

View File

@@ -201,12 +201,41 @@ class OrderReservation < ApplicationRecord
end
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")
.where("order_reservations.status='new'")
.order("order_reservations.order_reservation_id desc, order_reservations.created_at desc")
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
def generate_custom_id
self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "ODRS")

View File

@@ -1139,8 +1139,14 @@ def self.get_wastes_and_spoilages(from,to,status)
else
type = "and sales.sale_status = 'waste'"
end
query = Sale.all.where("sales.receipt_date between ? and ? #{type}",from,to)
.group("sales.receipt_no")
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" +
" JOIN menu_item_instances ON sale_items.item_instance_code = menu_item_instances.item_instance_code" +
" JOIN menu_items ON menu_item_instances.menu_item_id = menu_items.id" +
" JOIN menu_categories ON menu_items.menu_category_id = menu_categories.id")
.where("sales.receipt_date between ? and ? #{type}",from,to)
.group("sales.receipt_no,menu_categories.id,sale_items.item_instance_code")
.order("sales.sale_id,menu_categories.name,sale_items.product_name")
end
# def self.get_separate_tax(from,to,payment_method=nil)
@@ -2604,6 +2610,13 @@ end
query = query.where("bookings.booking_status = 'assign' AND orders.status = 'new' AND orders.source =? ","quick_service")
.group("bookings.booking_id")
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
query = Sale.select("sale_payments.created_at as receipt_close_time,

View File

@@ -206,7 +206,7 @@ class ReceiptBillPdf < Prawn::Document
total_price = item.price #item.qty*item.unit_price - comment for room charges
price = item.unit_price
product_name = item.product_name
total_qty += item.qty
y_position = cursor

View File

@@ -1,9 +1,10 @@
<!-- Column One -->
<div class="row clearfix" style="">
<div class="col-lg-11 col-md-11 col-sm-11">
<div class="col-lg-8 col-md-8 col-sm-8">
<div class="body p-l-10">
<div class="row clearfix">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
<div class="form-group col-lg-2 col-md-2 col-sm-2">
<label class="label-align">Select Station</label>
<span class="hidden" id="oqs_active"></span>
<select class="form-control select oqs_click" name="oqs_id" id="oqs_id">
<option value="0" data-id="0">Processed</option>
@@ -15,16 +16,6 @@
<% end %>
</select>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
<span class="hidden" id="table_id"></span>
<select class="form-control select tables" name="table_id" id="tables">
<option value="">Select Table</option>
<% @tables.each do |table| %>
<option value="<%= table.id %>" data-id="<%= table.id %>"> <%= table.name %></option>
<% end %>
</select>
</div>
<!--
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
<span class="hidden" id="room_id"></span>
@@ -44,67 +35,64 @@
<div class="card">
<div class="card-block">
<div class="tab-content" id="custom-slimscroll" style="">
<div class="tab-pane in active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;column-count: ;">
<%
@queue_completed_item.each do |qid|
%>
<div class="card queue_station" data-order-no="<%= qid.order_id %>">
<div class="card-block">
<div class="row">
<%if qid.type.present?%>
<span class="col-md-4 order-zone-type font-13"><%= qid.type %>-<%= qid.zone %></span>
<%else%>
<span class="col-md-4 order-zone-type font-13"></span>
<%end%>
<div class="tab-pane in active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;column-count: ;">
<%
@queue_completed_item.each do |qid|
%>
<div class="card queue_station" data-order-no="<%= qid.order_id %>">
<div class="card-block">
<div class="row">
<%if qid.type.present?%>
<span class="col-md-4 order-zone-type font-13"><%= qid.type %>-<%= qid.zone %></span>
<%else%>
<span class="col-md-4 order-zone-type font-13"></span>
<%end%>
<span class="order-zone hidden font-13"><%= qid.zone %></span>
<span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span>
</div>
<p class="m-b--10">
<span class="order-item font-16">
<%= qid.item_name %>
</span> [x
<span class="order-qty">
<%= qid.qty %>
</span> ]
<% if !qid.set_menu_items.nil? %>
<% qid.set_menu_items.each do |item_instance|%>
<br><span class="font-12">
<%= item_instance %>
<span class="order-zone hidden font-13"><%= qid.zone %></span>
<span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span>
</div>
<p class="m-b--10">
<span class="order-item font-16">
<%= qid.item_name %>
</span> [x
<span class="order-qty">
<%= qid.qty %>
</span> ]
<% if !qid.set_menu_items.nil? %>
<% qid.set_menu_items.each do |item_instance|%>
<br><span class="font-12">
<%= item_instance %>
</span>
<% end %>
<% end %>
</p>
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<span class="card-text">
<span class="text-muted">Order at -
<span class="order-at font-13">
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> <br>
Order By - <span class="order-by font-13">
<%= qid.item_order_by %>
</span>
</span>
<% end %>
<% end %>
</p>
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<span class="card-text">
<span class="text-muted">Order at -
<span class="order-at font-13">
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> <br>
Order By - <span class="order-by font-13">
<%= qid.item_order_by %>
</span>
</span>
</span>
<p class="hidden order-status">completed</p>
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
</div>
<% end %>
</div>
</div>
<div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;">
</span>
<p class="hidden order-status">completed</p>
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
</div>
<% end %>
</div>
</div>
<div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;">
</div>
</div>
</div>
</div>
</div>
<!-- Column Two -->
@@ -151,6 +139,35 @@
</div>
-->
<!-- Column Three -->
<div class="col-lg-3 col-md-3 col-sm-3 table-block">
<p class="hidden filter"><%= @filter %></p>
<div class="card">
<div class="card-block">
<div class="tab-content" id="table-slimscroll" style="">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#table" id="defaultOpen">Table</a></li>
<li><a data-toggle="tab" href="#room">Room</a></li>
</ul>
<div class="tab-content">
<div id="table" class="tab-pane fade">
<% @tables.each do |table| %>
<div class="col-lg-4 col-md-4 col-sm-4 table-float">
<button class='btn btn-lg waves-effect green tables table-width' value="<%= table.id %>" data-id="<%= table.id %>"> <%= table.name %></button>
</div>
<% end %>
</div>
<div id="room" class="tab-pane fade">
<% @rooms.each do |room| %>
<div class="col-lg-4 col-md-4 col-sm-4 table-float">
<button class='btn btn-lg waves-effect green tables table-width' value="<%= room.id %>" data-id="<%= room.id %>"> <%= room.name %></button>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- OQS Buttons -->
<br>
@@ -168,4 +185,6 @@
window.location.href = '/dashboard';
});
});
document.getElementById("defaultOpen").click();
</script>

977
app/views/origami/addorders/detail.html.erb Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -204,8 +204,7 @@
var bank_integration = "<%= @bank_integration %>";
var cashier_type = "<%= @cashier_type %>";
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card
// var sub_total = $('#sub-total').text();
@@ -244,15 +243,12 @@
});
}
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
}else{
$("#reference_no_Err").html("can't be blank");
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
})
</script>

View File

@@ -485,8 +485,10 @@
<% end %>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
<% 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" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</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> -->
<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 %>
<% 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>
@@ -579,26 +581,35 @@
</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-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;">&times;</button>
</div>
<div class="modal-body">
<div class="row p-r-20">
<div class="col-md-3">
<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>
<div class="col-md-3">
<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>
<div class="col-md-3">
<button type="button" class="btn btn-lg bg-blue waves-effect" data-dismiss="modal"><strong>CLOSE</strong></button>
</div>
</div>
</div>
<div class="modal-footer ">
<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>
@@ -957,6 +968,7 @@
});
$('#void').on('click', function () {
var access_code = localStorage.getItem("access_code");
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
@@ -975,7 +987,7 @@
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
@@ -1052,6 +1064,12 @@
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) {
swal({
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>

View File

@@ -200,8 +200,7 @@ $('#jcb_pay').on('click',function(){
var receipt_no = "<%= @receipt_no %>";
var bank_integration = "<%= @bank_integration %>";
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card
// var sub_total = $('#sub-total').text();
@@ -247,8 +246,5 @@ $('#jcb_pay').on('click',function(){
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
}else{
$("#reference_no_Err").html("can't be blank");
}
})
</script>

View File

@@ -198,7 +198,6 @@
var receipt_no = "<%= @receipt_no %>";
var bank_integration = "<%= @bank_integration %>";
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
@@ -245,8 +244,5 @@
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
}else{
$("#reference_no_Err").html("can't be blank");
}
})
</script>

View File

@@ -166,6 +166,10 @@
</div>
<script>
$(document).ready(function(){
/* check webview loaded*/
var webview = <%= @webview %>;
showHideNavbar(webview);
$(".tables").on('click', function(){
$('.tables').removeClass('selected-item');
$(this).addClass('selected-item');

View File

@@ -284,6 +284,10 @@ end
</div>
<script>
$(document).ready(function(){
/* check webview loaded*/
var webview = <%= @webview %>;
showHideNavbar(webview);
$(".tables").on('click', function(){
$('.tables').removeClass('selected-item');
$(this).addClass('selected-item');

View File

@@ -204,9 +204,8 @@
var bank_integration = "<%= @bank_integration %>";
var cashier_type = "<%= @cashier_type %>";
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card
// var sub_total = $('#sub-total').text();
// var member_id = $('#membership_id').text();
@@ -244,15 +243,12 @@
});
}
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
}else{
$("#reference_no_Err").html("can't be blank");
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
})
</script>

View File

@@ -60,7 +60,7 @@
<%=i%>
</td>
<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 width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
@@ -197,7 +197,6 @@
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">
<%= order.delivery.to_json %>
<% if order.delivery.delivery_type == 'service' %>
DELIVERY
<% elsif order.delivery.delivery_type == 'pick_up' %>
@@ -351,7 +350,7 @@
<b id="phone"></b>
</td>
<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>
</td>
</tr>
@@ -410,11 +409,6 @@
</div>
</div>
<script type="text/javascript">
$(function(){
$("#discount").hide();
$(".expected_time").hide();
$('.first-1').click();
});
</script>
<div id="notify_new_order"></div>
<div id="notify_order_send_to_kitchen"></div>
<div id="notify_order_ready_to_delivery"></div>

View File

@@ -350,16 +350,20 @@
<i class="material-icons">reply</i>
Back
</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 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>
<% if @cashier_type=="quick_service" %>
<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> -->
<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>
<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" 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="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<!-- Waiter Buttons -->
@@ -487,7 +491,40 @@
<div class="modal-footer"></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;">&times;</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-Content">
@@ -730,44 +767,7 @@ var customer_name = "<%= @customer.name %>";
// 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
@@ -940,59 +940,6 @@ var customer_name = "<%= @customer.name %>";
$('#balance').text(parseFloat(result));
<% 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) {
$.ajax({
type: "POST",
@@ -1220,28 +1167,157 @@ var customer_name = "<%= @customer.name %>";
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();
console.log(sale_id)
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,
success: function (result) {
console.log(result)
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+ "&access_code=" + access_code,
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';
}
}
})
}
});
});
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
if ($("#server_mode").val() == "cloud") {
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if (cashier_type=="cashier") {
@@ -1251,8 +1327,8 @@ var customer_name = "<%= @customer.name %>";
customer_display_view(null,"reload");
}
}
});
}
});
}
});
}
});
}
</script>

View 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">
&nbsp; 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">
&nbsp; 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 '-'%> &nbsp; </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 '-'%> &nbsp; </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' %>
&nbsp; Customer : <%= @sale.customer.name rescue "-" %>
<% else%>
&nbsp; 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>

View File

@@ -2,31 +2,50 @@
<div class="row clearfix">
<!-- Column One -->
<div class="col-lg-10 col-md-10 col-sm-10">
<div class="card">
<div class="card-header">
<strong id="order-title"> PENDING ORDER </strong>
</div>
<div class="card-block">
<!-- Nav tabs -->
<ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
</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 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 %>
<% @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 class="tab-content m-t-15">
<div class="tab-pane" 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 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>
<% 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>
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
@@ -46,6 +65,10 @@
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;
})
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";

View File

@@ -1,154 +1,171 @@
<div class="container-fluid">
<div class="row">
<!-- Column One -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card">
<div class="card-header">
<strong id="order-title"> PENDING ORDER </strong>
</div>
<div class="card-block">
<div id="custom-slimscroll">
<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 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" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
</li>
<li class="nav-item">
<a class="nav-link active" 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" 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>
<% 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>
<div class="tab-pane active" 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>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Column One -->
<!-- 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">
&nbsp; 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">
&nbsp; 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 '-'%> &nbsp; </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 '-'%> &nbsp; </span>
</div>
<% end%>
<!-- 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-title row customer_detail p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status == 'sale' %>
&nbsp; Customer : <%= @sale.customer.name rescue "-" %>
<% else%>
&nbsp; 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">
<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">
&nbsp; 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">
&nbsp; Order No: <span id="receipt_no">
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
</div>
<% end%>
<% 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>
<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 '-'%> &nbsp; </span>
</div>
<% 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>
<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 '-'%> &nbsp; </span>
</div>
<% 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' %>
&nbsp; Customer : <%= @sale.customer.name rescue "-" %>
<% else%>
&nbsp; 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>
<!-- 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>
@@ -182,6 +199,10 @@ $(document).ready(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;
})
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";

View File

@@ -187,6 +187,7 @@
</div>
<script>
var cashier_type = "<%= @cashier_type %>";
var access_code = localStorage.getItem("access_code");
// Bill Request
$(document).ready(function () {
@@ -201,7 +202,6 @@ var cashier_type = "<%= @cashier_type %>";
var sale_item_id = $(this).attr('data-id');
var qty = $('#' + sale_item_id + "_qty").val();
var price = $('#' + sale_item_id + "_price").val();
console.log(qty + "|" + price);
var qty_status = true;
var price_status = true;
if((qty > 0) && (price > 0)){
@@ -240,7 +240,7 @@ var cashier_type = "<%= @cashier_type %>";
$.ajax({
type: "POST",
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) {
swal({
title: "Information!",
@@ -293,7 +293,7 @@ var cashier_type = "<%= @cashier_type %>";
$.ajax({
type: "POST",
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) {
location.reload();
}
@@ -306,7 +306,7 @@ var cashier_type = "<%= @cashier_type %>";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id,
data: 'sale_item_id=' + sale_item_id + '&access_code=' + access_code,
success: function (result) {
location.reload();
}

View File

@@ -202,7 +202,6 @@
var receipt_no = "<%= @receipt_no %>";
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card
@@ -250,8 +249,5 @@
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
}else{
$("#reference_no_Err").html("can't be blank");
}
})
</script>

View File

@@ -201,9 +201,8 @@
var receipt_no = "<%= @receipt_no %>";
console.log(amount);
console.log($("#validamount").attr("value"));
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$("#reference_no_Err").html("");
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card
// var sub_total = $('#sub-total').text();
@@ -244,14 +243,11 @@
});
}
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
}else{
$("#reference_no_Err").html("can't be blank");
}
});
</script>

View File

@@ -1,12 +1,12 @@
<div class="container-fluid">
<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.waste_spoilage_report") %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>
</ol>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.waste_spoilage_report") %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>
</ol>
</div>
<div class="row">
<div class="col-md-12">
@@ -20,52 +20,77 @@
<div class="card">
<table class="table table-striped" border="0">
<h5 class="p-l-10 p-t-10">Report For <%= @sale_type? @sale_type : 'Waste' %></h5>
<h5 class="p-l-10 p-t-10">Report For <%= @sale_type? @sale_type : 'Waste' %></h5>
<% receipt_arr = Array.new %>
<% menu_cat_arr = Array.new %>
<% footer_arr = Array.new %>
<% count = 0 %>
<% waste_and_spoil_item_count = 0%>
<% @sale_data.each do |sale| %>
<% waste_and_spoil_item_count = 0%>
<thead>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</td>
<td></td>
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
</tr>
</thead>
<tbody>
<tr>
<td ><strong>Item Name</strong></td>
<td ><strong>Item Code</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
<% sale.sale_items.each do |item| %>
<% if !item.item_instance_code.nil?%>
<% waste_and_spoil_item_count += item.qty.to_i%>
<tr>
<td><%= item.product_name %></td>
<td><%= item.product_code %></td>
<td><%= item.qty %></td>
<td><%= item.price %></td>
<td><%= item.price %></td>
</tr>
<% end %>
<% if !receipt_arr.include?(sale.receipt_no) %>
<thead>
<td>&nbsp;</td>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</td>
<td></td>
<td></td>
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
</tr>
<tr>
<td><strong>Menu Category</strong></td>
<td><strong>Item Name</strong></td>
<td><strong>Item Code</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
</thead>
<% receipt_arr.push(sale.receipt_no) %>
<% menu_cat_arr.clear %>
<% count = 0 %>
<% end %>
<tbody>
<% if !sale.item_instance_code.nil?%>
<% waste_and_spoil_item_count += sale.qty.to_i %>
<tr>
<% if !menu_cat_arr.include?(sale.name) %>
<td><%= sale.name %></td>
<% menu_cat_arr.push(sale.name) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.product_name %></td>
<td><%= sale.product_code %></td>
<td><%= sale.qty.to_i %></td>
<td><%= sale.unit_price %></td>
<td><%= sale.price %></td>
</tr>
<% end %>
<tr>
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td><span class="underline" style="text-align:right">
<strong><%= waste_and_spoil_item_count %></strong>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= sale.grand_total %></strong>
</span>
</td>
</tr>
</tbody>
<% count = count + 1 %>
<% if sale.sale_items.count == count %>
<tr>
<td></td>
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td>
<span class="underline" style="text-align:right">
<strong><%= waste_and_spoil_item_count %></strong>
<% waste_and_spoil_item_count = 0%>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= sale.grand_total %></strong>
</span>
</td>
</tr>
<% footer_arr.push(sale.sale_id) %>
<% end %>
</tbody>
<% end %>
</table>
</div>

View File

@@ -94,12 +94,15 @@ scope "(:locale)", locale: /en|mm/ do
#--------- Cashier ------------#
namespace :origami do
post '/check_emp_access_code/:code' => 'home#check_emp_access_code', :defaults => { :format => 'json' }
get "dashboard" => "dashboard#index"
get "quick_service" => "quick_service#index"
get "quick_service/pending_order" => "pending_order#index"
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/: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' }
post 'order_reservation/update', to: "order_reservation#update" , :defaults => { :format => 'json' }
post 'order_reservation/send_status', to: "order_reservation#send_status", :defaults => { :format => 'json' }
end
#--------- Waiter/Ordering Station ------------#

View File

@@ -12,4 +12,16 @@ end
every 1.minutes do
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