Merge branch 'UX-commande' into buy-list
This commit is contained in:
commit
e1ad03ea2d
@ -34,7 +34,7 @@ module DocumentLineHelper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
link_to name,"#", :onclick => "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\");return false;", :class => (options[:class])
|
link_to name,"#", :onclick => "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\");return false;", :class => (options[:class]), tabindex: options[:tabindex], style: options[:style]
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,24 +1,28 @@
|
|||||||
=semantic_form_for [:admin, @p_customer_sheet], :html => {:class => "qi_price_form"}, :remote => false do |form|
|
=semantic_form_for [:admin, @p_customer_sheet], :html => {:class => "qi_price_form"}, :remote => false do |form|
|
||||||
|
=form.semantic_fields_for :price_line_block do |f|
|
||||||
|
=render :partial => "admin/price_line_blocks/form", :locals => {:f => f}
|
||||||
|
|
||||||
.content
|
.content
|
||||||
.qi_row
|
.qi_row
|
||||||
.qi_pannel.qi_plain.padding
|
.qi_pannel.qi_plain.padding.row
|
||||||
|
.col-2
|
||||||
-if @p_customer_sheet and @p_customer_sheet.state != "commande"
|
-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 :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 :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"
|
=form.input :past_id, :label => "N° système actuel"
|
||||||
|
=yield :discount
|
||||||
.price_line_block_form
|
.col-2
|
||||||
=form.semantic_fields_for :price_line_block do |f|
|
=yield :shipping_date
|
||||||
=render :partial => "admin/price_line_blocks/form", :locals => {:f => f}
|
.col-8
|
||||||
|
=yield :particular
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=yield :price_lines
|
||||||
.large_actions
|
.large_actions
|
||||||
.actions
|
.actions
|
||||||
=link_to "Annuler", admin_p_customer_sheets_path(), :class => "btn"
|
=link_to "Annuler", admin_p_customer_sheets_path(), :class => "btn"
|
||||||
=form.submit "sauvegarder", :class => "btn btn-primary btn-ap-add"
|
=form.submit "sauvegarder", :class => "btn btn-primary btn-ap-add"
|
||||||
|
.clear
|
||||||
|
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
.qi_row
|
=f.inputs do
|
||||||
=f.inputs do
|
|
||||||
|
|
||||||
|
|
||||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||||
.qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
|
|
||||||
|
|
||||||
= f.hidden_field :p_customer_id, :class => "p_customer_id"
|
= f.hidden_field :p_customer_id, :class => "p_customer_id"
|
||||||
|
=content_for :particular do
|
||||||
.p_customer_sheet_customer
|
.row
|
||||||
|
.p_customer_sheet_customer.col-12.mb-4
|
||||||
|
|
||||||
|
|
||||||
-if f.object.p_customer and 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}
|
=render :partial => "admin/p_customers/apercu", :locals => {:particular => f.object.p_customer.particular}
|
||||||
.padding{:style => "padding:0 10px;"}
|
.col-6
|
||||||
.addresses.row
|
.addresses.row
|
||||||
.columns.span_6
|
.columns.span_6
|
||||||
%h3 Adresse de facturation
|
%h4 Adresse de facturation
|
||||||
|
|
||||||
-if f.object.p_customer
|
-if f.object.p_customer
|
||||||
=f.inputs do
|
=f.inputs do
|
||||||
@ -23,9 +22,10 @@
|
|||||||
-else
|
-else
|
||||||
=f.inputs do
|
=f.inputs do
|
||||||
= f.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
= f.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
||||||
|
.col-6
|
||||||
|
.addresses.row
|
||||||
.columns.span_6
|
.columns.span_6
|
||||||
%h3 Adresse de livraison
|
%h4 Adresse de livraison
|
||||||
|
|
||||||
-if f.object.p_customer
|
-if f.object.p_customer
|
||||||
=f.inputs do
|
=f.inputs do
|
||||||
@ -36,16 +36,9 @@
|
|||||||
|
|
||||||
.clear
|
.clear
|
||||||
|
|
||||||
|
=content_for :shipping_date do
|
||||||
%table{:style => "width:100%;"}
|
|
||||||
%tr
|
|
||||||
%td{:style => "width:33%;"}
|
|
||||||
= f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
|
= f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
|
||||||
|
|
||||||
%td{:style => "width:33%;"}
|
|
||||||
= f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
|
= f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
|
||||||
|
|
||||||
%td{:style => "width:33%;"}
|
|
||||||
= f.input :validation_date, :label => "Date de validation :", :as => :date
|
= f.input :validation_date, :label => "Date de validation :", :as => :date
|
||||||
|
|
||||||
|
|
||||||
@ -62,17 +55,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=content_for :price_lines do
|
||||||
.price_lines_form
|
.row
|
||||||
|
.price_lines_form.col-11.row
|
||||||
=f.semantic_fields_for :price_lines do |f|
|
=f.semantic_fields_for :price_lines do |f|
|
||||||
=render :partial => "admin/price_lines/form", :locals => {:form => f}
|
=render :partial => "admin/price_lines/form", :locals => {:form => f}
|
||||||
|
|
||||||
%p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary"}
|
%p.col-1= 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 current_admin.has_permission?("payments")
|
||||||
.qi_pannel.qi_plain.padding.price_line_block_footer{:style => "margin:20px 0;"}
|
=content_for :discount do
|
||||||
|
|
||||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||||
-if !@avoir
|
-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_discount_percent, :label => "Réduction pied de page (%) :", :input_html => {:class => "input_price_line_block_ct_tot_discount_percent"}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
|
||||||
.qi_pannel.qi_plain.padding.price_line_form.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
|
.qi_pannel.qi_plain.padding.price_line_form.col-12.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
|
||||||
%table{:style => "width:100%;"}
|
= form.input :ct_title, :label => "Designation personnalisée : " if @avoir
|
||||||
|
%table
|
||||||
%tr
|
%tr
|
||||||
%td{:style => "width:30px;"}
|
%td{:class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
|
||||||
.take
|
.take.mx-1
|
||||||
=ic :arrows
|
=ic :arrows
|
||||||
%td
|
%td
|
||||||
|
|
||||||
@ -93,44 +94,109 @@
|
|||||||
%td{:style => "width:30px"}
|
%td{:style => "width:30px"}
|
||||||
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
|
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
|
||||||
%td
|
%td
|
||||||
|
%input.p_product_ref_autocomplete_input.form-control{:type => "text", tabindex: 1, autofocus: true, :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)}
|
||||||
-form.object.forced_price = true if form.object.ct_u_price_ht
|
-form.object.forced_price = true if form.object.ct_u_price_ht
|
||||||
|
|
||||||
-if form.object.forced_price and form.object.p_product_ref
|
-if form.object.forced_price and form.object.p_product_ref
|
||||||
|
%td
|
||||||
|
.mx-4
|
||||||
|
.form-inline
|
||||||
=qi_js_field(form, :price_line, :price_u_ht, :label => "Prix U HT :", :value => form.object.th_price_u_ht)
|
=qi_js_field(form, :price_line, :price_u_ht, :label => "Prix U HT :", :value => form.object.th_price_u_ht)
|
||||||
-else
|
-else
|
||||||
|
%td
|
||||||
|
.mx-3
|
||||||
|
.form-inline
|
||||||
=qi_js_field(form, :price_line, :price_u_ht, :label => "Prix U HT :")
|
=qi_js_field(form, :price_line, :price_u_ht, :label => "Prix U HT :")
|
||||||
|
%td
|
||||||
%div{:style => ("display:none;" if !current_admin or !current_admin.has_permission?("customer-sheets-personalised-price"))}
|
.form-inline.mx-4{:style => ("display:none;" if !current_admin or !current_admin.has_permission?("customer-sheets-personalised-price"))}
|
||||||
= form.input :forced_price, :label => "Prix personnalisé ?", :as => :boolean, :input_html => {:class => "input_price_line_forced_price"}
|
= form.input :forced_price, :label => "Prix personnalisé ?", :as => :boolean, :input_html => {:class => "input_price_line_forced_price"}
|
||||||
.forced_price_wrapper{:style => ("display:none;" if !form.object.forced_price)}= form.input :ct_u_price_ht, :label => false, :input_html => {:class => "input_price_line_ct_u_price_ht"}
|
.forced_price_wrapper.mx-4{:style => ("display:none;" if !form.object.forced_price)}= form.input :ct_u_price_ht, :label => false, :input_html => {:class => "input_price_line_ct_u_price_ht"}
|
||||||
|
|
||||||
%td
|
%td
|
||||||
= form.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte"}
|
.mx-4.form-inline
|
||||||
|
= form.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte form-control mx-2", tabindex: 1}
|
||||||
|
|
||||||
|
|
||||||
|
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
|
||||||
%td
|
%td
|
||||||
=#qi_js_field(form, :price_line, :tva_account_id, :label => "Compte TVA :")
|
.form-inline
|
||||||
|
%label.mx-4 Taux de TVA :
|
||||||
-if @avoir
|
=select_tag :tva_account_id, options_from_collection_for_select(TvaRate.where(:accounting_zone_id => (@p_customer ? @p_customer.accounting_zone_id : nil)).all, "id", "member_label", form.object.tva_account_id), :class => "input_price_line_tva_account_id form-control custom-select" #, :disabled => true
|
||||||
|
%td
|
||||||
-if !form.object.ct_tva_account_id
|
.ml-4
|
||||||
-form.object.ct_tva_account_id = form.object.tva_account_id
|
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
|
||||||
= form.input :ct_tva_account_id, :collection => TvaRate.where(:accounting_zone_id => (@p_customer ? @p_customer.accounting_zone_id : nil)).all, :as => :select, :member_label => :member_label, :include_blank => false, :label => "TVA personnalisée", :input_html => { :class => "input_price_line_tva_account_id"}
|
|
||||||
|
|
||||||
-else
|
|
||||||
%label Taux de TVA :
|
|
||||||
%br
|
|
||||||
=select_tag :tva_account_id, options_from_collection_for_select(TvaRate.where(:accounting_zone_id => (@p_customer ? @p_customer.accounting_zone_id : nil)).all, "id", "member_label", form.object.tva_account_id), :class => "input_price_line_tva_account_id" #, :disabled => true
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
|
=qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
|
||||||
|
|
||||||
= form.input :comment, :label => "Commentaire"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
= form.hidden_field :position, :class => "price_line_position_input"
|
= form.hidden_field :position, :class => "price_line_position_input"
|
||||||
|
|
||||||
|
|
||||||
|
:javascript
|
||||||
|
$('.p_product_ref_autocomplete_input').focus()
|
||||||
|
$( function() {
|
||||||
|
|
||||||
|
$('.p_product_ref_autocomplete_input').autocomplete({
|
||||||
|
source: function( request, response ) {
|
||||||
|
$.ajax( {
|
||||||
|
url: "/admin/p_product_refs/autocomplete.json",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
search: request.term,
|
||||||
|
p_customer_id: $(".p_customer_id").val()
|
||||||
|
},
|
||||||
|
success: function(data){
|
||||||
|
|
||||||
|
arr = jQuery.map( data, function( item ) {
|
||||||
|
return {
|
||||||
|
label: item.member_label,
|
||||||
|
value: item.member_label,
|
||||||
|
id: item.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
response(arr)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
minLength: 2,
|
||||||
|
select: function( event, ui ) {
|
||||||
|
|
||||||
|
$(this).next(".p_product_ref_id").val(ui.item.id)
|
||||||
|
|
||||||
|
form = $(this).closest(".price_line_form")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$.ajax( {
|
||||||
|
url: "/admin/p_product_refs/"+ui.item.id+"/get_infos.json",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
type: "price",
|
||||||
|
qte: form.find(".input_price_line_qte").val(),
|
||||||
|
p_customer_id: $(".p_customer_id").val()
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
form.find(".input_price_line_price_u_ht").val(data.price);
|
||||||
|
form.find(".input_price_line_tva_account_id").val(data.tva_account_id);
|
||||||
|
form.find(".input_price_line_tva_account_value").val(data.tva_account_value);
|
||||||
|
form.find(".input_price_line_weight_u").val(data.weight);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//return false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} );
|
||||||
|
133
app/views/admin/price_lines/_form_old.html.haml
Normal file
133
app/views/admin/price_lines/_form_old.html.haml
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
|
||||||
|
.qi_pannel.qi_plain.padding.price_line_form.col-12.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
|
||||||
|
%table{:style => "width:100%;"}
|
||||||
|
%tr
|
||||||
|
%td{:style => "width:30px;"}
|
||||||
|
.take
|
||||||
|
=ic :arrows
|
||||||
|
%td
|
||||||
|
|
||||||
|
= form.input :ct_title, :label => "Designation personnalisée : " if @avoir
|
||||||
|
%div{:class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
|
||||||
|
%label Produit :
|
||||||
|
%td
|
||||||
|
%input.p_product_ref_autocomplete_input.form-control{:type => "text", tabindex: 1, autofocus: true, :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)}
|
||||||
|
|
||||||
|
|
||||||
|
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
|
||||||
|
|
||||||
|
:javascript
|
||||||
|
$('.p_product_ref_autocomplete_input').focus()
|
||||||
|
$( function() {
|
||||||
|
|
||||||
|
$('.p_product_ref_autocomplete_input').autocomplete({
|
||||||
|
source: function( request, response ) {
|
||||||
|
$.ajax( {
|
||||||
|
url: "/admin/p_product_refs/autocomplete.json",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
search: request.term,
|
||||||
|
p_customer_id: $(".p_customer_id").val()
|
||||||
|
},
|
||||||
|
success: function(data){
|
||||||
|
|
||||||
|
arr = jQuery.map( data, function( item ) {
|
||||||
|
return {
|
||||||
|
label: item.member_label,
|
||||||
|
value: item.member_label,
|
||||||
|
id: item.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
response(arr)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
minLength: 2,
|
||||||
|
select: function( event, ui ) {
|
||||||
|
|
||||||
|
$(this).next(".p_product_ref_id").val(ui.item.id)
|
||||||
|
|
||||||
|
form = $(this).closest(".price_line_form")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$.ajax( {
|
||||||
|
url: "/admin/p_product_refs/"+ui.item.id+"/get_infos.json",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
type: "price",
|
||||||
|
qte: form.find(".input_price_line_qte").val(),
|
||||||
|
p_customer_id: $(".p_customer_id").val()
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
form.find(".input_price_line_price_u_ht").val(data.price);
|
||||||
|
form.find(".input_price_line_tva_account_id").val(data.tva_account_id);
|
||||||
|
form.find(".input_price_line_tva_account_value").val(data.tva_account_value);
|
||||||
|
form.find(".input_price_line_weight_u").val(data.weight);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//return false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
%td{:style => "width:30px"}
|
||||||
|
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
|
||||||
|
%td
|
||||||
|
-form.object.forced_price = true if form.object.ct_u_price_ht
|
||||||
|
|
||||||
|
-if form.object.forced_price and form.object.p_product_ref
|
||||||
|
=qi_js_field(form, :price_line, :price_u_ht, :label => "Prix U HT :", :value => form.object.th_price_u_ht)
|
||||||
|
-else
|
||||||
|
=qi_js_field(form, :price_line, :price_u_ht, :label => "Prix U HT :")
|
||||||
|
|
||||||
|
%div{:style => ("display:none;" if !current_admin or !current_admin.has_permission?("customer-sheets-personalised-price"))}
|
||||||
|
= form.input :forced_price, :label => "Prix personnalisé ?", :as => :boolean, :input_html => {:class => "input_price_line_forced_price"}
|
||||||
|
.forced_price_wrapper{:style => ("display:none;" if !form.object.forced_price)}= form.input :ct_u_price_ht, :label => false, :input_html => {:class => "input_price_line_ct_u_price_ht"}
|
||||||
|
|
||||||
|
%td
|
||||||
|
= form.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte", tabindex: 1}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%td
|
||||||
|
=#qi_js_field(form, :price_line, :tva_account_id, :label => "Compte TVA :")
|
||||||
|
|
||||||
|
-if @avoir
|
||||||
|
|
||||||
|
-if !form.object.ct_tva_account_id
|
||||||
|
-form.object.ct_tva_account_id = form.object.tva_account_id
|
||||||
|
= form.input :ct_tva_account_id, :collection => TvaRate.where(:accounting_zone_id => (@p_customer ? @p_customer.accounting_zone_id : nil)).all, :as => :select, :member_label => :member_label, :include_blank => false, :label => "TVA personnalisée", :input_html => { :class => "input_price_line_tva_account_id"}
|
||||||
|
|
||||||
|
-else
|
||||||
|
%label Taux de TVA :
|
||||||
|
%br
|
||||||
|
=select_tag :tva_account_id, options_from_collection_for_select(TvaRate.where(:accounting_zone_id => (@p_customer ? @p_customer.accounting_zone_id : nil)).all, "id", "member_label", form.object.tva_account_id), :class => "input_price_line_tva_account_id custom-select" #, :disabled => true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
|
||||||
|
|
||||||
|
/ = form.input :comment, :label => "Commentaire"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
= form.hidden_field :position, :class => "price_line_position_input"
|
||||||
|
|
Reference in New Issue
Block a user