update add order
This commit is contained in:
BIN
app/assets/images/logo.png
Normal file
BIN
app/assets/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
39
app/controllers/api/restaurant/menu_categories_controller.rb
Normal file
39
app/controllers/api/restaurant/menu_categories_controller.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
class Api::Restaurant::MenuCategoriesController < Api::ApiController
|
||||
skip_before_action :authenticate
|
||||
#Description
|
||||
# Pull the default menu details and also other available (active) menus
|
||||
# Input Params - order_id
|
||||
def index
|
||||
@menus = MenuCategory.all
|
||||
@current_menu = MenuCategory.current_menu
|
||||
|
||||
end
|
||||
|
||||
#Description
|
||||
# This API show current order details
|
||||
# Input Params - menu_id
|
||||
def show
|
||||
puts "SSSSSSSSSSSSS"
|
||||
@menu = menu_detail(params[:id])
|
||||
puts @menu.to_json
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def menu_detail (menu_id)
|
||||
if (menu_id)
|
||||
#Pull this menu
|
||||
menu = MenuCategory.find_by_id(menu_id)
|
||||
return menu
|
||||
else
|
||||
MenuCategory.current_menu
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def menu_params()
|
||||
params.permit(:id)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
43
app/views/api/restaurant/menu_categories/show.json.jbuilder
Normal file
43
app/views/api/restaurant/menu_categories/show.json.jbuilder
Normal file
@@ -0,0 +1,43 @@
|
||||
if @menu.menu_items
|
||||
json.menu_items @menu.menu_items do |item|
|
||||
#Menu Item Information
|
||||
json.item_code item.item_code
|
||||
json.name item.name
|
||||
json.alt_name item.alt_name
|
||||
json.type item.type
|
||||
json.min_qty item.min_qty
|
||||
json.min_selectable_item item.min_selectable_item
|
||||
json.max_selectable_item item.max_selectable_item
|
||||
|
||||
#Item instance
|
||||
if item.menu_item_instances.count == 1 then
|
||||
|
||||
item_instance = item.menu_item_instances[0]
|
||||
json.price = item_instance.price
|
||||
json.is_available = item_instance.is_available
|
||||
json.is_on_promotion = item_instance.is_on_promotion
|
||||
json.promotion_price = item_instance.promotion_price
|
||||
json.item_attributes = item_instance.item_attributes
|
||||
|
||||
elsif item.menu_item_instances.count > 1 then
|
||||
|
||||
json.item_instances item.menu_item_instances do |is|
|
||||
json.item_instance_item_code = is.item_instance_code
|
||||
json.item_instance_name = is.item_instance_name
|
||||
json.price = is.price
|
||||
json.is_available = is.is_available
|
||||
json.is_on_promotion = is.is_on_promotion
|
||||
json.promotion_price = is.promotion_price
|
||||
json.item_attributes = is.item_attributes
|
||||
end
|
||||
|
||||
end
|
||||
#Child Menu items
|
||||
if (item.children) then
|
||||
json.set_items item.children.each do |item|
|
||||
json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -81,6 +81,7 @@ $(function(){
|
||||
}); //End Booking Click
|
||||
|
||||
function show_details(url_item){
|
||||
alert(url_item)
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -109,9 +110,8 @@ function show_details(url_item){
|
||||
+'<div class="card-footer">'
|
||||
+'<small>'+ price +'</small>'
|
||||
+'</div>';
|
||||
|
||||
$(".menu_items_list").append(row);
|
||||
}
|
||||
$(".menu_items_list").html(row);
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
|
||||
BIN
public/image/logo.png
Normal file
BIN
public/image/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
Reference in New Issue
Block a user