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

This commit is contained in:
Yan
2018-04-18 14:17:52 +06:30
19 changed files with 775 additions and 346 deletions

View File

@@ -0,0 +1,189 @@
$(function() {
$(".nav-item").on("click", function(){
type = $(this).attr("data-type");
refreshDetailData();
if (type == "pending") {
$(".first-1").click();
$('#accepted').text("Accepted");
$('#accepted').attr("data-value","accepted");
}else if(type == "processing"){
$(".second-1").click();
$('#accepted').text("SEND TO KITCHEN");
$('#accepted').attr("data-value","processed");
}else if(type == "delivery"){
$(".third-1").click();
$('#accepted').text("READY TO DELIVERY");
$('#accepted').attr("data-value","delivery");
}else if(type == "completed"){
$(".fourth-1").click();
$('#accepted').text("PICK-UP");
$('#accepted').attr("data-value","completed");
}
// console.log(type);
});
jQuery(function(){
jQuery('.first-1').click();
});
$(".custom-tr").on("click", function(){
$(".custom-tr").removeClass("tr-active");
$(this).addClass("tr-active");
var order_id = $(this).attr("data-id");
var sr_no = $(this).attr("data-sr-no");
var url = "order_reservation/get_order/"+order_id;
show_order_detail(url,sr_no);
});
function refreshDetailData(){
$("#sr_number").text("");
$("#delivery_info").text("");
$("#contact_info").text("");
$('.summary-items').html("");
$('#sub_total').text("0.00");
$('#delivery_fee').text("0.00");
$('#total_charges').text("0.00");
$('#total_tax').text("0.00");
$('#grand_total').text("0.00");
}
//show order list
function show_order_detail(url,sr_no){
$('.summary-items').html("");
//Start Ajax
$.ajax({
type: "GET",
url: url,
data: {},
dataType: "json",
success: function(data) {
// console.log(data);
var delivery = data["delivery"];
var items = data["order_items"];
var item_list = $('.summary-items');
item_list.empty();
if(items!=undefined && items!=""){
if(items.length > 0){
for(var i in items) {
var item_price = 0;
if(items[i].price > 0){
item_price = items[i].price;
}else{
item_price = items[i].unit_price;
}
var total = items[i].qty * item_price;
row = '<tr>'
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
+' <br><span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>'
+'</td>'
+'<td width ="30%" class="body-td align-right">'+ total +'</td>'
+'</tr>';
$('.summary-items').append(row);
}
$('#sub_total').text(data.total_amount);
$('#delivery_fee').text(delivery.delivery_fee);
$('#total_charges').text(0);
$('#total_tax').text(data.total_tax);
$('#grand_total').text(data.grand_total);
var address = delivery.address +', ' +delivery.township+", (" +delivery.direction_address+")"
$('#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);
if(delivery.provider == "direct_delivery"){
$("#delivery_info").text("(DELIVERY)");
}else if(delivery.provider == "self_pick_up"){
$("#delivery_info").text("(PICK-UP)");
}
if(data.order_remark!=null && data.order_remark!=""){
$("#order_remark").text(data.order_remark);
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
$("#order_remark").text(data.reservation_remark);
}
$("#sr_number").text("No."+sr_no);
$("#contact_info").text();
}
}
}
});
//end Ajax
}
$("#accepted").on("click", function(){
var status = $(this).attr("data-value");
var order_id = $('#order_id').text();
var ref_no = $('#ref_no').text();
var callback = $('#callback_url').text();
callback_url(callback,ref_no,order_id,status);
});
$("#cancel").on("click", function(){
var status = $(this).attr("data-value");
var order_id = $('#order_id').text();
var callback = $('#callback_url').text();
var ref_no = $('#ref_no').text();
callback_url(callback,ref_no,order_id,status);
});
function callback_url(callback,ref_no,order_id,status){
var url = 'order_reservation/update';
var post_url = "order_reservation/send_status";
$.ajax({
type: "POST",
url: post_url,
data: {url: callback, ref_no: ref_no, status: status},
dataType: "json",
success: function(data) {
if(data.status){
$.ajax({
type: "POST",
url: url,
data: {'order_id': order_id, 'status': status},
dataType: "json",
success: function(data) {
console.log(data);
if (data.status) {
swal({
title: 'Information',
text: "Order has been "+data.message,
type: 'success',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, 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';
});
}
}
});
}
});

View File

@@ -0,0 +1,88 @@
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
border-bottom: 2px solid #2196F3 ;
bottom: 2px ;
}
.nav-tabs .nav-link {
padding: 0.5286em .33em;
}
.nav-tabs li a.active {
color: #111 !important;
border-bottom: 0px solid #fff !important;
}
.nav-tabs .nav-link.active {
color: #111;
border-color: #fff;
}
.nav-tabs > li > a {
margin-right: 0px;
color:#fff !important;
}
.nav-tabs > li > a {
border-bottom: 2px solid #2196F3;
bottom: 2px;
}
.nav-tabs.tab-col-teal > li > a:before {
border-bottom: 0px solid #009688;
}
.nav-tabs .nav-item{
margin-bottom: 2px ;
}
.num{
color:#fff;
text-align: center;
margin-bottom: -1px !important;
}
.nav-tabs .nav-link.active > p{
color: #111;
border-color: #fff;
}
/*Custosm Class*/
.table .header-td{
border-top:0px solid !important;
border-bottom: 0px solid !important;
padding:3px 7px !important;
border-top:0px solid !important;
border-bottom: 0px solid !important;
}
.custom-card-block .table td:first-child,
.custom-card-block .table td:nth-child(2),
.custom-card-footer .table td:first-child,
.custom-card-footer .table td:nth-child(2){
border-top:0px solid !important;
}
.custom-card-footer .footer-td ,
.grand-card-footer .footer-td {
border-top:0px solid !important;
border-bottom:0px solid !important;
font-weight: bold;
padding:6px 10px;
}
.custom-card-header{
border-bottom: 1px solid #F8BBD0 !important;
padding:13px 5px !important;
}
.custom-card-footer{
border-top: 1px solid #F8BBD0 !important;
}
.custom-card-block,
.grand-card-footer,
.custom-card-footer{
padding :5px !important;
}
.custom-table{
background-color:#F3E5F5;
}
.custom-table tbody tr td,
.custom-table tbody tr th{
border-top: 1px solid #FFEBEE;
border-bottom: 1px solid #FFEBEE;
}
.tr-active{
background-color : #FFCDD2;
}

View File

@@ -111,7 +111,8 @@ class Origami::AddordersController < BaseOrigamiController
end
items_arr.push(items)
}
puts items_arr.to_json
puts "sssssssssssssssssssssss"
# begin
# if params[:order_source] == "quick_service"
# customer_id = "CUS-000000000002" # for no customer id from mobile

View File

@@ -71,35 +71,37 @@ class Origami::MovetableController < BaseOrigamiController
booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
if order.status == 'new'
if order.status == 'new'
order.order_items.each do |order_item|
order_items.push(order_item)
end
end
end
end
end
end
@get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
# get printer info
@from = (DiningFacility.find(change_from)).name
@to = (DiningFacility.find(change_to)).name
@type = (DiningFacility.find(change_to)).type
@moved_by = @current_user.name
@date = DateTime.now
@shop = Shop.first
unique_code = "MoveTablePdf"
pdf_no = PrintSetting.where(:unique_code => unique_code).count
#print_settings = PrintSetting.find_by_unique_code(unique_code)
printer_array = []
printer_array = PrintSetting.where(:unique_code => unique_code)
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# get printer info
@from = (DiningFacility.find(change_from)).name
@to = (DiningFacility.find(change_to)).name
@type = (DiningFacility.find(change_to)).type
@moved_by = @current_user.name
@date = DateTime.now
@shop = Shop.first
unique_code = "MoveTablePdf"
pdf_no = PrintSetting.where(:unique_code => unique_code).count
#print_settings = PrintSetting.find_by_unique_code(unique_code)
printer_array = []
printer_array = PrintSetting.where(:unique_code => unique_code)
for i in 0..pdf_no
if i != pdf_no
print_settings = printer_array[i]
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by,order_items)
for i in 0..pdf_no
if i != pdf_no
print_settings = printer_array[i]
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by,order_items)
end
end
end
end

View File

@@ -1,12 +1,58 @@
class Origami::OrderReservationController < BaseOrigamiController
def index
@webview = check_mobile
@shop = Shop::ShopDetail
@order = OrderReservation.all
end
def update
@id = params[:order_id]
@status = params[:status]
@order_reservation = OrderReservation.find(@id)
status = true
if status
if @status == "processed"
result = OrderReservation.create_doemal_order(@order_reservation,current_user)
elsif @status == "delivery"
OrderReservation.update_order_reservation(@id, nil, "ready_to_delivery")
response = OrderReservation.send_status_to_ordering(@order_reservation.callback_url,@order_reservation.transaction_ref,"ready_to_delivery")
result = {:status=> true, :message => "ready for delivery" }
elsif @status == "completed"
result = OrderReservation.update_doemal_payment(@order_reservation,current_user)
else
if @status == "cancel"
OrderReservation.update_order_reservation(@id, nil, "cancelled")
result = {:status=> true, :message => "rejected" }
else
OrderReservation.update_order_reservation(@id, nil, "accepted")
result = {:status=> true, :message => "accepted" }
end
end
render :json => result.to_json
else
result = {:status=> false, :message => "Order not accepted !" }
render :json => result.to_json
end
end
def get_order
if (params[:id])
@order = OrderReservation.find(params[:id])
return @order
end
end
def send_status
if params[:status] == "cancel"
status = "rejected"
else
status = params[:status]
end
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status)
render :json => response
end
end

