From a705f0df9a62f77245d0fb2bbd7df10a5fbe3ca7 Mon Sep 17 00:00:00 2001 From: Git Code2lab Date: Mon, 9 Dec 2019 09:44:03 +0000 Subject: [PATCH 01/19] Update addorder.js --- app/assets/javascripts/addorder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 64208520..259f9f67 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -629,7 +629,7 @@ $(function() { status = "selected-attribute"; } if(parseInt(jQuery.inArray(value[i], instance_attributes)) == -1){ - disabled = "disabled"; + //disabled = "disabled"; } row +=" <%elsif !modify_order && type%> - + <% if current_user.role != "waiter"%> <% if @quick_service_only %> diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index 72650ba3..e3ed07cb 100644 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -22,7 +22,7 @@
- +
<% end %> --> @@ -72,7 +72,7 @@ - <% if @crm_customers.count > 0 %> + <% if @crm_customers.count > 0 %> <% @i = 0 %> <% @crm_customers.each do |crm_customer| %> @@ -80,7 +80,7 @@ - <% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %> + <% if crm_customer.customer_id != "" && crm_customer.customer_id != "" %> <%= @i += 1 %> <%else%> - @@ -156,7 +156,7 @@ <%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %> <%= f.error_notification %> - <%= f.hidden_field :id, :class => "form-control col-md-6 " %> + <%= f.hidden_field :id, :class => "form-control col-md-6 " %>
@@ -225,7 +225,7 @@
-
+
@@ -238,12 +238,12 @@ <% if f.object.image_path? %>

<%= f.object.name %>

<%= image_tag f.object.image_path.url, :class => "img-thumbnail" %> - <% else %> + <% else %> <%= image_tag "/image/menu_images/default.png", :class => "img-thumbnail" %> - <% end %> + <% end %>
<%= f.file_field :image_path, :class => "img-thumbnail" %> -
+
@@ -291,7 +291,7 @@ <%end %> - +
@@ -316,7 +316,7 @@
-
+
@@ -332,7 +332,7 @@ <%end %> - +
@@ -363,7 +363,7 @@
- diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index a7737724..ca2f6ada 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -1686,9 +1686,8 @@ $(document).ready(function(){ $("#customer_name").on("click",function(){ //start customer modal popup if((cashier_type=='quick_service' || cashier_type=='food_court') && (customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){ - // if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){ - $("#is_memberModal").modal({show : true, backdrop: false, keyboard : false}); - // } + + $("#is_memberModal").modal({show : true, backdrop: false, keyboard : false}); } }); From 704af3ce27a8e1873108d700046da106df5e22dd Mon Sep 17 00:00:00 2001 From: Min Zeya Phyo Date: Fri, 20 Dec 2019 11:55:45 +0630 Subject: [PATCH 15/19] production deployment changes --- config/deploy.rb | 19 +++++++++++++++++-- config/deploy/production.rb | 2 +- config/puma.rb | 11 ----------- 3 files changed, 18 insertions(+), 14 deletions(-) delete mode 100755 config/puma.rb diff --git a/config/deploy.rb b/config/deploy.rb index 05bba77d..851b4551 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -28,9 +28,24 @@ set :linked_dirs, %w{log tmp/pids tmp/puma tmp/cache tmp/sockets vendor/bundle p set :tests, [] set :pty, true -set :puma_jungle_conf, '/etc/puma.conf' -set :puma_run_path, '/usr/local/bin/run-puma' +#set :puma_state, "#{shared_path}/tmp/pids/puma.state" +#set :puma_pid, "#{shared_path}/tmp/pids/puma.pid" set :puma_bind, %w(tcp://0.0.0.0:9393) +#set :puma_conf, "#{shared_path}/puma.rb" +#set :puma_access_log, "#{shared_path}/log/puma_access.log" +#set :puma_error_log, "#{shared_path}/log/puma_error.log" +#set :puma_role, :app +set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production')) +set :puma_threads, [0, 16] +set :puma_workers, 2 +#set :puma_worker_timeout, nil +#set :puma_init_active_record, false +#set :puma_preload_app, false +#set :puma_daemonize, false +#set :puma_plugins, [] #accept array of plugins +#set :puma_tag, fetch(:application) +#set :puma_restart_command, 'bundle exec puma' + #set :enable_ssl, true diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 392bcb29..4a159049 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -13,7 +13,7 @@ set :server_name, "doemal.app" set :branch, "r-1902001-01" set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}" -server '167.71.194.57', user: 'deploy', roles: %w{web app db}, primary: true +server '178.128.58.251', user: 'deploy', roles: %w{web app db}, primary: true set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}" set :rbenv_ruby, '2.6.5' diff --git a/config/puma.rb b/config/puma.rb deleted file mode 100755 index d24425ae..00000000 --- a/config/puma.rb +++ /dev/null @@ -1,11 +0,0 @@ -application_path="#{File.expand_path("../..", __FILE__)}" -directory application_path -#environment ENV.fetch("RAILS_ENV") { "production" } -environment "production" -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! -threads 1,1 From 6561a2bce5a90f2d210eb6a23af609cbace6d6f7 Mon Sep 17 00:00:00 2001 From: Min Zeya Phyo Date: Fri, 20 Dec 2019 12:00:21 +0630 Subject: [PATCH 16/19] shared config file deployment files --- config/deploy/shared/.rbenv-vars | 1 + config/deploy/shared/database.yml.erb | 6 +++ config/deploy/shared/log_rotation.erb | 11 ++++++ config/deploy/shared/monit.conf.erb | 2 + config/deploy/shared/nginx.conf.erb | 40 ++++++++++++++++++++ config/deploy/shared/redis.yml.erb | 4 ++ config/deploy/shared/sidekiq.yml.erb | 2 + config/deploy/shared/sidekiq_init.sh.erb | 48 ++++++++++++++++++++++++ config/puma_backup.rb | 11 ++++++ 9 files changed, 125 insertions(+) create mode 100644 config/deploy/shared/.rbenv-vars create mode 100644 config/deploy/shared/database.yml.erb create mode 100644 config/deploy/shared/log_rotation.erb create mode 100644 config/deploy/shared/monit.conf.erb create mode 100644 config/deploy/shared/nginx.conf.erb create mode 100644 config/deploy/shared/redis.yml.erb create mode 100644 config/deploy/shared/sidekiq.yml.erb create mode 100644 config/deploy/shared/sidekiq_init.sh.erb create mode 100755 config/puma_backup.rb diff --git a/config/deploy/shared/.rbenv-vars b/config/deploy/shared/.rbenv-vars new file mode 100644 index 00000000..4589226b --- /dev/null +++ b/config/deploy/shared/.rbenv-vars @@ -0,0 +1 @@ +SECRET_KEY_BASE=33c956cc0e41623bf4e0aedbb16061fa7460a993452b58311d07009782dc242925a52dbb79b506c35308e65cda7cb07b014f78daea0a7ea883a535dc14b33a09 \ No newline at end of file diff --git a/config/deploy/shared/database.yml.erb b/config/deploy/shared/database.yml.erb new file mode 100644 index 00000000..7303b1cd --- /dev/null +++ b/config/deploy/shared/database.yml.erb @@ -0,0 +1,6 @@ +production: + adapter: postgresql + host: localhost + database: iticket + username: wathon + password: root diff --git a/config/deploy/shared/log_rotation.erb b/config/deploy/shared/log_rotation.erb new file mode 100644 index 00000000..7507de18 --- /dev/null +++ b/config/deploy/shared/log_rotation.erb @@ -0,0 +1,11 @@ +<%= fetch(:deploy_to) %>/shared/log/*.log { + daily + missingok + rotate 52 + compress + delaycompress + notifempty + sharedscripts + endscript + copytruncate +} diff --git a/config/deploy/shared/monit.conf.erb b/config/deploy/shared/monit.conf.erb new file mode 100644 index 00000000..1689f9e0 --- /dev/null +++ b/config/deploy/shared/monit.conf.erb @@ -0,0 +1,2 @@ +<% application = fetch(:application) %> +set mail-format { subject: <%= "#{fetch(:full_app_name)} - #{fetch(:rails_env)}" %> $SERVICE $EVENT at $DATE } diff --git a/config/deploy/shared/nginx.conf.erb b/config/deploy/shared/nginx.conf.erb new file mode 100644 index 00000000..c888b6ae --- /dev/null +++ b/config/deploy/shared/nginx.conf.erb @@ -0,0 +1,40 @@ +server { + server_name <%= fetch(:server_name) %>; + listen 80; + passenger_enabled on; + rails_env production; + root <%= fetch(:deploy_to) %>/current/public; + + location ^~ /assets/ { + gzip_static on; + expires max; + add_header Cache-Control public; + } + + error_page 500 502 503 504 /500.html; + client_max_body_size 4G; + keepalive_timeout 10; +} + +<% if fetch(:enable_ssl) %> +server { + server_name <%= fetch(:server_name) %>; + listen 443; + passenger_enabled on; + rails_env production; + root <%= fetch(:deploy_to) %>/current/public; + + location ^~ /assets/ { + gzip_static on; + expires max; + add_header Cache-Control public; + } + + error_page 500 502 503 504 /500.html; + client_max_body_size 4G; + keepalive_timeout 10; + ssl on; + ssl_certificate <%= fetch(:deploy_to) %>/shared/ssl_cert.crt; + ssl_certificate_key <%= fetch(:deploy_to) %>/shared/ssl_private_key.key; +} +<% end %> diff --git a/config/deploy/shared/redis.yml.erb b/config/deploy/shared/redis.yml.erb new file mode 100644 index 00000000..8a1f2d4a --- /dev/null +++ b/config/deploy/shared/redis.yml.erb @@ -0,0 +1,4 @@ +<%= fetch(:rails_env) %>: + host: data.myapp.com + port: 6379 + db: 0 \ No newline at end of file diff --git a/config/deploy/shared/sidekiq.yml.erb b/config/deploy/shared/sidekiq.yml.erb new file mode 100644 index 00000000..707ebb27 --- /dev/null +++ b/config/deploy/shared/sidekiq.yml.erb @@ -0,0 +1,2 @@ +<%= fetch(:rails_env) %>: + :concurrency: <%= fetch(:sidekiq_concurrency, 5) %> \ No newline at end of file diff --git a/config/deploy/shared/sidekiq_init.sh.erb b/config/deploy/shared/sidekiq_init.sh.erb new file mode 100644 index 00000000..1f667f90 --- /dev/null +++ b/config/deploy/shared/sidekiq_init.sh.erb @@ -0,0 +1,48 @@ +#!/bin/sh +set -e + +APP_ROOT=<%= current_path %> +PID=$APP_ROOT/tmp/pids/sidekiq.pid +CMD="cd $APP_ROOT; RAILS_ENV=<%= "#{fetch(:rails_env)}" %> nohup bundle exec sidekiq -e <%= "#{fetch(:rails_env)}" %> -C $APP_ROOT/config/sidekiq.yml -i 0 -P $PID >> $APP_ROOT/log/sidekiq.log 2>&1 &" +STOP_CMD="cd $APP_ROOT; RAILS_ENV=<%= "#{fetch(:rails_env)}" %> bundle exec sidekiqctl stop $APP_ROOT/tmp/pids/sidekiq.pid 10" +AS_USER=<%= fetch(:deploy_user) %> + +run () { + if [ "$(id -un)" = "$AS_USER" ]; then + eval $1 + else + su -c "$1" - $AS_USER + fi +} + +sig () { + test -s "$PID" && kill -$1 `cat $PID` +} + +case "$1" in + start) + sig 0 && echo >&2 "Already Running" && exit 0 + run "$CMD" + ;; + stop) + if test -s "$PID" && kill -0 `cat $PID` + then + echo "stopping...." + run "$STOP_CMD" + else + echo "not running" + fi + ;; + restart|reload) + if test -s "$PID" && kill -0 `cat $PID` + then + echo "stopping...." + run "$STOP_CMD" + fi + run "$CMD" + ;; + *) + echo >&2 "Usage: $0 " + exit 1 + ;; +esac diff --git a/config/puma_backup.rb b/config/puma_backup.rb new file mode 100755 index 00000000..d24425ae --- /dev/null +++ b/config/puma_backup.rb @@ -0,0 +1,11 @@ +application_path="#{File.expand_path("../..", __FILE__)}" +directory application_path +#environment ENV.fetch("RAILS_ENV") { "production" } +environment "production" +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! +threads 1,1 From e3207ed1d504934bc4d960b5fd5f54d91a0f9f06 Mon Sep 17 00:00:00 2001 From: Myat Zin Wai Maw Date: Fri, 20 Dec 2019 14:12:57 +0630 Subject: [PATCH 17/19] quick service tax --- app/assets/javascripts/addorder.js | 14 ++++++++++- app/controllers/crm/customers_controller.rb | 3 ++- .../origami/quick_service_controller.rb | 24 +++++++++++++++---- app/views/origami/addorders/detail.html.erb | 17 +++++++++++-- 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 93ec79c1..ca5a6932 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -1097,16 +1097,28 @@ $(function() { var total_price = 0; var total_qty = 0; var taxable_amount = 0; + var exclusive_total =0; + var inclusive_total =0; + var inclusive_tax =$('#inclusive_tax').val(); + var exclusive_tax =$('#exclusive_tax').val(); var item_row = $('.summary-items tbody tr'); - $(item_row).each(function(i){ var unit_price = parseFloat($(item_row[i]).attr('data-price')); var qty = parseFloat($(item_row[i]).children('#item_qty').text()); total_qty += qty; total_price += qty*unit_price; }); + if (inclusive_tax >0){ + inclusive_total = total_price / inclusive_tax; + } + if (exclusive_tax >0){ + exclusive_total = total_price * exclusive_tax; + } + total_price = total_price + exclusive_total + inclusive_total; var fixed_total_price = parseFloat(total_price).toFixed(2); var fixed_taxable_amount = parseFloat(taxable_amount).toFixed(2); + $('#total_tax').empty(); + $('#total_tax').append(exclusive_total + inclusive_total); $('#sub_total').empty(); $('#sub_total').append(fixed_total_price); diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index b6664050..12837add 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -81,7 +81,8 @@ class Crm::CustomersController < BaseCrmController @membership_types = Lookup.collection_of("member_group_type") - # @taxes = TaxProfile.where(:group_type => 'cashier') + # @taxes = TaxProfile.all + # @taxes =TaxProfile.unscoped.select("id,(SELECT name from lookups where lookup_type='tax_profiles') as name") @taxes = TaxProfile.unscoped.select("id, (CONCAT(name,'(',(SELECT name FROM lookups WHERE lookup_type='tax_profiles' AND value=group_type),')')) as name") .order("group_type ASC,order_by ASC") diff --git a/app/controllers/origami/quick_service_controller.rb b/app/controllers/origami/quick_service_controller.rb index 3e69485a..f61da475 100644 --- a/app/controllers/origami/quick_service_controller.rb +++ b/app/controllers/origami/quick_service_controller.rb @@ -32,8 +32,8 @@ class Origami::QuickServiceController < ApplicationController #checked quick_service only @quick_service_only = false lookup_dine_in = Lookup.collection_of('quickservice_add_order') - puts 'lookup_dine_in!!!!' - puts lookup_dine_in + # puts 'lookup_dine_in!!!!' + # puts lookup_dine_in if !lookup_dine_in.empty? lookup_dine_in.each do |dine_in| if dine_in[0].downcase == "quickserviceaddorder" @@ -43,7 +43,23 @@ class Origami::QuickServiceController < ApplicationController end end end - + divided_value =0 + exclusive =0 + tax_profiles = TaxProfile.where(group_type: "quick_service") + if !tax_profiles.empty? + tax_profiles.each do |tax| + #include or execulive + if tax.inclusive + tax_incl_exec = "inclusive" + rate = tax.rate + divided_value += (100 + rate)/rate + else + exclusive +=tax.rate / 100 + end + end + end + @inclusive_tax =divided_value + @exclusive_tax =exclusive render "origami/addorders/detail" end @@ -121,7 +137,7 @@ class Origami::QuickServiceController < ApplicationController order.table_id = params[:table_id] # this is dining facilities's id order.waiters = current_login_employee.name order.employee_name = current_login_employee.name - + order.is_extra_time = is_extra_time order.extra_time = extra_time diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index e7abb58b..ce3d709d 100644 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -10,6 +10,8 @@
+ +
@@ -259,8 +261,17 @@