diff --git a/app/views/admin/price_documents/analyse_reponses.html.haml b/app/views/admin/price_documents/analyse_reponses.html.haml index 1da2baa..489baa2 100644 --- a/app/views/admin/price_documents/analyse_reponses.html.haml +++ b/app/views/admin/price_documents/analyse_reponses.html.haml @@ -119,48 +119,37 @@ / Date du px de référence %td.limit / spec - - form = false - - if form - %td - = radio_button_tag "price_selected_#{}", price_line.id - = label_tag "price line i = #{price_line.id}" - - if false - - form_with do |form| - %td - = debug form - =form.collection_radio_buttons :selected_price, price_lines, :id, :cc_title - - else - - @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} %" + - @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 << "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}" - -# cell << "#{ic('info-circle')} #{display_comment}" + - 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 - = 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" + %td.p-0 + = 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"