From 41774b1731fcd72a89988c51e26a5c0e18524078 Mon Sep 17 00:00:00 2001 From: Philippe Date: Wed, 27 Oct 2021 19:21:53 +0200 Subject: [PATCH] Modification visuelle, saisie des article sur les price line --- .../(__TEMPLATE__)c | Bin 0 -> 5965 bytes .../admin/price_documents_controller.rb | 4 ++-- app/controllers/application_controller.rb | 2 +- app/models/p_article.rb | 4 ++-- app/models/p_grade.rb | 2 +- app/models/p_product.rb | 8 ++++++++ app/models/price_document.rb | 3 ++- app/models/price_line_block.rb | 2 +- app/views/admin/p_articles/_form.html.haml | 3 +-- app/views/admin/p_articles/_p_article.html.haml | 4 ++-- app/views/admin/price_documents/index.html.haml | 2 +- app/views/admin/price_documents/show.html.haml | 11 +++++++++-- .../admin/price_lines/add_p_articles.js.erb | 1 + 13 files changed, 31 insertions(+), 15 deletions(-) create mode 100644 .sass-cache/f6b9a0b1905a68d5dbb2139e95d49cba92f6fa93/(__TEMPLATE__)c create mode 100644 app/views/admin/price_lines/add_p_articles.js.erb diff --git a/.sass-cache/f6b9a0b1905a68d5dbb2139e95d49cba92f6fa93/(__TEMPLATE__)c b/.sass-cache/f6b9a0b1905a68d5dbb2139e95d49cba92f6fa93/(__TEMPLATE__)c new file mode 100644 index 0000000000000000000000000000000000000000..f14f6942a4eff9a4b9af0c9026e5b8e2e708b671 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%-8VNw?l5_F z7K#WS7ntz+N`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`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 literal 0 HcmV?d00001 diff --git a/app/controllers/admin/price_documents_controller.rb b/app/controllers/admin/price_documents_controller.rb index 693c8d5..a58c531 100644 --- a/app/controllers/admin/price_documents_controller.rb +++ b/app/controllers/admin/price_documents_controller.rb @@ -330,7 +330,8 @@ class Admin::PriceDocumentsController < ApplicationController @price_document.date = Date.today @avoir = true if @price_document.label == "Avoir" if @price_document.save - if @price_document.cc_label == "Demande prix" + #if @price_document.cc_label == "Demande prix" + if @price_document.cc_label == "Facture achat" render action: :show else redirect_to admin_price_documents_path(:price_document_type_id => @price_document.price_document_type_id) @@ -344,7 +345,6 @@ class Admin::PriceDocumentsController < ApplicationController def update - raise @price_document = PriceDocument.find(params[:id]) @avoir = true if @price_document.label == "Avoir" diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 24a8b80..dddda40 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -159,7 +159,7 @@ class ApplicationController < ActionController::Base if current_admin.has_permission?("bills") set_big_menu :documents, "Achats", admin_price_documents_path(:price_document_type_id =>6, :purchase => true), "file-text-o", "#d97941" - set_sub_menu :documents, :buy_lists, "TdB achats" + #set_sub_menu :documents, :buy_lists, "TdB achats" set_sub_menu :documents, :line_stocks, "Lignes de stock", admin_line_stocks_path set_sub_menu :documents, :stock_movements, "Mouvements de stock manuel", admin_stock_movements_path diff --git a/app/models/p_article.rb b/app/models/p_article.rb index db8556c..ca44f4f 100644 --- a/app/models/p_article.rb +++ b/app/models/p_article.rb @@ -17,7 +17,7 @@ class PArticle < ApplicationRecord acts_as_sorting :fields => { :id => {:name => "id", :reorder => true}, :p_product_ref_ref => {:name => "Code ref", :reorder => true}, - :p_product_ref => {:name => "Désignation", :reorder => true}, + :p_product_ref => {:name => "Référence", :reorder => true}, :p_grade => {:name => "Grade", :reorder => true}, :color => {:name => "Couleur"}, :p_article_serial_nums => {:name => "N° identifiants"}, @@ -27,7 +27,7 @@ class PArticle < ApplicationRecord acts_as_sorting :fields => { :id => {:name => "id", :reorder => true}, :p_product_ref_ref => {:name => "Code ref", :reorder => true}, - :p_product_ref => {:name => "Désignation", :reorder => true}, + :p_product_ref => {:name => "Référence", :reorder => true}, :color => {:name => "Couleur"}, :p_article_serial_nums => {:name => "N° identifiants"}, :actions => {:name => "Actions", :reorder => false}, diff --git a/app/models/p_grade.rb b/app/models/p_grade.rb index 648e10e..28102fe 100644 --- a/app/models/p_grade.rb +++ b/app/models/p_grade.rb @@ -7,5 +7,5 @@ class PGrade < ApplicationRecord :actions => {:name => "Actions", :reorder => false}, } - ACTIVATED = false + ACTIVATED = true end diff --git a/app/models/p_product.rb b/app/models/p_product.rb index bad4974..886c99f 100644 --- a/app/models/p_product.rb +++ b/app/models/p_product.rb @@ -454,4 +454,12 @@ class PProduct < ApplicationRecord end end + + def self.update_brand + PProduct.all.each do |pp| + pp.s_brand = SBrand.first + pp.save + end + end + end diff --git a/app/models/price_document.rb b/app/models/price_document.rb index 125545e..e941947 100644 --- a/app/models/price_document.rb +++ b/app/models/price_document.rb @@ -25,7 +25,8 @@ 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 achat", "Consultation fournisseur"] + #PURCHASES = ["Demande prix", "Réponse fournisseur", "Commande achat", "Facture achat", "Consultation fournisseur"] + PURCHASES = ["Commande achat"] 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/models/price_line_block.rb b/app/models/price_line_block.rb index 223aab1..b6b2b38 100644 --- a/app/models/price_line_block.rb +++ b/app/models/price_line_block.rb @@ -6,7 +6,7 @@ class PriceLineBlock < ApplicationRecord belongs_to :p_devise validates :p_customer_id, :presence => true, :if => :p_customer_needed? - validates :p_fournisseur_id, :presence => true, :if => :p_fournisseur_needed? + #validates :p_fournisseur_id, :presence => true, :if => :p_fournisseur_needed? validates :particular_bill_id, :presence => true, :if => :particular_bill_needed? validates :particular_send_id, :presence => true, :if => :particular_send_needed? diff --git a/app/views/admin/p_articles/_form.html.haml b/app/views/admin/p_articles/_form.html.haml index ae711c0..f2fbe48 100644 --- a/app/views/admin/p_articles/_form.html.haml +++ b/app/views/admin/p_articles/_form.html.haml @@ -2,7 +2,7 @@ .content =f.inputs do - = f.input :p_product_ref, as: :select, collection: PProductRef.all.distinct, :label => f.object.label_for(:p_product_ref) + = f.input :p_product_ref, as: :select, collection: PProductRef.all.distinct.pluck(:cc_name, :id), :label => f.object.label_for(:p_product_ref) -if PGrade::ACTIVATED = f.input :p_grade, as: :select, collection: PGrade.pluck(:grade, :id), :label => "Grade" %h4 Numero de série : @@ -17,4 +17,3 @@ .actions=f.submit "sauvegarder", :class => "btn btn-primary" - diff --git a/app/views/admin/p_articles/_p_article.html.haml b/app/views/admin/p_articles/_p_article.html.haml index 7368263..9978840 100644 --- a/app/views/admin/p_articles/_p_article.html.haml +++ b/app/views/admin/p_articles/_p_article.html.haml @@ -12,7 +12,7 @@ -tr[:color] = capture do %td - = p_article.p_product_ref.p_product_color.color + =# p_article.p_product_ref.p_product_color.color -tr[:p_product_ref] = capture do %td @@ -20,7 +20,7 @@ \- = p_article.p_product_ref.ct_sub_name \- - = p_article.p_product_ref.p_product_color.name + =# p_article.p_product_ref.p_product_color.name -tr[:p_article_serial_nums] = capture do %td diff --git a/app/views/admin/price_documents/index.html.haml b/app/views/admin/price_documents/index.html.haml index ca45910..9b37cf8 100644 --- a/app/views/admin/price_documents/index.html.haml +++ b/app/views/admin/price_documents/index.html.haml @@ -1,7 +1,7 @@ .qi_header .right -if params[:price_document_type_id].to_i == 6 # Facture Achat - = link_to 'Ajouter une facture achat', new_admin_price_document_path(:document_type => "Facture d'achat"), :class => "btn btn-primary bgbd-documents", :remote => false + = link_to 'Ajouter une facture achat', new_admin_price_document_path(:document_type => "Facture achat"), :class => "btn btn-primary bgbd-documents", :remote => false -elsif params[:price_document_type_id].to_i == 4 # Commande Achat = link_to 'Ajouter une commande achat', new_admin_price_document_path(:document_type => "Commande achat"), :class => "btn btn-primary bgbd-documents", :remote => false -elsif params[:price_document_type_id].to_i == 7 diff --git a/app/views/admin/price_documents/show.html.haml b/app/views/admin/price_documents/show.html.haml index c474220..19a9616 100644 --- a/app/views/admin/price_documents/show.html.haml +++ b/app/views/admin/price_documents/show.html.haml @@ -203,8 +203,9 @@ %th Qté %th P.U. HT %th TVA - %th - Montant HT + %th Montant HT + %th Actions + %tbody -price_line_block.price_lines.each do |price_line| %tr @@ -238,6 +239,12 @@ %td.numeraire =number_to_currency price_line.tot_amount_ht + %td.actions + = 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"), new_admin_p_article_path, :remote => true + / %td=# price_line.line_stocks.sum(:price_ht) .qi_row diff --git a/app/views/admin/price_lines/add_p_articles.js.erb b/app/views/admin/price_lines/add_p_articles.js.erb new file mode 100644 index 0000000..dc68c39 --- /dev/null +++ b/app/views/admin/price_lines/add_p_articles.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "add_p_articles_form"))%>",700,900); \ No newline at end of file