From bca6fabaaf9488c7232e8c741d3c3d0f53e76ecd Mon Sep 17 00:00:00 2001 From: Zin Moe Date: Mon, 27 Jan 2020 16:30:58 +0630 Subject: [PATCH] fix cashier page height & breadcrumb helper --- app/assets/javascripts/custom.js | 4 +- app/assets/stylesheets/custom.scss | 14 ++++++ app/assets/stylesheets/origami.scss | 1 + .../transactions/bookings_controller.rb | 1 + .../transactions/orders_controller.rb | 5 +- .../transactions/sales_controller.rb | 1 + app/helpers/breadcrumb_helper.rb | 21 +++++++++ app/models/customer.rb | 3 ++ app/models/printer/printer_worker.rb | 22 ++++----- app/views/crm/customers/show.html.erb | 14 +----- app/views/crm/dining_queues/_form.html.erb | 2 + app/views/crm/dining_queues/assign.html.erb | 13 +----- app/views/crm/dining_queues/edit.html.erb | 8 ---- app/views/crm/dining_queues/index.html.erb | 11 +---- app/views/crm/dining_queues/new.html.erb | 14 +----- app/views/inventory/inventory/index.html.erb | 10 +--- app/views/inventory/inventory/show.html.erb | 11 +---- .../inventory_definitions/_form.html.erb | 4 +- .../inventory/stock_checks/index.html.erb | 4 +- app/views/layouts/CRM.html.erb | 1 + app/views/layouts/application.html.erb | 1 + app/views/layouts/inventory.html.erb | 4 +- app/views/origami/addorders/detail.html.erb | 6 +-- app/views/origami/credit_sales/show.html.erb | 8 ++-- app/views/origami/home/show.html.erb | 8 ++-- app/views/origami/payments/show.html.erb | 10 ++-- app/views/origami/pending_order/show.html.erb | 6 +-- app/views/print_settings/_form.html.erb | 1 + app/views/print_settings/edit.html.erb | 11 ----- app/views/print_settings/index.html.erb | 11 +---- app/views/print_settings/new.html.erb | 11 ----- app/views/print_settings/show.html.erb | 11 +---- app/views/reports/commission/index.html.erb | 11 +---- .../reports/credit_payment/index.html.erb | 11 +---- app/views/reports/dailysale/index.html.erb | 10 +--- .../reports/hourly_saleitem/index.html.erb | 11 +---- app/views/reports/induty/index.html.erb | 11 +---- .../reports/order_reservation/index.html.erb | 11 +---- .../reports/payment_method/index.html.erb | 11 +---- app/views/reports/receipt_no/index.html.erb | 11 +---- .../reports/receipt_no_detail/index.html.erb | 11 +---- app/views/reports/saleitem/index.html.erb | 11 +---- app/views/reports/shiftsale/index.html.erb | 11 +---- app/views/reports/staff_meal/index.html.erb | 11 +---- app/views/reports/stock_check/index.html.erb | 11 +---- app/views/reports/void_sale/index.html.erb | 11 +---- .../reports/waste_and_spoilage/index.html.erb | 11 +---- app/views/settings/accounts/index.html.erb | 11 +---- .../settings/cashier_terminals/_form.html.erb | 1 + .../settings/cashier_terminals/edit.html.erb | 10 ---- .../settings/cashier_terminals/index.html.erb | 11 +---- .../settings/cashier_terminals/new.html.erb | 10 ---- .../settings/cashier_terminals/show.html.erb | 11 +---- .../settings/commissioners/_form.html.erb | 2 + .../settings/commissioners/edit.html.erb | 12 ----- .../settings/commissioners/index.html.erb | 11 +---- app/views/settings/commissioners/new.html.erb | 11 ----- .../settings/commissioners/show.html.erb | 11 +---- app/views/settings/commissions/_form.html.erb | 1 + app/views/settings/commissions/edit.html.erb | 12 +---- app/views/settings/commissions/index.html.erb | 10 +--- app/views/settings/commissions/new.html.erb | 12 +---- app/views/settings/commissions/show.html.erb | 11 +---- app/views/settings/employees/_form.html.erb | 1 + app/views/settings/employees/edit.html.erb | 13 +----- app/views/settings/employees/index.html.erb | 10 +--- app/views/settings/employees/new.html.erb | 13 +----- app/views/settings/employees/show.html.erb | 20 +------- app/views/settings/item_sets/index.html.erb | 12 +---- app/views/settings/lookups/_form.html.erb | 2 +- app/views/settings/lookups/edit.html.erb | 11 ----- app/views/settings/lookups/index.html.erb | 11 +---- app/views/settings/lookups/new.html.erb | 11 ----- .../settings/menu_categories/_form.html.erb | 2 + .../settings/menu_categories/edit.html.erb | 11 ----- .../settings/menu_categories/new.html.erb | 12 ----- .../settings/menu_categories/show.html.erb | 11 +---- .../menu_item_attributes/index.html.erb | 10 +--- .../menu_item_instances/_form.html.erb | 3 ++ .../menu_item_instances/edit.html.erb | 12 ----- .../settings/menu_item_instances/new.html.erb | 11 ----- .../menu_item_instances/show.html.erb | 26 ++--------- .../settings/menu_item_options/_form.html.erb | 1 + .../settings/menu_item_options/edit.html.erb | 10 ---- .../settings/menu_item_options/index.html.erb | 10 +--- .../settings/menu_item_options/new.html.erb | 10 ---- .../settings/menu_item_options/show.html.erb | 13 +----- app/views/settings/menus/_form.html.erb | 2 + app/views/settings/menus/edit.html.erb | 22 --------- app/views/settings/menus/index.html.erb | 11 +---- app/views/settings/menus/new.html.erb | 23 ---------- app/views/settings/menus/show.html.erb | 11 +---- .../order_queue_stations/_form.html.erb | 2 + .../order_queue_stations/edit.html.erb | 11 ----- .../order_queue_stations/index.html.erb | 13 +----- .../order_queue_stations/new.html.erb | 11 ----- .../settings/out_of_stock/index.html.erb | 10 +--- .../payment_method_settings/_form.html.erb | 1 + .../payment_method_settings/edit.html.erb | 11 ----- .../payment_method_settings/index.html.erb | 11 +---- .../payment_method_settings/new.html.erb | 12 ----- .../payment_method_settings/show.html.erb | 12 +---- .../settings/processing_items/new.html.erb | 11 +---- app/views/settings/products/_form.html.erb | 3 +- app/views/settings/products/edit.html.erb | 11 ----- app/views/settings/products/index.html.erb | 12 +---- app/views/settings/products/new.html.erb | 21 --------- app/views/settings/products/show.html.erb | 11 +---- app/views/settings/promotions/_form.html.erb | 1 + app/views/settings/promotions/edit.html.erb | 11 ----- app/views/settings/promotions/index.html.erb | 11 +---- app/views/settings/promotions/new.html.erb | 12 +---- app/views/settings/promotions/show.html.erb | 11 +---- .../settings/simple_menu_items/edit.html.erb | 12 +---- .../settings/simple_menu_items/new.html.erb | 14 +----- .../settings/simple_menu_items/show.html.erb | 12 +---- app/views/settings/tables/_form.html.erb | 1 + app/views/settings/tables/edit.html.erb | 13 +----- app/views/settings/tables/new.html.erb | 13 +----- .../settings/tax_profiles/_form.html.erb | 3 +- app/views/settings/tax_profiles/edit.html.erb | 21 --------- .../settings/tax_profiles/index.html.erb | 14 ++---- app/views/settings/tax_profiles/new.html.erb | 12 ----- app/views/settings/tax_profiles/show.html.erb | 11 +---- app/views/settings/zones/_form.html.erb | 2 + app/views/settings/zones/edit.html.erb | 12 +---- app/views/settings/zones/index.html.erb | 11 +---- app/views/settings/zones/new.html.erb | 11 ----- app/views/settings/zones/show.html.erb | 11 +---- app/views/shared/_breadcrumb.html.erb | 24 ++++++++++ .../transactions/bookings/index.html.erb | 15 +----- app/views/transactions/bookings/show.html.erb | 11 +---- .../transactions/credit_notes/index.html.erb | 20 +------- .../order_reservations/index.html.erb | 11 +---- app/views/transactions/orders/index.html.erb | 15 +----- app/views/transactions/orders/show.html.erb | 11 +---- app/views/transactions/sales/index.html.erb | 16 +------ app/views/transactions/sales/show.html.erb | 11 +---- .../transactions/shift_sales/index.html.erb | 11 +---- .../transactions/shift_sales/show.html.erb | 11 +---- app/views/transactions/surveys/index.html.erb | 11 +---- config/initializers/action_controller.rb | 46 +++++++++---------- 142 files changed, 266 insertions(+), 1207 deletions(-) create mode 100644 app/assets/stylesheets/custom.scss create mode 100644 app/helpers/breadcrumb_helper.rb create mode 100644 app/views/shared/_breadcrumb.html.erb diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js index 26e6c151..6d8092cc 100644 --- a/app/assets/javascripts/custom.js +++ b/app/assets/javascripts/custom.js @@ -24,7 +24,9 @@ $(document).ready(function() { }); $('#order-detail-slimscroll').slimScroll({ - height: height-$('#order-detail-slimscroll').attr('data-height'), + // height: '250px', + height: $('#order-detail-slimscroll').attr('data-height'), + // height: height-$('#order-detail-slimscroll').attr('data-height'), size: '5px', color: 'rgba(0,0,0,0.5)', alwaysVisible: false, diff --git a/app/assets/stylesheets/custom.scss b/app/assets/stylesheets/custom.scss new file mode 100644 index 00000000..e1d36dce --- /dev/null +++ b/app/assets/stylesheets/custom.scss @@ -0,0 +1,14 @@ +.home.card { + height: 100%; +} + +#order-detail-slimscroll { + display: block; +} + +.pending-order.card-footer, .home.card-footer, .credit_sale.card-footer .inventory.card-footer{ + width: 100%; + vertical-align: bottom; + position: absolute; + bottom: 0; +} diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index 64cc2937..b971b6dd 100755 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -11,6 +11,7 @@ @import "BSBMaterial/themes/all-themes"; @import "reset"; @import "fileinput.min"; +@import "custom"; /* Reset */ diff --git a/app/controllers/transactions/bookings_controller.rb b/app/controllers/transactions/bookings_controller.rb index 0a6f7cbb..5fe7fc4a 100644 --- a/app/controllers/transactions/bookings_controller.rb +++ b/app/controllers/transactions/bookings_controller.rb @@ -23,6 +23,7 @@ class Transactions::BookingsController < ApplicationController @receipt_no = filter @from = from @to = to + @food_court = Lookup.find_by_lookup_type_and_value("food_court", "1") respond_to do |format| format.html # index.html.erb format.json { render json: @bookings } diff --git a/app/controllers/transactions/orders_controller.rb b/app/controllers/transactions/orders_controller.rb index 5d41439c..4a3ab0ef 100755 --- a/app/controllers/transactions/orders_controller.rb +++ b/app/controllers/transactions/orders_controller.rb @@ -21,8 +21,9 @@ class Transactions::OrdersController < ApplicationController end @receipt_no = filter - @from = from - @to = to + @from = from + @to = to + @food_court = Lookup.find_by_lookup_type_and_value("food_court", "1") respond_to do |format| format.html diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb index 98b420ff..7e69ac4b 100755 --- a/app/controllers/transactions/sales_controller.rb +++ b/app/controllers/transactions/sales_controller.rb @@ -35,6 +35,7 @@ class Transactions::SalesController < ApplicationController @receipt_no = receipt_no @from = from @to = to + @food_court = Lookup.find_by_lookup_type_and_value("food_court", "1") if @shift.present? @shift_from = @shift.shift_started_at.nil? ? '-' : @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p") diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb new file mode 100644 index 00000000..91ee1ac3 --- /dev/null +++ b/app/helpers/breadcrumb_helper.rb @@ -0,0 +1,21 @@ +module BreadcrumbHelper + + def ensure_breadcrumb + @breadcrumb ||= [ { :title => t("views.right_panel.button.home"), :url => dashboard_path } ] + end + + def back + @back ||= [] + end + + def breadcrumb_add(title, url, back_url, act_name = nil) + ensure_breadcrumb << { :title => title, :url => url } + ensure_breadcrumb << { :title => act_name, :url => '' } if act_name.present? + + back << {url: back_url} if back_url.present? + end + + def render_breadcrumb + render :partial => 'shared/breadcrumb', :locals => { :nav => ensure_breadcrumb, :back => back } + end +end \ No newline at end of file diff --git a/app/models/customer.rb b/app/models/customer.rb index 29e93341..4f007b88 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -109,6 +109,9 @@ class Customer < ApplicationRecord }, :timeout => 10 ) + + rescue Errno::ECONNREFUSED + response = {status: false, message: "Can't open membership server " } rescue HTTParty::Error response = {status: false, message: "Can't open membership server " } diff --git a/app/models/printer/printer_worker.rb b/app/models/printer/printer_worker.rb index d30af42d..5d7cce22 100755 --- a/app/models/printer/printer_worker.rb +++ b/app/models/printer/printer_worker.rb @@ -42,17 +42,17 @@ class Printer::PrinterWorker end def print(file_path, printer_destination = nil ) - if printer_destination.nil? - printer_destination = self.printer_destination - end + # if printer_destination.nil? + # printer_destination = self.printer_destination + # end - copy = self.print_copies - #Print only when printer information is not null - if !self.printer_destination.nil? - (1..copy).each do - page = Cups::PrintJob.new(file_path, printer_destination) - page.print - end - end + # copy = self.print_copies + # #Print only when printer information is not null + # if !self.printer_destination.nil? + # (1..copy).each do + # page = Cups::PrintJob.new(file_path, printer_destination) + # page.print + # end + # end end end diff --git a/app/views/crm/customers/show.html.erb b/app/views/crm/customers/show.html.erb index 646cd06a..d881b73f 100644 --- a/app/views/crm/customers/show.html.erb +++ b/app/views/crm/customers/show.html.erb @@ -1,14 +1,4 @@ -
- +<% breadcrumb_add 'CRM', "", dashboard_path %>
@@ -65,7 +55,7 @@ <%= @customer.date_of_birth rescue '-'%> <% if @customer.membership_type.to_f > 0%> <%lookup= Lookup.find_by_value(@customer.membership_type) %> - <%= lookup.name %> + <%= lookup.try(:name) %> <%else%> - diff --git a/app/views/crm/dining_queues/_form.html.erb b/app/views/crm/dining_queues/_form.html.erb index 7c50a06d..fe7c913c 100755 --- a/app/views/crm/dining_queues/_form.html.erb +++ b/app/views/crm/dining_queues/_form.html.erb @@ -1,3 +1,5 @@ +<% breadcrumb_add t('queue'), crm_dining_queues_path, crm_dining_queues_path, t("views.btn.#{action_name}") %> +
diff --git a/app/views/crm/dining_queues/assign.html.erb b/app/views/crm/dining_queues/assign.html.erb index a6e6c20a..7c78ecc8 100755 --- a/app/views/crm/dining_queues/assign.html.erb +++ b/app/views/crm/dining_queues/assign.html.erb @@ -1,15 +1,6 @@
- -
+<% breadcrumb_add 'Queue', crm_dining_queues_path, dashboard_path, "Assign Queue #{@queue.queue_no}" %> +
diff --git a/app/views/crm/dining_queues/edit.html.erb b/app/views/crm/dining_queues/edit.html.erb index bf0c3b10..0632425a 100755 --- a/app/views/crm/dining_queues/edit.html.erb +++ b/app/views/crm/dining_queues/edit.html.erb @@ -1,11 +1,3 @@ -
- <%= render 'form', dining_queue: @dining_queue %>
diff --git a/app/views/crm/dining_queues/index.html.erb b/app/views/crm/dining_queues/index.html.erb index a935cf38..85450b84 100755 --- a/app/views/crm/dining_queues/index.html.erb +++ b/app/views/crm/dining_queues/index.html.erb @@ -1,13 +1,4 @@ -
- +<% breadcrumb_add t('queue'), "", dashboard_path %>
diff --git a/app/views/crm/dining_queues/new.html.erb b/app/views/crm/dining_queues/new.html.erb index 19a12c5b..e6aa5698 100755 --- a/app/views/crm/dining_queues/new.html.erb +++ b/app/views/crm/dining_queues/new.html.erb @@ -1,15 +1,3 @@
- - - <%= render 'form', dining_queue: @dining_queue %> - + <%= render 'form', dining_queue: @dining_queue %>
\ No newline at end of file diff --git a/app/views/inventory/inventory/index.html.erb b/app/views/inventory/inventory/index.html.erb index 06396dba..3b765c89 100755 --- a/app/views/inventory/inventory/index.html.erb +++ b/app/views/inventory/inventory/index.html.erb @@ -1,12 +1,4 @@ - +<% breadcrumb_add t('inventory'), "", dashboard_path %>
diff --git a/app/views/inventory/inventory/show.html.erb b/app/views/inventory/inventory/show.html.erb index a08110e8..a570277c 100644 --- a/app/views/inventory/inventory/show.html.erb +++ b/app/views/inventory/inventory/show.html.erb @@ -1,13 +1,4 @@ - - +<% breadcrumb_add t('inventory'), '', inventory_path %>
diff --git a/app/views/inventory/inventory_definitions/_form.html.erb b/app/views/inventory/inventory_definitions/_form.html.erb index 66497616..ada37e7b 100644 --- a/app/views/inventory/inventory_definitions/_form.html.erb +++ b/app/views/inventory/inventory_definitions/_form.html.erb @@ -79,7 +79,7 @@
-
+
@@ -96,7 +96,7 @@
-