View File

@@ -354,6 +354,11 @@ class Customer < ApplicationRecord
#new customer for doemal
def self.addCustomer(params)
if params[:gender] == "female"
gender = "Female"
else
gender = "Male"
end
customer = Customer.new
customer.name = params[:name]
customer.email = params[:email]

View File

@@ -7,13 +7,18 @@ class OrderReservation < ApplicationRecord
has_many :order_reservation_items
belongs_to :delivery
SEND_TO_KITCHEN = "send_to_kitchen"
READY_TO_DELIVERY = "ready_to_deliver"
DELIVERED = "delivered"
COMPLETED = "completed"
def self.addOrderReservationInfo(params)
check_order_reservation = OrderReservation.where("transaction_ref = ?",params[:reference])
if check_order_reservation.empty?
order_reservation = OrderReservation.new
order_reservation.order_reservation_type = params[:order_type]
order_reservation.customer_id = params[:cus_info]
order_reservation.requested_time = Time.parse(params[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S")
order_reservation.requested_time = DateTime.parse(params[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S")
order_reservation.callback_url = params[:callback_url]
order_reservation.transaction_ref = params[:reference]
if params[:order_info]
@@ -48,6 +53,206 @@ class OrderReservation < ApplicationRecord
end
end
def self.create_doemal_order(order,current_user)
is_extra_time = false
extra_time = ''
items_arr = []
count = 1
order.order_reservation_items.each { |i|
i.item_instance_code = i.item_instance_code.downcase.to_s
items = {"order_item_id": count,"item_instance_code": i.item_instance_code,"quantity": i.qty,"options": []}
count += 1
items_arr.push(items)
}
puts items_arr.to_json
puts "sssssssssssssssssssssss"
customer_id = order.customer_id
@order = Order.new
@order.source = "doemal_order"
@order.order_type = "delivery"
@order.customer_id = customer_id
@order.items = items_arr
@order.guest = ''
@order.table_id = nil # this is dining facilities's id
@order.new_booking = true
@order.waiters = current_user.name
@order.employee_name = current_user.name
@order.is_extra_time = is_extra_time
@order.extra_time = extra_time
@status, @booking = @order.generate
# Order.send_customer_view(@booking)
if @status && @booking
@status, @sale = Sale.request_bill(@order,current_user,current_user)
#order status send to doemal
callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,SEND_TO_KITCHEN)
#order reservation status updated
update_order_reservation(order.id, @sale.sale_id, SEND_TO_KITCHEN)
result = {:status=> @status, :data => @sale, :message => "created" }
return result
end
end
def self.update_doemal_payment(order,current_user)
if(Sale.exists?(order.sale_id))
saleObj = Sale.find(order.sale_id)
shop_details = Shop.first
# rounding adjustment
if shop_details.is_rounding_adj
a = saleObj.grand_total % 25 # Modulus
b = saleObj.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
#calculate rounding if modulus is zero or not zero and division are not even
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end
end
#end rounding adjustment
sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, current_user.name, saleObj.grand_total, "cash")
#order status send to doemal
callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,DELIVERED)
#order reservation status updated
update_order_reservation(order.id, saleObj.sale_id, DELIVERED)
result = {:status=> true, :message => DELIVERED }
return result
# rebate_amount = nil
# For Cashier by Zone
# bookings = Booking.where("sale_id='#{sale_id}'")
# if bookings[0].dining_facility_id.to_i > 0
# table = DiningFacility.find(bookings[0].dining_facility_id)
# cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
# cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
# else
# shift = ShiftSale.find(saleObj.shift_sale_id)
# cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
# end
# For Print
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
# unique_code = "ReceiptBillPdf"
# if !receipt_bill_a5_pdf.empty?
# receipt_bill_a5_pdf.each do |receipt_bilA5|
# if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
# if receipt_bilA5[1] == '1'
# unique_code = "ReceiptBillA5Pdf"
# else
# unique_code = "ReceiptBillPdf"
# end
# end
# end
# end
# customer= Customer.find(saleObj.customer_id)
# get member information
# rebate = MembershipSetting.find_by_rebate(1)
# credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
# if customer.membership_id != nil && rebate && credit_data.nil?
# member_info = Customer.get_member_account(customer)
# if member_info["status"] == true
# rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
# current_balance = SaleAudit.paymal_search(sale_id)
# end
# end
#orders print out
# if params[:type] == "quick_service"
# booking = Booking.find_by_sale_id(sale_id)
# if booking.dining_facility_id.to_i>0
# table_id = booking.dining_facility_id
# else
# table_id = 0
# end
# booking.booking_orders.each do |order|
# # Order.pay_process_order_queue(order.order_id, table_id)
# oqs = OrderQueueStation.new
# oqs.pay_process_order_queue(order.order_id, table_id)
# end
# end
#for card sale data
# card_data = Array.new
# card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
# if !card_sale_trans_ref_no.nil?
# card_sale_trans_ref_no.each do |cash_sale_trans|
# card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
# card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
# card_no = cash_sale_trans.pan.last(4)
# card_no = card_no.rjust(19,"**** **** **** ")
# card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
# end
# end
# get printer info
# print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
# discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
# printer = Printer::ReceiptPrinter.new(print_settings)
# filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
# render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
#end
end
end
def self.send_status_to_ordering(url,ref_no,status)
base_url = "http://192.168.1.186:3002"
post_url = base_url + url
begin
response = HTTParty.post(post_url,
:body => { id: ref_no, status: status}.to_json,
:headers => {
'Authorization' => 'Token token=3T-tnlYtFJ-5Z1vY6XQqxQ',
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3'
}, :timeout => 10
)
rescue Net::OpenTimeout
response = { status: false }
rescue OpenURI::HTTPError
response = { status: false}
rescue SocketError
response = { status: false}
end
Rails.logger.debug "Get Doemal Status "
Rails.logger.debug response.to_json
return response
end
def self.update_order_reservation(id, sale_id, status)
order_reservation = OrderReservation.find(id)
if sale_id.present?
order_reservation.sale_id = sale_id
end
order_reservation.status = status
order_reservation.save
end
private
def generate_custom_id
self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "ODRS")

