adding SN to sell price_line
This commit is contained in:
parent
f1bad61fd2
commit
d0646650c7
Binary file not shown.
@ -133,4 +133,8 @@ class Admin::LineStocksController < ApplicationController
|
||||
def empty_stock
|
||||
@price_document = PriceDocument.where(:price_document_type_id => 4, :cost_ok => false)
|
||||
end
|
||||
|
||||
def show_p_article
|
||||
@line_stock = LineStock.find(params[:line_stock_id])
|
||||
end
|
||||
end
|
||||
|
@ -146,17 +146,20 @@ class Admin::PCustomerSheetsController < ApplicationController
|
||||
|
||||
|
||||
def new
|
||||
|
||||
|
||||
@p_customer_sheet = PCustomerSheet.new()
|
||||
|
||||
@p_customer = PCustomer.find(params[:p_customer_id]) if params[:p_customer_id]
|
||||
|
||||
|
||||
|
||||
@p_customer_sheet.p_customer = @p_customer
|
||||
|
||||
@p_customer_sheet.price_line_block = PriceLineBlock.new(:particular_bill_id => @p_customer.particular_bill_id, :particular_send_id => @p_customer.particular_send_id)
|
||||
@p_customer_sheet.price_line_block = PriceLineBlock.new
|
||||
@p_customer_sheet.price_line_block.price_lines.build
|
||||
@p_customer_sheet.price_line_block.p_customer = @p_customer
|
||||
|
||||
@p_customer_sheet.price_line_block.build_particular_send(owner: @p_customer)
|
||||
@p_customer_sheet.price_line_block.build_particular_bill(owner: @p_customer)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -171,15 +174,15 @@ class Admin::PCustomerSheetsController < ApplicationController
|
||||
|
||||
def create
|
||||
@p_customer_sheet = PCustomerSheet.new(params.require(:p_customer_sheet).permit!)
|
||||
|
||||
@p_customer_sheet.admin = current_admin
|
||||
|
||||
|
||||
|
||||
if @p_customer_sheet.save
|
||||
|
||||
redirect_to admin_p_customer_sheet_path(@p_customer_sheet)
|
||||
else
|
||||
puts "ERRORSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"
|
||||
puts params
|
||||
puts @p_customer_sheet.errors.messages
|
||||
puts "ERRORSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"
|
||||
@p_customer = @p_customer_sheet.price_line_block.p_customer
|
||||
|
||||
render action: "new"
|
||||
|
@ -44,19 +44,12 @@ class Admin::PriceLinesController < ApplicationController
|
||||
|
||||
|
||||
def update
|
||||
puts "PAAMSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"
|
||||
puts params
|
||||
puts "PAAMSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"
|
||||
@price_line = PriceLine.find(params[:id])
|
||||
|
||||
if @price_line.update_attributes(params.require(:price_line).permit!)
|
||||
|
||||
|
||||
else
|
||||
puts "ERRORSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"
|
||||
puts @price_line.errors.messages
|
||||
puts "ERRORSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"
|
||||
render action: "edit"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@ -73,4 +66,8 @@ class Admin::PriceLinesController < ApplicationController
|
||||
# @p_article = PArticle.new#@price_line.p_articles.build
|
||||
# @p_article_serial_nums = @p_article.p_article_serial_nums.build
|
||||
end
|
||||
|
||||
def add_price_line_p_article
|
||||
@price_line = PriceLine.find(params[:price_line_id])
|
||||
end
|
||||
end
|
||||
|
@ -78,6 +78,16 @@ module ApplicationHelper
|
||||
icon = sort_direction == "asc" ? "chevron-up" : "chevron-down"
|
||||
icon = column == sort_column ? icon : ""
|
||||
link_to raw("#{title} "+ic(icon).html_safe), request.query_parameters.merge({column: column, direction: direction})
|
||||
end
|
||||
end
|
||||
|
||||
def id_color(price_line)
|
||||
if price_line.p_articles.count == 0
|
||||
return "background-color: red"
|
||||
elsif price_line.p_articles.count < price_line.qte
|
||||
return "background-color: orange"
|
||||
else
|
||||
return "background-color: #70ff29"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,6 +7,9 @@
|
||||
belongs_to :stock_movement_line
|
||||
belongs_to :partition_lines
|
||||
|
||||
has_many :line_stock_p_articles
|
||||
has_many :p_articles, through: :line_stock_p_articles
|
||||
|
||||
|
||||
acts_as_sorting :fields => {
|
||||
:id => {:name => "ID", :reorder => false},
|
||||
|
4
app/models/line_stock_p_article.rb
Normal file
4
app/models/line_stock_p_article.rb
Normal file
@ -0,0 +1,4 @@
|
||||
class LineStockPArticle < ApplicationRecord
|
||||
belongs_to :line_stock
|
||||
belongs_to :p_article
|
||||
end
|
@ -10,6 +10,9 @@ class PArticle < ApplicationRecord
|
||||
has_many :price_line_p_articles
|
||||
has_many :price_lines, through: :price_line_p_articles
|
||||
accepts_nested_attributes_for :p_article_serial_nums
|
||||
|
||||
has_many :line_stock_p_articles
|
||||
has_many :line_stocks, through: :line_stock_p_articles
|
||||
|
||||
|
||||
|
||||
|
@ -13,12 +13,13 @@ class PCustomerSheet < ApplicationRecord
|
||||
|
||||
belongs_to :particular_bill, :class_name => "Particular"#, :dependent => :destroy
|
||||
accepts_nested_attributes_for :particular_bill
|
||||
|
||||
belongs_to :particular_send, :class_name => "Particular"#, :dependent => :destroy
|
||||
accepts_nested_attributes_for :particular_send
|
||||
|
||||
has_one :price_line_block, :as => :price_lineable
|
||||
|
||||
accepts_nested_attributes_for :price_line_block
|
||||
accepts_nested_attributes_for :price_line_block
|
||||
|
||||
has_many :price_lines, :through => :price_line_block
|
||||
|
||||
|
@ -7,6 +7,7 @@ class Particular < ApplicationRecord
|
||||
has_many :open_ranges, :through => :open_range_elements
|
||||
|
||||
belongs_to :owner, :polymorphic => true
|
||||
#has_many :p_customer_sheets
|
||||
#validates :civilite, :presence => true, :if => :force_validation
|
||||
#validates :name, :presence => true, :if => :force_validation
|
||||
#validates :firstname, :presence => true, :if => :force_validation
|
||||
|
@ -764,4 +764,9 @@ class PriceDocument < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def stock_generable
|
||||
return self.price_line_block.price_lines.joins(:p_articles).count < self.price_line_block.price_lines.sum(:qte) ? false : true
|
||||
#exclure les produit non stockable et sans SN
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -13,6 +13,7 @@ class PriceLine < ApplicationRecord
|
||||
has_many :price_line_p_articles
|
||||
has_many :p_articles, through: :price_line_p_articles
|
||||
accepts_nested_attributes_for :p_articles
|
||||
accepts_nested_attributes_for :price_line_p_articles
|
||||
|
||||
default_scope { order('position ASC') }
|
||||
|
||||
|
@ -7,8 +7,8 @@ class PriceLineBlock < ApplicationRecord
|
||||
|
||||
validates :p_customer_id, :presence => true, :if => :p_customer_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?
|
||||
#validates :particular_bill_id, :presence => true, :if => :particular_bill_needed?
|
||||
#validates :particular_send_id, :presence => true, :if => :particular_send_needed?
|
||||
|
||||
belongs_to :particular_bill, :class_name => "Particular"#, :dependent => :destroy
|
||||
|
||||
@ -208,8 +208,18 @@ class PriceLineBlock < ApplicationRecord
|
||||
def generate_stock
|
||||
self.price_lines.each do |pl|
|
||||
if pl.p_product_ref
|
||||
LineStock.create(:dluo => pl.dluo, :date => self.price_lineable.date, :p_product_ref => pl.p_product_ref, :description => "Entrée en stock par facture d'achat", :qte => pl.qte, :price_ht => pl.local_tot_amount_ht, :price_line => pl, :price_line_block => self, :stockable => self.price_lineable)
|
||||
|
||||
ls = LineStock.new(
|
||||
:dluo => pl.dluo,
|
||||
:date => self.price_lineable.date,
|
||||
:p_product_ref => pl.p_product_ref,
|
||||
:description => "Entrée en stock par facture d'achat",
|
||||
:qte => pl.qte,
|
||||
:price_ht => pl.local_tot_amount_ht,
|
||||
:price_line => pl,
|
||||
:price_line_block => self,
|
||||
:stockable => self.price_lineable)
|
||||
ls.p_articles = pl.p_articles
|
||||
ls.save
|
||||
end
|
||||
|
||||
|
||||
@ -441,6 +451,9 @@ class PriceLineBlock < ApplicationRecord
|
||||
end
|
||||
|
||||
if self.particular_bill_needed? and (!self.p_customer or !self.particular_bill or !self.particular_bill.owner or self.particular_bill.owner != self.p_customer)
|
||||
puts "PARTICULEARRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"
|
||||
puts self.particular_bill
|
||||
puts "PARTICULEARRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"
|
||||
errors.add(:particular_bill_id, 'doit être une adresse du client')
|
||||
end
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
= link_to i(:"trash-o"), [:admin, line_stock], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||
= link_to i(:pencil), edit_admin_line_stock_path(line_stock), :remote => true
|
||||
= link_to i(:eye), admin_line_stock_path(line_stock), :remote => true
|
||||
= link_to i(:"mobile-alt"), show_p_article_admin_line_stocks_path(line_stock_id: line_stock.id), :remote => true
|
||||
|
||||
|
||||
|
||||
|
13
app/views/admin/line_stocks/_show_p_article_form.html.haml
Normal file
13
app/views/admin/line_stocks/_show_p_article_form.html.haml
Normal file
@ -0,0 +1,13 @@
|
||||
.mx-2.my-2
|
||||
%table.table-bordered
|
||||
%tbody
|
||||
-@line_stock.p_articles.each do |p_article|
|
||||
%tr
|
||||
%td="##{p_article.id}"
|
||||
%td=p_article.p_product_ref.name
|
||||
- p_article.p_article_serial_nums.each do |sn|
|
||||
%tr
|
||||
%td
|
||||
%td
|
||||
="#{sn.p_serial_num_type.name} - #{sn.value}"
|
||||
.actions
|
@ -140,3 +140,4 @@
|
||||
|
||||
|
||||
|
||||
|
1
app/views/admin/line_stocks/show_p_article.js.erb
Normal file
1
app/views/admin/line_stocks/show_p_article.js.erb
Normal file
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "show_p_article_form"))%>",700,900);
|
@ -15,7 +15,7 @@
|
||||
%p= link_to_add_fields "Ajouter un numéro de série", f, :p_article_serial_nums, {:class => "btn btn-primary"}
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
- else
|
||||
- elsif params[:controller] == "admin/price_lines"
|
||||
= form.inputs do
|
||||
-if params[:p_product_ref_id]
|
||||
= form.input :p_product_ref_id, as: :select, collection: PProductRef.all.distinct.pluck(:cc_name, :id), :label => form.object.label_for(:p_product_ref), input_html: {disabled: true}
|
||||
@ -30,3 +30,4 @@
|
||||
= form.semantic_fields_for :p_article_serial_nums do |form|
|
||||
=render :partial => "admin/p_article_serial_nums/form", :locals => {:form => form}
|
||||
%p= link_to_add_fields "Ajouter un numéro de série", form, :p_article_serial_nums, {:class => "btn btn-primary"}
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
=semantic_form_for [:admin, @p_customer_sheet], :html => {:class => "qi_price_form"}, :remote => false do |form|
|
||||
=#debug form.object.errors.messages if current_admin.id == 1
|
||||
=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
|
||||
@ -11,23 +12,6 @@
|
||||
=#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"
|
||||
=yield :shipping_date
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
nested form for particular send et bill qui crée à chaque fois un particular
|
||||
ajouter accept nested attributed for particular dans pcustomer sheet
|
||||
|
||||
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
=yield :price_lines
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
=yield :discount
|
||||
|
||||
|
||||
|
||||
|
||||
.large_actions
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
=form.hidden_field :particular_type
|
||||
=form.hidden_field :skip_validation, :class => "skip_validation"
|
||||
=form.hidden_field :pro
|
||||
@ -31,15 +30,14 @@
|
||||
=#form.input :email, :label => false, :placeholder => qit("don-particular-email","Email")
|
||||
=#form.input :tel, :label => false, :placeholder => qit("don-particular-phone","Téléphone")
|
||||
|
||||
Contacts de l'adresse :
|
||||
-if !params[:controller] == "p_customer_sheets"
|
||||
Contacts de l'adresse :
|
||||
.p_contacts_form
|
||||
=form.semantic_fields_for :p_contacts do |form|
|
||||
=render :partial => "admin/p_contacts/form", :locals => {:form => form}
|
||||
|
||||
|
||||
.p_contacts_form
|
||||
=form.semantic_fields_for :p_contacts do |form|
|
||||
=render :partial => "admin/p_contacts/form", :locals => {:form => form}
|
||||
|
||||
|
||||
%p= link_to_add_fields ic(:plus)+" Ajouter un contact à l'adresse", form, :p_contacts
|
||||
%p= link_to_add_fields ic(:plus)+" Ajouter un contact à l'adresse", form, :p_contacts
|
||||
|
||||
=#form.input :open_ranges, :label => "Horaires d'ouvertures :", :collection => OpenRange.all, :as => :check_boxes
|
||||
|
||||
|
@ -209,15 +209,8 @@
|
||||
-price_line_block.price_lines.each do |price_line|
|
||||
%tbody
|
||||
%tr
|
||||
-if price_line.p_articles.count == 0
|
||||
%td{style: "background-color: red;"}
|
||||
="##{price_line.id}"
|
||||
- elsif price_line.p_articles.count < price_line.qte
|
||||
%td{style: "background-color: orange"}
|
||||
="##{price_line.id}"
|
||||
- else
|
||||
%td{style: "background-color: green"}
|
||||
="##{price_line.id}"
|
||||
%td{style: id_color(price_line)}
|
||||
="##{price_line.id}"
|
||||
%td
|
||||
=price_line.ref
|
||||
%td
|
||||
@ -250,7 +243,8 @@
|
||||
-if current_admin.has_permission?("show-costs")
|
||||
%p
|
||||
-if @price_document.price_document_type_id == 6
|
||||
=link_to "Générer les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary" if !@price_document.stock_ok
|
||||
=link_to "Générer les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary" if !@price_document.stock_ok and @price_document.stock_generable
|
||||
=link_to "Générer les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary disabled" if !@price_document.stock_ok and !@price_document.stock_generable
|
||||
-elsif @price_document.price_document_type_id == 4 or @price_document.price_document_type_id == 5
|
||||
%p
|
||||
Coût :
|
||||
|
@ -4,47 +4,42 @@
|
||||
|
||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||
|
||||
= f.hidden_field :p_customer_id, :class => "p_customer_id"
|
||||
=content_for :particular do
|
||||
.row
|
||||
.p_customer_sheet_customer.col-12.mb-4
|
||||
= 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}
|
||||
|
||||
|
||||
-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
|
||||
.addresses.row
|
||||
.columns.span_6
|
||||
%h4 Adresse de facturation
|
||||
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
|
||||
|
||||
-if f.object.p_customer
|
||||
=f.inputs do
|
||||
= f.input :particular_bill_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de facturation"
|
||||
-else
|
||||
=f.inputs do
|
||||
= f.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
||||
.col-6
|
||||
.addresses.row
|
||||
.columns.span_6
|
||||
%h4 Adresse de livraison
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
-if f.object.p_customer
|
||||
=f.inputs do
|
||||
= f.input :particular_send_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de livraison"
|
||||
-else
|
||||
=f.inputs do
|
||||
= f.input :particular_send_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
||||
|
||||
.clear
|
||||
|
||||
=content_for :shipping_date do
|
||||
= 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 :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 client :"
|
||||
= 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;"}
|
||||
|
||||
@ -55,33 +50,30 @@
|
||||
%br
|
||||
|
||||
|
||||
%div{:style=>"padding:0 30px;"}
|
||||
.row.qi_field_wrapper
|
||||
%table{:style => "width:100%;border-collapse:separate;"}
|
||||
%thead
|
||||
%tr
|
||||
%th
|
||||
%th Produit
|
||||
%th{:style => "width:200px;"} Prix
|
||||
%th
|
||||
%th{:style => "width:100px;"} Qté
|
||||
%th TVA
|
||||
%th
|
||||
%tbody.price_lines_form
|
||||
=f.semantic_fields_for :price_lines do |f|
|
||||
=render :partial => "admin/price_lines/form", :locals => {:form => f}
|
||||
|
||||
=content_for :price_lines do
|
||||
%div{:style=>"padding:0 30px;"}
|
||||
.row.qi_field_wrapper
|
||||
%table{:style => "width:100%;border-collapse:separate;"}
|
||||
%thead
|
||||
%tr
|
||||
%th
|
||||
%th Produit
|
||||
%th{:style => "width:200px;"} Prix
|
||||
%th
|
||||
%th{:style => "width:100px;"} Qté
|
||||
%th TVA
|
||||
%th
|
||||
%tbody.price_lines_form
|
||||
=f.semantic_fields_for :price_lines do |f|
|
||||
=render :partial => "admin/price_lines/form", :locals => {:form => f}
|
||||
|
||||
%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"}
|
||||
%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")
|
||||
=content_for :discount do
|
||||
-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 :"
|
||||
-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 :"
|
||||
|
||||
|
||||
-if current_admin.has_permission?("payments")
|
||||
@ -103,7 +95,3 @@
|
||||
|
||||
-if false
|
||||
= f.input :ct_payment_month_end, :label => "Fin de mois ?"
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -96,6 +96,9 @@
|
||||
|
||||
%td.numeraire
|
||||
=price_line.qte
|
||||
%td
|
||||
= 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
|
||||
|
1
app/views/admin/price_line_p_articles/_form.html.haml
Normal file
1
app/views/admin/price_line_p_articles/_form.html.haml
Normal file
@ -0,0 +1 @@
|
||||
=form.input :p_article_id, as: :select, collection: PArticle.all, member_label: :id
|
@ -0,0 +1,9 @@
|
||||
.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"
|
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "add_price_line_p_article_form"))%>",700,900);
|
@ -447,6 +447,7 @@ Rails.application.routes.draw do
|
||||
collection do
|
||||
get "stock_resume"
|
||||
get "empty_stock"
|
||||
get :show_p_article
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -698,6 +699,7 @@ Rails.application.routes.draw do
|
||||
end
|
||||
collection do
|
||||
get :add_p_article
|
||||
get :add_price_line_p_article
|
||||
|
||||
end
|
||||
end
|
||||
|
10
db/migrate/20211103085623_create_line_stock_p_articles.rb
Normal file
10
db/migrate/20211103085623_create_line_stock_p_articles.rb
Normal file
@ -0,0 +1,10 @@
|
||||
class CreateLineStockPArticles < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :line_stock_p_articles do |t|
|
||||
t.belongs_to :p_article
|
||||
t.belongs_to :line_stock
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
11
db/schema.rb
11
db/schema.rb
@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_11_02_105934) do
|
||||
ActiveRecord::Schema.define(version: 2021_11_03_085623) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@ -549,6 +549,15 @@ ActiveRecord::Schema.define(version: 2021_11_02_105934) do
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
end
|
||||
|
||||
create_table "line_stock_p_articles", force: :cascade do |t|
|
||||
t.bigint "p_article_id"
|
||||
t.bigint "line_stock_id"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["line_stock_id"], name: "index_line_stock_p_articles_on_line_stock_id"
|
||||
t.index ["p_article_id"], name: "index_line_stock_p_articles_on_p_article_id"
|
||||
end
|
||||
|
||||
create_table "line_stock_usages", force: :cascade do |t|
|
||||
t.bigint "line_stock_id"
|
||||
t.decimal "qte", precision: 14, scale: 2
|
||||
|
11
test/fixtures/line_stock_p_articles.yml
vendored
Normal file
11
test/fixtures/line_stock_p_articles.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
7
test/models/line_stock_p_article_test.rb
Normal file
7
test/models/line_stock_p_article_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class LineStockPArticleTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Reference in New Issue
Block a user