Update analyse
This commit is contained in:
parent
55c3c371b2
commit
7f2208576d
@ -8,7 +8,7 @@
|
|||||||
= @price_document.list_designaton
|
= @price_document.list_designaton
|
||||||
|
|
||||||
-unmatched_fournisseur = 0
|
-unmatched_fournisseur = 0
|
||||||
=semantic_form_for [:admin, @price_document], :html => {:class => "qi_price_form"}, :remote => false do |form|
|
=semantic_form_for [:admin, @price_document],url: final_consult_admin_price_document_path, method: :post, :html => {:class => "qi_price_form"}, :remote => false do |form|
|
||||||
=form.semantic_fields_for :price_line_block do |f|
|
=form.semantic_fields_for :price_line_block do |f|
|
||||||
- price_line_block = f.object
|
- price_line_block = f.object
|
||||||
.qi_pannel.padding.new_table_container
|
.qi_pannel.padding.new_table_container
|
||||||
@ -26,9 +26,23 @@
|
|||||||
Consultation
|
Consultation
|
||||||
%th{colspan: nb_resp}
|
%th{colspan: nb_resp}
|
||||||
Fournisseurs
|
Fournisseurs
|
||||||
.btn.btn-light.ml-4#reset-radio
|
.btn.btn-light.mx-4#reset-radio
|
||||||
reset
|
reset
|
||||||
|
.legend.d-flex
|
||||||
|
légende :
|
||||||
|
.inlie-block.d-flex.flex-wrap.justify-content-end
|
||||||
|
.mx-2.red
|
||||||
|
= ic("diamond") + " Spot detecté !"
|
||||||
|
.mx-2.green
|
||||||
|
= ic("money") + " Meilleur prix"
|
||||||
|
.mx-2.red
|
||||||
|
= ic(:times) + " Alerte marge basse"
|
||||||
|
.mx-2.green
|
||||||
|
= ic(:check) + " Marge ok"
|
||||||
|
.mx-2.orange
|
||||||
|
= ic(:warning) + " Alerte Qté"
|
||||||
|
.mx-2.info
|
||||||
|
= ic('info-circle') + " Commentaire fournisseur"
|
||||||
%tr
|
%tr
|
||||||
%th
|
%th
|
||||||
Qté à
|
Qté à
|
||||||
@ -75,6 +89,7 @@
|
|||||||
|
|
||||||
-@price_document_responses.each do |resp|
|
-@price_document_responses.each do |resp|
|
||||||
%th
|
%th
|
||||||
|
=resp.id
|
||||||
-if resp.p_fournisseur
|
-if resp.p_fournisseur
|
||||||
=resp.p_fournisseur.name
|
=resp.p_fournisseur.name
|
||||||
-else
|
-else
|
||||||
@ -94,7 +109,6 @@
|
|||||||
- price_line = form.object
|
- price_line = form.object
|
||||||
-#price_lines = @price_document.price_line_block.price_lines
|
-#price_lines = @price_document.price_line_block.price_lines
|
||||||
-#price_lines.each do |price_line|
|
-#price_lines.each do |price_line|
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%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
|
=# 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
|
||||||
@ -142,16 +156,19 @@
|
|||||||
|
|
||||||
-#NICO : j'ai créé un hash plus haut, vide, qui va me permettre de faire correspondre à chaque ID de price_line leur index dans le nested form (qui est différent, une itération, de l'ID de l'élement... Là c'est la magie de rails.)
|
-#NICO : j'ai créé un hash plus haut, vide, qui va me permettre de faire correspondre à chaque ID de price_line leur index dans le nested form (qui est différent, une itération, de l'ID de l'élement... Là c'est la magie de rails.)
|
||||||
- price_lines_child_index[form.object.id.to_s] = form.options[:child_index]
|
- price_lines_child_index[form.object.id.to_s] = form.options[:child_index]
|
||||||
|
-best_price = PriceLine.where(price_line_ref_id: price_line.id).where("ct_u_price_ht > 0").order(:ct_u_price_ht).ids
|
||||||
|
|
||||||
-#Nico : je commence, pour chaque price line, par faire une checkbox vide. J'aurais pu faire un checkbox tag mais par facilité j'ai copé l'HTML dans HTML2HAML et je suis partid du résultat. Les checkboxes sont ensuite dans ta boucle
|
-#Nico : je commence, pour chaque price line, par faire une checkbox vide. J'aurais pu faire un checkbox tag mais par facilité j'ai copé l'HTML dans HTML2HAML et je suis partid du résultat. Les checkboxes sont ensuite dans ta boucle
|
||||||
%input{:autocomplete => "off", :id => "price_document[price_line_block_attributes][price_lines_attributes][#{form.options[:child_index] }]_price_line_resp_ids_none", :name => "price_document[price_line_block_attributes][price_lines_attributes][#{form.options[:child_index] }][price_line_resp_ids][]", :type => "hidden", :value => ""}/
|
%input{:autocomplete => "off", :id => "price_document[price_line_block_attributes][price_lines_attributes][#{form.options[:child_index] }]_price_line_resp_ids_none", :name => "price_document[price_line_block_attributes][price_lines_attributes][#{form.options[:child_index] }][price_line_resp_ids][]", :type => "hidden", :value => ""}/
|
||||||
|
|
||||||
|
=#{}"price doc id : #{@price_document_responses.ids}"
|
||||||
|
|
||||||
- @price_document_responses.each do |resp|
|
- @price_document_responses.each do |resp|
|
||||||
-line = resp.price_line_block.price_lines.where(p_product_ref: price_line.p_product_ref).first
|
-line = resp.price_line_block.price_lines.where(p_product_ref: price_line.p_product_ref).first
|
||||||
-cell = []
|
-cell = []
|
||||||
|
|
||||||
- if line.qte_available.to_i > 0
|
- if line.qte_available.to_i > 0
|
||||||
|
- if line.id == best_price[0]
|
||||||
|
-cell << "<span class=green>#{ic(:money)} Meilleur prix</span>"
|
||||||
- if line.qte_available >= price_line.qte.to_i
|
- if line.qte_available >= price_line.qte.to_i
|
||||||
- cell << "Qté dispo : #{line.qte_available.to_i}"
|
- cell << "Qté dispo : #{line.qte_available.to_i}"
|
||||||
- else
|
- else
|
||||||
@ -174,20 +191,19 @@
|
|||||||
- display_comment = line.comment
|
- 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 class='info-text'>#{line.comment}</span></span>"
|
||||||
|
|
||||||
%td.p-0
|
%td.p-0{class: ("best-price" if line.id == best_price[0])}
|
||||||
= "reponse price_line ID : #{line.id}"
|
=# "reponse price_line ID : #{line.id}"
|
||||||
= "price line origine : #{line.price_line_ref_id}" #NICO : simple contrôle, je récupère facilement par là l'ID de la price Line concernée.
|
=# "price line origine : #{line.price_line_ref_id}" #NICO : simple contrôle, je récupère facilement par là l'ID de la price Line concernée.
|
||||||
|
|
||||||
-#NICO : si on a un price_line_ref_id, j'ajoute la case à cocher. Je récupère l'index de nested form dans mon hash, et je passe en value le line.id
|
-#NICO : si on a un price_line_ref_id, j'ajoute la case à cocher. Je récupère l'index de nested form dans mon hash, et je passe en value le line.id
|
||||||
-if line.price_line_ref_id.to_s != ""
|
-if line.price_line_ref_id.to_s != ""
|
||||||
%br
|
%input.category-selector{:id => "price_document_price_line_block_attributes_price_lines_attributes_#{price_lines_child_index[line.price_line_ref_id.to_s]}_price_line_resp_ids_#{line.id}" , :autocomplete => "off", :checked => ("checked" if PriceLine.find(line.price_line_ref_id).price_line_resp_ids.include?(line.id) ), :name => "price_document[price_line_block_attributes][price_lines_attributes][#{price_lines_child_index[line.price_line_ref_id.to_s]}][price_line_resp_ids][]", :type => "checkbox", :value => line.id}>/
|
||||||
%label{:for => "price_document_price_line_block_attributes_price_lines_attributes_#{price_lines_child_index[line.price_line_ref_id.to_s]}_price_line_resp_ids_#{line.id}"}
|
%label.p-2.m-auto{:for => "price_document_price_line_block_attributes_price_lines_attributes_#{price_lines_child_index[line.price_line_ref_id.to_s]}_price_line_resp_ids_#{line.id}"}
|
||||||
%input{:id => "price_document_price_line_block_attributes_price_lines_attributes_#{price_lines_child_index[line.price_line_ref_id.to_s]}_price_line_resp_ids_#{line.id}" , :autocomplete => "off", :checked => ("checked" if PriceLine.find(line.price_line_ref_id).price_line_resp_ids.include?(line.id) ), :name => "price_document[price_line_block_attributes][price_lines_attributes][#{price_lines_child_index[line.price_line_ref_id.to_s]}][price_line_resp_ids][]", :type => "checkbox", :value => line.id}>/
|
=sanitize(cell.join('<br>'))
|
||||||
=line.id
|
|
||||||
|
|
||||||
|
|
||||||
= 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"
|
||||||
|
|
||||||
- if unmatched_fournisseur == 0
|
- if unmatched_fournisseur == 0
|
||||||
=submit_tag 'valider la selection', class: "btn btn-primary ml-4"
|
=submit_tag 'valider la selection', class: "btn btn-primary ml-4"
|
||||||
@ -235,6 +251,12 @@
|
|||||||
|
|
||||||
.category-selector:checked + label {
|
.category-selector:checked + label {
|
||||||
background-color: #b4f99e !important;
|
background-color: #b4f99e !important;
|
||||||
|
border-radius: 1em;
|
||||||
|
border: green solid 0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.best-price{
|
||||||
|
background-color: #f8fdab !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.limit {
|
.limit {
|
||||||
@ -250,6 +272,7 @@
|
|||||||
.orange {
|
.orange {
|
||||||
color: orange;
|
color: orange;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
color: #009bbf;
|
color: #009bbf;
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -305,5 +328,5 @@
|
|||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$( "#reset-radio" ).click(function(event){
|
$( "#reset-radio" ).click(function(event){
|
||||||
$( ":radio" ).prop('checked',false);
|
$('input:checkbox').prop('checked',false);
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user