View File

@@ -488,7 +488,9 @@
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<% end %>
<% if current_login_employee.role != "waiter" %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<% end %>
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<% if !@split_bill.nil? %>

View File

@@ -0,0 +1,15 @@
json.id item.order_reservation_items_id
json.order_id item.order_reservation_id
json.item_status item.item_status
json.item_code item.item_code
json.item_instance_code item.item_instance_code
json.item_name item.item_name
json.alt_name item.alt_name
json.set_menu_items item.set_menu_items
json.account_id item.account_id
json.qty item.qty
json.unit_price item.unit_price
json.price item.price
json.remark item.remark
json.options item.options
json.taxable item.taxable

View File

@@ -0,0 +1,25 @@
if @order
json.(@order, :order_reservation_id,:order_reservation_type,:customer_id,
:requested_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type,
:payment_status,:payment_ref,:total_amount,:total_tax,
:discount_amount,:grand_total,:status,:order_remark,
:reservation_remark)
@delivery = Delivery.find_by_order_reservation_id(@order.order_reservation_id)
if @delivery
json.delivery do |json|
# json.(@article.author, :id, :name)
json.(@delivery, :provider,:delivery_type,:township,
:address,:direction_address,:delivery_fee,:remark)
end
end
if @order.order_reservation_items
json.order_items @order.order_reservation_items do |item|
json.partial! 'origami/order_reservation/order_item', item: item
end
end
@customer = Customer.find(@order.customer_id)
json.customer_name @customer.name
json.phone @customer.contact_no
end

