change order reservation data
This commit is contained in:
@@ -17,7 +17,7 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel'
|
||||
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 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(value.delivery_type == "service"){
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
$(function() {
|
||||
$("#discount").hide();
|
||||
$(".expected_time").hide();
|
||||
$('#accepted').hide();
|
||||
$('#cancel').hide();
|
||||
$(".tbl_customer").hide();
|
||||
$(function() {
|
||||
$('.first-1').click();
|
||||
});
|
||||
@@ -11,8 +14,9 @@ $(function() {
|
||||
$(".nav-item").on("click", function(){
|
||||
type = $(this).attr("data-type");
|
||||
refreshDetailData();
|
||||
$('#accepted').show();
|
||||
$('#cancel').show();
|
||||
$('#accepted').hide();
|
||||
$('#cancel').hide();
|
||||
$(".tbl_customer").hide();
|
||||
if (type == "pending") {
|
||||
$(".first-1").click();
|
||||
$('#accepted').text("ACCEPT");
|
||||
@@ -26,13 +30,14 @@ $(function() {
|
||||
$('#accepted').text("READY TO DELIVERY");
|
||||
$('#accepted').attr("data-value","delivery");
|
||||
}else if(type == "completed"){
|
||||
// $('#cancel').hide();
|
||||
$(".fourth-1").click();
|
||||
$('#accepted').text("PICK-UP");
|
||||
$('#accepted').text("COMPLETE");
|
||||
$('#accepted').attr("data-value","completed");
|
||||
}else if(type == "processed"){
|
||||
$(".fifth-1").click();
|
||||
$('#accepted').hide();
|
||||
$('#cancel').hide();
|
||||
// $('#accepted').hide();
|
||||
// $('#cancel').hide();
|
||||
}
|
||||
// console.log(type);
|
||||
});
|
||||
@@ -94,7 +99,7 @@ $(function() {
|
||||
$(".time_interval").on("click",function(){
|
||||
var type = '';
|
||||
if($(".timer_type").hasClass("selected-item")){
|
||||
type = '+';
|
||||
type = 'after';
|
||||
}
|
||||
var minutes = $(this).attr("data-value");
|
||||
// console.log(type);
|
||||
@@ -104,14 +109,14 @@ $(function() {
|
||||
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());
|
||||
if(type == 'plus'){
|
||||
requested_time.setMinutes(requested_time.getMinutes() + minutes);
|
||||
}else{
|
||||
requested_time.setMinutes(requested_time.getMinutes() - minutes);
|
||||
}
|
||||
// var requested_time = new Date($("#requested_date_time").text());
|
||||
// if(type == 'after'){
|
||||
// requested_time.setMinutes(requested_time.getMinutes() + minutes);
|
||||
// }else{
|
||||
// requested_time.setMinutes(requested_time.getMinutes() - minutes);
|
||||
// }
|
||||
// console.log(requested_time);
|
||||
callback_url(callback,ref_no,order_id,status,type,minutes,requested_time);
|
||||
callback_url(callback,ref_no,order_id,status,type,minutes);
|
||||
});
|
||||
|
||||
$(document).on('click','.access_number', function(event){
|
||||
@@ -201,20 +206,30 @@ function show_order_detail(url,sr_no){
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// console.log(data);
|
||||
$(".tbl_customer").show();
|
||||
if(data.status != "delivered"){
|
||||
$('#accepted').show();
|
||||
if(data.status != "ready_to_delivery" && data.status != "send_to_kitchen"){
|
||||
$('#cancel').show();
|
||||
}
|
||||
}else{
|
||||
$('#accepted').hide();
|
||||
$('#cancel').hide();
|
||||
}
|
||||
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;
|
||||
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;
|
||||
// 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 : '');
|
||||
$('#expected_time').text(data.expected_waiting_time? data.expected_waiting_time : '');
|
||||
}else{
|
||||
$('.expected_time').hide();
|
||||
$('#expected_time').text('');
|
||||
@@ -334,7 +349,7 @@ function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reas
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {order_id: order_id, status: status, expected_time: expected_time, remark: reason, access_code: access_code},
|
||||
data: {order_id: order_id, status: status, min_type: min_type, expected_time: waiting_time, remark: reason, access_code: access_code},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.status) {
|
||||
@@ -383,7 +398,7 @@ function showNewOrder(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;
|
||||
var requested_date = date.getFullYear() + '-' + (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >= 10? date.getDate() : '0' + date.getDate()) +' '+time;
|
||||
//audio play
|
||||
var audio = new Audio('/beep-07.wav'); // define your audio
|
||||
// setTimeout(function(){
|
||||
|
||||
@@ -220,8 +220,12 @@ class Api::OrdersController < Api::ApiController
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
|
||||
|
||||
if !assigned_items.nil?
|
||||
assigned_items.each do |assign_item|
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
oqs = assign_item.order_queue_station
|
||||
|
||||
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
|
||||
|
||||
@@ -248,6 +252,8 @@ class Api::OrdersController < Api::ApiController
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return return_json_status_with_code(200, "updated successfully!")
|
||||
else
|
||||
|
||||
@@ -9,7 +9,12 @@ class Origami::OrderReservationController < BaseOrigamiController
|
||||
def update
|
||||
@id = params[:order_id]
|
||||
@status = params[:status]
|
||||
min_type = params[:min_type]
|
||||
if min_type != ""
|
||||
expected_waiting_time = params[:expected_time]
|
||||
else
|
||||
expected_waiting_time = min_type + " " +params[:expected_time]
|
||||
end
|
||||
remark = params[:remark]
|
||||
access_code = params[:access_code]
|
||||
@order_reservation = OrderReservation.find(@id)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Reports::OrderReservationController < BaseReportController
|
||||
# authorize_resource :class => false
|
||||
def index
|
||||
@providers = [["All",''], ["food2u","food2u"], ["Pick-Up","pick_up"], ["ygndoor2door","ygndoor2door"], ["Direct Delivery","direct_delivery"]]
|
||||
@providers = [["All",''], ["Direct Delivery","direct_delivery"],["Pick-Up","pick_up"],["food2u","food2u"], ["ygndoor2door","ygndoor2door"]]
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ 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.taxes = order_reserve[:payment_info][:taxes].to_json
|
||||
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]
|
||||
@@ -193,7 +193,7 @@ class OrderReservation < ApplicationRecord
|
||||
order_reservation.sale_id = sale_id
|
||||
end
|
||||
if !expected_waiting_time.nil?
|
||||
order_reservation.expected_waiting_time = DateTime.parse(expected_waiting_time).utc
|
||||
order_reservation.expected_waiting_time = expected_waiting_time
|
||||
end
|
||||
order_reservation.status = status
|
||||
if !remark.nil?
|
||||
|
||||
@@ -360,7 +360,7 @@
|
||||
<tr>
|
||||
<td width ="50%" class="footer-td align-left col-blue">
|
||||
<button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="rejected">
|
||||
<strong>DECLINE</strong>
|
||||
<strong>REJECT</strong>
|
||||
</button>
|
||||
</td>
|
||||
<td width ="50%" class="footer-td align-right col-blue">
|
||||
@@ -394,8 +394,8 @@
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<table class="table">
|
||||
<div class="card-block" style="height: 520px">
|
||||
<table class="table tbl_customer">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="body-td align-left">
|
||||
@@ -413,8 +413,8 @@
|
||||
<b id="customer_name"></b>
|
||||
</td>
|
||||
<td class="body-td align-right expected_time">
|
||||
<span class="font-13">EXPECTED TIME</span><br>
|
||||
<b id="expected_time"></b>
|
||||
<span class="font-13">COOKING TIME</span><br>
|
||||
<b><span id="expected_time"></span> MINS</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -467,7 +467,7 @@
|
||||
<div class="row text-center m-t-20">
|
||||
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3"></div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
<button type="button" class="btn btn-lg btn-link bg-info timer_type" data-value="plus">After</button>
|
||||
<button type="button" class="btn btn-lg btn-link bg-info timer_type" data-value="after">After</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@
|
||||
delimiter = ""
|
||||
end %>
|
||||
<%
|
||||
|
||||
discount_amount = 0.0
|
||||
delivery_fee = 0.0
|
||||
convenience_charge = 0.0
|
||||
@@ -96,20 +95,24 @@
|
||||
discount_amount = order_reservation.discount_amount
|
||||
delivery_fee = order_reservation.delivery_fee ? order_reservation.delivery_fee : 0.0
|
||||
convenience_charge = order_reservation.convenience_charge
|
||||
|
||||
(order_reservation.taxes).each do |tax| %>
|
||||
|
||||
<% end
|
||||
|
||||
JSON.parse(order_reservation.taxes).each do |tax_data|
|
||||
if tax_data[0] == "delivery_tax"
|
||||
delivery_tax = tax_data[1]
|
||||
elsif tax_data[0] == "convenience_tax"
|
||||
convenience_tax = tax_data[1]
|
||||
elsif tax_data[0] == "commercial_tax"
|
||||
commercial_tax = tax_data[1]
|
||||
end
|
||||
end
|
||||
total_discount_amount += discount_amount.to_f
|
||||
total_delivery_fee += delivery_fee.to_f
|
||||
total_convenience_charge += convenience_charge
|
||||
total_delivery_tax += delivery_tax
|
||||
total_convenience_tax += convenience_tax
|
||||
total_commercial_tax += commercial_tax
|
||||
total_tax += order_reservation.total_tax
|
||||
total_amount += order_reservation.total_amount
|
||||
grand_total += order_reservation.grand_total
|
||||
total_convenience_charge += convenience_charge.to_f
|
||||
total_delivery_tax += delivery_tax.to_f
|
||||
total_convenience_tax += convenience_tax.to_f
|
||||
total_commercial_tax += commercial_tax.to_f
|
||||
total_tax += order_reservation.total_tax.to_f
|
||||
total_amount += order_reservation.total_amount.to_f
|
||||
grand_total += order_reservation.grand_total.to_f
|
||||
%>
|
||||
<%
|
||||
if order_reservation.provider == 'pick_up'
|
||||
@@ -123,7 +126,7 @@
|
||||
<tr>
|
||||
<td><%= order_reservation.email %></td>
|
||||
<td><%= order_reservation.order_reservation_type %></td>
|
||||
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%d %m %Y %I:%M %p") %></td>
|
||||
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
|
||||
<td><%= provider%></td>
|
||||
<td><%= order_reservation.payment_type%></td>
|
||||
<td><%= order_reservation.payment_status%></td>
|
||||
|
||||
@@ -63,19 +63,25 @@
|
||||
delivery_fee = order_reservation.delivery_fee ? order_reservation.delivery_fee : 0.0
|
||||
convenience_charge = order_reservation.convenience_charge
|
||||
|
||||
(order_reservation.taxes).each do |tax| %>
|
||||
|
||||
<% end
|
||||
JSON.parse(order_reservation.taxes).each do |tax_data|
|
||||
if tax_data[0] == "delivery_tax"
|
||||
delivery_tax = tax_data[1]
|
||||
elsif tax_data[0] == "convenience_tax"
|
||||
convenience_tax = tax_data[1]
|
||||
elsif tax_data[0] == "commercial_tax"
|
||||
commercial_tax = tax_data[1]
|
||||
end
|
||||
end
|
||||
|
||||
total_discount_amount += discount_amount.to_f
|
||||
total_delivery_fee += delivery_fee.to_f
|
||||
total_convenience_charge += convenience_charge
|
||||
total_delivery_tax += delivery_tax
|
||||
total_convenience_tax += convenience_tax
|
||||
total_commercial_tax += commercial_tax
|
||||
total_tax += order_reservation.total_tax
|
||||
total_amount += order_reservation.total_amount
|
||||
grand_total += order_reservation.grand_total
|
||||
total_convenience_charge += convenience_charge.to_f
|
||||
total_delivery_tax += delivery_tax.to_f
|
||||
total_convenience_tax += convenience_tax.to_f
|
||||
total_commercial_tax += commercial_tax.to_f
|
||||
total_tax += order_reservation.total_tax.to_f
|
||||
total_amount += order_reservation.total_amount.to_f
|
||||
grand_total += order_reservation.grand_total.to_f
|
||||
%>
|
||||
<%
|
||||
if order_reservation.provider == 'pick_up'
|
||||
@@ -89,7 +95,7 @@
|
||||
<tr>
|
||||
<td><%= order_reservation.email %></td>
|
||||
<td><%= order_reservation.order_reservation_type %></td>
|
||||
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%d %m %Y %I:%M %p") %></td>
|
||||
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
|
||||
<td><%= provider%></td>
|
||||
<td><%= order_reservation.payment_type%></td>
|
||||
<td><%= order_reservation.payment_status%></td>
|
||||
|
||||
Reference in New Issue
Block a user