change order reservation

This commit is contained in:
phyusin
2018-05-12 11:38:43 +06:30
parent 34e2bdb0d1
commit c7c32ffff4
10 changed files with 131 additions and 41 deletions

View File

@@ -34,13 +34,16 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
// }
// });
$("#notify_new_order_lists").text(order_lists);
// if($("#notify_new_order").hasClass("hidden")){
$("#notify_new_order").removeClass("hidden");
// }
$("#notify_new_order").on('show.bs.modal', function(e){
$("#notify_order_send_to_kitchen").modal('hide');
$("#notify_order_ready_to_delivery").modal('hide');
$("#notify_order_send_to_kitchen").addClass("hidden");
$("#notify_order_ready_to_delivery").addClass("hidden");
}).on('shown.bs.modal', function(e){
$("#notify_new_order").focus();
}).on('hide.bs.modal', function (e) {
$("#notify_new_order").modal("hide");
$("#notify_new_order").addClass("hidden");
}).modal({show: true, keyboard: false, backdrop: false});
}
}

View File

@@ -34,13 +34,16 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
// }
// });
$("#notify_order_ready_to_delivery_lists").text(order_lists);
// if($("#notify_order_ready_to_delivery").hasClass("hidden")){
$("#notify_order_ready_to_delivery").removeClass("hidden");
// }
$("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
$("#notify_new_order").modal('hide');
$("#notify_order_send_to_kitchen").modal('hide');
$("#notify_new_order").addClass("hidden");
$("#notify_order_send_to_kitchen").addClass("hidden");
}).on('shown.bs.modal', function(e){
$("#notify_order_ready_to_delivery").focus();
}).on('hide.bs.modal', function (e) {
$("#notify_order_ready_to_delivery").modal("hide");
$("#notify_order_ready_to_delivery").addClass("hidden");
}).modal({show: true, keyboard: false, backdrop: false});
}
}

View File

@@ -34,13 +34,16 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
// }
// });
$("#notify_order_send_to_kitchen_lists").text(order_lists);
// if($("#notify_order_send_to_kitchen").hasClass("hidden")){
$("#notify_order_send_to_kitchen").removeClass("hidden");
// }
$("#notify_order_send_to_kitchen").on('show.bs.modal', function(e){
$("#notify_new_order").modal('hide');
$("#notify_order_ready_to_delivery").modal('hide');
$("#notify_new_order").addClass("hidden");
$("#notify_order_ready_to_delivery").addClass("hidden");
}).on('shown.bs.modal', function(e){
$("#notify_order_send_to_kitchen").focus();
}).on('hide.bs.modal', function (e) {
$("#notify_order_send_to_kitchen").modal("hide");
$("#notify_order_send_to_kitchen").addClass("hidden");
}).modal({show: true, keyboard: false, backdrop: false});
}
}

View File