View File

@@ -1,17 +1,19 @@
<%= stylesheet_link_tag 'order_reservation', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'order_reservation', 'data-turbolinks-track': 'reload' %>
<div class="container-fluid">
<div class="row m-t--10">
<div class="col-lg-4 col-md-4 col-sm-4" style="margin:0px 0px 0px -5px !important ">
<ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item active" data-color="#F44336" style="background-color: #F44336;">
<a class="nav-link" data-toggle="tab" href="#pending" role="tab"><p class="num">4</p> <%= t :pending %></a>
<li class="nav-item active" data-color="#F44336" data-type="pending" style="background-color: #F44336;">
<a class="nav-link" data-toggle="tab" href="#pending" role="tab"><p class="num">1</p> <%= t :pending %></a>
</li>
<li class="nav-item" data-color="#673AB7" style="background-color: #673AB7;">
<a class="nav-link" data-toggle="tab" href="#processing" role="tab"><p class="num">4</p> <%= t :processing %></a>
<li class="nav-item" data-color="#673AB7" data-type="processing" style="background-color: #673AB7;">
<a class="nav-link" data-toggle="tab" href="#processing" role="tab"><p class="num">2</p> <%= t :processing %></a>
</li>
<li class="nav-item" data-color="#009688" style="background-color: #009688;">
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><p class="num">4</p> <%= t :delivering %></a>
<li class="nav-item" data-color="#009688" data-type="delivery" style="background-color: #009688;">
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><p class="num">3</p> <%= t :delivering %></a>
</li>
<li class="nav-item" data-color="#03A9F4" style="background-color: #03A9F4;">
<li class="nav-item" data-color="#03A9F4" data-type="completed" style="background-color: #03A9F4;">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><p class="num">4</p> <%= t :completed %></a>
</li>
</ul>
@@ -22,62 +24,26 @@
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table">
<tbody>
<tr>
<td width ="5%" class="align-left">
1
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
2
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
3
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
4
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<% i=1
@order.each do |order| %>
<% if order.status == 'new' %>
<tr class="custom-tr first-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
<td width ="5%" class="align-left">
<%=i%>
</td>
<td width ="30%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
</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>
<%i+=1%>
<%end%>
<%end%>
</tbody>
</table>
</div>
@@ -90,35 +56,26 @@
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table">
<tbody>
<tr>
<td width ="5%" class="align-left">
1
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
2
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<% i=1
@order.each do |order| %>
<% if order.status == 'accepted' %>
<tr class="custom-tr second-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
<td width ="5%" class="align-left">
<%=i%>
</td>
<td width ="30%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
</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>
<%i+=1%>
<%end%>
<%end%>
</tbody>
</table>
</div>
@@ -130,49 +87,26 @@
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table">
<tbody>
<tr>
<td width ="5%" class="align-left">
1
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
2
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
3
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<% i=1
@order.each do |order| %>
<% if order.status == 'send_to_kitchen' %>
<tr class="custom-tr third-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
<td width ="5%" class="align-left">
<%=i%>
</td>
<td width ="30%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
</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>
<%i+=1%>
<%end%>
<%end%>
</tbody>
</table>
</div>
@@ -184,35 +118,26 @@
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table">
<tbody>
<tr>
<td width ="5%" class="align-left">
1
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
3
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<% i=1
@order.each do |order| %>
<% if order.status == 'ready_to_delivery' %>
<tr class="custom-tr fourth-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
<td width ="5%" class="align-left">
<%=i%>
</td>
<td width ="30%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
</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>
<%i+=1%>
<%end%>
<%end%>
</tbody>
</table>
</div>
@@ -227,59 +152,25 @@
<div class="card-header custom-card-header" style="color:">
<table class="table">
<tr>
<td width ="70%" class="header-td align-left"><b class="col-pink font-16">No.11</b>
<span class="font-13">(DELIVERY)</span>
<td width ="70%" class="header-td align-left">
<b class="col-pink font-16"><span id="sr_number"></span> </b>
<span class="font-13"><span id="delivery_info"></span></span>
</td>
<td width ="30%" class="header-td font-16 align-right"><b>0065 4321</b></td>
<td width ="30%" class="header-td font-16 align-right"><b><span id="contact_info">0065 4321</span></b></td>
</tr>
</table>
</div>
<div class="card-block custom-card-block">
<div id="order-detail-slimscroll" data-height="220">
<table class="table">
<table class="table summary-items">
<tbody>
<tr>
<!-- <tr>
<td width ="70%" class="body-td align-left">
MENU ITEM 01
<br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td>
<td width ="30%" class="body-td align-right">1400.00</td>
</tr>
<tr>
<td width ="70%" class="body-td align-left">
MENU ITEM 01
<br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td>
<td width ="30%" class="body-td align-right">1400.00</td>
</tr>
<tr>
<td width ="70%" class="body-td align-left">
MENU ITEM 01
<br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td>
<td width ="30%" class="body-td align-right">1400.00</td>
</tr>
<tr>
<td width ="70%" class="body-td align-left">
MENU ITEM 01
<br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td>
<td width ="30%" class="body-td align-right">1400.00</td>
</tr>
<tr>
<td width ="70%" class="body-td align-left">
MENU ITEM 01
<br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td>
<td width ="30%" class="body-td align-right">1400.00</td>
</tr>
<tr>
<td width ="70%" class="body-td align-left">
MENU ITEM 01
<br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td>
<td width ="30%" class="body-td align-right">1400.00</td>
</tr>
</tr> -->
</tbody>
</table>
</div>
@@ -288,28 +179,28 @@
<table class="table">
<tbody>
<tr>
<td width ="70%" class="footer-td align-left">
<td width ="70%" class="footer-td align-left" >
SUB TOTAL
</td>
<td width ="30%" class="footer-td align-right">1400.00</td>
<td width ="30%" class="footer-td align-right" id="sub_total">0.00</td>
</tr>
<tr>
<td width ="70%" class="footer-td align-left">
DELIVERY FEES (PICK-UP)
</td>
<td width ="30%" class="footer-td align-right">1400.00</td>
<td width ="30%" class="footer-td align-right" id="delivery_fee">0.00</td>
</tr>
<tr>
<td width ="70%" class="footer-td align-left">
CONVENIENCE CHARGES
</td>
<td width ="30%" class="footer-td align-right">1400.00</td>
<td width ="30%" class="footer-td align-right" id="total_charges">0.00</td>
</tr>
<tr>
<td width ="70%" class="footer-td align-left">
GOVERNMENT TAX
</td>
<td width ="30%" class="footer-td align-right">1400.00</td>
<td width ="30%" class="footer-td align-right" id="total_tax">0.00</td>
</tr>
</tbody>
</table>
@@ -321,14 +212,30 @@
<td width ="70%" class="footer-td align-left col-blue">
GRAND TOTAL
</td>
<td width ="30%" class="footer-td align-right col-blue">1400.00</td>
<td width ="30%" class="footer-td align-right col-blue" id="grand_total">0.00</td>
</tr>
<tr>
<td colspan="2" id="order_remark"></td>
</tr>
<tr>
<td width ="50%" class="footer-td align-left col-blue">
<button type="button" class="btn btn-lg bg-blue waves-effect" data-dismiss="modal"><strong>DECLINE</strong></button>
<button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="cancel">
<strong>DECLINE</strong>
</button>
</td>
<td width ="50%" class="footer-td align-right col-blue">
<button type="button" class="btn btn-lg bg-blue waves-effect" data-dismiss="modal"><strong>ACCEPT</strong></button>
<button type="button" class="btn btn-lg bg-blue waves-effect " id="accepted" data-value="accepted">
ACCEPT
</button>
<!-- <button type="button" class="btn btn-lg bg-blue waves-effect hidden" id="accepted" data-value="delivery">
<strong>SEND TO KITCHEN</strong>
</button>
<button type="button" class="btn btn-lg bg-blue waves-effect hidden" id="accepted" data-value="completed">
<strong>READY TO DELIVERY</strong>
</button>
<button type="button" class="btn btn-lg bg-blue waves-effect hidden" id="accepted" data-value="pick-up">
<strong>PICK UP</strong>
</button> -->
</td>
</tr>
</tbody>
@@ -353,119 +260,41 @@
<tr>
<td class="body-td align-left">
<span class="font-13">NAME</span><br>
<b>DAW AYE AYE</b>
<b id="customer_name"></b>
</td>
</tr>
<tr>
<td class="body-td align-left">
<span class="font-13">PHONE</span><br>
<b>09 8765 4321 098</b>
<b id="phone"></b>
</td>
</tr>
<tr>
<td class="body-td align-left">
<span class="font-13">ADDRESS</span><br>
<b>No. (12), 3rd floor, zay kyee Street, kyi myin dine
infront of Nya Zay Main Entrance</b>
<b id="address"></b>
</td>
</tr>
<tr>
<td class="body-td align-left">
<span class="font-13">DELEVER TO</span><br>
<b>HOME</b>
<span class="font-13">DELEVERY</span><br>
<b id="delivery_to"></b>
</td>
</tr>
</tbody>
</table>
</table>
</div>
</div>
</div>
</div>
</div>
<style type="text/css">
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
border-bottom: 2px solid #2196F3 ;
bottom: 2px ;
}
<p id="ref_no" class="hidden"></p>
<p id="callback_url" class="hidden"></p>
<p id="order_id"></p>
<p id="status" class="hidden"></p>
<script type="text/javascript">
jQuery(function(){
jQuery('.first-1').click();
});
.nav-tabs .nav-link {
padding: 0.5286em .33em;
}
.nav-tabs li a.active {
color: #111 !important;
border-bottom: 0px solid #fff !important;
}
.nav-tabs .nav-link.active {
color: #111;
border-color: #fff;
}
.nav-tabs > li > a {
margin-right: 0px;
color:#fff !important;
}
.nav-tabs > li > a {
border-bottom: 2px solid #2196F3;
bottom: 2px;
}
.nav-tabs.tab-col-teal > li > a:before {
border-bottom: 0px solid #009688;
}
.nav-tabs .nav-item{
margin-bottom: 2px ;
}
.num{
color:#fff;
text-align: center;
margin-bottom: -1px !important;
}
.nav-tabs .nav-link.active > p{
color: #111;
border-color: #fff;
}
/*Custosm Class*/
.table .header-td{
border-top:0px solid !important;
border-bottom: 0px solid !important;
padding:3px 7px !important;
border-top:0px solid !important;
border-bottom: 0px solid !important;
}
.custom-card-block .table td:first-child,
.custom-card-block .table td:nth-child(2),
.custom-card-footer .table td:first-child,
.custom-card-footer .table td:nth-child(2){
border-top:0px solid !important;
}
.custom-card-footer .footer-td ,
.grand-card-footer .footer-td {
border-top:0px solid !important;
border-bottom:0px solid !important;
font-weight: bold;
padding:5px 10px;
}
.custom-card-header{
border-bottom: 1px solid #F8BBD0 !important;
padding:13px 5px !important;
}
.custom-card-footer{
border-top: 1px solid #F8BBD0 !important;
}
.custom-card-block,
.grand-card-footer,
.custom-card-footer{
padding :5px !important;
}
.custom-table{
background-color:#F3E5F5;
}
.custom-table tbody tr td,
.custom-table tbody tr th{
border-top: 1px solid #FFEBEE;
border-bottom: 1px solid #FFEBEE;
}
</style>
</script>

