Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -8,6 +8,9 @@ $(function() {
|
||||
$(".tbl_customer").hide();
|
||||
$(".order_close_cashier").hide();
|
||||
$(".order_payment_type").hide();
|
||||
$(".accepted_time").hide();
|
||||
$(".kitchen_time").hide();
|
||||
$(".ready_time").hide();
|
||||
$(function() {
|
||||
$('.first-1').click();
|
||||
});
|
||||
@@ -290,7 +293,36 @@ function show_order_detail(url,sr_no){
|
||||
var delivery = data["delivery"];
|
||||
var items = data["order_items"];
|
||||
var item_list = $('.summary-items');
|
||||
var action_times = "";
|
||||
$("#accepted_time").html("");
|
||||
$("#send_kitchen_time").html("");
|
||||
$("#ready_delivery_time").html("");
|
||||
if((data["action_times"]!=undefined) && (data["action_times"]!=null)){
|
||||
action_times = JSON.parse(data["action_times"]);
|
||||
if((action_times.accepted_time!=undefined) && (action_times.accepted_time!="")){
|
||||
$(".accepted_time").show();
|
||||
var acceptedDate = new Date(action_times.accepted_time);
|
||||
var acceptedTime = timeFormat(acceptedDate);
|
||||
var accepted_time = getOrderMonth(acceptedDate.getMonth()) +' '+ (acceptedDate.getDate() >= 10? acceptedDate.getDate() : '0' + acceptedDate.getDate()) +', '+acceptedDate.getFullYear()+'('+getOrderDay(acceptedDate.getDay())+')'+' '+acceptedTime;
|
||||
$("#accepted_time").html(accepted_time);
|
||||
}
|
||||
if((action_times.kitchen_time!=undefined) && (action_times.kitchen_time!="")){
|
||||
$(".kitchen_time").show();
|
||||
var kitchenDate = new Date(action_times.kitchen_time);
|
||||
var kitchenTime = timeFormat(kitchenDate);
|
||||
var kitchen_time = getOrderMonth(kitchenDate.getMonth()) +' '+ (kitchenDate.getDate() >= 10? kitchenDate.getDate() : '0' + kitchenDate.getDate()) +', '+kitchenDate.getFullYear()+'('+getOrderDay(kitchenDate.getDay())+')'+' '+kitchenTime;
|
||||
$("#send_kitchen_time").html(kitchen_time);
|
||||
}
|
||||
|
||||
if((action_times.ready_time!=undefined) && (action_times.ready_time!="")){
|
||||
$(".ready_time").show();
|
||||
var readyDate = new Date(action_times.ready_time);
|
||||
var readyTime = timeFormat(readyDate);
|
||||
var ready_time = getOrderMonth(readyDate.getMonth()) +' '+ (readyDate.getDate() >= 10? readyDate.getDate() : '0' + readyDate.getDate()) +', '+readyDate.getFullYear()+'('+getOrderDay(readyDate.getDay())+')'+' '+readyTime;
|
||||
$("#ready_delivery_time").html(ready_time);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -36,7 +36,7 @@ class Oqs::EditController < BaseOqsController
|
||||
order_item.remark = remarks
|
||||
order_item.save
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" && order.source == 'cashier' #no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud" #&& order.source == 'cashier' #no print in cloud server
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code_and_order_id(order_item.item_instance_code, order_item.order_id)
|
||||
assigned_items = nil
|
||||
|
||||
@@ -11,7 +11,7 @@ class OrderReservation < ApplicationRecord
|
||||
scope :latest_order, -> { order("order_reservation_id desc, created_at desc") }
|
||||
|
||||
SEND_TO_KITCHEN = "send_to_kitchen"
|
||||
READY_TO_DELIVERY = "ready_to_deliver"
|
||||
READY_TO_DELIVERY = "ready_to_delivery"
|
||||
DELIVERED = "delivered"
|
||||
COMPLETED = "completed"
|
||||
|
||||
@@ -134,7 +134,7 @@ class OrderReservation < ApplicationRecord
|
||||
|
||||
#order status send to doemal
|
||||
callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,SEND_TO_KITCHEN)
|
||||
#order reservation status updated
|
||||
# order reservation status updated
|
||||
update_order_reservation(order.id, @sale.sale_id, SEND_TO_KITCHEN)
|
||||
|
||||
result = {:status=> @status, :data => @sale, :message => "send to kitchen" }
|
||||
@@ -237,6 +237,7 @@ class OrderReservation < ApplicationRecord
|
||||
|
||||
def self.update_order_reservation(id, sale_id, status, expected_waiting_time=nil, remark=nil, access_code=nil, current_user=nil)
|
||||
order_reservation = OrderReservation.find(id)
|
||||
action_times = {}
|
||||
if sale_id.present?
|
||||
order_reservation.sale_id = sale_id
|
||||
end
|
||||
@@ -252,11 +253,27 @@ class OrderReservation < ApplicationRecord
|
||||
if status == "delivered"
|
||||
order_reservation.payment_status = "paid"
|
||||
end
|
||||
if status == "accepted"
|
||||
action_times = {"accepted_time" => DateTime.now.utc, "kitchen_time" => "", "ready_time" => ""}
|
||||
order_reservation.action_times = action_times.to_json
|
||||
elsif status == SEND_TO_KITCHEN
|
||||
if !order_reservation.action_times.nil?
|
||||
action_data = JSON.parse(order_reservation.action_times)
|
||||
action_data["kitchen_time"] = DateTime.now.utc
|
||||
order_reservation.action_times = action_data.to_json
|
||||
end
|
||||
elsif status == READY_TO_DELIVERY
|
||||
if !order_reservation.action_times.nil?
|
||||
action_data = JSON.parse(order_reservation.action_times)
|
||||
action_data["ready_time"] = DateTime.now.utc
|
||||
order_reservation.action_times = action_data.to_json
|
||||
end
|
||||
end
|
||||
order_reservation.save
|
||||
|
||||
# if !order_reservation.sale_id.nil? && status == "rejected"
|
||||
# void_doemal_payment(order_reservation.sale_id, remark, access_code, current_user)
|
||||
# end
|
||||
if !order_reservation.sale_id.nil? && status == "rejected"
|
||||
void_doemal_payment(order_reservation.sale_id, remark, access_code, current_user)
|
||||
end
|
||||
end
|
||||
|
||||
def self.void_doemal_payment(sale_id, remark, access_code, current_user)
|
||||
|
||||
@@ -1163,7 +1163,7 @@
|
||||
|
||||
$('#edit').on('click', function () {
|
||||
var dining_id = "<%= @dining.id %>"
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var sale_id = $("#sale_id").val(); //"<%= @obj_sale.sale_id rescue "" %>"
|
||||
if ($(this).attr('active')=== "true") {
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type +"/edit";
|
||||
}else{
|
||||
@@ -1174,7 +1174,7 @@
|
||||
|
||||
$('#commissions').on('click', function () {
|
||||
var dining_id = "<%= @dining.id %>"
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var sale_id = $("#sale_id").val(); //"<%= @obj_sale.sale_id rescue "" %>"
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/load_commissioners";
|
||||
});
|
||||
|
||||
@@ -1197,7 +1197,7 @@
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var sale_id = $("#sale_id").val();//"<%= @obj_sale.sale_id rescue "" %>"
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
|
||||
var remark = $("#remark").val();
|
||||
|
||||
@@ -1305,7 +1305,7 @@
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var sale_id = $("#sale_id").val(); //"<%= @obj_sale.sale_id rescue "" %>"
|
||||
var url = "/origami/sale/" + sale_id + '/cashier/waste_and_spoilage';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@@ -1336,7 +1336,7 @@
|
||||
createAccessCode(code);
|
||||
if (type == "edit") {
|
||||
var dining_id = "<%= @dining.id rescue "" %> ";
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>";
|
||||
var sale_id = $("#sale_id").val(); //"<%= @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');
|
||||
@@ -1371,7 +1371,7 @@
|
||||
var cashier_type = 'cashier';
|
||||
var sale_id = $('#sale_id').text();
|
||||
var dining_id = "<%= @dining.id rescue "" %> ";
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>";
|
||||
var sale_id = $("#sale_id").val(); //"<%= @obj_sale.sale_id rescue "" %>";
|
||||
localStorage.removeItem("tax_type");
|
||||
swal({
|
||||
title: "Alert",
|
||||
|
||||
@@ -4,7 +4,7 @@ if @order
|
||||
:requested_time,:pickup_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,
|
||||
:remark,:sale_id)
|
||||
:remark,:sale_id,:action_times)
|
||||
@delivery = Delivery.find_by_order_reservation_id(@order.order_reservation_id)
|
||||
if @delivery
|
||||
json.delivery do |json|
|
||||
|
||||
@@ -468,26 +468,26 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- <table class="table">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td colspan="2" class="body-td align-left">
|
||||
<td colspan="2" class="body-td align-left accepted_time">
|
||||
<span class="font-13">ACCEPTED</span><br>
|
||||
<b id="accepted_time">Sept 06, 2018(Weds) 10:00 AM</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="body-td align-left">
|
||||
<td colspan="2" class="body-td align-left kitchen_time">
|
||||
<span class="font-13">SEND TO KITCHEN</span><br>
|
||||
<b id="send_kitchen_time">Sept 06, 2018(Weds) 11:00 AM</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="body-td align-left">
|
||||
<td colspan="2" class="body-td align-left ready_time">
|
||||
<span class="font-13">READY TO DELIVERY</span><br>
|
||||
<b id="ready_delivery_time">Sept 06, 2018(Weds) 12:00 PM</b>
|
||||
</td>
|
||||
</tr>
|
||||
</table> -->
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="card-footer grand-card-footer">
|
||||
|
||||
@@ -1260,7 +1260,7 @@ $('#add_invoice').on('click',function(){
|
||||
|
||||
$('#edit').on('click',function(){
|
||||
var dining_id = "<%= @room.id %>"
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var sale_id = $('#sale_id').val(); //"<%= @obj_sale.sale_id rescue "" %>"
|
||||
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/cashier/edit";
|
||||
});
|
||||
|
||||
@@ -1319,7 +1319,7 @@ $('#add_invoice').on('click',function(){
|
||||
|
||||
$('#commissions').on('click', function () {
|
||||
var dining_id = "<%= @room.id %>"
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var sale_id = $('#sale_id').val(); //"<%= @obj_sale.sale_id rescue "" %>"
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/load_commissioners";
|
||||
});
|
||||
|
||||
@@ -1384,7 +1384,7 @@ $('#add_invoice').on('click',function(){
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var sale_id = $('#sale_id').val(); //"<%= @obj_sale.sale_id rescue "" %>"
|
||||
var url = "/origami/sale/" + sale_id + '/cashier/waste_and_spoilage';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@@ -1421,7 +1421,7 @@ $('#add_invoice').on('click',function(){
|
||||
createAccessCode(code);
|
||||
if (type == "edit") {
|
||||
var dining_id = "<%= @room.id rescue ""%>";
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>";
|
||||
var sale_id = $('#sale_id').val(); //"<%= @obj_sale.sale_id rescue "" %>";
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/cashier/edit";
|
||||
}else if(type == "void"){
|
||||
$('#AccessCodeModal').modal('hide');
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
count += 1
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
||||
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
||||
<%
|
||||
# Can't check for discount
|
||||
# unless sale_item.price == 0
|
||||
|
||||
Reference in New Issue
Block a user