From 95b7f7b80debf272e300fc3bb9abfb2bd7e66f90 Mon Sep 17 00:00:00 2001 From: Wathon Aung Date: Thu, 20 Apr 2017 17:56:00 +0630 Subject: [PATCH] edit json builder booking order --- .ruby-version | 1 + app/views/api/bookings/show.json.jbuilder | 25 ++++++++++++---------- dump.rdb | Bin 0 -> 485 bytes 3 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 .ruby-version create mode 100644 dump.rdb diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..0bee604d --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.3.3 diff --git a/app/views/api/bookings/show.json.jbuilder b/app/views/api/bookings/show.json.jbuilder index 28dec50c..d579810c 100644 --- a/app/views/api/bookings/show.json.jbuilder +++ b/app/views/api/bookings/show.json.jbuilder @@ -12,22 +12,25 @@ if (@booking) @total_tax = 0.00 if @booking.booking_orders + order_items = [] @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 + order_items = order_items + order.order_items end end + + 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 json.sub_total @total_amount diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 0000000000000000000000000000000000000000..96c96478436694a7da4fdb143daf16a6e2e802f7 GIT binary patch literal 485 zcmZvZ&q~}-6vpppMy&%QidqW7gp1%N3CW$z(SP)Js)Ck*2#YdH^HCADemS%W;6xt<9Aq%5e#d1 zDgoD~t3QjYrerZH`78RUB z7WJ`DS{i=IkNrJ7z5q&s)uk>w>>l(u%Q=&MyszPehA=9qHHF2H$>8H)?lL&5zX^uV nl&}!}5-A~2IX^b%I=15(UfXIC2i0CZp+t{Ycb_kkUxURbn6RK= literal 0 HcmV?d00001