View File

@@ -437,10 +437,12 @@
<div class="row m-b-10 m-r-30">
<div class="col-md-5 m-r-20">
<button type="button" class="btn btn-link bg-red waves-effect print_receipt">Print</button>
<% if ENV["SERVER_MODE"] != "cloud" %>
<button type="button" class="btn btn-link bg-red waves-effect print_receipt">Print</button>
<% end %>
</div>
<div class="col-md-5">
<div class="col-md-5 m-r-20">
<button type="button" class="btn btn-link bg-blue waves-effect btn_pdf_close" data-dismiss="modal">CLOSE</button>
</div>
</div>

View File

@@ -9,12 +9,12 @@
<div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :child, input_html: { value: @survey_data.child, class: 'col-md-10' }%>
<%= f.input :child, input_html: { value: @survey_data.child, class: 'col-md-10', :onChange => "total_customer();" }%>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :adult, input_html: { value: @survey_data.adult, class: 'col-md-10' }%>
<%= f.input :adult, input_html: { value: @survey_data.adult, class: 'col-md-10', :onChange => "total_customer();" }%>
</div>
</div>
</div>
@@ -30,7 +30,7 @@
</div>
</div>
</div>
<%= f.input :total_customer, input_html: { value: @survey_data.total_customer, class: 'col-md-11'} %>
<%= f.input :total_customer, input_html: { value:@survey_data.total_customer , :readonly => true, class: 'col-md-11'} %>
<%= f.input :local , input_html: { value: @survey_data.local, class: 'col-md-11' }%>
<!--<fieldset style="border: 1px solid #BDBDBD;padding: 20px; width: 92%;margin: 20px 0 20px 0;"> -->
<!-- <legend style="font-size: 1.2em !important;font-weight: bold !important;text-align: left !important;border:none;width:100px;">Foreigner</legend> -->
@@ -67,12 +67,12 @@
<div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :child , input_html: { class: 'col-md-10' }%>
<%= f.input :child , input_html: { class: 'col-md-10' , :onChange => "total_customer();"}%>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :adult , input_html: { class: 'col-md-10' }%>
<%= f.input :adult , input_html: { class: 'col-md-10' , :onChange => "total_customer();"}%>
</div>
</div>
</div>
@@ -88,7 +88,7 @@
</div>
</div>
</div>
<%= f.input :total_customer, input_html: { class: 'col-md-11'} %>
<%= f.input :total_customer, input_html: { :readonly => true, class: 'col-md-11'} %>
<%= f.input :local , input_html: { class: 'col-md-11' }%>
<fieldset style="border: 1px solid #BDBDBD;padding: 20px; width: 92%;margin: 20px 0 20px 0;">
@@ -457,4 +457,11 @@ var cashier_type = "<%= @cashier_type %>";
});
}
}
function total_customer(){
var child = $("#survey_child").val() || 0;
var adult = $("#survey_adult").val() || 0;
var result = parseInt(child) + parseInt(adult);
$("#survey_total_customer").val(result);
}
</script>

