diff --git a/.sass-cache/f6b9a0b1905a68d5dbb2139e95d49cba92f6fa93/(__TEMPLATE__)c b/.sass-cache/f6b9a0b1905a68d5dbb2139e95d49cba92f6fa93/(__TEMPLATE__)c index e1c3ae1..f14f694 100644 Binary files a/.sass-cache/f6b9a0b1905a68d5dbb2139e95d49cba92f6fa93/(__TEMPLATE__)c and b/.sass-cache/f6b9a0b1905a68d5dbb2139e95d49cba92f6fa93/(__TEMPLATE__)c differ 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