From 721c98e20d8b714273c81a9d4f02b25417c829e5 Mon Sep 17 00:00:00 2001
From: Philippe
Date: Fri, 5 Nov 2021 11:24:58 +0100
Subject: [PATCH] add p_fournisseur_id in price_document achat form,
autocomplete for p_article_ids in price_line_block form
---
.../(__TEMPLATE__)c | Bin 1374 -> 5965 bytes
app/models/p_article.rb | 4 +
app/models/p_customer_sheet.rb | 3 +-
app/models/price_document.rb | 1 -
app/models/price_line.rb | 3 -
.../admin/p_customer_sheets/_form.html.haml | 18 ++--
.../admin/p_customer_sheets/show.html.haml | 37 ++++----
.../admin/p_fournisseurs/_form.html.haml | 4 +-
app/views/admin/p_products/_form.html.haml | 2 +-
.../admin/price_documents/_form.html.haml | 5 +-
.../admin/price_documents/show.html.haml | 13 ++-
.../admin/price_line_blocks/_form.html.haml | 85 ++++++++++--------
.../_form_facture_achat.html.haml | 1 -
.../_price_line_block.html.haml | 37 ++++----
.../price_line_p_articles/_form.html.haml | 6 +-
.../_add_price_line_p_article_form.html.haml | 15 ++--
app/views/admin/price_lines/_form.html.haml | 1 -
17 files changed, 124 insertions(+), 111 deletions(-)
diff --git a/.sass-cache/f6b9a0b1905a68d5dbb2139e95d49cba92f6fa93/(__TEMPLATE__)c b/.sass-cache/f6b9a0b1905a68d5dbb2139e95d49cba92f6fa93/(__TEMPLATE__)c
index e1c3ae14c64ffb6b86d264611307231a215c18c3..f14f6942a4eff9a4b9af0c9026e5b8e2e708b671 100644
GIT binary patch
literal 5965
zcmbVQUvt~W5f?Qbii9jtbo9@ZEVHzu*orOEk{sE0Gwmg=JYgnrG#1krJz$RHi9!S7
zPym#pdi>UWh4f?eOSNC2eQb9Re~w2&ij*hfh}*s2?(P0|7yG-1y9d_c!NDQ#?RC4a
z&iLMo?w)8J?Dt;r=l$Nx7hJsT9f~iyqPyR+epiy@-U$ywLOOvEguIh7dMo?l4q0Tq
zbI0um!aFTbZW_4)H&uwm0(d?xwi{~?yRv_2hY^pQFmnDn5@C@Pk2>To^LY@8zKuIW
zNgDBSC&CrINCt$wmct=G5g_69M2Rf0p%`{W5S|t#xj(r%-8V;QNPD@13FViged}
zylZW8SG!*V=pG-6c4KuKH!XMIwd;7oDS{u)99Q7p7GMiU-M;{C^(aR{4=pO4h^Pnx
z=R7?BIP(T94%I6=;NCz;vYs5T{sb4}zhzQk;Hx0AeF-Wy%q_<Nw?l5_F
z7K#WS7ntz+N`%(bOS<8#!_f$_1yI3y8AKvzp&-2*|HO}EgN2FDZ37=&FVlNc>nqaD
zvDG@g-)?;J*tR=I-yMJZW#`DYpA^ACbW4(YjJlm13PJP+aDwKJ%Sg~6E^pK)C+zI1b6Mr)MRR}EnL|f^(xS`RQFKjS@6{!GzeTt3dXzB!B##da$vL>+Qg$D>x=Zh~8r@|8sY@TY!Y6Q!}IKdyCapKFPl4E-urP7$dT74kGjsl?nze$M#k2E9|sWk
zB3j>Rs`~)1UHXE|hnNKs_-+Qwg+P=(Mrin929TE~3@!msD}#+IlER*#lH)-7NF_^j
z2`^(sV|=FIsVmvWR8NBKq!&1Tl+x9=4g@=QOLTi`!=KS|LQbLpqM%H-k)pnM{o<>`
zug0uY>YuPz^fOX%`e2`P=7@kaSYP;o=OhIEWMQ_gNoolT>(b;xX;eu+AHx{ie#?w+
zWEqcV!HqBccAROo$Z#HqV$_%OWSOY|1CRA=m9=q*Z9XNlh7>GW0KecT)8ePxB^Lo#7dHWdWS-qw;QL;9hLYup(v|9#%VEMkot6z
zr&LBiqmRw3TTBBqNrOeers=i(Oq=(
z(!`ldaLQulS6pqSXDW(s(v}H2Pk{z)DtI1O6IS@Ual%4&!k$rX5-hCnbGkvBUG2)C
zFM?-*GdPb_9w03n)~_D;Kh;C&I{ow()IPyK
z^M5f;Sk6u`%}=nf!auSN84WI^xLKI#GDCTs%WAo7rM&U0{l#@WwS1E-)wzabyOCw7
z60SPS5QOT{%+h7pt0i#-l2>Kv{w=aJX(XnzZzXkUl6@<1roKsB?WYKI7*1p#d6aPW
zL|YI>No#Ll=OhJ6`QE2sXD6@-dY9!EN7vJt9z-p=v`Jzflk<)0DU{c5zC_6XQkHe3#{~H
zg?XbPG*d8>*(1*ZZ_Plb0X>m~?%4Qukx3u{_|t7SP#gfhftbnzxM2X)#0CJt*FTEO
z_dqHz|7^wX{2_8&Lf*$X(}eqW>ND=b&|heb5tN9|!Fwl&>N8;dh>ezRO`0gALH^
z5A1k(1(J$^w38A6pX>PYmMm7xYc
z(Uk#Lx`9uJ(5ySUdV(`rg==TAv{%?jothMg4LG`%c^6ktvzy2bhCBs27)%9eFwAZh
zj3czIX0wohVY3ekDTwKexTaOSkq0&>Jg^BiuV(OY^*B8|pAqsDXb+eQG7q%02XMz#
z`H+BNv(GaR=!B@H$k}W~t22XVKb;k!7QiPXWOMi+H~VgO`di`$t6tY1YH(GrH=Fuv
z!Og}65Yi&o3=E+Dqh)=xa=W;jOr!{~*}TOdV;FNivRLcnph4lp@eZA6!c8V33I^p{
zbbGWhhB~%Kj}?-qb!Y^hj14~5;2A3b3ez+fBA}aIRAO|3C};XZv#q3w%DzY>jDiia
NrnY#MHog0u{{w}+6Mp~z
delta 389
zcmX@BcaKZYSkGL~gv-Ft$jCf3HQB=4I4#v6HPtxPBq=#1&D_W+H6It+*WW5_3~Mm3W{MlU*3sGxAOT!WauA
zgP5*QUc@3R#*>m+T#%Dk$!5(NV#V!HmY7qT8qGFYo>zSGdlp?8&b<7*RInVcLw-R?
zW`16AH3QJ(lFEYA$(F48%IwzS`PLGg){^!FD8Pv&LQl7O1)pl>bfAZ0D*AZ;yVV6Ew(F}aIP8t9#DHaRm5D?W#k
v)Lfu%N`SsrfrUpkmx2P+lU5+#SaWgJa&d8iJOy+U+vJbjiacy^Qw>7^kL+bZ
diff --git a/app/models/p_article.rb b/app/models/p_article.rb
index 6f695d4..4d69fd9 100644
--- a/app/models/p_article.rb
+++ b/app/models/p_article.rb
@@ -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
diff --git a/app/models/p_customer_sheet.rb b/app/models/p_customer_sheet.rb
index a16ac3a..c477f8c 100644
--- a/app/models/p_customer_sheet.rb
+++ b/app/models/p_customer_sheet.rb
@@ -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},
diff --git a/app/models/price_document.rb b/app/models/price_document.rb
index ae3a1f6..9629fe2 100644
--- a/app/models/price_document.rb
+++ b/app/models/price_document.rb
@@ -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
diff --git a/app/models/price_line.rb b/app/models/price_line.rb
index faa5f6d..534aaf5 100644
--- a/app/models/price_line.rb
+++ b/app/models/price_line.rb
@@ -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"}
-
}
diff --git a/app/views/admin/p_customer_sheets/_form.html.haml b/app/views/admin/p_customer_sheets/_form.html.haml
index 5c93951..9f1576e 100755
--- a/app/views/admin/p_customer_sheets/_form.html.haml
+++ b/app/views/admin/p_customer_sheets/_form.html.haml
@@ -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
diff --git a/app/views/admin/p_customer_sheets/show.html.haml b/app/views/admin/p_customer_sheets/show.html.haml
index 1b37292..8bab240 100644
--- a/app/views/admin/p_customer_sheets/show.html.haml
+++ b/app/views/admin/p_customer_sheets/show.html.haml
@@ -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();
\ No newline at end of file
diff --git a/app/views/admin/p_fournisseurs/_form.html.haml b/app/views/admin/p_fournisseurs/_form.html.haml
index 082c082..33ff79e 100755
--- a/app/views/admin/p_fournisseurs/_form.html.haml
+++ b/app/views/admin/p_fournisseurs/_form.html.haml
@@ -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"
\ No newline at end of file
diff --git a/app/views/admin/p_products/_form.html.haml b/app/views/admin/p_products/_form.html.haml
index d8f02c4..6a02656 100755
--- a/app/views/admin/p_products/_form.html.haml
+++ b/app/views/admin/p_products/_form.html.haml
@@ -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
diff --git a/app/views/admin/price_documents/_form.html.haml b/app/views/admin/price_documents/_form.html.haml
index 0f516cc..9b21234 100644
--- a/app/views/admin/price_documents/_form.html.haml
+++ b/app/views/admin/price_documents/_form.html.haml
@@ -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}
diff --git a/app/views/admin/price_documents/show.html.haml b/app/views/admin/price_documents/show.html.haml
index a66ebcd..9b78bee 100644
--- a/app/views/admin/price_documents/show.html.haml
+++ b/app/views/admin/price_documents/show.html.haml
@@ -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
diff --git a/app/views/admin/price_line_blocks/_form.html.haml b/app/views/admin/price_line_blocks/_form.html.haml
index 9adc306..861d505 100644
--- a/app/views/admin/price_line_blocks/_form.html.haml
+++ b/app/views/admin/price_line_blocks/_form.html.haml
@@ -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 ?"
diff --git a/app/views/admin/price_line_blocks/_form_facture_achat.html.haml b/app/views/admin/price_line_blocks/_form_facture_achat.html.haml
index db81fc0..001336e 100644
--- a/app/views/admin/price_line_blocks/_form_facture_achat.html.haml
+++ b/app/views/admin/price_line_blocks/_form_facture_achat.html.haml
@@ -1,4 +1,3 @@
-PRICE LINE BLOCKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
=f.inputs do
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
diff --git a/app/views/admin/price_line_blocks/_price_line_block.html.haml b/app/views/admin/price_line_blocks/_price_line_block.html.haml
index 961c8ae..54da1fc 100644
--- a/app/views/admin/price_line_blocks/_price_line_block.html.haml
+++ b/app/views/admin/price_line_blocks/_price_line_block.html.haml
@@ -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
diff --git a/app/views/admin/price_line_p_articles/_form.html.haml b/app/views/admin/price_line_p_articles/_form.html.haml
index b7c9644..ce107a0 100644
--- a/app/views/admin/price_line_p_articles/_form.html.haml
+++ b/app/views/admin/price_line_p_articles/_form.html.haml
@@ -1 +1,5 @@
-=form.input :p_article_id, as: :select, collection: PArticle.all, member_label: :id
\ No newline at end of file
+=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');
\ No newline at end of file
diff --git a/app/views/admin/price_lines/_add_price_line_p_article_form.html.haml b/app/views/admin/price_lines/_add_price_line_p_article_form.html.haml
index 8575343..7aa687c 100644
--- a/app/views/admin/price_lines/_add_price_line_p_article_form.html.haml
+++ b/app/views/admin/price_lines/_add_price_line_p_article_form.html.haml
@@ -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"
\ No newline at end of file
+ =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"
+
\ No newline at end of file
diff --git a/app/views/admin/price_lines/_form.html.haml b/app/views/admin/price_lines/_form.html.haml
index 013f1d6..839313b 100644
--- a/app/views/admin/price_lines/_form.html.haml
+++ b/app/views/admin/price_lines/_form.html.haml
@@ -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