WIP analyse

This commit is contained in:
Barnabé 2021-09-06 18:04:45 +02:00
parent 05963478a4
commit 9d24db2178

View File

@ -119,48 +119,37 @@
/ Date du px de référence / Date du px de référence
%td.limit %td.limit
/ spec / 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 - @price_document_responses.each do |resp|
-if line.qte_available >= price_line.qte.to_i -line = resp.price_line_block.price_lines.where(p_product_ref: price_line.p_product_ref).first
- cell << "Qté dispo : #{line.qte_available.to_i}" -cell = []
-else
- cell << "#{ic(:warning, class: "orange")} Qté dispo : #{line.qte_available.to_i} (#{line.qte_available.to_i - price_line.qte.to_i})" - if line.qte_available.to_i > 0
- cell << "PA: #{line.ct_u_price_ht} €" -if line.qte_available >= price_line.qte.to_i
- # mp = calcul de la marge prévisionelle TODO - cell << "Qté dispo : #{line.qte_available.to_i}"
- line.id.odd? ? mp = 0.17 : mp = 0.11
- if mp.present?
-if mp > 0.15
- cell << "<span class=green>#{ic(:check)} MP: #{mp * 100} %</span>"
-else
- cell << "#{ic(:times, class: "red")} MP: #{mp * 100} %"
-else -else
- cell << "<span class=red>pas dispo</span>" - cell << "#{ic(:warning, class: "orange")} Qté dispo : #{line.qte_available.to_i} (#{line.qte_available.to_i - price_line.qte.to_i})"
-if line.comment.present? - cell << "PA: #{line.ct_u_price_ht} €"
- display_comment = "" - # mp = calcul de la marge prévisionelle TODO
- if line.comment.length > 10 - line.id.odd? ? mp = 0.17 : mp = 0.11
- display_comment = "#{line.comment[0..10]} (..)" - if mp.present?
- else -if mp > 0.15
- display_comment = line.comment - cell << "<span class=green>#{ic(:check)} MP: #{mp * 100} %</span>"
- cell << "<span class='info'>#{ic('info-circle')} #{display_comment}<span class='info-text'>#{line.comment}</span></span>" -else
-# cell << "<span class=info>#{ic('info-circle')} #{display_comment}</span>" - cell << "#{ic(:times, class: "red")} MP: #{mp * 100} %"
-else
- cell << "<span class=red>pas dispo</span>"
-if line.comment.present?
- display_comment = ""
- if line.comment.length > 10
- display_comment = "#{line.comment[0..10]} (..)"
- else
- display_comment = line.comment
- cell << "<span class='info'>#{ic('info-circle')} #{display_comment}<span class='info-text'>#{line.comment}</span></span>"
%td.p-0 %td.p-0
= radio_button_tag "ref_price_selected_#{price_line.p_product_ref.id}", line.id, false, class: "category-selector" = 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('<br>')), class: "p-2 m-auto" = label_tag "ref_price_selected_#{price_line.p_product_ref.id}_#{line.id}", sanitize(cell.join('<br>')), class: "p-2 m-auto"
=submit_tag 'valider la selection', class: "btn btn-primary" =submit_tag 'valider la selection', class: "btn btn-primary"