update price-line form demande de prix
This commit is contained in:
parent
2f7a3a48a1
commit
2a540f292a
@ -21,7 +21,7 @@
|
|||||||
=f.semantic_fields_for :price_lines do |f|
|
=f.semantic_fields_for :price_lines do |f|
|
||||||
=render :partial => "admin/price_lines/form_#{f.object.block_type_slug}", :locals => {:form => f}
|
=render :partial => "admin/price_lines/form_#{f.object.block_type_slug}", :locals => {:form => f}
|
||||||
|
|
||||||
%p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary"}
|
%p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {slug: f.object.block_type_slug , :class => "btn btn-primary", tabindex: 2}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,98 +1,24 @@
|
|||||||
|
.qi_pannel.qi_plain.padding.price_line_form.col-12.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
|
||||||
.qi_pannel.qi_plain.padding.price_line_form.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
|
- price_line = form.object
|
||||||
%table{:style => "width:100%;"}
|
.row
|
||||||
%tr
|
.col-6.row
|
||||||
%td{:style => "width:30px;"}
|
.col-2.d-flex
|
||||||
.take
|
.take.mx-3
|
||||||
=ic :arrows
|
=ic :arrows
|
||||||
%td
|
%label
|
||||||
|
ref :
|
||||||
= form.input :ct_title, :label => "Designation personnalisée : " if @avoir
|
%input.p_product_ref_autocomplete_input.form-control.col{: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)}
|
||||||
%div{:class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
|
|
||||||
%label Produit :
|
.col-3.ml-4
|
||||||
%input.p_product_ref_autocomplete_input.form-control{:disabled => true, :type => "text", :value => ("#{form.object.p_product_ref.member_label}" if form.object.p_product_ref)}
|
.form-inline
|
||||||
|
= form.input :qte, :label => "qte :", :input_html => { class: "mx-2", tabindex: 1}
|
||||||
|
.col-1
|
||||||
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
|
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
|
||||||
|
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
|
||||||
:javascript
|
|
||||||
$( function() {
|
|
||||||
|
|
||||||
$('.p_product_ref_autocomplete_input').autocomplete({
|
=qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
|
||||||
source: function( request, response ) {
|
|
||||||
$.ajax( {
|
= form.hidden_field :position, :class => "price_line_position_input"
|
||||||
url: "/admin/p_product_refs/autocomplete.json",
|
|
||||||
dataType: "json",
|
|
||||||
data: {
|
|
||||||
search: request.term,
|
|
||||||
},
|
|
||||||
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
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} );
|
|
||||||
|
|
||||||
|
|
||||||
%table.top_td{:style => "width:100%;margin-top:5px;"}
|
|
||||||
%tr
|
|
||||||
%td{:style => "width:30px"}
|
|
||||||
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
|
|
||||||
|
|
||||||
%td
|
|
||||||
= form.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte"}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
= form.hidden_field :position, :class => "price_line_position_input"
|
|
||||||
|
|
||||||
|
98
app/views/admin/price_lines/_form_demande_prix_OLD.html.haml
Normal file
98
app/views/admin/price_lines/_form_demande_prix_OLD.html.haml
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
|
||||||
|
.qi_pannel.qi_plain.padding.price_line_form.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 :
|
||||||
|
%input.p_product_ref_autocomplete_input.form-control{:disabled => true, :type => "text", :value => ("#{form.object.p_product_ref.member_label}" if form.object.p_product_ref)}
|
||||||
|
|
||||||
|
|
||||||
|
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
|
||||||
|
|
||||||
|
:javascript
|
||||||
|
$( 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,
|
||||||
|
},
|
||||||
|
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
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
%table.top_td{:style => "width:100%;margin-top:5px;"}
|
||||||
|
%tr
|
||||||
|
%td{:style => "width:30px"}
|
||||||
|
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
|
||||||
|
|
||||||
|
%td
|
||||||
|
= form.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
= form.hidden_field :position, :class => "price_line_position_input"
|
||||||
|
|
Reference in New Issue
Block a user