shop code

This commit is contained in:
Nweni
2019-12-04 10:49:46 +06:30
18 changed files with 108 additions and 120 deletions

View File

@@ -5,6 +5,8 @@ class Lookup < ApplicationRecord
scope :number_formats, -> { where(lookup_type: 'number_format')}
TIME_LIMIT = 5
def available_types
{'Employee Roles' => 'employee_roles',
'Dining Facilities Status' => 'dining_facilities_status',
@@ -24,15 +26,15 @@ class Lookup < ApplicationRecord
# Lookup.select("value, name").where("lookup_type = ?", lookup_type ).order("name asc").map { |r| [r.name, r.value] }
# end
def self.get_checkin_time_limit(shop_code)
time_limit = 5
lookup = Lookup.find_by_lookup_type_and_shop_code('checkin_time_limit',shop_code)
if !lookup.nil?
time_limit = lookup.value.to_i
end
def self.time_limit
TIME_LIMIT
end
return time_limit
def self.get_checkin_time_limit
return RequestStore[:checkin_time_limit] if RequestStore[:checkin_time_limit]
RequestStore[:checkin_time_limit] = Lookup.find_by_lookup_type('checkin_time_limit').value.to_i rescue time_limit
end
def self.sync_url
@@ -59,7 +61,6 @@ class Lookup < ApplicationRecord
def self.collection_of(type)
Lookup.select("name, value").where("lookup_type" => type ).map { |l| [l.name, l.value] }
end
def self.create_shift_sale_lookup(shop_code)