@@ -21,9 +21,9 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel'
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"){
if(value.provider == "food2u" || value.provider == "yangondoor2door"){
delivery_type = "DELIVERY";
}else if(value.delivery_type == "pick_up"){
}else if(value.provider == "pick_up"){
delivery_type = "PICK-UP";
}else{
delivery_type = "DIRECT DELIVERY";

View File

@@ -54,7 +54,17 @@ $(document).ready(function() {
});
$('#modal-set-slimscroll').slimScroll({
height: height-$('#modal-slimscroll').attr('data-height'),
height: height-$('#modal-set-slimscroll').attr('data-height'),
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 45
});
$('#customer-info-slimscroll').slimScroll({
height: height-$('#customer-info-slimscroll').attr('data-height'),
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,

View File

@@ -5,6 +5,7 @@ $(function() {
$('#accepted').hide();
$('#cancel').hide();
$(".tbl_customer").hide();
$(".order_close_cashier").hide();
$(function() {
$('.first-1').click();
});
@@ -17,6 +18,7 @@ $(function() {
$('#accepted').hide();
$('#cancel').hide();
$(".tbl_customer").hide();
$(".order_close_cashier").hide();
if (type == "pending") {
$(".first-1").click();
$('#accepted').text("ACCEPT");
@@ -36,6 +38,7 @@ $(function() {
$('#accepted').attr("data-value","completed");
}else if(type == "processed"){
$(".fifth-1").click();
$(".order_close_cashier").show();
// $('#accepted').hide();
// $('#cancel').hide();
}
@@ -119,6 +122,12 @@ $(function() {
callback_url(callback,ref_no,order_id,status,type,minutes);
});
$('#order_close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/ordering/close';
warnBeforeRedirect(linkURL);
});
$(document).on('click','.access_number', function(event){
if(event.handled !== true) {
var original_value = $('#access_code').val();
@@ -148,9 +157,39 @@ $(function() {
}
});
$('button[data-dismiss="modal"]').on('click', function(){ $(this).parent().parent().parent().parent().modal('hide'); });
// $('button[data-dismiss="modal"]').on('click', function(){ $(this).parent().parent().parent().parent().modal('hide'); });
// $(".new_order_close").on("click",function(){
// var code = $(this).attr("data-value");
// $("#"+code+"_doemal_new_order").modal("hide");
// });
$("[data-dismiss='modal']").on('click', function() {
$('body').addClass('modal-open-fix');
if($('body').css("padding-right") == '15px') {
$('body').addClass('modal-open-fix-pad');
}
setTimeout(function() {
if($('body').hasClass('modal-open-fix-pad')) {
$('body').css('padding-right', '15px');
}
$('body').addClass('modal-open').removeClass('modal-open-fix, modal-open-fix-pad');
}, 1000);
});
});
function warnBeforeRedirect(linkURL) {
swal({
title: "Alert!",
text: "Are you sure you want to close cashier?",
type: "warning",
showCancelButton: true
}, function() {
// Redirect the user
window.location.href = linkURL;
});
}
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
@@ -195,6 +234,8 @@ function refreshDetailData(){
$('#discount_amount').text("0.00");
$('#total_tax').text("0.00");
$('#grand_total').text("0.00");
$(".tbl_customer").hide();
$(".order_close_cashier").hide();
}
//show order list
@@ -282,19 +323,21 @@ function show_order_detail(url,sr_no){
$('#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);
$("#trans_ref").text(data.transaction_ref);
if(delivery.delivery_type == "service"){
if(delivery.provider == "food2u" || delivery.provider == "yangondoor2door"){
$("#delivery_info").text("(DELIVERY)");
}else if(delivery.delivery_type == "pick_up"){
$("#delivery_to").text("DELIVERY");
}else if(delivery.provider == "pick_up"){
$("#delivery_info").text("(PICK-UP)");
$("#delivery_to").text("PICK-UP");
}else{
$("#delivery_info").text("(DIRECT DELIVERY)");
$("#delivery_to").text("DIRECT DELIVERY");
}
if(data.order_remark!=null && data.order_remark!=""){
@@ -377,6 +420,18 @@ function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reas
}, 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';
});
}
}
});
@@ -420,15 +475,17 @@ function showNewOrder(order_reservation,shop_code){
$("#new_order").text(order_reservation.order_reservation_id);
$("#new_order_date").text(requested_date);
if($("#"+shop_code+"_doemal_new_order").hasClass("hidden")){
$("#"+shop_code+"_doemal_new_order").removeClass("hidden");
}
$("#"+shop_code+"_doemal_new_order").on('show.bs.modal', function(e){
$("#notify_new_order").modal('hide');
$("#notify_order_send_to_kitchen").modal('hide');
$("#notify_order_ready_to_delivery").modal('hide');
$("#notify_new_order").addClass("hidden");
$("#notify_order_send_to_kitchen").addClass("hidden");
$("#notify_order_ready_to_delivery").addClass("hidden");
}).on('shown.bs.modal', function(e){
$("#"+shop_code+"_doemal_new_order").focus();
}).on('hide.bs.modal', function (e) {
audio.pause();
$("#"+shop_code+"_doemal_new_order").modal("hide");
$("#"+shop_code+"_doemal_new_order").addClass("hidden");
}).modal({show: true, keyboard: false, backdrop: false});
}
}

View File

@@ -18,7 +18,7 @@ module TokenVerification
# Rails.logger.debug "token - " + token.to_s
if(options.length !=0 && options["from"] == "DOEMAL")
if(ENV["SERVER_MODE"] === "cloud")
from = request.subdomain.downcase + "." + request.domain.downcase #"local"
from = request.subdomain.downcase + "." + request.domain.downcase #"local"
aes = MyAesCrypt.new
return aes.checkKeyForAuth(from, token)
end

View File

@@ -93,9 +93,6 @@ class OrderReservation < ApplicationRecord
count += 1
items_arr.push(items)
}
puts items_arr.to_json
puts "sssssssssssssssssssssss"
customer_id = order.customer_id
@order = Order.new
@@ -125,8 +122,11 @@ class OrderReservation < ApplicationRecord
update_order_reservation(order.id, @sale.sale_id, SEND_TO_KITCHEN)
result = {:status=> @status, :data => @sale, :message => "send to kitchen" }
return result
else
result = {:status=> @status, :message => "No current shift open for this employee!" }
end
return result
end
def self.update_doemal_payment(order,current_user)
@@ -178,8 +178,8 @@ class OrderReservation < ApplicationRecord
end
Rails.logger.debug "Doemal URL" + base_url
post_url = base_url + url
if !waiting_time.nil?
if !waiting_time.nil? && !min_type.nil? && reason.nil?
send_params = {id: ref_no,type: min_type, waiting_time: waiting_time, status: status}
elsif !reason.nil?
send_params = {id: ref_no, status: status, reason: reason}

View File

@@ -389,34 +389,36 @@
<div class="card-header custom-card-header" style="background-color: #E8EAF6">
<table class="table">
<tr>
<td width ="" class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION
<td class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION
</td>
</tr>
</table>
</div>
<div class="card-block" style="height: 520px">
<div class="card-block" id="customer-info-slimscroll" data-height="95">
<table class="table tbl_customer">
<tbody>
<tr>
<td class="body-td align-left">
<td colspan="2" class="body-td align-left">
<span class="font-13">REF.</span><br>
<b id="trans_ref"></b>
</td>
<td class="body-td align-right">
<span class="font-13">REQUESTED TIME</span><br>
<b id="requested_time"></b>
</td>
</tr>
<tr>
<td class="body-td align-left">
<span class="font-13">NAME</span><br>
<b id="customer_name"></b>
<span class="font-13">REQUESTED TIME</span><br>
<b id="requested_time"></b>
</td>
<td class="body-td align-right expected_time">
<span class="font-13">COOKING TIME</span><br>
<b><span id="expected_time"></span> MINS</b>
</td>
</tr>
<tr>
<td colspan="2" class="body-td align-left">
<span class="font-13">NAME</span><br>
<b id="customer_name"></b>
</td>
</tr>
<tr>
<td colspan="2" class="body-td align-left">
<span class="font-13">PHONE</span><br>
@@ -449,6 +451,16 @@
</tbody>
</table>
</div>
<div class="card-footer order_close_cashier">
<% if current_user.role != "waiter" %>
<div class="row">
<div class="col-sm-7 col-xs-7 col-md-7 col-lg-7"></div>
<div class="col-sm-4 col-xs-4 col-md-4 col-lg-4">
<button id="order_close_cashier" class="align-right text-center btn btn-md btn-link btn-primary waves-effect"><%= t("views.btn.close_cashier") %></button>
</div>
</div>
<% end %>
</div>
</div>
</div>
@@ -585,7 +597,7 @@
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect new_order_close" data-value="<%= @shop.shop_code %>" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>

View File

@@ -31,7 +31,7 @@
<div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn bg-default btn-block" id='back'><i class="material-icons">reply</i> <%= t("views.btn.back") %> </button>
<button type="button" class="btn bg-blue btn-block green" id='close_cashier'> <%= t("views.btn.close_cashier") %> </button>
<% if @bank_integration == '1' %>
<% if @bank_integration == '1' && @cashier_type!="ordering" %>
<button type="button" class="btn bg-blue btn-block green" id="card_settlement"> <%= t("views.btn.card_settle") %> </button>
<% end %>
</div>
@@ -73,10 +73,12 @@
});
$('#back').on('click',function(){
if(cashier_type!='quick_service'){
if(cashier_type=='cashier'){
window.location.href = '/origami';
}else{
}else if(cashier_type=='quick_service'){
window.location.href = '/origami/quick_service';
}else{
window.location.href = '/origami/order_reservation';
}
});