Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Aung Myo
2018-10-11 11:39:04 +06:30
8 changed files with 43 additions and 73 deletions

View File

@@ -10,14 +10,18 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
var hostname = location.hostname.trim();
if(data.from == "" || hostname == data.from)
{
table = data.table
time = data.time
table = data.table;
time = data.time;
// for Notificaiotn message
var element = "#notify-wrapper"
var class_name = "";
if(data.shift_ids != "" && data.shift_ids!=null){
if(data.shift_ids.length == 1){
class_name = ".shift_" + data.shift_ids;
}
}
var element = "#notify-wrapper" + class_name;
var animateEnter = "";
var animateExit = "";
if (time == 'print_error') {
var colorName = "alert-danger";
var placementFrom = "center";

View File

@@ -5,13 +5,23 @@ class Api::CallWaitersController < ActionController::API
@table_id = params[:dining_id]
@time = params[:time]
@table = DiningFacility.find(@table_id)
shift_ids = []
#for multiple zone with terminal
multiple_zone = CashierTerminalByZone.where("zone_id = #{@table.zone_id}")
multiple_zone.each do |zone|
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{zone.cashier_terminal_id}").first
if !shift.nil?
shift_ids.push(shift.id)
end
end
# CallWaiterJob.perform_later(@table,@time)
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain
else
from = ""
end
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time,from: from
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time,from: from, shift_ids: shift_ids
# get printer info
@shop = Shop.first
unique_code = "CallWaiterPdf"

View File

@@ -11,8 +11,8 @@ class Origami::HomeController < BaseOrigamiController
@customers = Customer.pluck("customer_id, name")
@shop = shop_detail
@occupied_table = DiningFacility.where("status='occupied'").count;
# @shift = ShiftSale.current_open_shift(current_user.id)
@occupied_table = DiningFacility.where("status='occupied'").count
@shift = ShiftSale.current_open_shift(current_user.id)
end
# origami table detail
@@ -24,6 +24,7 @@ class Origami::HomeController < BaseOrigamiController
@complete = Sale.completed_sale("cashier")
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@customers = Customer.pluck("customer_id, name")
@shift = ShiftSale.current_open_shift(current_user.id)
@status_order = ""
@status_sale = ""

View File

@@ -4,7 +4,7 @@ class Origami::RoomsController < BaseOrigamiController
@rooms = Room.unscoped.all.active.order('status desc')
@complete = Sale.completed_sale("cashier")
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
# @shift = ShiftSale.current_open_shift(current_user.id)
@shift = ShiftSale.current_open_shift(current_user.id)
@webview = false
if check_mobile
@webview = true
@@ -23,7 +23,8 @@ class Origami::RoomsController < BaseOrigamiController
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@customers = Customer.pluck("customer_id, name")
@room = DiningFacility.find(params[:room_id])
@shift = ShiftSale.current_open_shift(current_user.id)
@status_order = ""
@status_sale = ""
@sale_array = Array.new

View File

@@ -42,7 +42,7 @@
</section>
<!-- Notify -->
<div id="notify-wrapper"></div>
<div id="notify-wrapper" class="shift_<%= !@shift.nil? ? @shift.id : '' %>"></div>
<!-- Notify -->
<!-- Main Content -->

View File

@@ -670,24 +670,25 @@
</div>
<!-- customer light box -->
<div class="modal fade" id="is_paymemberModal" tabindex="-1" role="dialog">
<div class="modal fade m-t-40" id="is_paymemberModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title" id="is_paymemberModalLabel">Are you Member?</h1>
<!-- <h1 class="modal-title" id="is_paymemberModalLabel">Are you Member?</h1> -->
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
<input type="hidden" name="qr_code" id="qr_code" />
<div class="row text-center m-t-20">
<div class="row text-center m-t-20" align="center">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3"></div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_paymal_member">Card Member</button>
<button type="button" class="btn btn-lg btn-link bg-primary btn_paymal_member">Card</button>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<!-- <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_paymal_qr_code">QR Code</button>
</div>
</div> -->
</div>
</div>
<div class="modal-footer"></div>
@@ -705,11 +706,12 @@ var customer_id = "<%= @customer.id %>";
var customer_name = "<%= @customer.name %>";
var pdf_view = '<%=@pdf_view%>';
var trans_flag = <%= @trans_flag %>;
var paymalcount = <%= @paymalcount %>;
// console.log(pdf_view)
$(document).ready(function(){
<%if @cashier_type == "food_court" && @paymalcount == 0.0 %>
if(cashier_type == "food_court" && paymalcount == 0.0){
$("#is_paymemberModal").modal({show : true, backdrop : false, keyboard : false});
<% end %>
}
setHeaderBreadCrumb(_PAYMENTS_);
/* replace url type*/
@@ -808,9 +810,9 @@ var trans_flag = <%= @trans_flag %>;
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/"+url_param+"/others_payment";
return false;
}else{
<% if @paymalcount == 0.0 %>
if(paymalcount == 0.0){
$("#is_paymemberModal").modal({show : true, backdrop : false, keyboard : false});
<% end %>
}
}
});
@@ -1305,7 +1307,9 @@ var trans_flag = <%= @trans_flag %>;
// Read NFC card no from java
function getCardNo(){
code2lab.readNFC();
if(typeof code2lab != 'undefined'){
code2lab.readNFC();
}
}
// get CardNo from Java
@@ -1660,7 +1664,7 @@ var trans_flag = <%= @trans_flag %>;
});
// Read Card Reader
$(".btn_paymal_member").on('click', function(){
$(".btn_paymal_member").on('click', function (){
var cardNo = "";
var sale_id = $("#sale_id").text() || 0;
var receipt_no = "";

View File

@@ -1,24 +0,0 @@
class CreateReservations < ActiveRecord::Migration[5.1]
def change
create_table :reservations, :id => false do |t|
t.string :reservation_id, :limit => 16, :primary_key => true
t.string :source, :null => false, :default => "Cashier"
t.string :reservation_type, :null => false
t.string :customer_id, :null => false
t.datetime :checkin_datetime, :null => false
t.datetime :checkout_datetime
t.json :reservation_info
t.string :remark
t.string :status, :null => false, :default => "new"
t.datetime :action_at, :null => false
t.string :action_by, :null => false
t.datetime :modify_at
t.string :modify_by
t.timestamps
end
end
def down
drop_table :reservations
end
end

View File

@@ -1,26 +0,0 @@
class CreateReservationItems < ActiveRecord::Migration[5.1]
def change
create_table :reservation_items, :id => false do |t|
t.string :reservation_items_id, :limit => 16, :primary_key => true
t.string :reservation_id, foreign_key: true, :null => false, :limit => 16
t.string :item_status, :null => false, :default => "new"
t.string :item_code, :null => false
t.string :item_instance_code
t.string :item_name, :null => false
t.string :alt_name, :null => false
t.json :set_menu_items
t.integer :account_id, :limit => 8, :null => false, :default => 1
t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :unit_price, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :price, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.string :remark
t.string :options
t.boolean :taxable, :null => false, :default => true
t.timestamps
end
end
def down
drop_table :reservation_items
end
end