verify
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
if @result
|
||||
json.status true
|
||||
json.sent_pin true
|
||||
json.customer_id @cus.id
|
||||
elsif @cus
|
||||
json.status true
|
||||
json.sent_pin false
|
||||
|
||||
@@ -41,16 +41,16 @@ if (menu.menu_categories)
|
||||
attr_format = []
|
||||
# Format for attributes json
|
||||
if item.item_attributes.count > 0
|
||||
item_attributes = @item_attributes.select{ |x| item.item_attributes.include?(x.id.to_s) }
|
||||
attr_format = item_attributes.group_by {|att| att.attribute_type }.map { |type, values| {type: type, values: values.map(&:name)} }
|
||||
item_attributes = item.item_attributes.map(&:to_s)
|
||||
attr_format = @item_attributes.select { |x| item_attributes.include?(x.id.to_s) }.group_by {|att| att.attribute_type.strip }.map { |type, values| {type: type, values: values.map { |x| x.name.strip } } }
|
||||
end
|
||||
|
||||
# Format for option json
|
||||
opt_format = []
|
||||
# Format for attributes json
|
||||
if item.item_options.count > 0
|
||||
item_options = @item_options.select{ |x| item.item_options.include?(x.id.to_s) }
|
||||
opt_format = item_options.group_by {|opt| opt.option_type }.map { |type, values| {type: type, values: values.map(&:name)} }
|
||||
item_options = item.item_options.map(&:to_s)
|
||||
opt_format = @item_options.select { |x| item_options.include?(x.id.to_s) }.group_by {|opt| opt.option_type.strip }.map { |type, values| {type: type, values: values.map { |x| x.name.strip } } }
|
||||
end
|
||||
|
||||
#Menu Item Information
|
||||
@@ -69,15 +69,14 @@ if (menu.menu_categories)
|
||||
json.unit item.unit
|
||||
|
||||
# Item Sets of Menu Item
|
||||
json.item_sets item.item_sets.map { |its|
|
||||
{ id: its.id,
|
||||
name: its.name,
|
||||
alt_name: its.alt_name,
|
||||
min_selectable_qty: its.min_selectable_qty,
|
||||
max_selectable_qty: its.max_selectable_qty,
|
||||
instances: its.menu_item_instances.map { |i| {id: i.id} }
|
||||
}
|
||||
}
|
||||
json.item_sets item.item_sets do |its|
|
||||
json.id its.id
|
||||
json.name its.name
|
||||
json.alt_name its.alt_name
|
||||
json.min_selectable_qty its.min_selectable_qty
|
||||
json.max_selectable_qty its.max_selectable_qty
|
||||
json.instances its.menu_item_instances.map { |i| {id: i.id} }
|
||||
end
|
||||
|
||||
json.attributes attr_format
|
||||
json.options opt_format
|
||||
@@ -85,7 +84,8 @@ if (menu.menu_categories)
|
||||
json.instances item.menu_item_instances do |is|
|
||||
if is.is_available
|
||||
# Convert id to name for attributes
|
||||
instance_attr = @item_attributes.select{ |x| item.item_attributes.include?(x.id) }.pluck(:name)
|
||||
item_attributes = is.item_attributes.map(&:to_s)
|
||||
instance_attr = @item_attributes.select{ |x| item_attributes.include?(x.id.to_s) }.pluck(:name)
|
||||
|
||||
json.id is.id
|
||||
json.code is.item_instance_code
|
||||
|
||||
Reference in New Issue
Block a user