=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.input :buy_at, :label => "Date de la facture :", :as => :date

        = 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

        = f.input :admin_ok, :label => "Décision :", :collection => [["Validé",true], ["Refusé", false]], :as => :select
        = f.input :reject_reason, :label => "Motif du rejet :", :collection => ["Mauvais document","Mauvaise qualité rendant le fichier illisible"]
        
        = f.input :reject_reason_description, :label => "Précisions sur le rejet"



        -if f.object.m_odr_file_type_id == 2
          %table.m_odr_file_products_form.form-table
            = f.input :m_odr_place, :label => "Revendeur :", :as => :date, :collection => MOdrPlace.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
          = f.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => MEvent.all, :member_label => :member_label, :as => :select

      
      
  .large_actions
    .actions=f.submit "sauvegarder", :class => "btn btn-primary"
  