Add multiple photo upload
This commit is contained in:
@@ -31,4 +31,29 @@ class Menu < ApplicationRecord
|
||||
menu.destroy
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def self.to_csv
|
||||
m_attributes = %w{id name is_active valid_days valid_time_from valid_time_to created_by created_at updated_at}
|
||||
CSV.generate(headers: true) do |csv|
|
||||
csv << m_attributes
|
||||
menu = Menu.all
|
||||
menu.each do |user|
|
||||
puts user
|
||||
csv << m_attributes.map{ |attr| user.send(attr)}
|
||||
end
|
||||
end
|
||||
|
||||
# mc_attributes = %w{id menu_id code name alt_name order_by created_by menu_category_id is_available created_at updated_at}
|
||||
# CSV.generate(headers: true) do |csv|
|
||||
# csv << m_attributes
|
||||
|
||||
# csv << mc_attributes
|
||||
# MenuCategory.all.each do |user|
|
||||
# puts user
|
||||
# csv << mc_attributes.map{ |attr| user.send(attr)}
|
||||
# end
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -135,7 +135,7 @@ class Order < ApplicationRecord
|
||||
|
||||
#loop to add all items to order
|
||||
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
|
||||
@@ -152,7 +152,7 @@ class Order < ApplicationRecord
|
||||
item[:sub_items].each do |si|
|
||||
# Retrive instance's Price
|
||||
set_item = MenuItem.search_by_item_code(si[:item_instance_code])
|
||||
set_order_items.push({"item_instance_code"=>si[:item_instance_code], "quantity"=>si[:quantity], "price"=>set_item[:price]})
|
||||
set_order_items.push({"item_instance_code"=>si[:item_instance_code], "item_instance_name"=>set_item[:name], "quantity"=>si[:quantity], "price"=>set_item[:price], "options"=>si[:options]})
|
||||
end
|
||||
end
|
||||
set_order_items = set_order_items.to_json
|
||||
@@ -339,17 +339,17 @@ class Order < ApplicationRecord
|
||||
#Process order items and send to order queue
|
||||
def self.pay_process_order_queue(id,table_id)
|
||||
sidekiq = Lookup.find_by_lookup_type("sidekiq")
|
||||
if !sidekiq.nil?
|
||||
OrderQueueProcessorJob.perform_later(id, table_id)
|
||||
else
|
||||
order = Order.find(id)
|
||||
if order
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.process_order(order, table_id)
|
||||
end
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(id)
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
end
|
||||
if !sidekiq.nil?
|
||||
OrderQueueProcessorJob.perform_later(id, table_id)
|
||||
else
|
||||
order = Order.find(id)
|
||||
if order
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.process_order(order, table_id)
|
||||
end
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(id)
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
end
|
||||
end
|
||||
|
||||
def check_cup_status(status)
|
||||
|
||||
@@ -6,4 +6,8 @@ class Shop < ApplicationRecord
|
||||
|
||||
has_many :display_images
|
||||
accepts_nested_attributes_for :display_images
|
||||
|
||||
def file_data=(input_data)
|
||||
self.data = input_data.read
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user