api integrated
This commit is contained in:
7
app/views/api/bookings/create.json.jbuilder
Normal file
7
app/views/api/bookings/create.json.jbuilder
Normal file
@@ -0,0 +1,7 @@
|
||||
if @status == true
|
||||
#show invoice number and stuff
|
||||
json.status @status
|
||||
else
|
||||
json.status @status
|
||||
json.error_message @error_message
|
||||
end
|
||||
37
app/views/api/bookings/show.json.jbuilder
Normal file
37
app/views/api/bookings/show.json.jbuilder
Normal file
@@ -0,0 +1,37 @@
|
||||
if (@booking)
|
||||
json.id @booking.id
|
||||
json.status @booking.booking_status
|
||||
json.checkin_at @booking.checkin_at
|
||||
|
||||
if @booking.type == "TableBooking"
|
||||
json.table_id @booking.dining_facility_id
|
||||
else
|
||||
json.room_id @booking.dining_facility_id
|
||||
end
|
||||
@total_amount = 0.00
|
||||
@total_tax = 0.00
|
||||
|
||||
if @booking.booking_orders
|
||||
@booking.booking_orders.each do |bo|
|
||||
order = Order.find(bo.order_id)
|
||||
if (order.status == "new")
|
||||
order_items = order.order_items
|
||||
json.order_items order_items do |item|
|
||||
json.item_instance_code item.item_code
|
||||
json.item_name item.item_name
|
||||
json.price item.price
|
||||
json.qty item.qty
|
||||
json.options item.options
|
||||
json.remark item.remark
|
||||
json.item_status item.order_item_status
|
||||
@total_amount = @total_amount + (item.price * item.qty)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
json.sub_total @total_amount
|
||||
json.commerical_tax @total_amount * 0.05
|
||||
json.total @total_amount + (@total_amount * 0.05)
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user