From 06349e23cc001009f5413c60b97b6c9a30e9d28d Mon Sep 17 00:00:00 2001 From: NyanLinHtut Date: Thu, 29 Aug 2019 18:33:13 +0630 Subject: [PATCH] - --- app/models/order.rb | 36 +++++++++++------------ app/views/api/shifts/create.json.jbuilder | 2 +- app/views/crm/customers/index.html.erb | 29 +++++++++--------- config/initializers/action_controller.rb | 10 +++---- config/puma.rb | 20 ++++++------- 5 files changed, 49 insertions(+), 48 deletions(-) diff --git a/app/models/order.rb b/app/models/order.rb index 26451207..00ecd4ca 100755 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -41,14 +41,14 @@ class Order < ApplicationRecord :booking_status => "assign" }) end #end extra time - + if self.table_id.to_i > 0 table = DiningFacility.find(self.table_id) table.update_attributes(status:"occupied") # table.status = "occupied" # table.save end - + else booking = Booking.find(self.booking_id) #add extra time @@ -56,7 +56,7 @@ class Order < ApplicationRecord if !booking.checkout_at.nil? new_time = booking.checkout_at + self.extra_time.to_i booking.update_attributes(checkout_at: new_time) - end + end end #end extra time end @@ -74,7 +74,7 @@ class Order < ApplicationRecord #Send order to queue one it done! # if self.source != "quick_service" # process_order_queue - # end + # end #send order to broadcast job # send_order_broadcast(booking) @@ -138,7 +138,7 @@ class Order < ApplicationRecord ordered_list.each do |item| menu_item = MenuItem.search_by_item_code(item[:item_instance_code]) - + # For Product while item code not in menu item if menu_item.nil? menu_item = Product.search_by_product_code(item[:item_instance_code]) @@ -148,7 +148,7 @@ class Order < ApplicationRecord # Rails.logger.debug menu_item set_order_items = Array.new ##If menu Item set item - must add child items to order as well, where price is only take from menu_item - if (menu_item[:type] == "SetMenuItem") + if (menu_item[:type] == "SetMenuItem") if (item.include? 'sub_items') || (item.include? :sub_items) item[:sub_items].each do |si| # Retrive instance's Price @@ -286,7 +286,7 @@ class Order < ApplicationRecord # Counter number of quantityf end - + #Process order items and send to order queue def self.pay_process_order_queue(id,table_id) # if ENV["SERVER_MODE"] != 'cloud' @@ -294,7 +294,7 @@ class Order < ApplicationRecord if !sidekiq.nil? OrderQueueProcessorJob.perform_later(id, table_id) else - order = Order.find(id) + order = Order.find(id) if order oqs = OrderQueueStation.new oqs.process_order(order, table_id) @@ -314,11 +314,11 @@ class Order < ApplicationRecord # OrderBroadcastJob.perform_later(table,type) if ENV["SERVER_MODE"] == 'cloud' from = request.subdomain + "." + request.domain - else + else from = "" end ActionCable.server.broadcast "order_channel",table: table,type:type,from:from - + end end @@ -434,7 +434,7 @@ class Order < ApplicationRecord if from.present? && to.present? order = Order.where("DATE_FORMAT(date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(date,'%d-%m-%Y') <= ?", from,to) query = order.where(keyword) - else + else where("order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%") end end @@ -442,12 +442,12 @@ class Order < ApplicationRecord def self.send_customer_view(booking) @status = "" @data_array = Array.new - if(!booking.sale_id.nil?) + if(!booking.sale_id.nil?) sale = Sale.find(booking.sale_id) if sale.sale_status != "completed" && sale.sale_status != 'void' @data_array.push(sale) @status = "sale" - @data_obj = sale + @data_obj = sale end else @@ -474,7 +474,7 @@ class Order < ApplicationRecord end if ENV["SERVER_MODE"] == 'cloud' from = request.subdomain + "." + request.domain - else + else from = "" end ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status,from:from @@ -484,11 +484,11 @@ class Order < ApplicationRecord def self.process_order_queue(order_id,table_id,source) print_status = nil cup_status = nil - + #Send to background job for processing - order = Order.find(order_id) + order = Order.find(order_id) sidekiq = Lookup.find_by_lookup_type("sidekiq") - + if ENV["SERVER_MODE"] != 'cloud' cup_status = `#{"sudo service cups status"}` print_status = check_cup_status(cup_status) @@ -526,7 +526,7 @@ class Order < ApplicationRecord else if ENV["SERVER_MODE"] != 'cloud' - msg = ' Print Error ! Please contact to service' + msg = ' Print Error ! Please contact to service' ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error' end if !sidekiq.nil? diff --git a/app/views/api/shifts/create.json.jbuilder b/app/views/api/shifts/create.json.jbuilder index c5b02c92..fd15892a 100644 --- a/app/views/api/shifts/create.json.jbuilder +++ b/app/views/api/shifts/create.json.jbuilder @@ -29,4 +29,4 @@ if @status == true else json.status false json.error_message @error_message -end \ No newline at end of file +end diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 55295c9e..d379b12b 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -62,7 +62,7 @@ <%end %> - +
<%= paginate @crm_customers %> @@ -76,8 +76,8 @@ - + + --> @@ -122,8 +122,9 @@ <% end %> <%= crm_customer.card_no rescue '-' %> + <%= crm_customer.paypar_account_no rescue '-' %> - <% if crm_customer.membership_id.nil? && !crm_customer.membership_type.nil? && !crm_customer.membership_type =="" && !crm_customer.paypar_account_no =="" && !crm_customer.paypar_account_no.nil? %> + <% if crm_customer.membership_id.nil? && !crm_customer.membership_type.nil? && !crm_customer.membership_type.blank? && !crm_customer.paypar_account_no.blank? && !crm_customer.paypar_account_no.nil? %> <%= link_to t("views.btn.sync"), crm_customer_sync_path(crm_customer), :class => "btn btn-md bg-green waves-effect" %> <% end %> <% if @customer_update_phone_email_membertype %> @@ -138,7 +139,7 @@ <% end %> - +
<% if @create_flag %> @@ -178,10 +179,10 @@ // QR Code Reader $("#qr_code").on('click', function(e){ - var code = ""; + var code = ""; setTimeout(function(){ code=getQRCode(); - setQRCode(code); + setQRCode(code); },100); }); @@ -199,12 +200,12 @@ /*new customer UI func:*/ //Initialize tooltips $('.nav-tabs > li a[title]').tooltip(); - + //Wizard $('a[data-toggle="tab"]').on('show.bs.tab', function (e) { var $target = $(e.target); - + if ($target.parent().hasClass('disabled')) { return false; } @@ -256,10 +257,10 @@ url: url, data: {}, dataType: "json", - success: function(data) { - // Selected for Taxes - var taxes = JSON.stringify(data.tax_profiles); - var parse_taxes = JSON.parse(taxes); + success: function(data) { + // Selected for Taxes + var taxes = JSON.stringify(data.tax_profiles); + var parse_taxes = JSON.parse(taxes); $.each(parse_taxes, function(i, value){ $("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'}); }); @@ -272,7 +273,7 @@ $('#customer_salutation').val(data.salutation); $('#customer_nrc_no').val(data.nrc_no); $('#customer_card_no').val(data.card_no); - $('#customer_type').val(data.customer_type); + $('#customer_type').val(data.customer_type); $('#paypar_account_no').val(data.paypar_account_no); $('#customer_address').val(data.address); $('#customer_date_of_birth').val(data.date_of_birth); diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 205c330a..85f38ec5 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -21,11 +21,11 @@ class ActionController::Base end else # check for license file - if check_license - current_license(ENV["SX_PROVISION_URL"]) - else - redirect_to activate_path - end + # if check_license + # current_license(ENV["SX_PROVISION_URL"]) + # else + # redirect_to activate_path + # end end end diff --git a/config/puma.rb b/config/puma.rb index fd89392f..6a545bed 100755 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,10 +1,10 @@ -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! +# 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!