:coffeescript
  @update_p_customer_form = () ->
    if $("#p_customer_enabled").is(':checked')
      $(".disabled_raison").hide()
    else
      $(".disabled_raison").show()




=semantic_form_for [:admin, @p_fournisseur], :remote => false, :html => {:onchange => "update_p_customer_form();"} do |f|
  =f.inputs do
  
    .qi_row
      .qi_pannel.qi_plain.padding
    
        .row.qi_cancel_margins
         
          .col-sm-3
            %br
            = f.input :enabled, :label => "Fournisseur actif ?", :as => :boolean, :input_html => {:id => "p_customer_enabled"}
            
          
          .col-sm-3
            .disabled_raison{:style => ("display:none;" if @p_fournisseur.enabled)}
              = f.input :disabled_raison, :label => "Raison du blocage :", :as => :select, :collection => ["Impayé","Litige", "N'existe plus"], :include_blank => false
              
          .col-sm-4
            = f.input :accounting_zone_id, :label => "Zone :", :collection => AccountingZone.all, :as => :select, :include_blank => false
              
        = f.input :code, :label => "Code :" 
      
      
        =f.input :compta_account, :label => "Compte comptable :"
        
    
    .qi_row
      .qi_pannel.qi_plain.padding
        Adresses :  
    
        -if false
          %p.right= link_to_add_fields "Ajouter une adresse", form, :particulars 
      
        .particulars_form
          =f.semantic_fields_for :particulars do |form|
            =render :partial => "admin/particulars/form", :locals => {:form => form}
    
      
    
      
    
    
    .qi_row
      .qi_pannel.qi_plain.padding
        Contacts du fournisseur :
        %hr
    
        .p_contacts_form
          =f.semantic_fields_for :p_contacts do |f|
            =render :partial => "admin/p_contacts/form", :locals => {:form => f}
  
        %p= link_to_add_fields ic(:plus)+" Ajouter un contact au fournisseur", f, :p_contacts
      
      
    .qi_row
      .qi_pannel.qi_plain.padding
        %h4 Paiements
    
        = f.input :p_payment_type_id, :label => "Type de paiement :", :include_blank => false, :collection => PPaymentType.order(:name).all, :as => :select, :input_html => {:id => "payment_type_id_select"}
    

        = f.input :payment_comptant, :label => "Paiement comptant nécessaire ?" 

        -if false
          = f.input :acompte, :label => "Acompte nécessaire ?" 
          = f.input :acompte_percent, :label => "Pourcentage d'acompte :" 

        = f.input :payment_delais, :label => "Délais jour de paiement :"
    
        = f.input :payment_month_end, :label => "Fin de mois ?"
        
      
  .large_actions
    .actions
      =f.submit "sauvegarder", :class => "btn btn-primary"
  