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
%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 << "<span class=green>#{ic(:check)} MP: #{mp * 100} %</span>"
-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 << "<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>"
-# cell << "<span class=info>#{ic('info-circle')} #{display_comment}</span>"
- 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 << "<span class=green>#{ic(:check)} MP: #{mp * 100} %</span>"
-else
- 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
= 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"
%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('<br>')), class: "p-2 m-auto"
=submit_tag 'valider la selection', class: "btn btn-primary"