.qi_header %h1 Achats %span Analyse des réponces à la consiltation n° = link_to @price_document.d_number, admin_price_document_path(@price_document) \- = @price_document.list_designaton =semantic_form_for [:admin, @price_document], :html => {:class => "qi_price_form"}, :remote => false do |form| =form.semantic_fields_for :price_line_block do |f| - price_line_block = f.object .qi_pannel.padding.new_table_container .table-slider .inner .table-area{:style => "overflow:auto;"} .table-area-inner .freezeTable %table.table.table-striped.table-hover.table-bordered.data_table %thead.header %tr -nb_resp = @price_document_responses.count %th{colspan: 12} Consultation %th{colspan: nb_resp} Fournisseurs .btn.btn-light.ml-4#reset-radio reset %tr %th Qté à %br satisfaire %th Qté consultée %th Produit %th Référence %th Couleur %th Type %br chargeur %th Target hors %br Sorecop %th Px d'achat %br référence %th Marge %br théorique %br référence %br par zone %th Fours. %br de référence %th Date %br px référence %th.limit Spec -@price_document_responses.each do |resp| %th -if resp.p_fournisseur =resp.p_fournisseur.name %tbody -# price_lines = f.object.price_lines -consult_price_lines = @price_document.price_line_block.price_lines =f.semantic_fields_for :price_lines do |form| - price_line = form.object -#price_lines = @price_document.price_line_block.price_lines -#price_lines.each do |price_line| %tr %td =# ATTENTION ! On a plus accès direct aux commandes qui on engendré cette demande de prix. donc plus accès aux délais différent entre les différentes commades pour une ref donée / ∑ / =price_line.qte.to_i / %br - if price_line.cc_wish_date.present? && price_line.cc_wish_date < Date.today + 20.days %span.red =ic(:fire) =price_line.qte.to_i - else %span.darkblue =ic(:hourglass) =price_line.qte.to_i %td.ref_tr Qté en comm %td = price_line.p_product_ref.p_product.name %td =link_to [:admin, price_line.p_product_ref] do = price_line.p_product_ref.ct_sub_name = price_line.p_product_ref.p_product_color.name %td = price_line.p_product_ref.p_product_color.color if price_line.p_product_ref and price_line.p_product_ref.p_product_color %td = price_line.p_product_power.name if price_line.p_product_power %td / Target hors Sorecop %td / Px d'achat de référence %td / Marge théorique de référence par zone %td / Fournisseurs de référence %td / Date du px de référence %td.limit / spec =form.input :selected_price_line_id, collection: PriceLine.where(:price_line_ref_id => form.object.id).all, as: :radio, :member_label => :id =debug form.object.id - @price_document_responses.each do |resp| -line = resp.price_line_block.price_lines.where(p_product_ref: price_line.p_product_ref).first -cell = [] - if line.qte_available.to_i > 0 -if line.qte_available >= price_line.qte.to_i - cell << "Qté dispo : #{line.qte_available.to_i}" -else - cell << "#{ic(:warning, class: "orange")} Qté dispo : #{line.qte_available.to_i} (#{line.qte_available.to_i - price_line.qte.to_i})" - cell << "PA: #{line.ct_u_price_ht} €" - # mp = calcul de la marge prévisionelle TODO - line.id.odd? ? mp = 0.17 : mp = 0.11 - if mp.present? -if mp > 0.15 - cell << "#{ic(:check)} MP: #{mp * 100} %" -else - cell << "#{ic(:times, class: "red")} MP: #{mp * 100} %" -else - cell << "pas dispo" -if line.comment.present? - display_comment = "" - if line.comment.length > 10 - display_comment = "#{line.comment[0..10]} (..)" - else - display_comment = line.comment - cell << "#{ic('info-circle')} #{display_comment}#{line.comment}" %td.p-0 = "reponse price_line ID : #{line.id}" =#form.input :selected_price_offer, as: :radio = radio_button_tag "ref_price_selected_#{price_line.p_product_ref.id}", line.id, false, class: "category-selector" = label_tag "ref_price_selected_#{price_line.p_product_ref.id}_#{line.id}", sanitize(cell.join('
')), class: "p-2 m-auto" =submit_tag 'valider la selection', class: "btn btn-primary" :scss .category-selector { position: absolute; transform: scale(0); } .category-selector + label { display: block; min-height: 105px; cursor: pointer; box-sizing: border-box; width: 100%; text-align: left; } .category-selector:checked + label { background-color: #b4f99e !important; } .limit { border-right:3px solid green !important; } .red { color: red; } .green { color: green; } .orange { color: orange; } .info { color: #009bbf; position: relative; display: inline-block; text-overflow: ellipsis; .info-text { visibility: hidden; background-color: #555; color: #fff; text-align: center; padding: 5px; border-radius: 6px; max-width: 500px; min-width: fit-content; white-space: normal; /* Position the tooltip text */ position: absolute; z-index: 1; bottom: 125%; left: 50%; margin-left: -60px; /* Fade in tooltip */ opacity: 0; transition: opacity 0.3s; } .info-text::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border-width: 5px; border-style: solid; border-color: #555 transparent transparent transparent; } } .info:hover { .info-text { visibility: visible; opacity: 1; } } .darkblue { color: darkblue; } .small-input { max-width: 100px; } :javascript $( "#reset-radio" ).click(function(event){ $( ":radio" ).prop('checked',false); })