172 lines
6.5 KiB
Plaintext
172 lines
6.5 KiB
Plaintext
.qi_pannel.qi_plain.padding.price_line_form.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
|
|
%table.nested_line_form_table{:style => "width:100%;"}
|
|
%tr
|
|
|
|
%td{:style => "width:30px"}
|
|
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
|
|
|
|
%td
|
|
|
|
|
|
%div{:class => ("error has-error" if form.object.errors[:p_product_ref_to_id].size > 0 )}
|
|
%label Produit :
|
|
%input.p_product_ref_from_autocomplete_input.form-control{:type => "text", :value => ("#{form.object.p_product_ref_from.ref} #{form.object.p_product_ref_from.cc_name}" if form.object.p_product_ref_from)}
|
|
|
|
|
|
= form.hidden_field :p_product_ref_from_id, :class => "p_product_ref_from_id"
|
|
|
|
:javascript
|
|
$( function() {
|
|
|
|
$('.p_product_ref_from_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_from_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
|
|
= form.input :qte_from, :label => "Quantité utilisée :"
|
|
|
|
|
|
%td
|
|
|
|
|
|
%div{:class => ("error has-error" if form.object.errors[:p_product_ref_to_id].size > 0 )}
|
|
%label Produit :
|
|
%input.p_product_ref_autocomplete_input.form-control{:type => "text", :value => ("#{form.object.p_product_ref_to.ref} #{form.object.p_product_ref_to.cc_name}" if form.object.p_product_ref_to)}
|
|
|
|
|
|
= form.hidden_field :p_product_ref_to_id, :class => "p_product_ref_to_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_to_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
|
|
= form.input :qte_to, :label => "Quantité produite :"
|
|
|
|
|