This commit is contained in:
NyanLinHtut
2019-08-29 18:33:13 +06:30
parent e443c5431e
commit 06349e23cc
5 changed files with 49 additions and 48 deletions

View File

@@ -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?

View File

@@ -29,4 +29,4 @@ if @status == true
else
json.status false
json.error_message @error_message
end
end

View File

@@ -62,7 +62,7 @@
<%end %>
</div>
</div>
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-8">
<%= paginate @crm_customers %>
@@ -76,8 +76,8 @@
<button id="member_acc_no" class="btn btn-success btn-md"><span class="fa fa-credit-card"></span> Member Card</button>
<button id="qr_code" class="btn btn-danger btn-md">
<span class="fa fa-credit-card"></span> QR CODE
</button>
</button>
</td>
</tr>-->
<tr>
@@ -122,8 +122,9 @@
<% end %>
</td>
<td><%= crm_customer.card_no rescue '-' %></td>
<td><%= crm_customer.paypar_account_no rescue '-' %></td>
<td>
<% 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 %>
</tbody>
</table>
</div>
</div>
<% 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);

View File

@@ -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

View File

@@ -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!