From 7f6676c840d9dde16ce8c14f29d2df8db3ef0886 Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 16 Mar 2018 18:07:35 +0630 Subject: [PATCH] change order item count --- app/views/origami/split_bill/index.html.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/origami/split_bill/index.html.erb b/app/views/origami/split_bill/index.html.erb index fb97b51d..69743cf1 100755 --- a/app/views/origami/split_bill/index.html.erb +++ b/app/views/origami/split_bill/index.html.erb @@ -53,12 +53,14 @@ + <% order_item_count = 0 %> <% if !@order_items.nil? %> <% sub_total = 0 %> <% @order_items.each do |order_item| %> <% if order_item.include? ('all_order') %> <% order_item['all_order'].each do |odr_item| %> <% + order_item_count = order_item_count.to_i + 1 sub_total += odr_item['qty'].to_f * odr_item['price'].to_f %> > @@ -385,10 +387,10 @@ //order_item_split $('#order_item_split').on('click',function () { - var cnt_order_item = "<%= @order_items.count %>"; + var cnt_order_item = "<%= order_item_count %>"; var order_items = get_selected_order_items();// Selected Order Items - var cnt_items = parseInt(cnt_order_item - 1) - parseInt(order_items.length); + var cnt_items = parseInt(cnt_order_item) - parseInt(order_items.length); if (order_items.length > 0){ // if(cnt_items > 0){ swal({