!!! %html{:lang => "fr"} %head %meta{:charset => "utf-8"}/ %meta{:content => "IE=Edge,chrome=1", "http-equiv" => "X-UA-Compatible"}/ %meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}/ %title= @title || "Admin" = csrf_meta_tags = stylesheet_link_tag :admin, :media => :all = javascript_include_tag "admin" =javascript_include_tag "https://maps.google.com/maps/api/js?sensor=false®ion=FR" =#javascript_include_tag "https://yidas.github.io/jquery-freeze-table/dist/js/freeze-table.js" %body.admin{:id => "body_#{@qi_menu_active}"} #right_bar =link_to image_tag("/logo-prestaphone.png"), "/", :id => "logo" -if current_admin -@qi_menus.each do |k,v| :scss #body_#{k.to_s}{ #admin_nav{ //background:$big_color_#{k.to_s} !important; background-color: #{v[:color].to_s} !important; } } #big_cat_#{k.to_s}.active, #big_cat_#{k.to_s}:hover{ //color:$big_color_#{k.to_s} !important; //background-color: #{v[:color].to_s} !important; color:white !important; border-right:4px solid #{v[:color].to_s}; } #big_cat_#{k.to_s}{ //color:$big_color_#{k.to_s} !important; color: rgba(white, 0.5) !important; border-right:4px solid transparent; } .bgbd-#{k.to_s}{ background-color: #{v[:color].to_s} !important; border-color: #{v[:color].to_s} !important; } .element =link_to v[:link] do .cat#big_cat{:id => k.to_s} =ic v[:icon].to_s.to_sym =v[:name] .bottom .element -if current_admin and current_admin.has_permission?("admins") =link_to admin_admins_path do .cat#big_cat_preferences =ic :"cog" =image_tag("/logo-basic-intelligence.png", :id => "logo-basic") if true =render partial: "layouts/navbar" #main_yield= yield :coffeescript $(".price_lines_form").sortable tolerance: "pointer" handle : ".take" stop : (evt, ui) -> i = 0 $(this).find(".price_line_form").each -> i += 1 $(this).find(".price_line_position_input").val(i) :coffeescript parse_field = (val) -> return parseFloat(val) round_price = (val) -> return (Math.round(val*100)/ 100) update_qi_price_form = (form) -> tot_lines_ht = 0.0 tot_lines_tva = 0.0 tot_lines_ttc = 0.0 weight_tot = 0.0 form.find(".price_line_form").each -> #alert($(this).find(".destroy input").val() == "false") if ($(this).find(".destroy input").val() == "false") qte = parse_field($(this).find(".input_price_line_qte").val()) if $(this).find(".input_price_line_forced_price").is(':checked') price_u_ht = parse_field($(this).find(".input_price_line_ct_u_price_ht").val()) $(this).find(".forced_price_wrapper").show() else price_u_ht = parse_field($(this).find(".input_price_line_price_u_ht").val()) $(this).find(".input_price_line_ct_u_price_ht").val("") $(this).find(".forced_price_wrapper").hide() line_tot_line_ht = round_price(qte * price_u_ht) $(this).find(".input_price_line_tot_line_ht").val(line_tot_line_ht) tot_discount_ht = parse_field($(this).find(".input_price_line_tot_discount_ht").val()) tva_account_value = parse_field($(this).find(".input_price_line_tva_account_value").val()) tot_amount_ht = round_price(line_tot_line_ht + tot_discount_ht) $(this).find(".input_price_line_tot_amount_ht").val(tot_amount_ht) tot_amount_tva = round_price(tot_amount_ht * (tva_account_value/ 100)) $(this).find(".input_price_line_tot_amount_tva").val(tot_amount_tva) tot_amount_ttc = round_price(tot_amount_ht + tot_amount_tva) $(this).find(".input_price_line_tot_amount_ttc").val(tot_amount_ttc) tot_lines_ht += round_price(tot_amount_ht) tot_lines_tva += round_price(tot_amount_tva) tot_lines_ttc += round_price(tot_amount_ttc) weight_u = parse_field($(this).find(".input_price_line_weight_u").val()) line_weight_tot = round_price(weight_u * qte) $(this).find(".input_price_line_weight_tot").val(line_weight_tot) weight_tot += line_weight_tot form.find(".input_price_line_block_tot_lines_ht").val(tot_lines_ht) ct_tot_discount_percent = parse_field(form.find(".input_price_line_block_ct_tot_discount_percent").val()) ct_tot_discount_percent = 0.0 if isNaN(ct_tot_discount_percent) ct_tot_discount_ht = round_price((ct_tot_discount_percent / -100) * tot_lines_ht) ct_tot_discount_tva = round_price((ct_tot_discount_percent / -100) * tot_lines_tva) ct_tot_discount_ttc = round_price((ct_tot_discount_percent / -100) * tot_lines_ttc) tot_discount_ht = round_price(ct_tot_discount_ht) tot_discount_tva = round_price(ct_tot_discount_tva) tot_discount_ttc = round_price(ct_tot_discount_ttc) form.find(".input_price_line_block_tot_discount_ht").val(tot_discount_ht) form.find(".input_price_line_block_tot_discount_tva").val(tot_discount_tva) form.find(".input_price_line_block_tot_discount_ttc").val(tot_discount_ttc) #tot_discount_ht = parse_field(form.find(".input_price_line_block_tot_discount_ht").val()) #tot_discount_tva = parse_field(form.find(".input_price_line_block_tot_discount_tva").val()) #tot_discount_ttc = parse_field(form.find(".input_price_line_block_tot_discount_ttc").val()) tot_fdp_ht = parse_field(form.find(".input_price_line_block_tot_fdp_ht").val()) tot_fdp_tva = parse_field(form.find(".input_price_line_block_tot_fdp_tva").val()) tot_fdp_ttc = parse_field(form.find(".input_price_line_block_tot_fdp_ttc").val()) tot_amount_ht = round_price(tot_lines_ht + tot_discount_ht + tot_fdp_ht) tot_amount_tva = round_price(tot_lines_tva + tot_discount_tva + tot_fdp_tva) tot_amount_ttc = round_price(tot_lines_ttc + tot_discount_ttc + tot_fdp_ttc) form.find(".input_price_line_block_tot_amount_ht").val(tot_amount_ht) form.find(".input_price_line_block_tot_amount_tva").val(tot_amount_tva) form.find(".input_price_line_block_tot_amount_ttc").val(tot_amount_ttc) form.find(".input_price_line_block_weight_tot").val(weight_tot) $(".qi_price_form").on "change", -> update_qi_price_form($(this)) $(".qi_price_form").on "keyup", -> update_qi_price_form($(this)) $(".qi_price_form").each -> update_qi_price_form($(this)) #flashs= bootstrap_flash .clear = timer_watcher() if Rails.env.production? :javascript $('.qi_search_row form input').keypress(function (e) { if (e.which == 13) { $(this).closest('form').submit(); return false; //<---- Add this line } }); $('.qi_price_form').on('keyup keypress', function(e) { var keyCode = e.keyCode || e.which; if (keyCode === 13 && !$(e.target).is('textarea')) { e.preventDefault(); //return false; } }); :javascript $("input").focusin(function(){ $(this).attr("autocomplete", "off"); }); $("input").attr("autocomplete", "off");