diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index fa4cec7c..dbd84007 100644 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -8,18 +8,16 @@ class Origami::HomeController < BaseOrigamiController left join order_items on order_items.order_id = orders.id") .where("orders.order_type=? and dining_facilities.is_active=?","dine_in",true) .group("orders.id") - end def show @order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price") .joins("left join orders on orders.id = order_items.order_id") - .where("order_items.order_id=?",params[:order_id]) - respond_to do |format| - format.html - format.json{ - render :json => @order_details.to_json - } - end - + .where("order_items.order_id=?",params[:order_id]) + # render :json => @order_details.to_json + str = [] + @order_details.each do |ord_detail| + str.push(ord_detail) + end + render :json => str.to_json end end diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 156ee076..ec523494 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -196,23 +196,18 @@
- <% sub_total = 0%> - <% if @order_details%> - <% @order_details.each do |order_detail| %> - - <% end %> - <% end %> + +
- <%=order_detail.item_name%> @ <%=order_detail.price%> + - <%=order_detail.qty%> + - <%=order_detail.total_price%> - <%sub_total+=order_detail.total_price%> +
@@ -220,13 +215,13 @@ - - + +
Total Amount<%=sub_total%>Sub Total