diff --git a/README.md b/README.md
index 43a2091e..0605a14a 100755
--- a/README.md
+++ b/README.md
@@ -188,6 +188,14 @@ Add Base URL for DOEMAL
1) settings/lookups => { type:order_reservation, name: BaseURL, value:'{doemal url}' }
2) settings/lookups => { type:order_reservation, name: Token, value:'{doemal token}' }
+Add Feature for Quick Service
+ ** '0' means can not use quick service and '1' means can use quick service **
+ => settings/lookups => { type:quick_service, name: QuickService, value:'{0 or 1}' }
+
+Add Feature for Order and Reservation
+ ** '0' means can not use order reservation and '1' means can use order reservation **
+ => settings/lookups => { type:order_reservation, name: OrderReservation, value:'{0 or 1}' }
+
* ToDo list
1. Migration
diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js
index 1409c829..5e866699 100755
--- a/app/assets/javascripts/OQS.js
+++ b/app/assets/javascripts/OQS.js
@@ -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{
diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js
index 1044bc6f..0c4363db 100755
--- a/app/assets/javascripts/addorder.js
+++ b/app/assets/javascripts/addorder.js
@@ -101,6 +101,13 @@ $(function() {
var menu_id = $(this).attr("data-id");
var url = "get_menu_category/"+menu_id;
show_menu_item_list(url);
+
+ var sub_id = $(this).attr("data-sub-id");
+ if (sub_id == "true") {
+ var sub_url = "get_menu_sub_category/"+menu_id;
+ sub_category = $(this).find('.sub_category_list');
+ show_sub_category_list(sub_url,sub_category);
+ }
});
//End menu category Click
@@ -457,9 +464,10 @@ $(function() {
var items = $('.selected-set');
if (items.length >= min_qty) {
-
+ if ($('#server_mode').val() != "cloud") {
item = get_set_item(items);
customer_display_view(item,"set_add");
+ }
var option = []
attribute_arr = []
@@ -786,8 +794,10 @@ $(function() {
$('.add_to_order').attr('data-options',JSON.stringify(option_arr));
$('.add_to_order').attr('data-opt',JSON.stringify(option_arr));
var item_data = $(this);
- item = get_item(item_data,"add_to_order");
- customer_display_view(item,"add");
+ if ($('#server_mode').val() != "cloud") {
+ item = get_item(item_data,"add_to_order");
+ customer_display_view(item,"add");
+ }
show_item_detail(item_data,"add_to_order");
calculate_sub_total();
@@ -796,8 +806,10 @@ $(function() {
// click plus icon for add
$(document).on('click', '.add_icon', function(event){
var item_data = $(this);
- item = get_item(item_data,"add_icon");
- customer_display_view(item,"add");
+ if ($('#server_mode').val() != "cloud") {
+ item = get_item(item_data,"add_icon");
+ customer_display_view(item,"add");
+ }
show_item_detail(item_data,"add_icon");
calculate_sub_total();
}); //End Add Icon Click
@@ -822,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');
@@ -830,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;
@@ -922,7 +933,9 @@ console.log(d_option)
window.location.href = "/origami/room/" + table_id
}
}
- customer_display_view(null,"reload");
+ if ($('#server_mode').val() != "cloud") {
+ customer_display_view(null,"reload");
+ }
}
});
// }else{
@@ -1225,7 +1238,7 @@ console.log(d_option)
//click menu sidebar menu category
- $(document).on('click', '.sub_click', function(event){
+ $(document).on('click', '.sub_clickssss', function(event){
event.preventDefault();
var menu_id = $(this).attr("data-id");
var url = "get_menu_sub_category/"+menu_id;
@@ -1260,11 +1273,11 @@ console.log(d_option)
data = data.sub_category;
if (data.length>0) {
- if ((sub_category.hasClass('hidden'))) {
+ // if ((sub_category.hasClass('hidden'))) {
$(sub_category).removeClass('hidden');
- }else{
- $(sub_category).addClass('hidden');
- }
+ // }else{
+ // $(sub_category).addClass('hidden');
+ // }
for(var i in data) {
diff --git a/app/assets/javascripts/channels/check_new_order.js b/app/assets/javascripts/channels/check_new_order.js
new file mode 100644
index 00000000..5bd64013
--- /dev/null
+++ b/app/assets/javascripts/channels/check_new_order.js
@@ -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. "+
+ "Are you accept or reject for these orders "+order_lists+" ?",
+ type: 'success',
+ timer: 1000,
+ closeOnConfirm: false,
+ closeOnCancel: false,
+ allowOutsideClick: false
+ },function(isConfirm){
+ if(isConfirm){
+ swal.close();
+ }
+ });
+ }
+ }
+});
+
diff --git a/app/assets/javascripts/channels/check_order_ready_to_delivery.js b/app/assets/javascripts/channels/check_order_ready_to_delivery.js
new file mode 100644
index 00000000..84dd1982
--- /dev/null
+++ b/app/assets/javascripts/channels/check_order_ready_to_delivery.js
@@ -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. "+
+ "Could you ready these orders "+order_lists+" to deliver?",
+ type: 'success',
+ timer: 1000,
+ closeOnConfirm: false,
+ closeOnCancel: false,
+ allowOutsideClick: false
+ },function(isConfirm){
+ if(isConfirm){
+ swal.close();
+ }
+ });
+ }
+ }
+});
+
diff --git a/app/assets/javascripts/channels/check_order_send_to_kitchen.js b/app/assets/javascripts/channels/check_order_send_to_kitchen.js
new file mode 100644
index 00000000..6727dbdb
--- /dev/null
+++ b/app/assets/javascripts/channels/check_order_send_to_kitchen.js
@@ -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. "+
+ "Could you send these orders "+order_lists+" to kitchen?",
+ type: 'success',
+ timer: 1000,
+ closeOnConfirm: false,
+ closeOnCancel: false,
+ allowOutsideClick: false
+ },function(isConfirm){
+ if(isConfirm){
+ swal.close();
+ }
+ });
+ }
+ }
+});
+
diff --git a/app/assets/javascripts/channels/order_reservation.js b/app/assets/javascripts/channels/order_reservation.js
index 605afe16..68da8d87 100644
--- a/app/assets/javascripts/channels/order_reservation.js
+++ b/app/assets/javascripts/channels/order_reservation.js
@@ -1,38 +1,52 @@
-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() {},
received: function(data) {
var order = data.data;
- var rowCount = $('.order_reserve_cable tbody tr').length+1;
+ 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 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 date = new Date(order.requested_time);
- var requested_time = date.getHours()+ ':' + date.getMinutes()+ '-' + date.getMinutes();
-
- var isPM = date.getHours() >= 12;
- var isMidday = date.getHours() == 12;
- var result = document.querySelector('#result');
- var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
- date.getMinutes() || '00'].join(':') +
- (isPM ? ' PM' : 'AM');
+ var delivery_type = "";
+ if(value.delivery_type == "service"){
+ delivery_type = "DELIVERY";
+ }else if(value.delivery_type == "pick_up"){
+ delivery_type = "PICK-UP";
+ }else{
+ delivery_type = "DIRECT DELIVERY";
+ }
- row = '
'
- +''+rowCount
- +' '
- +''+time
- +' '
- +''+order.grand_total
- +' '
- +''
- +''+ order.status +' '
- +' '
- +' '
-
- $('.order_reserve_cable tbody').append(row);
+ row = ''
+ +''+rowCount
+ +' '
+ +''+created_at
+ +' '
+ +''+time
+ +' '
+ +''+value.grand_total
+ +' '
+ +''
+ +''+ delivery_type +' '
+ +' '
+ +' ';
+
+ $('.custom-table.order_reserve_cable tbody').append(row);
+ });
+ }
+ customTableClick();
}
});
diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js
index 043fbb03..ca1bd0b9 100644
--- a/app/assets/javascripts/custom.js
+++ b/app/assets/javascripts/custom.js
@@ -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',
diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js
index 9b7c3fbb..c60accdf 100644
--- a/app/assets/javascripts/order_reservation.js
+++ b/app/assets/javascripts/order_reservation.js
@@ -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,113 +31,19 @@ $(function() {
// console.log(type);
});
- jQuery(function(){
- jQuery('.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(){
- $("#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");
- $('#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');
- 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 = ''
- +''+items[i].item_name
- +' '+items[i].qty+ ' X '+items[i].unit_price+' '
- +' '
- +''+ total +' '
- +' ';
- $('.summary-items').append(row);
- }
-
- $('#sub_total').text(data.total_amount);
- $('#delivery_fee').text(delivery.delivery_fee);
- $('#total_charges').text(0);
- $('#total_tax').text(data.total_tax);
- $('#grand_total').text(data.grand_total);
-
- var address = delivery.address +', ' +delivery.township+", (" +delivery.direction_address+")"
- $('#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.provider == "direct_delivery"){
- $("#delivery_info").text("(DELIVERY)");
- }else if(delivery.provider == "self_pick_up"){
- $("#delivery_info").text("(PICK-UP)");
- }
-
- 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 status = $(this).attr("data-value");
- var order_id = $('#order_id').text();
- var ref_no = $('#ref_no').text();
- var callback = $('#callback_url').text();
- callback_url(callback,ref_no,order_id,status);
+ 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(){
@@ -141,52 +54,250 @@ $(function() {
callback_url(callback,ref_no,order_id,status);
});
- function callback_url(callback,ref_no,order_id,status){
- var url = 'order_reservation/update';
- var post_url = "order_reservation/send_status";
- $.ajax({
- type: "POST",
- url: post_url,
- data: {url: callback, ref_no: ref_no, status: status},
- dataType: "json",
- success: function(data) {
- if(data.status){
- $.ajax({
- type: "POST",
- url: url,
- data: {'order_id': order_id, 'status': status},
- 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();
+ var order_id = $('#order_id').text();
+ var ref_no = $('#ref_no').text();
+ var callback = $('#callback_url').text();
+ var requested_time = new Date($("#requested_date_time").text());
+ var date_time = requested_time.getFullYear()+'-'+(requested_time.getMonth() > 10? requested_time.getMonth() : '0'+ (requested_time.getMonth() + 1))+'-'+(requested_time.getDate()> 10? requested_time.getDate() : '0' + requested_time.getDate());
+ var waiting_time = new Date(date_time+' '+$("#waiting_time").val());
+ // requested_time.setHours(requested_time.getHours() - 1);
+ // console.log(requested_time);
+ if(waiting_time.getTime() < requested_time.getTime()){
+ var time_diff = (requested_time.getTime() - waiting_time.getTime());
+ var expected_time = (Math.floor(time_diff) / 1000) / 60;
+ callback_url(callback,ref_no,order_id,status,expected_time,waiting_time);
+ }else{
+ $("#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 = ''
+ +''+items[i].item_name
+ +' '+items[i].qty+ ' X '+items[i].unit_price+' '
+ +' '
+ +''+ total +' '
+ +' ';
+ $('.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 " + order_reservation.order_reservation_id + " at "+requested_date+" ",
+ type: 'success',
+ closeOnConfirm: false,
+ closeOnCancel: false,
+ allowOutsideClick: false
+ });
+ }
+}
\ No newline at end of file
diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js
index ca021430..715a9fe1 100755
--- a/app/assets/javascripts/origami.js
+++ b/app/assets/javascripts/origami.js
@@ -361,6 +361,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,
diff --git a/app/assets/stylesheets/OQS.scss b/app/assets/stylesheets/OQS.scss
index 88b00402..6a97bdcb 100755
--- a/app/assets/stylesheets/OQS.scss
+++ b/app/assets/stylesheets/OQS.scss
@@ -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%;
}
\ No newline at end of file
diff --git a/app/assets/stylesheets/order_reservation.scss b/app/assets/stylesheets/order_reservation.scss
index c33e1f32..4a5c591a 100644
--- a/app/assets/stylesheets/order_reservation.scss
+++ b/app/assets/stylesheets/order_reservation.scss
@@ -85,4 +85,10 @@
}
.tr-active{
background-color : #FFCDD2;
+}
+.div_order_margin {
+ margin: 0px 0px 0px -5px !important
+}
+.div_card_order {
+ margin: 0px -5px !important
}
\ No newline at end of file
diff --git a/app/channels/check_new_order_channel.rb b/app/channels/check_new_order_channel.rb
new file mode 100644
index 00000000..8a7dfcfb
--- /dev/null
+++ b/app/channels/check_new_order_channel.rb
@@ -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
diff --git a/app/channels/check_order_ready_to_delivery_channel.rb b/app/channels/check_order_ready_to_delivery_channel.rb
new file mode 100644
index 00000000..6f5e1a06
--- /dev/null
+++ b/app/channels/check_order_ready_to_delivery_channel.rb
@@ -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
diff --git a/app/channels/check_order_send_to_kitchen_channel.rb b/app/channels/check_order_send_to_kitchen_channel.rb
new file mode 100644
index 00000000..c0821483
--- /dev/null
+++ b/app/channels/check_order_send_to_kitchen_channel.rb
@@ -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
diff --git a/app/controllers/api/order_reserve/order_reservation_controller.rb b/app/controllers/api/order_reserve/order_reservation_controller.rb
index 89571a9a..f34c0f6f 100644
--- a/app/controllers/api/order_reserve/order_reservation_controller.rb
+++ b/app/controllers/api/order_reserve/order_reservation_controller.rb
@@ -59,10 +59,11 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
order_reservation = params
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
- order_reservation = OrderReservation.find(order_reservation_id)
- # if ENV["SERVER_MODE"] != 'cloud'
- ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
- # end
+ 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
+
if flag
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
else
diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb
index 3082687b..1d0ad8e4 100755
--- a/app/controllers/crm/customers_controller.rb
+++ b/app/controllers/crm/customers_controller.rb
@@ -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
diff --git a/app/controllers/oqs/backhome_controller.rb b/app/controllers/oqs/backhome_controller.rb
index 4ac5f0a2..f809ef9f 100755
--- a/app/controllers/oqs/backhome_controller.rb
+++ b/app/controllers/oqs/backhome_controller.rb
@@ -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
diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb
index 23d6341e..48e686b6 100755
--- a/app/controllers/oqs/home_controller.rb
+++ b/app/controllers/oqs/home_controller.rb
@@ -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
diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb
index 537703a1..ec559870 100755
--- a/app/controllers/origami/customers_controller.rb
+++ b/app/controllers/origami/customers_controller.rb
@@ -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
diff --git a/app/controllers/origami/dashboard_controller.rb b/app/controllers/origami/dashboard_controller.rb
index f888ac57..8bdd5c27 100644
--- a/app/controllers/origami/dashboard_controller.rb
+++ b/app/controllers/origami/dashboard_controller.rb
@@ -56,6 +56,22 @@ class Origami::DashboardController < BaseOrigamiController
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
@current_user = current_user
+ #quick service
+ quick_service = Lookup.collection_of('quick_service')
+ @quick_service = 0
+ if !quick_service[0].nil?
+ @quick_service = quick_service[0][1]
+ end
+ #order reservation
+ order_reservation = Lookup.collection_of('order_reservation')
+ @order_reservation = 0
+ if !order_reservation.empty?
+ order_reservation.each do |order_reserve|
+ if order_reserve[0] == 'OrderReservation'
+ @order_reservation = order_reserve[1]
+ end
+ end
+ end
end
end
diff --git a/app/controllers/origami/dinga_controller.rb b/app/controllers/origami/dinga_controller.rb
index 586403f9..87caddfa 100644
--- a/app/controllers/origami/dinga_controller.rb
+++ b/app/controllers/origami/dinga_controller.rb
@@ -86,11 +86,12 @@ def create
# saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new
- status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no)
- if status == true
+ status, @sale,@membership_data = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no)
+
+ if status == true && @membership_data["status"] == true
@out = true, "Success!"
else
- @out =false, "Please try again payment!"
+ @out =false, @membership_data["message"]
end
end
end
diff --git a/app/controllers/origami/moveroom_controller.rb b/app/controllers/origami/moveroom_controller.rb
index 316ab894..b7260863 100755
--- a/app/controllers/origami/moveroom_controller.rb
+++ b/app/controllers/origami/moveroom_controller.rb
@@ -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
diff --git a/app/controllers/origami/movetable_controller.rb b/app/controllers/origami/movetable_controller.rb
index bbc02bdc..eaf7fca1 100755
--- a/app/controllers/origami/movetable_controller.rb
+++ b/app/controllers/origami/movetable_controller.rb
@@ -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
diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb
index 562eaaed..12a3ee2f 100644
--- a/app/controllers/origami/order_reservation_controller.rb
+++ b/app/controllers/origami/order_reservation_controller.rb
@@ -1,12 +1,14 @@
class Origami::OrderReservationController < BaseOrigamiController
def index
- @order = OrderReservation.all
+ @order = OrderReservation.latest_order
+ @count_on_order = OrderReservation.get_count_on_order
end
def update
@id = params[:order_id]
- @status = params[:status]
+ @status = params[:status]
+ expected_waiting_time = params[:expected_time]
@order_reservation = OrderReservation.find(@id)
status = true
@@ -25,7 +27,7 @@ class Origami::OrderReservationController < BaseOrigamiController
OrderReservation.update_order_reservation(@id, nil, "cancelled")
result = {:status=> true, :message => "rejected" }
else
- OrderReservation.update_order_reservation(@id, nil, "accepted")
+ OrderReservation.update_order_reservation(@id, nil, "accepted", expected_waiting_time)
result = {:status=> true, :message => "accepted" }
end
end
@@ -50,7 +52,7 @@ class Origami::OrderReservationController < BaseOrigamiController
status = params[:status]
end
- response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status)
+ response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status,params[:waiting_time])
render :json => response
end
diff --git a/app/controllers/origami/paymal_controller.rb b/app/controllers/origami/paymal_controller.rb
index 1321cf87..e9d3cb6c 100644
--- a/app/controllers/origami/paymal_controller.rb
+++ b/app/controllers/origami/paymal_controller.rb
@@ -88,11 +88,11 @@ def create
# saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new
- status, @sale = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no)
- if status == true
+ status, @sale,@membership_data = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no)
+ if status == true && @membership_data["status"] == true
@out = true, "Success!"
else
- @out =false, "Please try again payment!"
+ @out =false, @membership_data["message"]
end
end
end
diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb
index dbd1cbb1..3baed9f3 100755
--- a/app/controllers/origami/payments_controller.rb
+++ b/app/controllers/origami/payments_controller.rb
@@ -6,7 +6,7 @@ class Origami::PaymentsController < BaseOrigamiController
def first_bill
sale_id = params[:sale_id] # sale_id
sale_data = Sale.find_by_sale_id(sale_id)
- sale_items = SaleItem.where("sale_id=?",sale_id)
+ sale_items = SaleItem.unscoped.select("sale_id,product_code,item_instance_code,product_name,product_alt_name,account_id,status,remark,SUM(qty) as qty,SUM(unit_price) as unit_price,SUM(taxable_price) as taxable_price,SUM(price) as price,is_taxable").where("sale_id=?",sale_id).group("item_instance_code,unit_price")
member_info = nil
# For Cashier by Zone
@@ -99,6 +99,7 @@ class Origami::PaymentsController < BaseOrigamiController
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
+ sale_items = SaleItem.unscoped.select("sale_id,product_code,item_instance_code,product_name,product_alt_name,account_id,status,remark,SUM(qty) as qty,SUM(unit_price) as unit_price,SUM(taxable_price) as taxable_price,SUM(price) as price,is_taxable").where("sale_id=?",sale_id).group("item_instance_code,unit_price")
shop_details = Shop.first
# rounding adjustment
if shop_details.is_rounding_adj
@@ -204,7 +205,7 @@ class Origami::PaymentsController < BaseOrigamiController
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
- filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
+ filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
diff --git a/app/controllers/origami/pending_order_controller.rb b/app/controllers/origami/pending_order_controller.rb
index 9a413316..4fa6002b 100644
--- a/app/controllers/origami/pending_order_controller.rb
+++ b/app/controllers/origami/pending_order_controller.rb
@@ -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
diff --git a/app/controllers/reports/order_reservation_controller.rb b/app/controllers/reports/order_reservation_controller.rb
new file mode 100644
index 00000000..fb9517e4
--- /dev/null
+++ b/app/controllers/reports/order_reservation_controller.rb
@@ -0,0 +1,63 @@
+class Reports::OrderReservationController < BaseReportController
+# authorize_resource :class => false
+ def index
+ @payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"], ["Other Payment","card"]]
+
+ from, to = get_date_range_from_params
+
+ @shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
+
+ @shift = ''
+ if params[:shift_name].to_i != 0
+ shift_sale = ShiftSale.find(params[:shift_name])
+ if to.blank?
+ @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
+ else
+
+ @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
+ end
+ end
+ payment_type = params[:payment_type]
+ @sale_data = Sale.get_sales_by_order_reservation(@shift_sale_range,@shift,from,to,payment_type)
+ @from = from
+ @to = to
+ # get printer info
+ @print_settings = PrintSetting.get_precision_delimiter()
+ if @shift.present?
+ @shift.each do |sh|
+ @shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
+ @shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
+ @shift_data = sh
+ end
+ end
+
+ respond_to do |format|
+ format.html
+ format.xls
+ end
+ end
+
+ def show
+ from, to = get_date_range_from_params
+
+ @sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
+
+ date_arr = Array.new
+ @sale_data.each do |sale|
+ local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
+ local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
+ opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
+ closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
+ shift_id = sale.id.nil? ? '-' : sale.id
+ str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
+ date_arr.push(str)
+ end
+
+ out = {:status => 'ok', :message => date_arr}
+
+ respond_to do |format|
+ format.json { render json: out }
+ end
+ end
+
+end
\ No newline at end of file
diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb
index cff7887c..a86fb9b2 100755
--- a/app/controllers/reports/receipt_no_controller.rb
+++ b/app/controllers/reports/receipt_no_controller.rb
@@ -20,7 +20,7 @@ authorize_resource :class => false
payment_type = params[:payment_type]
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
- @tax_profiles = TaxProfile.order('order_by asc')
+ @tax_profiles = TaxProfile.order('order_by asc').limit(2)
@from = from
@to = to
# get printer info
diff --git a/app/models/menu_category.rb b/app/models/menu_category.rb
index 7fb23647..948ffe69 100755
--- a/app/models/menu_category.rb
+++ b/app/models/menu_category.rb
@@ -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
@@ -78,6 +79,14 @@ class MenuCategory < ApplicationRecord
end
end
+ def get_sub_category
+ menu_category = MenuCategory.find_by_menu_category_id(self.id)
+ if menu_category
+ return true
+ end
+ return false
+ end
+
private
# def generate_menu_category_code
diff --git a/app/models/order_reservation.rb b/app/models/order_reservation.rb
index 3c401e31..e5b95f8c 100644
--- a/app/models/order_reservation.rb
+++ b/app/models/order_reservation.rb
@@ -5,7 +5,9 @@ class OrderReservation < ApplicationRecord
before_create :generate_custom_id
has_many :order_reservation_items
- belongs_to :delivery
+ has_one :delivery
+
+ scope :latest_order, -> { order("order_reservation_id desc, created_at desc") }
SEND_TO_KITCHEN = "send_to_kitchen"
READY_TO_DELIVERY = "ready_to_deliver"
@@ -19,7 +21,7 @@ class OrderReservation < ApplicationRecord
order_reservation = OrderReservation.new
order_reservation.order_reservation_type = order_reserve[:order_type]
order_reservation.customer_id = order_reserve[:cus_info]
- order_reservation.requested_time = DateTime.parse(order_reserve[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S")
+ order_reservation.requested_time = Time.parse(order_reserve[:requested_time]).utc
order_reservation.callback_url = order_reserve[:callback_url]
order_reservation.transaction_ref = order_reserve[:reference]
if order_reserve[:order_info]
@@ -27,9 +29,11 @@ class OrderReservation < ApplicationRecord
order_reservation.payment_type = order_reserve[:payment_info][:payment_type]
order_reservation.payment_status = order_reserve[:payment_info][:payment_status]
order_reservation.payment_ref = order_reserve[:payment_info][:payment_ref]
+ order_reservation.taxes = order_reserve[:payment_info][:taxes]
order_reservation.total_amount = order_reserve[:payment_info][:sub_total]
order_reservation.total_tax = order_reserve[:payment_info][:total_tax]
order_reservation.discount_amount = order_reserve[:payment_info][:discount_amount]
+ order_reservation.convenience_charge = order_reserve[:payment_info][:convenience_charge]
order_reservation.grand_total = order_reserve[:payment_info][:grand_total]
order_reservation.order_remark = order_reserve[:order_info][:order_remark]
end
@@ -130,96 +134,10 @@ class OrderReservation < ApplicationRecord
result = {:status=> true, :message => DELIVERED }
return result
- # rebate_amount = nil
-
- # For Cashier by Zone
- # bookings = Booking.where("sale_id='#{sale_id}'")
-
- # if bookings[0].dining_facility_id.to_i > 0
- # table = DiningFacility.find(bookings[0].dining_facility_id)
- # cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
- # cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
- # else
- # shift = ShiftSale.find(saleObj.shift_sale_id)
- # cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
- # end
-
- # For Print
- # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
- # receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
- # unique_code = "ReceiptBillPdf"
- # if !receipt_bill_a5_pdf.empty?
- # receipt_bill_a5_pdf.each do |receipt_bilA5|
- # if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
- # if receipt_bilA5[1] == '1'
- # unique_code = "ReceiptBillA5Pdf"
- # else
- # unique_code = "ReceiptBillPdf"
- # end
- # end
- # end
- # end
-
- # customer= Customer.find(saleObj.customer_id)
-
- # get member information
- # rebate = MembershipSetting.find_by_rebate(1)
- # credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
-
- # if customer.membership_id != nil && rebate && credit_data.nil?
- # member_info = Customer.get_member_account(customer)
- # if member_info["status"] == true
- # rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
- # current_balance = SaleAudit.paymal_search(sale_id)
- # end
- # end
-
- #orders print out
- # if params[:type] == "quick_service"
- # booking = Booking.find_by_sale_id(sale_id)
- # if booking.dining_facility_id.to_i>0
- # table_id = booking.dining_facility_id
- # else
- # table_id = 0
- # end
-
- # booking.booking_orders.each do |order|
- # # Order.pay_process_order_queue(order.order_id, table_id)
- # oqs = OrderQueueStation.new
- # oqs.pay_process_order_queue(order.order_id, table_id)
- # end
-
- # end
-
- #for card sale data
- # card_data = Array.new
- # card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
- # if !card_sale_trans_ref_no.nil?
- # card_sale_trans_ref_no.each do |cash_sale_trans|
- # card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
- # card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
- # card_no = cash_sale_trans.pan.last(4)
- # card_no = card_no.rjust(19,"**** **** **** ")
- # card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
- # end
- # end
-
- # get printer info
- # print_settings=PrintSetting.find_by_unique_code(unique_code)
- # Calculate Food and Beverage Total
- # item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
- # discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
-
- # printer = Printer::ReceiptPrinter.new(print_settings)
- # filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
-
- # render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
-
- #end
end
end
- def self.send_status_to_ordering(url,ref_no,status)
+ def self.send_status_to_ordering(url,ref_no,status,waiting_time=nil)
base_url = 'https://api.doemal.com'
token = '3T-tnlYtFJ-5Z1vY6XQqxQ'
order_reservation = Lookup.collection_of("order_reservation")
@@ -238,10 +156,15 @@ class OrderReservation < ApplicationRecord
Rails.logger.debug "Doemal URL" + base_url
post_url = base_url + url
+ if !waiting_time.nil?
+ send_params = {id: ref_no, waiting_time: waiting_time, status: status}
+ else
+ send_params = {id: ref_no, status: status}
+ end
begin
response = HTTParty.post(post_url,
- :body => { id: ref_no, status: status}.to_json,
+ :body => send_params.to_json,
:headers => {
'Authorization' => 'Token token='+token,
'Content-Type' => 'application/json',
@@ -261,15 +184,58 @@ class OrderReservation < ApplicationRecord
return response
end
- def self.update_order_reservation(id, sale_id, status)
+ def self.update_order_reservation(id, sale_id, status, expected_waiting_time=nil)
order_reservation = OrderReservation.find(id)
if sale_id.present?
order_reservation.sale_id = sale_id
end
+ if !expected_waiting_time.nil?
+ order_reservation.expected_waiting_time = DateTime.parse(expected_waiting_time).utc
+ end
order_reservation.status = status
order_reservation.save
end
+ def self.get_count_on_order
+ order_reservation = OrderReservation.select("COUNT(order_reservation_id) as count, status").group("status")
+ end
+
+ def self.get_pending_orders
+ 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")
diff --git a/app/models/sale.rb b/app/models/sale.rb
index 522fcd62..acf76f0d 100644
--- a/app/models/sale.rb
+++ b/app/models/sale.rb
@@ -2604,6 +2604,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,
diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb
index 3dba0a9b..5f372581 100755
--- a/app/models/sale_payment.rb
+++ b/app/models/sale_payment.rb
@@ -23,6 +23,7 @@ class SalePayment < ApplicationRecord
if (amount_due >= 0)
payment_status = false
+ membership_data = nil
#route to payment type
case payment_method
when "cash"
@@ -52,11 +53,11 @@ class SalePayment < ApplicationRecord
when "foc"
payment_status = foc_payment
when "paymal"
- payment_status = paymal_payment
+ payment_status,membership_data = paymal_payment
when "JunctionPay"
payment_status = junction_pay_payment
when "dinga"
- payment_status = dinga_payment
+ payment_status,membership_data = dinga_payment
else
puts "it was something else"
end
@@ -73,7 +74,7 @@ class SalePayment < ApplicationRecord
end
end
- return true, self.save
+ return true, self.save,membership_data
else
#record an payment in sale-audit
# remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
@@ -430,7 +431,7 @@ class SalePayment < ApplicationRecord
sale_update_payment_status(0)
end
- return payment_status
+ return payment_status,membership_data
end
def junction_pay_payment
@@ -480,7 +481,7 @@ class SalePayment < ApplicationRecord
sale_update_payment_status(0)
end
- return payment_status
+ return payment_status,membership_data
end
diff --git a/app/pdf/receipt_bill_a5_pdf.rb b/app/pdf/receipt_bill_a5_pdf.rb
index 7253bfe1..78b27e3f 100644
--- a/app/pdf/receipt_bill_a5_pdf.rb
+++ b/app/pdf/receipt_bill_a5_pdf.rb
@@ -202,10 +202,12 @@ class ReceiptBillA5Pdf < Prawn::Document
y_position = cursor
move_down line_move
sub_total = 0.0
+ total_qty = 0.0
sale_items.each do |item|
# check for item not to show
if item.price != 0
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
+ total_qty += item.qty
qty = item.qty
total_price = item.price #item.qty*item.unit_price - comment for room charges
price = item.unit_price
@@ -240,12 +242,15 @@ class ReceiptBillA5Pdf < Prawn::Document
move_down line_move
y_position = cursor
- bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
+ bounding_box([0,y_position], :width =>self.item_width + self.price_width, :height => self.item_height) do
text "Sub Total", :size => self.item_font_size,:align => :left
end
- bounding_box([self.description_width,y_position], :width =>self.label_width) do
- text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right
- end
+ bounding_box([self.item_width + self.price_width + 11,y_position], :width =>self.qty_width, :height => self.item_height) do
+ text "#{number_with_precision(total_qty, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :center
+ end
+ bounding_box([self.item_width + self.price_width + 8,y_position], :width =>self.total_width, :height => self.item_height) do
+ text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
+ end
end
def all_total(sale_data,precision,delimiter)
diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb
index 7ebe5997..95a6a277 100755
--- a/app/pdf/receipt_bill_pdf.rb
+++ b/app/pdf/receipt_bill_pdf.rb
@@ -196,15 +196,17 @@ class ReceiptBillPdf < Prawn::Document
y_position = cursor
move_down line_move
sub_total = 0.0
+ total_qty = 0.0
sale_items.each do |item|
# check for item not to show
if item.price != 0
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
+ total_qty += item.qty
qty = item.qty
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
@@ -235,12 +237,15 @@ class ReceiptBillPdf < Prawn::Document
move_down line_move
y_position = cursor
- bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
+ bounding_box([0,y_position], :width =>self.item_width + self.price_width, :height => self.item_height) do
text "Sub Total", :size => self.item_font_size,:align => :left
end
- bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
- text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right
- end
+ bounding_box([self.item_width + self.price_width + 11,y_position], :width =>self.qty_width, :height => self.item_height) do
+ text "#{number_with_precision(total_qty, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :center
+ end
+ bounding_box([self.item_width + self.price_width + 8,y_position], :width =>self.total_width, :height => self.item_height) do
+ text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
+ end
end
def all_total(sale_data,precision,delimiter)
diff --git a/app/uploaders/menu_item_image_uploader.rb b/app/uploaders/menu_item_image_uploader.rb
index 91bbdc37..90755159 100755
--- a/app/uploaders/menu_item_image_uploader.rb
+++ b/app/uploaders/menu_item_image_uploader.rb
@@ -33,7 +33,7 @@ class MenuItemImageUploader < CarrierWave::Uploader::Base
# Process files as they are uploaded:
# process scale: [200, 300]
- process :resize_to_fit => [200, 150]
+ process :resize_to_fit => [400, 250]#[200, 150]
#
# def scale(width, height)
diff --git a/app/views/oqs/home/index.html.erb b/app/views/oqs/home/index.html.erb
index ee73d560..fe7f4b4e 100644
--- a/app/views/oqs/home/index.html.erb
+++ b/app/views/oqs/home/index.html.erb
@@ -1,9 +1,10 @@
-
+
-
+
+ Select Station
Processed
@@ -15,16 +16,6 @@
<% end %>
-
-
-
- Select Table
- <% @tables.each do |table| %>
- <%= table.name %>
-
- <% end %>
-
-
@@ -151,6 +139,35 @@
-->
+
+
<%= @filter %>
+
+
+
+
+
+
+ <% @tables.each do |table| %>
+
+ <%= table.name %>
+
+ <% end %>
+
+
+ <% @rooms.each do |room| %>
+
+ <%= room.name %>
+
+ <% end %>
+
+
+
+
+
+
@@ -168,4 +185,6 @@
window.location.href = '/dashboard';
});
});
+ document.getElementById("defaultOpen").click();
+
diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb
old mode 100755
new mode 100644
index 235e958a..7e8cbb2c
--- a/app/views/origami/addorders/detail.html.erb
+++ b/app/views/origami/addorders/detail.html.erb
@@ -1,14 +1,16 @@
<%= stylesheet_link_tag 'addorder', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %>
-
+
<% type = request.path_info.include?('quick_service')%>
<% modify_order = request.path_info.include?('modify_order')%>
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+ <% @menu.each do |menu| %>
+ <% if !menu.valid_time.nil? %>
+ <% if menu.menu_category_id.nil? %>
+
+ <% if type %>
+ <% if !menu.code.include? "SPL" %>
+
+ <% end%>
+
+ <% else %>
+ <% if @table.get_current_checkout_booking.nil? %>
+ <% if !menu.code.include? "SPL" %>
+
+ <% end%>
+ <% else %>
+
<% end%>
- <% end %>
- <% end%>
- <% end %>
- <%end %>
-
-
-
-
-
-
-
-
-
-
-
-
- <% @menu.each do |menu| %>
- <% if !menu.valid_time.nil? %>
- <% if menu.menu_category_id.nil? %>
-
- <% if type %>
- <% if !menu.code.include? "SPL" %>
-
- <% end%>
-
- <% else %>
- <% if @table.get_current_checkout_booking.nil? %>
- <% if !menu.code.include? "SPL" %>
-
- <% end%>
- <% else %>
-
- <% end%>
-
- <% end %>
- <% end%>
<% end %>
- <%end %>
+ <% end%>
+ <% end %>
+ <%end %>
+
+
+
-
-
-
-
-
- <% if type && modify_order%>
-
-
- Back
-
-
-
Pending Order
-
-
- <%elsif !modify_order && type%>
-
+
+
+ <% if type && modify_order%>
+
- Back
-
-
-
Pending Order
-
+ Back
+
+
+
Pending Order
+
+
+ <%elsif !modify_order && type%>
+
+
+ Back
+
+
+
Pending Order
+
-
Select
-
+
Select
+
- <%else%>
-
- reply Back
-
- <%end%>
+ <%else%>
+
+ reply Back
+
+ <%end%>
-
+
+
+
+
+
+ #
+ Items
+ QTY
+ Price
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ remove
+
+
+
+
+
+
+ add
+
+
+
+
+
+
+
+
+
+
+
+
Attributes
+
+
+
Options
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- remove
-
-
-
-
-
-
- add
-
-
-
-
-
-
-
-
-
-
-
-
-
Attributes
-
-
-
-
Options
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
<%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %>
+
+
+
+
+
+
+
+
+
<%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %>
-
-
- remove
-
-
-
-
-
- add
-
-
+
+
+ remove
+
+
+
+
+
+ add
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
-
-
-
+
+
+
-
-
- <% if type && !modify_order%>
-
-
-
-
-
- <%@zone.each do |zone| %>
-
Zone : <%=zone.name%>
-
- <%zone.tables.each do |table| %>
- <% if table.status == 'occupied' %>
- <% if table.get_booking.nil? %>
- <% if table.get_checkout_booking.nil? %>
- <% color="red"%>
- <% else %>
- <% color="orange"%>
- <% end %>
-
- <% else %>
- <% if table.get_checkout_booking.nil? %>
- <% color="blue"%>
- <% else %>
- <% color="orange"%>
- <% end %>
- <% end %>
- <% else %>
- <% color="green"%>
- <% end %>
-
- <%end%>
-
- <%end%>
-
+
+
+
+ <% if type && !modify_order%>
+
+
+
+
+
+ <%@zone.each do |zone| %>
+
Zone : <%=zone.name%>
+
+ <%zone.tables.each do |table| %>
+ <% if table.status == 'occupied' %>
+ <% if table.get_booking.nil? %>
+ <% if table.get_checkout_booking.nil? %>
+ <% color="red"%>
+ <% else %>
+ <% color="orange"%>
+ <% end %>
+
+ <% else %>
+ <% if table.get_checkout_booking.nil? %>
+ <% color="blue"%>
+ <% else %>
+ <% color="orange"%>
+ <% end %>
+ <% end %>
+ <% else %>
+ <% color="green"%>
+ <% end %>
+
+
+ <%= table.name %>
+
+
+
+ <%end%>
+
+ <%end%>
+
+
+
+
+
+ <% end %>
+
" id="server_mode">
-
-
-
- <% end %>
-
+
\ No newline at end of file
diff --git a/app/views/origami/alipay/index.html.erb b/app/views/origami/alipay/index.html.erb
index abd065fb..5552d3f8 100755
--- a/app/views/origami/alipay/index.html.erb
+++ b/app/views/origami/alipay/index.html.erb
@@ -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" );
+ }
}
})
diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb
index 1b6a554e..b6b36427 100644
--- a/app/views/origami/dashboard/index.html.erb
+++ b/app/views/origami/dashboard/index.html.erb
@@ -18,6 +18,7 @@
+ <% if @quick_service == '1' %>
@@ -26,6 +27,7 @@
<%= t :quick_service %>
+ <% end %>
@@ -34,6 +36,7 @@
<%= t :dine_in_cashier %>
+ <% if @order_reservation == '1' %>
@@ -42,6 +45,7 @@
<%= t :order_reservation %>
+ <% end %>
<% if !@current_user.nil? && @current_user.role != 'waiter' %>
@@ -199,6 +203,7 @@
<% end %>
Customer View
+
" id="server_mode">
diff --git a/app/views/origami/master/index.html.erb b/app/views/origami/master/index.html.erb
index 38237f1a..301452b8 100755
--- a/app/views/origami/master/index.html.erb
+++ b/app/views/origami/master/index.html.erb
@@ -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");
- }
})
diff --git a/app/views/origami/moveroom/move_dining.html.erb b/app/views/origami/moveroom/move_dining.html.erb
index b46834ca..240d3b20 100755
--- a/app/views/origami/moveroom/move_dining.html.erb
+++ b/app/views/origami/moveroom/move_dining.html.erb
@@ -166,6 +166,10 @@
diff --git a/app/views/origami/order_reservation/get_order.json.jbuilder b/app/views/origami/order_reservation/get_order.json.jbuilder
index e5ecdfe6..b3cb8f65 100644
--- a/app/views/origami/order_reservation/get_order.json.jbuilder
+++ b/app/views/origami/order_reservation/get_order.json.jbuilder
@@ -1,9 +1,9 @@
if @order
json.(@order, :order_reservation_id,:order_reservation_type,:customer_id,
- :requested_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type,
- :payment_status,:payment_ref,:total_amount,:total_tax,
- :discount_amount,:grand_total,:status,:order_remark,
+ :requested_time,:expected_waiting_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type,
+ :payment_status,:payment_ref,:taxes,:total_amount,:total_tax,
+ :discount_amount,:convenience_charge,:grand_total,:status,:order_remark,
:reservation_remark,:sale_id)
@delivery = Delivery.find_by_order_reservation_id(@order.order_reservation_id)
if @delivery
diff --git a/app/views/origami/order_reservation/index.html.erb b/app/views/origami/order_reservation/index.html.erb
index 15f173ce..a15b45aa 100644
--- a/app/views/origami/order_reservation/index.html.erb
+++ b/app/views/origami/order_reservation/index.html.erb
@@ -2,19 +2,47 @@
<%= javascript_include_tag 'order_reservation', 'data-turbolinks-track': 'reload' %>
-
+
@@ -31,14 +59,25 @@
<%=i%>
-
- <%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
+
+ <%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
-
+
+ <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
+
+
<%=order.grand_total%>
- <%= order.status %>
+
+ <% if order.delivery.delivery_type == 'service' %>
+ DELIVERY
+ <% elsif order.delivery.delivery_type == 'pick_up' %>
+ PICK-UP
+ <% else %>
+ DIRECT DELIVERY
+ <% end %>
+
<%i+=1%>
@@ -63,14 +102,25 @@
<%=i%>
-
- <%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
+
+ <%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
-
+
+ <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
+
+
<%=order.grand_total%>
- <%=order.status%>
+
+ <% if order.delivery.delivery_type == 'service' %>
+ DELIVERY
+ <% elsif order.delivery.delivery_type == 'pick_up' %>
+ PICK-UP
+ <% else %>
+ DIRECT DELIVERY
+ <% end %>
+
<%i+=1%>
@@ -94,14 +144,25 @@
<%=i%>
-
- <%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
+
+ <%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
-
+
+ <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
+
+
<%=order.grand_total%>
- <%=order.status%>
+
+ <% if order.delivery.delivery_type == 'service' %>
+ DELIVERY
+ <% elsif order.delivery.delivery_type == 'pick_up' %>
+ PICK-UP
+ <% else %>
+ DIRECT DELIVERY
+ <% end %>
+
<%i+=1%>
@@ -125,14 +186,25 @@
<%=i%>
-
- <%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
+
+ <%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
-
+
+ <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
+
+
<%=order.grand_total%>
- <%=order.status%>
+
+ <% if order.delivery.delivery_type == 'service' %>
+ DELIVERY
+ <% elsif order.delivery.delivery_type == 'pick_up' %>
+ PICK-UP
+ <% else %>
+ DIRECT DELIVERY
+ <% end %>
+
<%i+=1%>
@@ -147,16 +219,17 @@
-
+
@@ -293,9 +383,32 @@
-
\ No newline at end of file
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/origami/paymal/index.html.erb b/app/views/origami/paymal/index.html.erb
index 6818fbad..df5464dd 100644
--- a/app/views/origami/paymal/index.html.erb
+++ b/app/views/origami/paymal/index.html.erb
@@ -281,7 +281,7 @@
});
}else{
- swal ( "Information" , result.message);
+ swal ( "Opps",result.message ,"warning" );
}
}
});
@@ -328,7 +328,6 @@
var payment_amount = parseFloat($("#used_amount").text());
setTimeout(function(){
code=getQRCode();
- alert(code)
if(sale_id != 0 && code != ""){
$.ajax({
type: "POST",
@@ -345,7 +344,6 @@
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:code},
success: function(result){
- alert(result)
if(result.status == true){
swal({
title: "Information!",
@@ -359,7 +357,7 @@
});
}else{
- swal ( "Information" , result.message);
+ swal ( "Opps",result.message ,"warning" );
}
}
});
diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb
index 100b1425..d1a9eef4 100755
--- a/app/views/origami/payments/show.html.erb
+++ b/app/views/origami/payments/show.html.erb
@@ -530,7 +530,6 @@ var customer_name = "<%= @customer.name %>";
} else{
$("#credit_payment").show();
}
-console.log(jQuery.inArray("Master", payment_type))
if(parseInt(jQuery.inArray("MPU", payment_type)) != -1 ||
parseInt(jQuery.inArray("VISA", payment_type)) != -1 ||
parseInt(jQuery.inArray("JCB", payment_type)) != -1 ||
@@ -1020,7 +1019,7 @@ console.log(jQuery.inArray("Master", payment_type))
$.ajax({
type: "POST",
url: "/origami/" + sale_id + "/member_discount",
- data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
+ data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':cashier_type },
async: false,
success:function(result){
}
diff --git a/app/views/origami/pending_order/completed_sale.html.erb b/app/views/origami/pending_order/completed_sale.html.erb
new file mode 100644
index 00000000..f67be2d6
--- /dev/null
+++ b/app/views/origami/pending_order/completed_sale.html.erb
@@ -0,0 +1,207 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <% if @status == 'sale' %>
+
+ Receipt No:
+ <%= @sale.receipt_no rescue '' %>
+
+ <% else%>
+
+
+ Order No:
+ <%= @bookings.booking_orders[0].order_id rescue '' %>
+
+ <% end%>
+
+
+ <% if @status == 'sale' %>
+
+ Date: <%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
+
+ <% else%>
+
+ Date: <%= @order.created_at.strftime("%I:%M %p") rescue '-'%>
+
+ <% end%>
+
+
+
+ <% if @status == 'sale' %>
+ Customer : <%= @sale.customer.name rescue "-" %>
+ <% else%>
+ Customer : <%= @order.customer.name rescue "-" %>
+ <% end%>
+
+
+
+
+
+
+
+
+
+
+ reply Back
+ Reprint
+ <% if current_user.role != "waiter" %>
+ <%= t("views.btn.close_cashier") %>
+ <% end %>
+
+
+
+
diff --git a/app/views/origami/pending_order/index.html.erb b/app/views/origami/pending_order/index.html.erb
index 447612d1..02b4d07c 100644
--- a/app/views/origami/pending_order/index.html.erb
+++ b/app/views/origami/pending_order/index.html.erb
@@ -2,31 +2,50 @@
-
@@ -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";
diff --git a/app/views/origami/pending_order/show.html.erb b/app/views/origami/pending_order/show.html.erb
index 0cc6f949..48cad44e 100644
--- a/app/views/origami/pending_order/show.html.erb
+++ b/app/views/origami/pending_order/show.html.erb
@@ -1,154 +1,171 @@