diff --git a/app/models/price_document.rb b/app/models/price_document.rb index 8ed50a1..24fcc09 100644 --- a/app/models/price_document.rb +++ b/app/models/price_document.rb @@ -25,7 +25,7 @@ class PriceDocument < ApplicationRecord has_many :avoir_p_payment_documents, :dependent => :destroy, :foreign_key => :avoir_id, :class_name => "PPaymentDocument" accepts_nested_attributes_for :avoir_p_payment_documents, allow_destroy: true - PURCHASES = ["Demande prix", "Réponse fournisseur", "Commande achat", "Facture d'achat", "Consultation fournisseur"] + PURCHASES = ["Demande prix", "Réponse fournisseur", "Commande achat", "Facture achat", "Consultation fournisseur"] SALES = ["Bon de commande", "Devis", "Bon de livraison", "Facture", "Avoir"] # AVANCEMENT = ["0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"] AVANCEMENT = ["0%", "25%", "50%", "75%", "100"] diff --git a/app/views/admin/price_documents/analyse_reponses.html.haml b/app/views/admin/price_documents/analyse_reponses.html.haml index b88eab3..7b68000 100644 --- a/app/views/admin/price_documents/analyse_reponses.html.haml +++ b/app/views/admin/price_documents/analyse_reponses.html.haml @@ -224,7 +224,8 @@ .modal-footer %button.btn.btn-light{"data-dismiss" => "modal"} Close -=link_to "Generer les consultations", generate_final_consult_admin_price_document_path, class: "btn btn-primary ml-4 mt-4" +- if PriceDocument.where(doc_ref_id: @price_document, price_document_type: PriceDocumentType.find_by_label("Consultation fournisseur")).empty? + =link_to "Generer les consultations", generate_final_consult_admin_price_document_path, class: "btn btn-primary ml-4 mt-4" =link_to "Acceder aux consultations", admin_price_document_path(@price_document, anchor: "consult"), class: "btn btn-primary ml-4 mt-4" diff --git a/app/views/admin/price_documents/index.html.haml b/app/views/admin/price_documents/index.html.haml index 8513399..014b9eb 100644 --- a/app/views/admin/price_documents/index.html.haml +++ b/app/views/admin/price_documents/index.html.haml @@ -65,7 +65,7 @@ Type de document : %td - -if [1,2,6,7].include?(params[:price_document_type_id].to_i)or (params[:price_document_type_ids] and (params[:price_document_type_ids].include?("6") or params[:price_document_type_ids].include?("7"))) + -if [3,4,5,6,7,9,10].include?(params[:price_document_type_id].to_i)or (params[:price_document_type_ids] and (params[:price_document_type_ids].include?("6") or params[:price_document_type_ids].include?("7"))) -PriceDocumentType.where(:label => PriceDocument::PURCHASES, :enabled => true).order("id DESC").each do |pdt| %p.d-inline-flex.ml-3 = check_box_tag :"price_document_type_ids[]", pdt.id, (true if params[:price_document_type_ids].include?(pdt.id.to_s)), {:id => "price_document_type_ids_#{pdt.id}", class: "my-auto"} diff --git a/app/views/admin/price_line_blocks/_form_bon_de_reception_achat.html.haml b/app/views/admin/price_line_blocks/_form_bon_de_reception_achat.html.haml index c4c181a..783139d 100644 --- a/app/views/admin/price_line_blocks/_form_bon_de_reception_achat.html.haml +++ b/app/views/admin/price_line_blocks/_form_bon_de_reception_achat.html.haml @@ -1,27 +1,11 @@ =f.inputs do + .price_lines_form + =f.semantic_fields_for :price_lines do |f| + =render :partial => "admin/price_lines/form_#{f.object.block_type_slug}", :locals => {:form => f} - -if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande") - .qi_pannel.qi_plain.padding{:style => "margin:20px 0;"} - - %table{:style => "width:100%;"} - %tr - %td{:style => "width:50%;"} - = f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date - - - -if @price_document.label != "Demande prix" - = f.input :customer_ref, :label => "Référence commande client :" - -if current_admin.has_permission?("customer-sheets-bl") - = f.input :bl_comment, :label => "Commentaire à mettre sur le BL :", :input_html => {:style => "min-height:50px;height:50px;"} - - - .price_lines_form - =f.semantic_fields_for :price_lines do |f| - =render :partial => "admin/price_lines/form_#{f.object.block_type_slug}", :locals => {:form => f} - - %p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {slug: f.object.block_type_slug , :class => "btn btn-primary", tabindex: 2} + %p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {slug: f.object.block_type_slug , :class => "btn btn-primary", tabindex: 2} diff --git a/app/views/admin/price_lines/_form_bon_de_reception_achat.html.haml b/app/views/admin/price_lines/_form_bon_de_reception_achat.html.haml index 56ccde8..a8d7aa0 100644 --- a/app/views/admin/price_lines/_form_bon_de_reception_achat.html.haml +++ b/app/views/admin/price_lines/_form_bon_de_reception_achat.html.haml @@ -7,11 +7,11 @@ =ic :arrows %label ref : - %input.p_product_ref_autocomplete_input.form-control.col{:type => "text", tabindex: 1, autofocus: true, :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)} + %input.p_product_ref_autocomplete_input.form-control.col{:type => "text", :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)} .col-3.ml-2 .form-inline - = form.input :qte, :label => "qte :", :input_html => { class: "mx-2", tabindex: 1} + = form.input :qte, :label => "qte :", :input_html => { class: "mx-2", autofocus: true, tabindex: 1} .col-2 .form-inline = form.input :ct_u_price_ht, :label => "PU :", :input_html => { class: "mx-2"}