Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
38
app/assets/javascripts/channels/order_reservation.js
Normal file
38
app/assets/javascripts/channels/order_reservation.js
Normal file
@@ -0,0 +1,38 @@
|
||||
App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
|
||||
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
|
||||
|
||||
connected: function() {},
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
received: function(data) {
|
||||
var order = data.data;
|
||||
var rowCount = $('.order_reserve_cable tbody tr').length+1;
|
||||
|
||||
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');
|
||||
|
||||
row = '<tr class="custom-tr first-'+rowCount+'" style="" data-id="'+order.order_reservation_id+'" data-sr-no="'+rowCount+'">'
|
||||
+'<td width ="5%" class="align-left">'+rowCount
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="align-center">'+time
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="align-center">'+order.grand_total
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="align-center">'
|
||||
+'<span class="font-10 col-blue">'+ order.status +'</span>'
|
||||
+'</td>'
|
||||
+' </tr>'
|
||||
|
||||
$('.order_reserve_cable tbody').append(row);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -62,7 +62,6 @@ $(function() {
|
||||
// console.log(data);
|
||||
var delivery = data["delivery"];
|
||||
var items = data["order_items"];
|
||||
console.log(data)
|
||||
var item_list = $('.summary-items');
|
||||
item_list.empty();
|
||||
|
||||
@@ -158,7 +157,6 @@ console.log(data)
|
||||
data: {'order_id': order_id, 'status': status},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
if (data.status) {
|
||||
swal({
|
||||
title: 'Information',
|
||||
|
||||
10
app/channels/order_reservation_channel.rb
Normal file
10
app/channels/order_reservation_channel.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class OrderReservationChannel < ApplicationCable::Channel
|
||||
def subscribed
|
||||
stream_from "order_reservation_channel"
|
||||
end
|
||||
|
||||
def unsubscribed
|
||||
stop_all_streams
|
||||
# Any cleanup needed when channel is unsubscribed
|
||||
end
|
||||
end
|
||||
@@ -57,6 +57,10 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
||||
|
||||
if status == true
|
||||
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(params)
|
||||
|
||||
order_reservation = OrderReservation.find(order_reservation_id)
|
||||
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
|
||||
|
||||
if flag
|
||||
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
|
||||
else
|
||||
|
||||
@@ -92,7 +92,8 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
||||
if customer.membership_id != nil && rebate
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer,sale.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
# current_balance = SaleAudit.paymal_search(sale_id)
|
||||
current_balance = 0
|
||||
end
|
||||
|
||||
# get printer info
|
||||
|
||||
@@ -128,6 +128,9 @@ class Sale < ApplicationRecord
|
||||
self.save!
|
||||
|
||||
#compute sales summary
|
||||
if order_source.nil?
|
||||
order_source = order.source
|
||||
end
|
||||
compute(order_source)
|
||||
|
||||
#Update the order items that is billed
|
||||
|
||||
@@ -84,7 +84,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
#start for individual payment
|
||||
if !sale_data.equal_persons.nil?
|
||||
individual_payment(sale_data, printer_settings.precision, delimiter)
|
||||
individual_payment(sale_data,sale_data.equal_persons, printer_settings.precision, delimiter)
|
||||
end
|
||||
#end for individual payment
|
||||
|
||||
@@ -487,7 +487,8 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
#individual payment per person
|
||||
def individual_payment(sale_data, survey, precision, delimiter)
|
||||
per_person = sale_data.grand_total.to_f / survey.total_customer.to_i
|
||||
# per_person = sale_data.grand_total.to_f / survey.total_customer.to_i
|
||||
per_person = sale_data.grand_total.to_f / survey.to_i
|
||||
stroke_horizontal_rule
|
||||
move_down line_move
|
||||
y_position = cursor
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<div class="tab-pane active" id="pending" role="tabpanel">
|
||||
<div class="card-block font-13">
|
||||
<div id="menu-slimscroll" data-height="50">
|
||||
<table class="table table-stripe custom-table">
|
||||
<table class="table table-stripe custom-table order_reserve_cable">
|
||||
<tbody>
|
||||
<% i=1
|
||||
@order.each do |order| %>
|
||||
|
||||
@@ -523,14 +523,24 @@ var customer_name = "<%= @customer.name %>";
|
||||
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
||||
console.log(payment_type)
|
||||
if (member_id && member_discount) {
|
||||
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
||||
$("#credit_payment").hide();
|
||||
} else{
|
||||
$("#credit_payment").show();
|
||||
}
|
||||
|
||||
if(parseInt(jQuery.inArray("MPU", payment_type)) !=-1 || parseInt(jQuery.inArray("VISA", payment_type)) !=-1 || parseInt(jQuery.inArray("JCB", payment_type)) !=-1 || parseInt(jQuery.inArray("Master", payment_type)) !=-1 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) !=-1 || parseInt(jQuery.inArray("Redeem", payment_type)) !=-1, parseInt(jQuery.inArray("PAYMAL", payment_type)) !=-1 || parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) !=-1 || parseInt(jQuery.inArray("Alipay", payment_type)) !=-1 || parseInt(jQuery.inArray("DINGA", payment_type)) !=-1){
|
||||
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 ||
|
||||
parseInt(jQuery.inArray("Master", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("UNIONPAY", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("Redeem", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("Alipay", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("DINGA", payment_type)) != -1){
|
||||
$("#card_payment").show();
|
||||
} else{
|
||||
$("#card_payment").hide();
|
||||
|
||||
@@ -361,7 +361,7 @@ $('#pay').on('click',function() {
|
||||
$('#back').on('click',function(){
|
||||
var lookup_split_bill = '<%= @split_bill %>';
|
||||
if(lookup_split_bill == '1'){
|
||||
window.location.href = '/origami/table/<%= @table.id %>/split_bills';
|
||||
window.location.href = '/origami/table/<%= @table.id %>/cashier/split_bills';
|
||||
}else{
|
||||
window.location.href = '/origami/table/<%= @table.id %>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user