140 lines
4.8 KiB
Plaintext
Executable File
140 lines
4.8 KiB
Plaintext
Executable File
#p_payment_form_wrapper
|
|
|
|
.content
|
|
=debug @p_payment.errors.messages
|
|
=semantic_form_for [:admin, @p_payment], :remote => true, :html => {:id => "p_payment_general_form",:onsubmit => "$this = $(this); if ($this.data().isSubmitted) { alert('La sauvegarde est en cours, merci de patienter.');return false; } $this.data().isSubmitted = true; return true;"} do |f|
|
|
-@p_customer = @p_payment.p_customer if @p_payment.p_customer
|
|
|
|
|
|
=f.inputs do
|
|
|
|
|
|
=hidden_field_tag :last_p_customer_id, @p_payment.p_customer_id
|
|
|
|
|
|
%label Client :
|
|
%input.p_customer_autocomplete_input.form-control{:type => "text", :value => ("#{f.object.p_customer.show_name}" if f.object.p_customer)}
|
|
|
|
|
|
= f.hidden_field :p_customer_id, :class => "p_customer_id"
|
|
|
|
:javascript
|
|
$( function() {
|
|
|
|
|
|
|
|
$('.p_customer_autocomplete_input').autocomplete({
|
|
source: function( request, response ) {
|
|
$.ajax( {
|
|
|
|
|
|
url: "/admin/p_customers/autocomplete.json",
|
|
dataType: "json",
|
|
data: {
|
|
search: request.term,
|
|
|
|
},
|
|
success: function(data){
|
|
|
|
arr = jQuery.map( data, function( item ) {
|
|
return {
|
|
label: item.show_name,
|
|
value: item.show_name,
|
|
id: item.id
|
|
}
|
|
});
|
|
|
|
response(arr)
|
|
|
|
}
|
|
|
|
} );
|
|
},
|
|
minLength: 2,
|
|
select: function( event, ui ) {
|
|
|
|
$(this).next(".p_customer_id").val(ui.item.id)
|
|
|
|
var change_address = false;
|
|
|
|
if (parseInt($("#last_p_customer_id").val()) != parseInt(ui.item.id)){
|
|
change_address = true;
|
|
|
|
}
|
|
|
|
$.ajax({
|
|
url:"/admin/p_customers/"+ui.item.id+"/autocomplete_apercu.js",
|
|
type : "GET",
|
|
data : { change_address : change_address}
|
|
|
|
});
|
|
|
|
$.ajax({
|
|
url:"/admin/p_documents/search_to_affect?p_customer_id="+ui.item.id+".js",
|
|
type : "GET"
|
|
//data : { change_address : change_address}
|
|
|
|
});
|
|
|
|
$("#last_p_customer_id").val(ui.item.id);
|
|
|
|
|
|
//return false
|
|
}
|
|
});
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
%br
|
|
|
|
=render :partial => "admin/p_payments/essentials_form", :locals => {:form => f}
|
|
|
|
|
|
#lettrage_panel
|
|
=f.inputs do
|
|
|
|
%hr
|
|
|
|
Lettrage :
|
|
#lettrage_table
|
|
%table.table
|
|
%thead
|
|
%tr
|
|
%th{:style => "width:30px"}
|
|
%th{:style => "width:100px"} Date
|
|
%th{:style => "width:90px"} Offre
|
|
%th Numéro de doc.
|
|
%th.numeraire{:style => "width:90px"} Montant TTC
|
|
%th.numeraire{:style => "width:90px"} Solde TTC
|
|
%th.numeraire{:style => "width:30px"} Montant à lettrer
|
|
%th{:style => "width:10px"}
|
|
|
|
%tbody.p_payment_documents_form
|
|
|
|
=f.semantic_fields_for :p_payment_documents do |form|
|
|
=render :partial => "admin/p_payment_documents/form", :locals => {:form => form}
|
|
|
|
:scss
|
|
#lettrage_table{
|
|
font-size:14px;
|
|
td,th{
|
|
padding:2px 4px;
|
|
vertical-align:middle;
|
|
.form-group{
|
|
margin:0;
|
|
}
|
|
}
|
|
}
|
|
%p Pour sélectionner un document avec lequel lettrer ce paiement, cliquer sur le + dans la liste des paiements ci-dessous :
|
|
=render :partial => "admin/p_documents/search_to_affect"
|
|
|
|
|
|
|
|
|
|
.actions=submit_tag "sauvegarder", :class => "btn btn-primary", :onclick => "$(this).val('Sauvegarde en cours...');$(this).closest('#p_payment_form_wrapper').find('#p_payment_general_form').submit();"
|
|
|