diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 64003b8b..b65561e9 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -95,7 +95,6 @@ $(function() { var menu_items_list = $('.menu_items_list'); menu_items_list.empty(); menu_items = data.menu_items; - console.log(menu_items); for(var field in menu_items) { if (menu_items[field].is_sub_item == false) { @@ -194,6 +193,7 @@ $(function() { $(document).on('click', '.set_item_box', function(event){ $(".instance-list").empty(); $(".options-list").empty(); + $('.set_change_qty').val(1); change_qty_plus_minus("set_count","set_plus","set_minus"); data = $(this).parent().children().children('.add_icon'); @@ -373,6 +373,8 @@ $(function() { $('.add_to_order').removeAttr('data-attributes'); $('.add_to_order').removeAttr('data-options'); + $('.change_qty').val(1); + change_qty_plus_minus("count","plus","minus"); data = $(this).parent().children().children('.add_icon'); @@ -513,7 +515,6 @@ $(function() { // click select option icon for add $(document).on('click', '.option_btn', function(event){ active =$(this).hasClass('selected-option'); - console.log(active); value = $(this).data('value'); type = $(this).data('type'); group = $(this).data('group'); @@ -558,8 +559,23 @@ $(function() { if (item_row.length>0) { var instances = jQuery.parseJSON(item_row.attr('data-instances')); - for(var field in instances) { - if (JSON.stringify(attribute_arr) === JSON.stringify(instances[field].values)) { + + + for(var field in instances) { + + attrbu = JSON.stringify(attribute_arr); + instan = JSON.stringify(instances[field].values); + var newarr = new Set(instan); + + result = false; + for(var i in attrbu) { + if (newarr.has(attrbu[i])) { + result = true; + break; + } + + } + if (JSON.stringify(attribute_arr) === JSON.stringify(instances[field].values) || result) { $('.add_to_order').attr('data-instance-code',instances[field].code); $('.add_to_order').attr('data-instance',instances[field].name); $('.add_to_order').attr('data-price',instances[field].price); @@ -872,7 +888,7 @@ $(function() { id = $(this).attr('id'); value = $(this).val(); - $('#count').attr('value',value); + $('.change_qty').attr('value',value); if (id=="count") { price = $("#unit_price").text(); $("#total_price").text(value*price); @@ -880,7 +896,7 @@ $(function() { var item_row = $('.selected-instance'); price = $("#set_unit_price").text(); set_total_price = $("#set_total_price").text(); - $("#set_count").val(value); + $(".set_change_qty").val(value); if (item_row.length > 1) { total = 0 ; $(item_row).each(function(i){ diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index bc621bd7..e0667a83 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -45,7 +45,7 @@ class HomeController < ApplicationController elsif @employee.role == "manager" session[:session_token] = @employee.token_session redirect_to dashboard_path - elsif @employee.role == "supervisour" + elsif @employee.role == "supervisor" session[:session_token] = @employee.token_session redirect_to origami_root_path elsif @employee.role == "account" @@ -151,7 +151,7 @@ class HomeController < ApplicationController redirect_to oqs_root_path elsif employee.role == "crm" redirect_to crm_root_path - elsif @employee.role == "supervisour" + elsif @employee.role == "supervisor" redirect_to origami_root_path elsif @employee.role == "account" redirect_to reports_dailysale_index_path diff --git a/app/models/ability.rb b/app/models/ability.rb index 70ce4e94..c2947fe1 100755 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -122,7 +122,7 @@ class Ability can :index, :credit_payment can :index, :void_sale - elsif user.role == "supervisour" + elsif user.role == "supervisor" can :edit, :sale_edit can :item_void, :sale_edit diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index bcd3becf..ebdfa147 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -45,7 +45,7 @@ class ReceiptBillPdf < Prawn::Document delimiter = "" end - header( shop_details) + header(shop_details) stroke_horizontal_rule @@ -60,12 +60,14 @@ class ReceiptBillPdf < Prawn::Document customer(customer_name) - if discount_price_by_accounts.length > 0 + if discount_price_by_accounts.length > 0 && shop_details.show_account_info discount_account(discount_price_by_accounts,printer_settings.precision,delimiter) end - items_account(item_price_by_accounts,printer_settings.precision,delimiter) - + if shop_details.show_account_info + items_account(item_price_by_accounts,printer_settings.precision,delimiter) + end + sign(sale_data) footer(printed_status) @@ -389,6 +391,8 @@ class ReceiptBillPdf < Prawn::Document text "#{ customer_name }" , :size => self.item_font_size,:align => :right end end + + def discount_account(discount_price_by_accounts,precision,delimiter) move_down 5 stroke_horizontal_rule diff --git a/app/views/layouts/login_dashboard.html.erb b/app/views/layouts/login_dashboard.html.erb index d0d2cddd..7df224a3 100755 --- a/app/views/layouts/login_dashboard.html.erb +++ b/app/views/layouts/login_dashboard.html.erb @@ -85,7 +85,7 @@
<%= @sale_array[0].customer_id rescue '' %>
- Customer : <%= @sale_array[0].customer.name rescue '' %> + Customer : <%= @sale_array[0].customer.name rescue '' %> <% elsif @status_order == 'order' %><%= @customer.customer_id rescue "" %>
- Customer : <%= @customer.name rescue "" %> + Customer : <%= @customer.name rescue "" %> <% end %><%= @obj_sale_sale.customer_id rescue '' %>
- Customer : <%= @obj_sale.customer.name rescue '-' %> + Customer : <%= @obj_sale.customer.name rescue '-' %> <%else%><%= @obj_order.customer_id rescue "-" %>
- Customer : <%= @customer.name rescue "-" %> + Customer : <%= @customer.name rescue "-" %> <%end%>