View File

@@ -13,14 +13,10 @@
<%= f.input :header_font_size %>
<%= f.input :item_font_size %>
<%
if(@server_mode != 'cloud')
%>
<% if(@server_mode != 'cloud') %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<%
else
%>
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: false %>
<% else %>
<%= f.input :printer_name %>
<% end %>
<%= f.input :brand_name %>
<%= f.input :printer_type %>

View File

@@ -37,7 +37,7 @@ Rails.application.config.assets.precompile += %w( CRM.js )
# --- Image Uploader ----
Rails.application.config.assets.precompile += %w( fileinput.min.js )
# --- Customer/ Customer - Crm ----
# --- Add order/ Add order - Crm ----
Rails.application.config.assets.precompile += %w( addorder.css )
Rails.application.config.assets.precompile += %w( addorder.js )
@@ -53,4 +53,9 @@ Rails.application.config.assets.precompile += %w( sx-sidebar.css )
Rails.application.config.assets.precompile += %w( inventory_definitions.css )
Rails.application.config.assets.precompile += %w( inventory.js )
# --- Customer/ Customer - Crm ----
Rails.application.config.assets.precompile += %w( order_reservation.css )
Rails.application.config.assets.precompile += %w( order_reservation.js )

View File

@@ -75,6 +75,10 @@ en:
dine_in_cashier: "Dine-in Cashier"
quick_service: "Quick Service"
order_reservation: "Order & Reservation"
pending: "Pending"
processing: "Processing"
delivering: "Delivering"
completed: "Completed"
views:
btn:

View File

@@ -70,6 +70,10 @@ mm:
dine_in_cashier: "Dine-in Cashier"
quick_service: "Quick Service"
order_reservation: "Order & Reservation"
pending: "Pending"
processing: "Processing"
delivering: "Delivering"
completed: "Completed"
views:
btn:

View File

@@ -268,6 +268,9 @@ scope "(:locale)", locale: /en|mm/ do
#order and reservation
resources :order_reservation
get 'order_reservation/get_order/:id' => "order_reservation#get_order",:as => "get_order", :defaults => { :format => 'json' }
post 'order_reservation/update', to: "order_reservation#update" , :defaults => { :format => 'json' }
post 'order_reservation/send_status', to: "order_reservation#send_status", :defaults => { :format => 'json' }
end
#--------- Waiter/Ordering Station ------------#

View File

@@ -7,6 +7,7 @@ class CreateOrderReservations < ActiveRecord::Migration[5.1]
t.datetime :requested_time, :null => false
t.string :callback_url, :null => false
t.string :transaction_ref, :null => false
t.string :sale_id
t.integer :item_count, :null => false, :default => 0
t.integer :total_customer
t.string :payment_type