Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into r-1804001-01
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);
|
// console.log(data);
|
||||||
var delivery = data["delivery"];
|
var delivery = data["delivery"];
|
||||||
var items = data["order_items"];
|
var items = data["order_items"];
|
||||||
console.log(data)
|
|
||||||
var item_list = $('.summary-items');
|
var item_list = $('.summary-items');
|
||||||
item_list.empty();
|
item_list.empty();
|
||||||
|
|
||||||
@@ -158,7 +157,6 @@ console.log(data)
|
|||||||
data: {'order_id': order_id, 'status': status},
|
data: {'order_id': order_id, 'status': status},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
console.log(data);
|
|
||||||
if (data.status) {
|
if (data.status) {
|
||||||
swal({
|
swal({
|
||||||
title: 'Information',
|
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
|
||||||
@@ -41,6 +41,21 @@ class Api::ApiController < ActionController::API
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def website_connection(license)
|
||||||
|
default_connection.dup.update(:host => license.dbhost, :database => license.dbschema.to_s.downcase,
|
||||||
|
:username => license.dbusername, :password => license.dbpassword)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def reconnect_default_db
|
||||||
|
ActiveRecord::Base.establish_connection(Rails.env)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Regular database.yml configuration hash
|
||||||
|
def default_connection
|
||||||
|
@default_config ||= ActiveRecord::Base.connection.instance_variable_get("@config").dup
|
||||||
|
end
|
||||||
|
|
||||||
def cache_license(url, lookup)
|
def cache_license(url, lookup)
|
||||||
@license = License.new(url, lookup)
|
@license = License.new(url, lookup)
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,10 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
|||||||
|
|
||||||
if status == true
|
if status == true
|
||||||
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(params)
|
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
|
if flag
|
||||||
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
|
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -128,6 +128,9 @@ class Sale < ApplicationRecord
|
|||||||
self.save!
|
self.save!
|
||||||
|
|
||||||
#compute sales summary
|
#compute sales summary
|
||||||
|
if order_source.nil?
|
||||||
|
order_source = order.order_source
|
||||||
|
end
|
||||||
compute(order_source)
|
compute(order_source)
|
||||||
|
|
||||||
#Update the order items that is billed
|
#Update the order items that is billed
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<div class="tab-pane active" id="pending" role="tabpanel">
|
<div class="tab-pane active" id="pending" role="tabpanel">
|
||||||
<div class="card-block font-13">
|
<div class="card-block font-13">
|
||||||
<div id="menu-slimscroll" data-height="50">
|
<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>
|
<tbody>
|
||||||
<% i=1
|
<% i=1
|
||||||
@order.each do |order| %>
|
@order.each do |order| %>
|
||||||
|
|||||||
Reference in New Issue
Block a user