From 5b7ba0c1446214ade3e9e16166b15e172b05cbeb Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 22 Nov 2017 10:40:43 +0630 Subject: [PATCH 1/3] update supervisor wrong spelling --- app/controllers/home_controller.rb | 4 +-- app/models/ability.rb | 2 +- app/views/layouts/login_dashboard.html.erb | 2 +- app/views/origami/addorders/detail.html.erb | 2 +- app/views/origami/home/show.html.erb | 16 +++++----- app/views/origami/rooms/show.html.erb | 35 +++++++++++++++------ 6 files changed, 38 insertions(+), 23 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index bc621bd7..e0667a83 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -45,7 +45,7 @@ class HomeController < ApplicationController elsif @employee.role == "manager" session[:session_token] = @employee.token_session redirect_to dashboard_path - elsif @employee.role == "supervisour" + elsif @employee.role == "supervisor" session[:session_token] = @employee.token_session redirect_to origami_root_path elsif @employee.role == "account" @@ -151,7 +151,7 @@ class HomeController < ApplicationController redirect_to oqs_root_path elsif employee.role == "crm" redirect_to crm_root_path - elsif @employee.role == "supervisour" + elsif @employee.role == "supervisor" redirect_to origami_root_path elsif @employee.role == "account" redirect_to reports_dailysale_index_path diff --git a/app/models/ability.rb b/app/models/ability.rb index 70ce4e94..c2947fe1 100755 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -122,7 +122,7 @@ class Ability can :index, :credit_payment can :index, :void_sale - elsif user.role == "supervisour" + elsif user.role == "supervisor" can :edit, :sale_edit can :item_void, :sale_edit diff --git a/app/views/layouts/login_dashboard.html.erb b/app/views/layouts/login_dashboard.html.erb index d0d2cddd..7df224a3 100755 --- a/app/views/layouts/login_dashboard.html.erb +++ b/app/views/layouts/login_dashboard.html.erb @@ -85,7 +85,7 @@
<% @employees.each do |employee| %> - <%if employee.role == "supervisour" %> + <%if employee.role == "supervisor" %>
diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 2a6411a4..150ea55d 100755 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -51,7 +51,7 @@ Price - + diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index fc340d2c..0fd7fa89 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -143,7 +143,7 @@
<% if (!@sale_array.empty?) && (!@date.nil?) %>
- Receipt No: +   Receipt No: <% if @status_sale == 'sale' %> <%= @sale_array[0].receipt_no rescue '' %> @@ -152,12 +152,12 @@
- Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %> + Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %>
<% elsif !@date.nil? %> -
- Order No: +
+   Order No: <% if @status_order == 'order' %> <%= @obj_order.order_id rescue '' %> @@ -165,8 +165,8 @@
-
- Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %> +
+ Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %>
<% end %> @@ -176,11 +176,11 @@ <% if @status_sale == 'sale' %> - Customer : <%= @sale_array[0].customer.name rescue '' %> +   Customer : <%= @sale_array[0].customer.name rescue '' %> <% elsif @status_order == 'order' %> - Customer : <%= @customer.name rescue "" %> +   Customer : <%= @customer.name rescue "" %> <% end %>
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index aaf7ad58..5e461650 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -137,26 +137,41 @@
-
- Receipt No: - <% if @status_sale == 'sale' %> + + <% if @status_sale == 'sale' %> +
+   Receipt No: + <%= @obj_sale.receipt_no rescue '' %> - - <% end %> - -
-
+ +
+ <% else %> +
+   Order No: + + <%= @obj_order.order_id rescue '' %> + +
+ <% end %> + <% if @status_sale == 'sale' %> +
Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
+ <% else %> +
+ Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-'%> +
+ <% end %> +
<% if @status_sale == 'sale' %> - Customer : <%= @obj_sale.customer.name rescue '-' %> +   Customer : <%= @obj_sale.customer.name rescue '-' %> <%else%> - Customer : <%= @customer.name rescue "-" %> +   Customer : <%= @customer.name rescue "-" %> <%end%>
From d3ceba0a7a1d28b66ec1d23fba3d131964818a72 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 22 Nov 2017 15:54:58 +0630 Subject: [PATCH 2/3] update add order --- app/assets/javascripts/addorder.js | 29 ++++++++++++---- config/puma.rb | 56 +++++++++++++++++++++++++----- 2 files changed, 70 insertions(+), 15 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 64003b8b..3d61b547 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -95,7 +95,6 @@ $(function() { var menu_items_list = $('.menu_items_list'); menu_items_list.empty(); menu_items = data.menu_items; - console.log(menu_items); for(var field in menu_items) { if (menu_items[field].is_sub_item == false) { @@ -194,6 +193,7 @@ $(function() { $(document).on('click', '.set_item_box', function(event){ $(".instance-list").empty(); $(".options-list").empty(); + $('.set_change_qty').val(1); change_qty_plus_minus("set_count","set_plus","set_minus"); data = $(this).parent().children().children('.add_icon'); @@ -373,6 +373,8 @@ $(function() { $('.add_to_order').removeAttr('data-attributes'); $('.add_to_order').removeAttr('data-options'); + $('.change_qty').val(1); + change_qty_plus_minus("count","plus","minus"); data = $(this).parent().children().children('.add_icon'); @@ -513,7 +515,6 @@ $(function() { // click select option icon for add $(document).on('click', '.option_btn', function(event){ active =$(this).hasClass('selected-option'); - console.log(active); value = $(this).data('value'); type = $(this).data('type'); group = $(this).data('group'); @@ -558,8 +559,24 @@ $(function() { if (item_row.length>0) { var instances = jQuery.parseJSON(item_row.attr('data-instances')); - for(var field in instances) { - if (JSON.stringify(attribute_arr) === JSON.stringify(instances[field].values)) { + + + for(var field in instances) { + + attrbu = JSON.stringify(attribute_arr); + instan = JSON.stringify(instances[field].values); + var newarr = new Set(instan); + + result = false; + for(var i in attrbu) { + if (newarr.has(attrbu[i])) { + result = true; + break; + } + + } + + if (JSON.stringify(attribute_arr) === JSON.stringify(instances[field].values) || result) { $('.add_to_order').attr('data-instance-code',instances[field].code); $('.add_to_order').attr('data-instance',instances[field].name); $('.add_to_order').attr('data-price',instances[field].price); @@ -872,7 +889,7 @@ $(function() { id = $(this).attr('id'); value = $(this).val(); - $('#count').attr('value',value); + $('.change_qty').attr('value',value); if (id=="count") { price = $("#unit_price").text(); $("#total_price").text(value*price); @@ -880,7 +897,7 @@ $(function() { var item_row = $('.selected-instance'); price = $("#set_unit_price").text(); set_total_price = $("#set_total_price").text(); - $("#set_count").val(value); + $(".set_change_qty").val(value); if (item_row.length > 1) { total = 0 ; $(item_row).each(function(i){ diff --git a/config/puma.rb b/config/puma.rb index a835964b..c8e0145e 100755 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,10 +1,48 @@ -application_path = ENV.fetch("SX_PATH") {'/home/superuser/Application/production/sxrestaurant'} -directory application_path +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum, this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests, default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# environment ENV.fetch("RAILS_ENV") { "development" } -daemonize true -pidfile "#{application_path}/tmp/puma/pid" -state_path "#{application_path}/tmp/puma/state" -stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" -port ENV.fetch("PORT") { 62158 } -workers 2 -preload_app! + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. If you use this option +# you need to make sure to reconnect any threads in the `on_worker_boot` +# block. +# +# preload_app! + +# The code in the `on_worker_boot` will be called if you are using +# clustered mode by specifying a number of `workers`. After each worker +# process is booted this block will be run, if you are using `preload_app!` +# option you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, Ruby +# cannot share connections between processes. +# +# on_worker_boot do +# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) +# end + +# Allow puma to be restarted by `rails restart` command. + +plugin :tmp_restart From fafd6df5e19493e67f4c603c675352a339a4b27d Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 22 Nov 2017 16:49:34 +0630 Subject: [PATCH 3/3] update addorder and show_account_info add shops --- app/assets/javascripts/addorder.js | 1 - app/pdf/receipt_bill_pdf.rb | 12 ++++++++---- app/views/settings/shops/_form.html.erb | 3 ++- app/views/settings/shops/index.html.erb | 3 ++- db/migrate/20170530072247_create_shops.rb | 1 + 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 3d61b547..b65561e9 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -575,7 +575,6 @@ $(function() { } } - if (JSON.stringify(attribute_arr) === JSON.stringify(instances[field].values) || result) { $('.add_to_order').attr('data-instance-code',instances[field].code); $('.add_to_order').attr('data-instance',instances[field].name); diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index bcd3becf..ebdfa147 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -45,7 +45,7 @@ class ReceiptBillPdf < Prawn::Document delimiter = "" end - header( shop_details) + header(shop_details) stroke_horizontal_rule @@ -60,12 +60,14 @@ class ReceiptBillPdf < Prawn::Document customer(customer_name) - if discount_price_by_accounts.length > 0 + if discount_price_by_accounts.length > 0 && shop_details.show_account_info discount_account(discount_price_by_accounts,printer_settings.precision,delimiter) end - items_account(item_price_by_accounts,printer_settings.precision,delimiter) - + if shop_details.show_account_info + items_account(item_price_by_accounts,printer_settings.precision,delimiter) + end + sign(sale_data) footer(printed_status) @@ -389,6 +391,8 @@ class ReceiptBillPdf < Prawn::Document text "#{ customer_name }" , :size => self.item_font_size,:align => :right end end + + def discount_account(discount_price_by_accounts,precision,delimiter) move_down 5 stroke_horizontal_rule diff --git a/app/views/settings/shops/_form.html.erb b/app/views/settings/shops/_form.html.erb index 5f93ea50..5a353b9b 100755 --- a/app/views/settings/shops/_form.html.erb +++ b/app/views/settings/shops/_form.html.erb @@ -15,12 +15,13 @@ <%= f.input :license_data %> <%= f.input :base_currency %> <%= f.input :cloud_token %> - <%= f.input :cloud_url %> + <%= f.input :cloud_url %> <%= f.input :owner_token %> <%= f.input :id_prefix %> <%= f.input :is_rounding_adj %> <%= f.input :quick_sale_summary %> <%= f.input :calc_tax_order %> + <%= f.input :show_account_info %>
diff --git a/app/views/settings/shops/index.html.erb b/app/views/settings/shops/index.html.erb index 61005a34..c323defa 100755 --- a/app/views/settings/shops/index.html.erb +++ b/app/views/settings/shops/index.html.erb @@ -23,6 +23,7 @@ Rouding Adj View Sale Summary Calculate Tax + Show Account Info Actions @@ -36,7 +37,7 @@ <%= shop.is_rounding_adj %> <%= shop.quick_sale_summary %> <%= shop.calc_tax_order %> - + <%= shop.show_account_info %> <%= link_to t("views.btn.show"), settings_shop_path(shop),:class => 'btn btn-info btn-sm waves-effect' %> <%= link_to t("views.btn.edit"), edit_settings_shop_path(shop),:class => 'btn btn-primary btn-sm waves-effect' %> diff --git a/db/migrate/20170530072247_create_shops.rb b/db/migrate/20170530072247_create_shops.rb index 2d2f68ad..bd25c970 100755 --- a/db/migrate/20170530072247_create_shops.rb +++ b/db/migrate/20170530072247_create_shops.rb @@ -21,6 +21,7 @@ class CreateShops < ActiveRecord::Migration[5.1] t.boolean :is_rounding_adj, :default => false t.boolean :quick_sale_summary, :default => false t.boolean :calc_tax_order, :default => false + t.boolean :show_account_info, :default => true t.timestamps end end