.qi_header
  .right
    #state=render :partial => "admin/m_odr_reps/state"
  %h1
    Participations ODR
    %span
      Détail
      
-@no_freezee =true
      
-@m_odr_rep.save

-@can_update = current_admin.has_permission?("odr_rep.update")


-params[:search][:per_page] = params[:search][:per_page] || 50
-per_page = params[:search][:per_page]
-page = (params[:page] and params[:page] != "") ? params[:page] : 1 
-m_odr_reps = MOdrRep.where(:m_odr_id => @m_odr_rep.m_odr_id).where("cc_particular_name LIKE ? or cc_particular_firstname LIKE ? or cc_particular_name LIKE ? or cc_particular_firstname LIKE ? or cc_particular_email LIKE ? or cc_particular_address_2 LIKE ?","%#{@m_odr_rep.cc_particular_firstname}%", "%#{@m_odr_rep.cc_particular_firstname}%", "%#{@m_odr_rep.cc_particular_name}%", "%#{@m_odr_rep.cc_particular_name}%", "%#{@m_odr_rep.cc_particular_email}%", "%#{@m_odr_rep.cc_particular_address_2}%").where("id != ?",@m_odr_rep.id)
-m_odr_reps = sort_by_sorting(m_odr_reps, "created_at DESC")
-m_odr_reps = m_odr_reps.page(page).per(per_page)

-if m_odr_reps.count > 0

  %hr
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Doublons potentiels :

  =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => m_odr_reps}


.qi_row
  .qi_pannel.qi_plain.padding

      
    #head=render :partial => "admin/m_odr_reps/head"
    
    
    
    
    %hr
    Achat
    .row
      .columns.span_4
        #left_column
          =render :partial => "admin/m_odr_reps/left_column"
          
          
      .columns.span_8{:style => "padding-left:20px;"}
        -file = @m_odr_rep.m_odr_files.order("id DESC").first
        -if file
          =link_to ic(:download)+" Télécharger le document", download_admin_m_odr_file_path(file, :disposition => "attachment")
          
          
          -if File.extname(file.file.path) == ".pdf" || File.extname(file.file.path) == ".PDF"
            
            %iframe{:src => file.file.url, :style => "width:100%;height:800px;border:1px solid gray;"}
          
          -else
            &nbsp;&nbsp;
            =link_to ic(:"rotate-left"), rotate_admin_m_odr_file_path(:id => file.id, :direction => "right"), :remote => true
            &nbsp;&nbsp;
            =link_to ic(:"rotate-right"), rotate_admin_m_odr_file_path(file), :remote => true
            #image_previ{:style => "width:100%;height:800px;border:1px solid gray;overflow:auto;"}
              =render :partial => "admin/m_odr_files/image", :locals => {:file => file}
          
          
          
    .clear
    %hr
    Virements
    
    
    -params[:search][:per_page] = params[:search][:per_page] || 50
    -per_page = params[:search][:per_page]
    -page = (params[:page] and params[:page] != "") ? params[:page] : 1 
    -@m_odr_virements = @m_odr_rep.m_odr_virements.page(page).per(per_page)
    
    =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @m_odr_virements}
    
    
    %hr
    Historique des mails envoyés
    
    -params[:search][:per_page] = params[:search][:per_page] || 50
    -per_page = params[:search][:per_page]
    -page = (params[:page] and params[:page] != "") ? params[:page] : 1 
    -@mail_hists = @m_odr_rep.mail_hists
    -@mail_hists = sort_by_sorting(@mail_hists, "created_at DESC")
    -@mail_hists = @mail_hists.page(page).per(per_page)
    
    =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @mail_hists}
    
    