diff --git a/app/controllers/admin/price_documents_controller.rb b/app/controllers/admin/price_documents_controller.rb index b480168..8d69bb2 100644 --- a/app/controllers/admin/price_documents_controller.rb +++ b/app/controllers/admin/price_documents_controller.rb @@ -279,7 +279,7 @@ class Admin::PriceDocumentsController < ApplicationController @ref_price_lines = @demande.price_line_block.price_lines @ref_price_lines.group(:p_product_ref_id).each do |plr| - @price_document.price_line_block.price_lines << PriceLine.new(:p_product_ref_id => plr.p_product_ref_id, :qte => @ref_price_lines.where(:p_product_ref_id => plr.p_product_ref_id).sum(:qte)) + @price_document.price_line_block.price_lines << PriceLine.new(:price_line_ref_id => plr.id, :p_product_ref_id => plr.p_product_ref_id, :qte => @ref_price_lines.where(:p_product_ref_id => plr.p_product_ref_id).sum(:qte)) end diff --git a/app/views/admin/price_documents/analyse_reponses.html.haml b/app/views/admin/price_documents/analyse_reponses.html.haml index 96050ca..7528f80 100644 --- a/app/views/admin/price_documents/analyse_reponses.html.haml +++ b/app/views/admin/price_documents/analyse_reponses.html.haml @@ -7,7 +7,7 @@ \- = @price_document.list_designaton - +-unmatched_fournisseur = 0 =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 @@ -77,6 +77,13 @@ %th -if resp.p_fournisseur =resp.p_fournisseur.name + -else + -unmatched_fournisseur += 1 + nom renseigné par le fournisseur : + %br + ="(#{resp.public_fournisseur_name})" + %br + =link_to ic('pencil') + " rapprocher le fournisseur", match_p_fournisseur_admin_price_document_path(resp), remote: true %tbody @@ -127,9 +134,10 @@ / 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 + =#form.object.price_line_resp_ids + =#form.text_field :price_line_demand_id + =#form.input :price_line_resp_id, collection: PriceLine.where(:price_line_demand_id => form.object.id).all, as: :check_boxes, :member_label => :id + =form.input :price_line_resp_ids, collection: PriceLine.where(:price_line_ref_id => form.object.id).all, as: :check_boxes , :member_label => :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 = [] @@ -162,7 +170,29 @@ =#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" + + - if unmatched_fournisseur == 0 + =submit_tag 'valider la selection', class: "btn btn-primary ml-4" + - else + %button.btn.btn-primary.ml-4{"type" => "button", "data-toggle" => "modal", "data-target" => "#unmatched-fournisseur"} + Valider la selection + .modal.fade#unmatched-fournisseur{"tab-index" => "-1", "role" => "dialog", "aria-labelledby" => "Raprochement Fournisseur", "aria-hidden" => "true"} + .modal-dialog{role: "dialog"} + .modal-content + .modal-header + %h5.modal-title + Rapprochement du fournisseur + %button.close{"data-dismiss" => "modal", "aria-label" => "Close"} + %span{"aria-hidden" => "true"} + × + .modal-body + Il reste des fournisseurs à prapprocher avant de pouvoir valider. + .modal-footer + %button.btn.btn-light{"data-dismiss" => "modal"} + Close + + +