.qi_header
  .right{:style => "text-align:right;"}
    = link_to i(:pencil), edit_admin_p_customer_path(@p_customer), :remote => false
    
    
    
  %h1
    Utilisateurs
    %span
      Détail d'un utilisateur
    %span
      =link_to [:admin, @p_customer] do
        =@p_customer.code
        =@p_customer.show_name



.qi_row
  .qi_pannel.qi_plain.padding
    
    -if @p_customer.ambassadeur
      %p
        Code ambassadeur :
        =@p_customer.mlm_token

    %p
      Email :
      =@p_customer.email

    %p
      Tel :
      =@p_customer.tel
   

#customer_adresses
  =render(:partial => "admin/particulars/customer_preview", :locals => {:p_customer => @p_customer})
  
    
.qi_row#tabs
  .qi_pannel
    %ul.nav.nav-tabs
      -params[:tab] = params[:tab] || "mail_hists"
      
      %li{:class => ("active" if params[:tab] == "mail_hists")}=link_to "Historique des mails envoyés", "?tab=mail_hists"

      %li{:class => ("active" if params[:tab] == "m_odr_rep_ribs")}=link_to "Ribs", "?tab=m_odr_rep_ribs"


      %li{:class => ("active" if params[:tab] == "m_odr_files")}=link_to "Factures", "?tab=m_odr_files"


    
    .qi_tab_content
      -if params[:tab] == "m_odr_files"
        #offres
      
          .qi_tab_header
            .right{:style => "text-align:right;"}
              -MOdrFileType.all.each do |moft|
                = link_to 'Ajouter '+moft.name.to_s, new_admin_m_odr_file_path(:p_customer_id => @p_customer, :m_odr_file_type_id => moft.id), :class => "btn btn-primary", :remote => false

          -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_files =@p_customer.m_odr_files
          -@m_odr_files = sort_by_sorting(@m_odr_files, "created_at DESC")
          -@m_odr_files = @m_odr_files.page(page).per(per_page)

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



      -if params[:tab] == "m_odr_rep_ribs"
        #offres
          .qi_tab_header
            .right{:style => "text-align:right;"}
              -if @p_customer.enabled
                = link_to 'Ajouter un rib', new_admin_m_odr_rep_rib_path(:p_customer_id => @p_customer.id), :class => "btn btn-primary bgbd-ventes", :remote => true

          -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_rep_ribs =@p_customer.m_odr_rep_ribs
          -@m_odr_rep_ribs = sort_by_sorting(@m_odr_rep_ribs, "created_at DESC")
          -@m_odr_rep_ribs = @m_odr_rep_ribs.page(page).per(per_page)


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



      -if params[:tab] == "mail_hists"
        #offres
      
          .qi_tab_header
            .right{:style => "text-align:right;"}
              
        
     
     
          -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 =@p_customer.mail_hists
          -@mail_hists = sort_by_sorting(@mail_hists, "created_at DESC")
          -@mail_hists = @mail_hists.page(page).per(per_page)

          =#debug MailHist.qi_ordered_table_name
          =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @mail_hists}
     
  
      


   


 
  