add p_fournisseur_id in price_document achat form, autocomplete for p_article_ids in price_line_block form
This commit is contained in:
parent
d0646650c7
commit
721c98e20d
Binary file not shown.
@ -56,4 +56,8 @@ class PArticle < ApplicationRecord
|
||||
def member_label
|
||||
"#{p_product_ref.cc_name}"
|
||||
end
|
||||
|
||||
def serialized_name
|
||||
"#{self.p_product_ref.cc_name} #{self.p_article_serial_nums.map{|x| x.value}.join(' / ')}"
|
||||
end
|
||||
end
|
||||
|
@ -18,7 +18,6 @@ class PCustomerSheet < ApplicationRecord
|
||||
accepts_nested_attributes_for :particular_send
|
||||
|
||||
has_one :price_line_block, :as => :price_lineable
|
||||
|
||||
accepts_nested_attributes_for :price_line_block
|
||||
|
||||
has_many :price_lines, :through => :price_line_block
|
||||
@ -32,7 +31,7 @@ class PCustomerSheet < ApplicationRecord
|
||||
|
||||
|
||||
#:cc_com_counter => {:name => "ID", :reorder => true},
|
||||
:past_id => {:name => "N° ancien système", :reorder => true},
|
||||
:id => {:name => "ID", :reorder => true},
|
||||
:d_number => {:name => "N° BC", :reorder => false},
|
||||
:created_at => {:name => "Date", :reorder => true, :sort_name => "p_customer_sheets.created_at"},
|
||||
:admin_id => {:name => "Déposée par", :reorder => true},
|
||||
|
@ -13,7 +13,6 @@ class PriceDocument < ApplicationRecord
|
||||
belongs_to :p_fournisseur
|
||||
|
||||
has_one :price_line_block, :as => :price_lineable
|
||||
|
||||
accepts_nested_attributes_for :price_line_block
|
||||
|
||||
belongs_to :ref_element, :polymorphic => true
|
||||
|
@ -32,9 +32,7 @@ class PriceLine < ApplicationRecord
|
||||
:ref => {:name => "Ref", :reorder => true},
|
||||
:title => {:name => "Désignation", :reorder => true},
|
||||
:qte => {:name => "Qté", :reorder => true},
|
||||
|
||||
:qte_available => {:name => "Qté dispo.", :reorder => true},
|
||||
|
||||
:ct_u_price_ht => {:name => "Prix de vente", :reorder => true},
|
||||
:ref_fournisseur => {:name => "Réf. fournisseur", :reorder => true},
|
||||
:p_product_power_id => {:name => "Chargeur", :reorder => true},
|
||||
@ -47,7 +45,6 @@ class PriceLine < ApplicationRecord
|
||||
:lang_start => {:name => "Démarrage écran langue ?", :reorder => true},
|
||||
:actions => {:name => "Actions"}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,15 +3,15 @@
|
||||
=form.semantic_fields_for :price_line_block do |f|
|
||||
=render :partial => "admin/price_line_blocks/form", :locals => {:f => f}
|
||||
|
||||
.content
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
.col-8
|
||||
=@p_customer_sheet.p_customer.particular.organisation
|
||||
-if @p_customer_sheet and @p_customer_sheet.state != "commande"
|
||||
=#form.input :demande_type, :collection => ["Brouillon", "Demande de bon de commande","Demande de devis"], :as => :select, :include_blank => false, :label => "Type de demande :"
|
||||
=#form.input :state, :collection => ["AV BPA", "PAS BPA","BPA", "Traitée"], :as => :select, :include_blank => false, :label => "Statut :"
|
||||
=#form.input :past_id, :label => "N° système actuel"
|
||||
-# .content
|
||||
-# .qi_row
|
||||
-# .qi_pannel.qi_plain.padding.row
|
||||
-# .col-8
|
||||
-# =@p_customer_sheet.p_customer.particular.organisation
|
||||
-# -if @p_customer_sheet and @p_customer_sheet.state != "commande"
|
||||
-# =#form.input :demande_type, :collection => ["Brouillon", "Demande de bon de commande","Demande de devis"], :as => :select, :include_blank => false, :label => "Type de demande :"
|
||||
-# =#form.input :state, :collection => ["AV BPA", "PAS BPA","BPA", "Traitée"], :as => :select, :include_blank => false, :label => "Statut :"
|
||||
-# =#form.input :past_id, :label => "N° système actuel"
|
||||
|
||||
|
||||
.large_actions
|
||||
|
@ -88,25 +88,24 @@
|
||||
|
||||
.clear
|
||||
|
||||
%h3 Documents liés à l'offre
|
||||
#bills
|
||||
-params[:search][:per_page] = params[:search][:per_page] || 50
|
||||
-per_page = params[:search][:per_page]
|
||||
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
|
||||
-@price_documents = @p_customer_sheet.price_documents.order("date DESC, created_at DESC")
|
||||
-if params[:price_document_ids]
|
||||
-@price_documents = @price_documents.where(:id => params[:price_document_ids])
|
||||
|
||||
|
||||
-@price_documents = sort_by_sorting(@price_documents, "created_at DESC")
|
||||
-@price_documents = @price_documents.page(page).per(per_page)
|
||||
%br
|
||||
|
||||
|
||||
|
||||
.clear
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_documents}
|
||||
|
||||
-params[:search][:per_page] = params[:search][:per_page] || 50
|
||||
-per_page = params[:search][:per_page]
|
||||
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
-@price_documents = @p_customer_sheet.price_documents.order("date DESC, created_at DESC")
|
||||
-if params[:price_document_ids]
|
||||
-@price_documents = @price_documents.where(:id => params[:price_document_ids])
|
||||
-@price_documents = sort_by_sorting(@price_documents, "created_at DESC")
|
||||
-@price_documents = @price_documents.page(page).per(per_page)
|
||||
|
||||
- if @price_documents.exists?
|
||||
%h3 Documents liés à l'offre
|
||||
#bills
|
||||
%br
|
||||
.clear
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_documents}
|
||||
|
||||
|
||||
|
||||
:javascript
|
||||
$('.p_articles_lines').hide();
|
@ -19,6 +19,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=link_to "Annuler", "#", class:"btn btn-default", onclick:"close_pane_hover();return false;"
|
||||
=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -11,7 +11,7 @@
|
||||
= f.input :enabled, :label => "Produit actif ?"
|
||||
.col-sm-2
|
||||
%br
|
||||
= f.input :stockable, :label => "Produit stockable ?", :input_html => {:onclick => "$('#with_serial').toggle('slow');"}
|
||||
= f.input :stockable, :label => "Produit stockable ?"#, :input_html => {:onclick => "$('#with_serial').toggle('slow');"}
|
||||
.col-sm-2
|
||||
%br
|
||||
#with_serial
|
||||
|
@ -1,4 +1,3 @@
|
||||
PRICE_DOCUMENTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
|
||||
=semantic_form_for [:admin, @price_document], :html => {:class => "qi_price_form"}, :remote => false do |f|
|
||||
-@p_customer = @price_document.p_customer
|
||||
=diag do
|
||||
@ -11,7 +10,7 @@ PRICE_DOCUMENTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
|
||||
=f.inputs do
|
||||
|
||||
=f.hidden_field :price_document_type_id
|
||||
= f.hidden_field :p_customer_id
|
||||
=f.hidden_field :p_customer_id
|
||||
=f.hidden_field :ref_element_type
|
||||
=f.hidden_field :ref_element_id
|
||||
=f.hidden_field :doc_ref_id
|
||||
@ -50,6 +49,8 @@ PRICE_DOCUMENTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
|
||||
= f.input :supplier_document_date, :label => "Date du document fournisseur :", :as => :date
|
||||
.col-6
|
||||
= f.input :tva_type_id, :label => "Type de TVA :", as: :select, collection: TvaType.pluck(:name, :id)
|
||||
.col-6
|
||||
= f.input :p_fournisseur, :label => "Fournisseur :", as: :select, collection: PFournisseur.pluck(:name, :id)
|
||||
.price_line_block_form
|
||||
=f.semantic_fields_for :price_line_block do |f|
|
||||
=render :partial => "admin/price_line_blocks/form_#{f.object.block_type_slug}", :locals => {:f => f}
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
|
||||
.qi_row
|
||||
=debug @price_document.price_line_block.price_lines.count
|
||||
=#debug @price_document.price_line_block.price_lines.count
|
||||
%table.table.table-striped
|
||||
-if @price_document.label == "Réponse fournisseur"
|
||||
|
||||
@ -201,6 +201,7 @@
|
||||
%th Marque
|
||||
%th Désignation
|
||||
%th Qté
|
||||
%th Qté saisie
|
||||
%th P.U. HT
|
||||
%th TVA
|
||||
%th Montant HT
|
||||
@ -209,7 +210,7 @@
|
||||
-price_line_block.price_lines.each do |price_line|
|
||||
%tbody
|
||||
%tr
|
||||
%td{style: id_color(price_line)}
|
||||
%td{style: id_color(price_line), id: "price_line_#{price_line.id}", onclick: "$('.p_articles_#{price_line.id}').toggle('800','swing');"}
|
||||
="##{price_line.id}"
|
||||
%td
|
||||
=price_line.ref
|
||||
@ -219,6 +220,8 @@
|
||||
=link_to price_line.p_product_ref.cc_name, edit_admin_p_product_path(price_line.p_product_ref.p_product) if price_line.p_product_ref and price_line.p_product_ref.p_product
|
||||
%td.numeraire{class: "price_line_qte_#{@price_document.id}"}
|
||||
=price_line.qte
|
||||
%td.numeraire{class: "price_line_qte_#{@price_document.id}"}
|
||||
=price_line.p_articles.count
|
||||
%td.numeraire{class: "price_line_price_u_ht_#{@price_document.id}"}
|
||||
=number_to_currency price_line.price_u_ht
|
||||
%td.numeraire
|
||||
@ -229,9 +232,9 @@
|
||||
= link_to i(:"trash-o"), admin_price_line_path(price_line), method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||
= link_to i(:pencil), edit_admin_price_line_path(price_line), :remote => true
|
||||
= link_to i(:eye), admin_price_line_path(price_line), :remote => true
|
||||
= link_to i(:"mobile-alt"), add_p_article_admin_price_lines_path(p_product_ref_id: price_line.p_product_ref.id, price_line_id: price_line.id), :remote => true
|
||||
= link_to i(:"mobile-alt"), add_p_article_admin_price_lines_path(p_product_ref_id: price_line.p_product_ref.id, price_line_id: price_line.id), :remote => true if price_line.p_product_ref.p_product.stockable and price_line.p_product_ref.p_product.with_serial_number
|
||||
-price_line.p_articles.each do |p_article|
|
||||
%tr
|
||||
%tr{class: "p_articles_lines p_articles_#{price_line.id}"}
|
||||
%td
|
||||
%td="##{p_article.id}"
|
||||
%td=p_article.p_product_ref.name
|
||||
@ -427,6 +430,8 @@
|
||||
|
||||
|
||||
:javascript
|
||||
$('.p_articles_lines').hide();
|
||||
|
||||
const copyPriceLines = (event) => {
|
||||
event.preventDefault()
|
||||
let priceDocumentId = event.target.dataset.document
|
||||
|
@ -4,42 +4,43 @@
|
||||
|
||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||
|
||||
= f.text_field :p_customer_id, :class => "p_customer_id"
|
||||
.row
|
||||
.p_customer_sheet_customer.col-12.mb-4
|
||||
-if f.object.p_customer and f.object.p_customer.particular
|
||||
=render :partial => "admin/p_customers/apercu", :locals => {:particular => f.object.p_customer.particular}
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
.col-6
|
||||
= f.input :customer_ref, :label => "Référence commande client :"
|
||||
.col-6
|
||||
= f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
|
||||
= f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
|
||||
= f.input :validation_date, :label => "Date de validation :", :as => :date
|
||||
= f.hidden_field :p_customer_id, :class => "p_customer_id"
|
||||
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
-if f.object.p_customer and f.object.p_customer.particular
|
||||
=render :partial => "admin/p_customers/apercu", :locals => {:particular => f.object.p_customer.particular}
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
.col-6
|
||||
Adresse de livraison :
|
||||
=f.semantic_fields_for :particular_send do |form_particular_send|
|
||||
=render :partial => "admin/particulars/form", :locals => {:form => form_particular_send}
|
||||
=form_particular_send.text_field :owner_id
|
||||
=form_particular_send.text_field :owner_type
|
||||
|
||||
=form_particular_send.hidden_field :owner_id
|
||||
=form_particular_send.hidden_field :owner_type
|
||||
.col-6
|
||||
Adresse de facturation :
|
||||
=f.semantic_fields_for :particular_bill do |form_particular_bill|
|
||||
=render :partial => "admin/particulars/form", :locals => {:form => form_particular_bill}
|
||||
=form_particular_bill.text_field :owner_id
|
||||
=form_particular_bill.text_field :owner_type
|
||||
=form_particular_bill.hidden_field :owner_id
|
||||
=form_particular_bill.hidden_field :owner_type
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.clear
|
||||
|
||||
= f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
|
||||
= f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
|
||||
= f.input :validation_date, :label => "Date de validation :", :as => :date
|
||||
|
||||
|
||||
|
||||
|
||||
= f.input :customer_ref, :label => "Référence commande clientttt :"
|
||||
|
||||
-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;"}
|
||||
|
||||
@ -69,29 +70,41 @@
|
||||
%p{:style=>"padding-top:10px;"}= link_to_add_fields ic("plus-circle") + " ligne", f, :price_lines, {:class => "btn btn-primary p-2", tabindex: 10, style: "position: sticky; top: 100px"}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-if current_admin.has_permission?("payments")
|
||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||
-if !@avoir
|
||||
= f.input :ct_tot_discount_percent, :label => "Réduction pied de page (%) :"#, :input_html => {:class => "input_price_line_block_ct_tot_discount_percent"}
|
||||
= f.input :ct_tot_fdp_ht, :label => "Frais de port personnalisés :"
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
-if !@avoir
|
||||
= f.input :ct_tot_discount_percent, :label => "Réduction pied de page (%) :"#, :input_html => {:class => "input_price_line_block_ct_tot_discount_percent"}
|
||||
= f.input :ct_tot_fdp_ht, :label => "Frais de port personnalisés :"
|
||||
|
||||
|
||||
-if current_admin.has_permission?("payments")
|
||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||
- if f.object.id
|
||||
.qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
|
||||
%h4 Paiements
|
||||
|
||||
= f.input :p_payment_type_id, :label => "Type de paiement :", :include_blank => false, :collection => PPaymentType.order(:name).all, :as => :select, :input_html => {:id => "payment_type_id_select"}
|
||||
|
||||
|
||||
= f.input :ct_payment_comptant, :label => "Paiement comptant nécessaire ?"
|
||||
|
||||
-if false
|
||||
= f.input :ct_acompte, :label => "Acompte nécessaire ?"
|
||||
= f.input :ct_acompte_percent, :label => "Pourcentage d'acompte :"
|
||||
|
||||
= f.input :ct_payment_delais, :label => "Délais jour de paiement :"
|
||||
|
||||
-if false
|
||||
= f.input :ct_payment_month_end, :label => "Fin de mois ?"
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
.col-6
|
||||
%h4 Paiements
|
||||
= f.input :p_payment_type_id, :label => "Type de paiement :", :include_blank => false, :collection => PPaymentType.order(:name).all, :as => :select, :input_html => {:id => "payment_type_id_select"}
|
||||
= f.input :ct_payment_comptant, :label => "Paiement comptant nécessaire ?"
|
||||
-if false
|
||||
.col-6
|
||||
= f.input :ct_acompte, :label => "Acompte nécessaire ?"
|
||||
= f.input :ct_acompte_percent, :label => "Pourcentage d'acompte :"
|
||||
.col-6
|
||||
%h4{style: "color: transparent;"} Paiements
|
||||
= f.input :ct_payment_delais, :label => "Délais jour de paiement :"
|
||||
-if false
|
||||
.col-6
|
||||
= f.input :ct_payment_month_end, :label => "Fin de mois ?"
|
||||
|
@ -1,4 +1,3 @@
|
||||
PRICE LINE BLOCKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
|
||||
=f.inputs do
|
||||
|
||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||
|
@ -1,7 +1,3 @@
|
||||
|
||||
|
||||
|
||||
|
||||
-if price_line_block.p_customer
|
||||
%h3 Client
|
||||
-if price_line_block.p_customer and price_line_block.p_customer.particular
|
||||
@ -66,60 +62,57 @@
|
||||
%table.table
|
||||
%thead
|
||||
%tr
|
||||
%th IDddd
|
||||
%th Référence
|
||||
|
||||
%th Désignation
|
||||
|
||||
|
||||
|
||||
%th Qté
|
||||
%th Qté saisie
|
||||
%th Actions
|
||||
-if @price_document and @price_document.label != "Demande prix" and @price_document.label != "Réponse fournisseur"
|
||||
%th P.U. HT
|
||||
%th TVA
|
||||
%th
|
||||
Montant HT
|
||||
|
||||
-if price_line_block.purchase?
|
||||
%th Montant équivalent
|
||||
%tbody
|
||||
-price_line_block.price_lines.each do |price_line|
|
||||
%tr
|
||||
%td{style: id_color(price_line), id: "price_line_#{price_line.id}", onclick: "$('.p_articles_#{price_line.id}').toggle('800','swing');"}
|
||||
="##{price_line.id}"
|
||||
%td
|
||||
=price_line.ref
|
||||
|
||||
%td
|
||||
-if price_line.p_product_ref
|
||||
=price_line.p_product_ref.member_label
|
||||
-else
|
||||
=price_line.title
|
||||
|
||||
|
||||
%td.numeraire
|
||||
=price_line.qte
|
||||
%td
|
||||
%td.numeraire
|
||||
= price_line.p_articles.count
|
||||
= link_to i(:"mobile-alt"), add_price_line_p_article_admin_price_lines_path(p_product_ref_id: price_line.p_product_ref.id, price_line_id: price_line.id), :remote => true
|
||||
|
||||
-if @price_document and @price_document.label != "Demande prix" and @price_document.label != "Réponse fournisseur"
|
||||
%td.numeraire
|
||||
=number_to_currency price_line.price_u_ht, :unit => price_line_block.devise_symbol
|
||||
|
||||
|
||||
%td.numeraire
|
||||
=price_line.tva_account_value.to_s+"%"
|
||||
|
||||
|
||||
|
||||
|
||||
%td.numeraire
|
||||
=number_to_currency price_line.tot_amount_ht, :unit => price_line_block.devise_symbol
|
||||
|
||||
|
||||
-if price_line_block.purchase?
|
||||
%td.numeraire
|
||||
=number_to_currency price_line.local_tot_amount_ht, :unit => price_line_block.devise_symbol
|
||||
|
||||
|
||||
-price_line.p_articles.each do |p_article|
|
||||
%tr{class: "p_articles_lines p_articles_#{price_line.id}"}
|
||||
%td
|
||||
%td="##{p_article.id}"
|
||||
%td=p_article.p_product_ref.name
|
||||
%td
|
||||
- p_article.p_article_serial_nums.each do |sn|
|
||||
="#{sn.p_serial_num_type.name} - #{sn.value} /"
|
||||
|
||||
-if @price_document and @price_document.label != "Demande prix" and @price_document.label != "Réponse fournisseur"
|
||||
%table.table{:style => "width:auto;float:right;"}
|
||||
%tr
|
||||
|
@ -1 +1,5 @@
|
||||
=form.input :p_article_id, as: :select, collection: PArticle.all, member_label: :id
|
||||
=form.input :p_article_id, as: :select, collection: PArticle.all.map{|p_article| [p_article.serialized_name, p_article.id]}, label: "Article(s) associé(s)", input_html: {class:"p_article_select"}
|
||||
|
||||
:javascript
|
||||
$('.p_article_select').select2();
|
||||
$('.p_article_select').removeClass('form-control');
|
@ -1,9 +1,10 @@
|
||||
.mx-2.my-2
|
||||
=semantic_form_for [:admin, @price_line], :remote => true do |f|
|
||||
.content
|
||||
=f.inputs do
|
||||
.price_line_p_articles_form
|
||||
= f.semantic_fields_for :price_line_p_articles do |form|
|
||||
=render :partial => "admin/price_line_p_articles/form", :locals => {:form => form}
|
||||
%p= link_to_add_fields "Ajouter un article", f, :price_line_p_articles, {:class => "btn btn-primary"}
|
||||
.actions=f.submit "Sauvegarder", :class => "btn btn-primary"
|
||||
=f.inputs do
|
||||
.price_line_p_articles_form
|
||||
= f.semantic_fields_for :price_line_p_articles do |form|
|
||||
=render :partial => "admin/price_line_p_articles/form", :locals => {:form => form}
|
||||
%p= link_to_add_fields "Ajouter un article", f, :price_line_p_articles, {:class => "btn btn-primary"} if @price_line.p_articles.count < @price_line.qte
|
||||
=link_to "Annuler", "#", class:"btn btn-default", onclick:"close_pane_hover();return false;"
|
||||
=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -4,7 +4,6 @@
|
||||
%td{:style => "padding-left:10px;", :class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
|
||||
.take.mr-1
|
||||
=ic :arrows
|
||||
= "PRICE_LINEEEEEEEE"
|
||||
%td{:style => "white-space: nowrap;"}
|
||||
.input-group
|
||||
%label Référence
|
||||
|
Reference in New Issue
Block a user