=semantic_form_for [:admin, @m_odr_file], :remote => false do |f|
  -if current_admin.id == 1
    =debug f.object.errors.messages
  .qi_row
    .qi_pannel.qi_plain.padding
      =f.inputs do

        =render :partial => "qi/autocomplete", :locals => {:form => f, :field => :p_customer, :label => "Utilisateur :"}

        = f.input :file, :label => "Fichier :"

        

        = f.hidden_field :m_odr_file_type_id
        =# f.input :m_odr_file_type_id, :label => "Décision :", :collection => MOdrFileType.all, :as => :select, :include_blank => false

        


        -if f.object.m_odr_file_type_id == 2
          %table.m_odr_file_products_form.form-table
            = f.input :buy_at, :label => "Date de l'achat", :as => :date
            = f.input :m_odr_place, :label => "Revendeur :", :as => :date, :collection => MOdrPlace.order("enseigne ASC, name ASC, city ASC").all, :member_label => :member_label, :as => :select
            =f.semantic_fields_for :m_odr_file_products do |form|
              =render :partial => "admin/m_odr_file_products/form", :locals => {:form => form}

          %p= link_to_add_fields ic(:plus)+" Ajouter un produit", f, :m_odr_file_products


        -else
          %table.m_odr_file_roulages_form.form-table
            =f.semantic_fields_for :m_odr_file_roulages do |form|
              =render :partial => "admin/m_odr_file_roulages/form", :locals => {:form => form}

          %p= link_to_add_fields ic(:plus)+" Ajouter un roulage", f, :m_odr_file_roulages

        
        = f.input :admin_ok, :label => "Décision :", :collection => [["Validé",true], ["Refusé", false]], :as => :select
        
        = f.input :reject_reason_description, :label => "Commentaire interne", :input_html => {:style => "height:100px;"}
        
      
      
  .large_actions
    .actions=f.submit "sauvegarder", :class => "btn btn-primary"
  