101 lines
3.7 KiB
Plaintext
101 lines
3.7 KiB
Plaintext
|
|
.stock_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
|
|
%br
|
|
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
|
|
%td
|
|
%label Produit :
|
|
%input.p_product_ref_autocomplete_input.form-control{:type => "text", :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
|
|
$( 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_fournisseur_id: $(".p_fournisseur_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(".stock_line_form")
|
|
|
|
|
|
|
|
$.ajax( {
|
|
url: "/admin/p_product_refs/"+ui.item.id+"/get_infos.json",
|
|
dataType: "json",
|
|
data: {
|
|
type: "price",
|
|
qte: form.find(".input_stock_line_qte").val(),
|
|
p_fournisseur_id: $("#p_fournisseur_id").val()
|
|
},
|
|
success: function (data) {
|
|
form.find(".input_stock_line_price_u_ht").val(data.price);
|
|
form.find(".input_stock_line_tva_account_id").val(data.tva_account_id);
|
|
form.find(".input_stock_line_tva_account_value").val(data.tva_account_value);
|
|
form.find(".input_stock_line_weight_u").val(data.weight);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
//return false
|
|
}
|
|
});
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
-if false
|
|
%td
|
|
|
|
=qi_js_field(form, :stock_line, :price_u_ht, :label => "Prix U cat. :", :value => 1.2 ) #
|
|
|
|
%td
|
|
= form.input :ct_price_u_ht, :label => "Prix U HT", :input_html => {:class => "input_stock_line_ct_u_price_ht"}
|
|
|
|
%td{:style => "width:50px;"}
|
|
= form.input :qte, :label => "qte :", :input_html => {:class => "input_stock_line_qte"}
|
|
|
|
|
|
|