add order and reservation, quick service in lookups and add date and order by in order reservation

This commit is contained in:
phyusin
2018-04-25 15:07:43 +06:30
parent d0ad95c8d6
commit b41c85132d
10 changed files with 61 additions and 16 deletions

View File

@@ -188,6 +188,14 @@ Add Base URL for DOEMAL
1) settings/lookups => { type:order_reservation, name: BaseURL, value:'{doemal url}' }
2) settings/lookups => { type:order_reservation, name: Token, value:'{doemal token}' }
Add Feature for Quick Service
** '0' means can not use quick service and '1' means can use quick service **
=> settings/lookups => { type:quick_service, name: QuickService, value:'{0 or 1}' }
Add Feature for Order and Reservation
** '0' means can not use order reservation and '1' means can use order reservation **
=> settings/lookups => { type:order_reservation, name: OrderReservation, value:'{0 or 1}' }
* ToDo list
1. Migration

View File

@@ -18,13 +18,16 @@ App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
date.getMinutes() || '00'].join(':') +
(isPM ? ' PM' : 'AM');
var requested_date = date.getDate() + '-' + date.getMonth() + '-' + date.getFullYear()
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 width ="20%" class="align-center">'+requested_date
+'</td>'
+'<td width ="30%" class="align-center">'+order.grand_total
+'<td width ="20%" class="align-center">'+time
+'</td>'
+'<td width ="20%" class="align-center">'+order.grand_total
+'</td>'
+'<td width ="30%" class="align-center">'
+'<span class="font-10 col-blue">'+ order.status +'</span>'

View File

@@ -60,9 +60,9 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
order_reservation = OrderReservation.find(order_reservation_id)
# if ENV["SERVER_MODE"] != 'cloud'
# ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
# end
if flag #&& ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
end
if flag
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
else

View File

@@ -56,6 +56,22 @@ class Origami::DashboardController < BaseOrigamiController
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
@current_user = current_user
#quick service
quick_service = Lookup.collection_of('quick_service')
@quick_service = 0
if !quick_service[0].nil?
@quick_service = quick_service[0][1]
end
#order reservation
order_reservation = Lookup.collection_of('order_reservation')
@order_reservation = 0
if !order_reservation.empty?
order_reservation.each do |order_reserve|
if order_reserve[0] == 'OrderReservation'
@order_reservation = order_reserve[1]
end
end
end
end
end

View File

@@ -1,7 +1,7 @@
class Origami::OrderReservationController < BaseOrigamiController
def index
@order = OrderReservation.all
@order = OrderReservation.latest_order
end
def update

View File

@@ -6,7 +6,7 @@ class Origami::PaymentsController < BaseOrigamiController
def first_bill
sale_id = params[:sale_id] # sale_id
sale_data = Sale.find_by_sale_id(sale_id)
sale_items = SaleItem.where("sale_id=?",sale_id)
sale_items = SaleItem.select("sale_id,product_code,item_instance_code,product_name,product_alt_name,account_id,status,remark,SUM(qty) as qty,unit_price,taxable_price,price,is_taxable").where("sale_id=?",sale_id).group("item_instance_code,price")
member_info = nil
# For Cashier by Zone

View File

@@ -7,6 +7,8 @@ class OrderReservation < ApplicationRecord
has_many :order_reservation_items
belongs_to :delivery
scope :latest_order, -> { order("order_reservation_id desc, requested_time asc") }
SEND_TO_KITCHEN = "send_to_kitchen"
READY_TO_DELIVERY = "ready_to_deliver"
DELIVERED = "delivered"

View File

@@ -18,6 +18,7 @@
<!-- Widgets -->
<div class="row clearfix">
<% if @quick_service == '1' %>
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 qs_view">
<div class="info-box bg-purple">
<div class="icon" >
@@ -26,6 +27,7 @@
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :quick_service %></div>
</div>
</div>
<% end %>
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 cashier_view">
<div class="info-box bg-green">
<div class="icon" >
@@ -34,6 +36,7 @@
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_cashier %></div>
</div>
</div>
<% if @order_reservation == '1' %>
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 order_reservation">
<div class="info-box bg-blue">
<div class="icon" >
@@ -42,6 +45,7 @@
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :order_reservation %></div>
</div>
</div>
<% end %>
</div>
<!-- #END# Widgets -->
<% if !@current_user.nil? && @current_user.role != 'waiter' %>

View File

@@ -31,10 +31,13 @@
<td width ="5%" class="align-left">
<%=i%>
</td>
<td width ="30%" class="align-center">
<td width ="20%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%d-%m-%Y") %>
</td>
<td width ="20%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
</td>
<td width ="30%" class="align-center">
<td width ="20%" class="align-center">
<%=order.grand_total%>
</td>
<td width ="30%" class="align-center">
@@ -63,10 +66,13 @@
<td width ="5%" class="align-left">
<%=i%>
</td>
<td width ="30%" class="align-center">
<td width ="20%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%d-%m-%Y") %>
</td>
<td width ="20%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
</td>
<td width ="30%" class="align-center">
<td width ="20%" class="align-center">
<%=order.grand_total%>
</td>
<td width ="30%" class="align-center">
@@ -94,10 +100,13 @@
<td width ="5%" class="align-left">
<%=i%>
</td>
<td width ="30%" class="align-center">
<td width ="20%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%d-%m-%Y") %>
</td>
<td width ="20%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
</td>
<td width ="30%" class="align-center">
<td width ="20%" class="align-center">
<%=order.grand_total%>
</td>
<td width ="30%" class="align-center">
@@ -125,10 +134,13 @@
<td width ="5%" class="align-left">
<%=i%>
</td>
<td width ="30%" class="align-center">
<td width ="20%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%d-%m-%Y") %>
</td>
<td width ="20%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
</td>
<td width ="30%" class="align-center">
<td width ="20%" class="align-center">
<%=order.grand_total%>
</td>
<td width ="30%" class="align-center">

View File

@@ -16,7 +16,7 @@
<% 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 => [] %>
<%= f.input :printer_name %>
<% end %>
<%= f.input :brand_name %>
<%= f.input :printer_type %>