diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 0c319877..218bceef 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -62,14 +62,14 @@ $(function() { +'' - +"
"+type+"
" $(value).each(function(i){ - row +=""; }); @@ -540,6 +550,90 @@ $(function() { //click item row for add order $(document).on('click', '.menu_item_box', function(event){ + attributes = $(this).data('id'); + selected_item = $(this).data('item'); + instances = $(this).data('instance'); + item_options = $(this).data('option'); + data = $(this).parent().siblings('.add_icon'); + + show_attribute_selection_modal(attributes, selected_item, instances, item_options, data) + + }); + + // click plus icon for add + $(document).on('click', '.add_icon', function(event){ + + if($(this).hasClass('product_item')) { + $('.sx_item_detailModal').modal('hide'); + + var item_data = $(this); + code = $(this).data('instance-code'); + + if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) { + item = get_item(item_data,"add_icon"); + customer_display_view(item,"add"); + } + show_item_detail(item_data,"add_icon"); + calculate_sub_total(); + autoScrollToItem(code) + + return + } + + if ($(this).data('instances').length == 1) { + + $('.sx_item_detailModal').modal('hide'); + + if ($(this).data('instances')[0].out_of_stock == false ) { + var item_data = $(this); + code = $(this).data('instance-code'); + + if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) { + item = get_item(item_data,"add_icon"); + customer_display_view(item,"add"); + } + show_item_detail(item_data,"add_icon"); + calculate_sub_total(); + autoScrollToItem(code) + + } + return + + } else { + count = 0 + for (var i in $(this).data('instances')) { + if(!$(this).data('instances')[i].out_of_stock) { + count += 1; + } + } + + if (count === 1) { + $('.sx_item_detailModal').modal('hide'); + + var item_data = $(this); + code = $(this).data('instance-code'); + + if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) { + item = get_item(item_data,"add_icon"); + customer_display_view(item,"add"); + } + show_item_detail(item_data,"add_icon"); + calculate_sub_total(); + autoScrollToItem(code) + return + } + + attributes = $(this).data('id'); + selected_item = $(this).data('attributes'); + instances = $(this).data('instances'); + item_options = $(this).data('options'); + data = $(this) + + show_attribute_selection_modal(attributes, selected_item, instances, item_options, data) + } + }); //End Add Icon Click + + function show_attribute_selection_modal(attributes, selected_item, instances, item_options, data) { $('.attributes-list').empty(); $('.options-list').empty(); $('#modal_box_img').empty(); @@ -553,19 +647,16 @@ $(function() { $('.add_to_order').removeAttr('data-name'); $('.add_to_order').removeAttr('data-attributes'); $('.add_to_order').removeAttr('data-options'); + $('.add_to_order').removeAttr('disabled'); + $('#minus').removeAttr('disabled'); + $('#plus').removeAttr('disabled'); + $('#count').removeAttr('readonly'); + $('#wanring_text').text(''); + $('#total_price').text(0.0); - $('#count').val(1); + $('#count').val(1); change_qty_plus_minus("count","plus","minus"); - // data = $(this).parent().children().children('.add_icon'); - data = $(this).parent().siblings('.add_icon'); - - $('#total_price').text(data.attr('data-price')); - attributes = $(this).data('id'); - selected_item = $(this).data('item'); - instances = $(this).data('instance'); - item_options = $(this).data('option'); - if (data.attr('data-image')) { if (modify_order) { image = "| # | @@ -184,10 +194,6 @@Price |
|---|
| Total: | -0 | -0.00 | +Total: | +0 | +0.00 | ||
<%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %>
@@ -465,6 +478,9 @@ $(document).ready(function () { }); $(document).on('click', '.menu_click', function(event){ + + $('.category_list').find('li').find('.nav-link').removeClass('active'); + var menu_id = $(this).attr("data-id"); var name = $(this).attr("data-name"); var menus = JSON.parse(localStorage.getItem("menus")); diff --git a/app/views/foodcourt/orders/app_orders.html.erb b/app/views/foodcourt/orders/app_orders.html.erb index 629a3d97..3e876618 100644 --- a/app/views/foodcourt/orders/app_orders.html.erb +++ b/app/views/foodcourt/orders/app_orders.html.erb @@ -8,95 +8,186 @@ <%= javascript_include_tag 'custom', 'data-turbolinks-track': 'reload' %> - -| <%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%> |
| Items | +QTY | +Price | +
|---|---|---|
| <%= sale_item.product_name %> | +<%= sale_item.qty %> | +<%= sale_item.price %> | +
| <%= order_item.item_name %> | +<%= order_item.qty %> | +<%= total %> | +
| Member Discount: | + <%else%> +Discount: | + <%end%> +(<%= @sale.total_discount rescue 0%>) | +
| Tax: | +<%= @sale.total_tax rescue 0%> | +|
| Rounding Adj: | +<%= @sale.rounding_adjustment rescue 0%> | +|
| Grand Total: | +<%= @sale.grand_total rescue 0%> | +|
| Sub Total: | +<%= sub_total %> | +
<%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %>
diff --git a/config/routes.rb b/config/routes.rb index a303d2d0..8914aced 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -698,6 +698,10 @@ scope "(:locale)", locale: /en|mm/ do get "food_court" => "food_court#index" get "app_orders" => "orders#app_orders",:as => "app_order_by_booking" post ':booking_id/:order_id/completed' => "orders#completed", :defaults => { :format => 'json' } + get "food_court/modify_order/:id/:sale_id" => "orders#modify_order" + post '/food_court/update_modify_order' => "orders#update_modify_order", :defaults => { :format => 'json' } + get '/food_court/:order_id/request_bill' => 'orders#request_bill', :as => 'food_court_request_bill' + get 'current_shift_order_count' => 'orders#current_shift_order_count', :as => 'food_court_order_count' end end end