diff --git a/README.md b/README.md index 43a2091e..0605a14a 100755 --- a/README.md +++ b/README.md @@ -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 diff --git a/app/assets/javascripts/channels/order_reservation.js b/app/assets/javascripts/channels/order_reservation.js index 605afe16..e3c06e47 100644 --- a/app/assets/javascripts/channels/order_reservation.js +++ b/app/assets/javascripts/channels/order_reservation.js @@ -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 = '' +''+rowCount +'' - +''+time + +''+requested_date +'' - +''+order.grand_total + +''+time + +'' + +''+order.grand_total +'' +'' +''+ order.status +'' diff --git a/app/controllers/api/order_reserve/order_reservation_controller.rb b/app/controllers/api/order_reserve/order_reservation_controller.rb index 61e89c39..81e12952 100644 --- a/app/controllers/api/order_reserve/order_reservation_controller.rb +++ b/app/controllers/api/order_reserve/order_reservation_controller.rb @@ -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 diff --git a/app/controllers/origami/dashboard_controller.rb b/app/controllers/origami/dashboard_controller.rb index f888ac57..8bdd5c27 100644 --- a/app/controllers/origami/dashboard_controller.rb +++ b/app/controllers/origami/dashboard_controller.rb @@ -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 diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb index 562eaaed..0d5d5277 100644 --- a/app/controllers/origami/order_reservation_controller.rb +++ b/app/controllers/origami/order_reservation_controller.rb @@ -1,7 +1,7 @@ class Origami::OrderReservationController < BaseOrigamiController def index - @order = OrderReservation.all + @order = OrderReservation.latest_order end def update diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index dbd1cbb1..5337bac5 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -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 diff --git a/app/models/order_reservation.rb b/app/models/order_reservation.rb index 3c401e31..296523cb 100644 --- a/app/models/order_reservation.rb +++ b/app/models/order_reservation.rb @@ -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" diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb index 1b6a554e..330c963f 100644 --- a/app/views/origami/dashboard/index.html.erb +++ b/app/views/origami/dashboard/index.html.erb @@ -18,6 +18,7 @@
+ <% if @quick_service == '1' %>
@@ -26,6 +27,7 @@
<%= t :quick_service %>
+ <% end %>
@@ -34,6 +36,7 @@
<%= t :dine_in_cashier %>
+ <% if @order_reservation == '1' %>
@@ -42,6 +45,7 @@
<%= t :order_reservation %>
+ <% end %>
<% if !@current_user.nil? && @current_user.role != 'waiter' %> diff --git a/app/views/origami/order_reservation/index.html.erb b/app/views/origami/order_reservation/index.html.erb index 15f173ce..87533715 100644 --- a/app/views/origami/order_reservation/index.html.erb +++ b/app/views/origami/order_reservation/index.html.erb @@ -31,10 +31,13 @@ <%=i%> - + + <%= order.requested_time.utc.getlocal.strftime("%d-%m-%Y") %> + + <%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %> - + <%=order.grand_total%> @@ -63,10 +66,13 @@ <%=i%> - + + <%= order.requested_time.utc.getlocal.strftime("%d-%m-%Y") %> + + <%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %> - + <%=order.grand_total%> @@ -94,10 +100,13 @@ <%=i%> - + + <%= order.requested_time.utc.getlocal.strftime("%d-%m-%Y") %> + + <%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %> - + <%=order.grand_total%> @@ -125,10 +134,13 @@ <%=i%> - + + <%= order.requested_time.utc.getlocal.strftime("%d-%m-%Y") %> + + <%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %> - + <%=order.grand_total%> diff --git a/app/views/print_settings/_form.html.erb b/app/views/print_settings/_form.html.erb index ae1f90c1..e07da111 100755 --- a/app/views/print_settings/_form.html.erb +++ b/app/views/print_settings/_form.html.erb @@ -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 %>