349 lines
12 KiB
Plaintext
349 lines
12 KiB
Plaintext
!!!
|
|
%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
|
|
<link href="https://fonts.googleapis.com/css?family=Nunito+Sans:400,400i,700,700i&display=swap" rel="stylesheet">
|
|
= javascript_include_tag "admin"
|
|
=javascript_include_tag "https://maps.google.com/maps/api/js?sensor=false®ion=FR"
|
|
|
|
<link rel="apple-touch-icon" href="/apple-touch-icon-iphone-60x60.png">
|
|
<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-ipad-76x76.png">
|
|
<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-iphone-retina-120x120.png">
|
|
<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-ipad-retina-152x152.png">
|
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
|
|
|
|
|
|
=#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-presta.png"), "/", :id => "logo"
|
|
|
|
|
|
|
|
|
|
|
|
-@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.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
|
|
|
|
|
|
|
|
|
|
|
|
#qi_header_wrapper.fh-fixedHeader
|
|
|
|
%nav#admin_nav.navbar.navbar-expand-lg.navbar-dark.bg-light
|
|
%button.navbar-toggler{"aria-controls" => "navbarSupportedContent", "aria-expanded" => "false", "aria-label" => "Toggle navigation", "data-target" => "#navbarSupportedContent", "data-toggle" => "collapse", :type => "button"}
|
|
%span.navbar-toggler-icon
|
|
#navbarSupportedContent.collapse.navbar-collapse
|
|
%ul.navbar-nav.mr-auto
|
|
-if @qi_menu_active
|
|
-qi_menu_active = @qi_menus[@qi_menu_active]
|
|
|
|
-if qi_menu_active[:elements]
|
|
-qi_menu_active[:elements].each do |k,v|
|
|
%li.nav-item= link_to v[:name], v[:link], :class => "nav-link "+("active" if (@qi_menu_sub_menu_active and @qi_menu_sub_menu_active == k)).to_s
|
|
|
|
%script
|
|
=raw '$("#big_cat_'+@qi_menu_active.to_s+'").addClass("active");'
|
|
|
|
|
|
|
|
%form.form-inline.my-2.my-lg-0
|
|
%ul.nav.navbar-nav.navbar-right
|
|
%li.nav-item.qi_help_remove{:style => ("display:none" if !session[:qi_helps] )}
|
|
|
|
=link_to ic(:"question-circle"), admin_qi_helps_path(), :onclick => '$(".qi_help").hide();$(".qi_help_add").show();$(".qi_help_remove").hide();', :remote => true, :class => "nav-link"
|
|
|
|
|
|
%li.nav-item.qi_help_add{:style => ("display:none" if session[:qi_helps] )}
|
|
=link_to ic(:"question-circle-o"), admin_qi_helps_path(:enabled => true), :onclick => '$(".qi_help").show();$(".qi_help_add").hide();$(".qi_help_remove").show();', :remote => true, :class => "nav-link"
|
|
|
|
|
|
|
|
-if session[:qi_helps]
|
|
:scss
|
|
.qi_help{
|
|
display:inherit;
|
|
|
|
}
|
|
-else
|
|
:scss
|
|
.qi_help{
|
|
display:none;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
%li.nav-item.qi_stat_remove{:style => ("display:none" if !session[:qi_stats] )}
|
|
|
|
=link_to raw("<span class='qi_stat_active'>"+ic(:"pie-chart")+"</span>"), admin_qi_stats_path(), :onclick => '$(".qi_stat, .qi_kpi").show();$(".qi_stat_add").show();$(".qi_stat_remove").hide();', :remote => true, :class => "nav-link"
|
|
|
|
|
|
%li.nav-item.qi_stat_add{:style => ("display:none" if session[:qi_stats] )}
|
|
=link_to ic(:"pie-chart"), admin_qi_stats_path(:enabled => true), :onclick => '$(".qi_stat, .qi_kpi").hide();$(".qi_stat_add").hide();$(".qi_stat_remove").show();', :remote => true, :class => "nav-link"
|
|
|
|
|
|
|
|
-if session[:qi_stats]
|
|
:scss
|
|
.qi_stat, .qi_kpi{
|
|
display:none;
|
|
|
|
}
|
|
|
|
-else
|
|
:scss
|
|
.qi_stat, .qi_kpi{
|
|
display:inherit;
|
|
|
|
}
|
|
|
|
|
|
|
|
%li.nav-item.dropdown
|
|
%a#navbarDropdown.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :href => "#", :role => "button"}
|
|
=current_admin.firstname
|
|
=current_admin.name
|
|
|
|
|
|
.dropdown-menu{"aria-labelledby" => "navbarDropdown"}
|
|
= link_to "Gestion des admins", admin_admins_path, :class => "dropdown-item" if current_admin.super_admin
|
|
.dropdown-divider
|
|
=link_to "Se déconnecter", admin_admin_auth_path(1), method: :delete, :class => "dropdown-item"
|
|
|
|
-if super_current_admin
|
|
%li.nav-item
|
|
=link_to ic(:"user-secret"), admin_admins_path, :class => "nav-link"
|
|
|
|
|
|
%li.nav-item
|
|
=link_to ic(:refresh), "#", :onclick => "location.reload();", :class => "nav-link"
|
|
|
|
|
|
|
|
|
|
|
|
= yield :header
|
|
|
|
|
|
|
|
#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");
|
|
|