diff --git a/app/assets/javascripts/channels/call_waiter.js b/app/assets/javascripts/channels/call_waiter.js
new file mode 100644
index 00000000..a623fb10
--- /dev/null
+++ b/app/assets/javascripts/channels/call_waiter.js
@@ -0,0 +1,61 @@
+App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
+// App.messages = App.cable.subscriptions.create('MessagesChannel', {
+
+ connected: function() {},
+
+ disconnected: function() {},
+
+ received: function(data) {
+ console.log(data.table);
+ console.log(data.time);
+ table = data.table
+ // for Notificaiotn message
+ var placementFrom = "top";
+ var placementAlign = "center";
+ var animateEnter = "";
+ var animateExit = "";
+ var colorName = "alert-warning";
+ var text = " Calling Waiter
"+table.name ;
+
+ if (text != null || colorName != null){
+ showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
+ }
+
+ function showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit) {
+ if (colorName === null || colorName === '') { colorName = 'bg-black'; }
+ if (animateEnter === null || animateEnter === '') { animateEnter = 'animated fadeInDown'; }
+ if (animateExit === null || animateExit === '') { animateExit = 'animated fadeOutUp'; }
+ var allowDismiss = true;
+ $.notify({
+ message: text
+ },
+ {
+ type: colorName,
+ newest_on_top: true,
+ allow_dismiss: allowDismiss,
+ newest_on_top: true,
+ timer: 200000000000000,
+ placement: {
+ from: placementFrom,
+ align: placementAlign
+ },
+ animate: {
+ enter: animateEnter,
+ exit: animateExit
+ },
+ template: '
' +
+ '
' +
+ '
' +
+ '
{1} ' +
+ '
{2}' +
+ '
' +
+ '
' +
+ '
'
+ });
+ }
+ //end Notificaiotn message
+ }
+});
+
diff --git a/app/assets/stylesheets/reset.css b/app/assets/stylesheets/reset.css
index e118c9f8..02688d2e 100644
--- a/app/assets/stylesheets/reset.css
+++ b/app/assets/stylesheets/reset.css
@@ -265,5 +265,13 @@ section.content {
color: #F44336;
}
+
+/*notification */
+.alert {
+ padding: .25rem .25rem !important;
+}
+.alert-dismissible .close {
+ padding: 0.2rem 0.24rem;
+}
/* End Reset Theme */
/* *************************************************** */
\ No newline at end of file
diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb
index b2cb741f..89fe509d 100755
--- a/app/channels/application_cable/channel.rb
+++ b/app/channels/application_cable/channel.rb
@@ -15,4 +15,9 @@ module ApplicationCable
class BillChannel < ActionCable::Channel::Base
end
+
+ # Call Waiter Channel
+ class CallWaiterChannel < ActionCable::Channel::Base
+
+ end
end
diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb
index 9da60bf4..4efdb70d 100755
--- a/app/channels/application_cable/connection.rb
+++ b/app/channels/application_cable/connection.rb
@@ -1,7 +1,7 @@
module ApplicationCable
class Connection < ActionCable::Connection::Base
def connect
- logger.add_tags "ActionCable"
+ logger.add_tags "SX-ActionCable"
end
end
end
diff --git a/app/channels/call_waiter_channel.rb b/app/channels/call_waiter_channel.rb
new file mode 100644
index 00000000..53eb7e61
--- /dev/null
+++ b/app/channels/call_waiter_channel.rb
@@ -0,0 +1,14 @@
+class CallWaiterChannel < ApplicationCable::Channel
+ def subscribed
+ stream_from "call_waiter_channel"
+ end
+
+ def unsubscribed
+ stop_all_streams
+ # Any cleanup needed when channel is unsubscribed
+ end
+
+ def order(message)
+ # ToDo
+ end
+end
\ No newline at end of file
diff --git a/app/controllers/api/call_waiters_controller.rb b/app/controllers/api/call_waiters_controller.rb
new file mode 100644
index 00000000..2c45bbbe
--- /dev/null
+++ b/app/controllers/api/call_waiters_controller.rb
@@ -0,0 +1,12 @@
+class Api::CallWaitersController < ActionController::API
+
+ #List all active customers by name
+ def index
+ @table_id = params[:dining_id]
+ @time = params[:time]
+ @table = DiningFacility.find(@table_id)
+ CallWaiterJob.perform_later(@table,@time)
+ end
+
+
+end
diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb
index 254bb423..9564bfe1 100755
--- a/app/controllers/reports/receipt_no_controller.rb
+++ b/app/controllers/reports/receipt_no_controller.rb
@@ -22,9 +22,6 @@ authorize_resource :class => false
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
@tax_profiles = TaxProfile.order('order_by asc')
-puts @sale_data.count
-puts "sssssss"
-puts @tax_profiles.to_json
@from = from
@to = to
diff --git a/app/controllers/reports/saleitem_controller.rb b/app/controllers/reports/saleitem_controller.rb
index 428bf9d7..18c86d92 100755
--- a/app/controllers/reports/saleitem_controller.rb
+++ b/app/controllers/reports/saleitem_controller.rb
@@ -17,6 +17,8 @@ class Reports::SaleitemController < BaseReportController
end
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED)
+ @sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
+puts @sale_taxes.to_json
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
diff --git a/app/jobs/call_waiter_job.rb b/app/jobs/call_waiter_job.rb
new file mode 100644
index 00000000..89c1b9ae
--- /dev/null
+++ b/app/jobs/call_waiter_job.rb
@@ -0,0 +1,8 @@
+class CallWaiterJob < ApplicationJob
+ queue_as :default
+
+ def perform(table,time)
+ ActionCable.server.broadcast "call_waiter_channel",table: table,time:time
+ # Rails.logger.debug "Testing: I'm performing my job with arguments: #{table}"
+ end
+end
diff --git a/app/views/api/call_waiters/index.json.jbuilder b/app/views/api/call_waiters/index.json.jbuilder
new file mode 100644
index 00000000..9173b340
--- /dev/null
+++ b/app/views/api/call_waiters/index.json.jbuilder
@@ -0,0 +1,6 @@
+if (@table)
+ json.table_id @table.id
+ json.name @table.name
+ json.type @table.type
+ json.time @time
+end
\ No newline at end of file
diff --git a/app/views/reports/saleitem/index.html.erb b/app/views/reports/saleitem/index.html.erb
index 8a36d9e9..2999a0cf 100644
--- a/app/views/reports/saleitem/index.html.erb
+++ b/app/views/reports/saleitem/index.html.erb
@@ -60,7 +60,8 @@
<% total_amount = 0 %>
<% discount = 0 %>
<% total_item_foc = 0 %>
- <% total_item_dis = 0 %>
+ <% total_item_dis = 0.0 %>
+ <% total_tax = 0 %>
<% @sale_data.each do |sale| %>
@@ -153,7 +154,7 @@
| |
<%= t("views.right_panel.detail.sub_total") %> |
- <%= other_sub_total %> |
+ <%= other_sub_total %> |
@@ -161,8 +162,8 @@
|
<%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %> |
<%= total_qty%> |
- <%= t("views.right_panel.detail.net_amount") %> |
- <%= grand_total%> |
+ <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %> |
+ <%= grand_total%> |
<% end %>
@@ -173,8 +174,8 @@
| |
- <%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %> |
- <%= total_item_dis %> |
+ <%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %> |
+ <%= total_item_dis %> |
| |
@@ -183,9 +184,31 @@
| |
- <%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> |
- <%= @discount_data %> |
-
+ <%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> |
+ <%= @discount_data %> |
+
+
+ <% @sale_taxes.each do |tax| %>
+
+ | |
+ <%= tax.tax_name %> |
+ <%= tax.st_amount.round(2) %>
+ <%total_tax += tax.st_amount%>
+ |
+
+ <% end %>
+
+ | |
+ Net Amount |
+
+ <%= grand_total + total_tax%> |
+
+
diff --git a/config/routes.rb b/config/routes.rb
index f03cd4e9..93fe22e2 100755
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -71,7 +71,10 @@ scope "(:locale)", locale: /en|mm/ do
get "check_in/:dining_id" => "check_in_process#check_in_time"
post "check_in" => "check_in_process#check_in_process"
post "request_time" => "check_in_process#request_time"
+ post "call_waiter" => "call_waiters#index"
end
+
+
end
#--------- Cashier ------------#
diff --git a/spec/jobs/call_waiter_job_spec.rb b/spec/jobs/call_waiter_job_spec.rb
new file mode 100644
index 00000000..d0699adb
--- /dev/null
+++ b/spec/jobs/call_waiter_job_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe CallWaiterJob, type: :job do
+ pending "add some examples to (or delete) #{__FILE__}"
+end