Zone and OQS
This commit is contained in:
@@ -6,6 +6,9 @@ class Employee < ApplicationRecord
|
||||
validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true
|
||||
validates :password, numericality: true, length: {in: 3..9}, allow_blank: true
|
||||
|
||||
def self.collection
|
||||
Employee.select("id, name").map { |e| [e.name, e.id] }
|
||||
end
|
||||
|
||||
def self.login(emp_id, password)
|
||||
user = Employee.find_by_emp_id(emp_id)
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
class OrderQueueStation < ApplicationRecord
|
||||
has_many :assigned_order_items
|
||||
has_many :order_items
|
||||
has_many :order_queue_process_by_zones
|
||||
has_many :zones, through: :order_queue_process_by_zones
|
||||
|
||||
scope :active, -> {where(is_active: true)}
|
||||
|
||||
def process_order (order)
|
||||
def process_order (order)
|
||||
oqs_stations = OrderQueueStation.active
|
||||
|
||||
order_items = order.order_items
|
||||
@@ -20,10 +22,10 @@ class OrderQueueStation < ApplicationRecord
|
||||
#Loop through the processing items
|
||||
pq_items.each do |pq_item|
|
||||
#Processing through the looping items
|
||||
order_items.each do |order_item|
|
||||
order_items.each do |order_item|
|
||||
if (pq_item == order_item.item_code)
|
||||
#Same Order_items can appear in two location.
|
||||
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,7 +2,12 @@ class Zone < ApplicationRecord
|
||||
# model association
|
||||
has_many :tables, dependent: :destroy
|
||||
has_many :rooms, dependent: :destroy
|
||||
has_many :order_queue_stations
|
||||
|
||||
# validations
|
||||
validates_presence_of :name, :created_by
|
||||
|
||||
def self.collection
|
||||
Zone.select("id, name").map { |e| [e.name, e.id] }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user