.qi_header
  .right{:style => "text-align:right;"}
    = link_to i(:pencil), edit_admin_p_customer_path(@p_customer), :remote => false
    
    
    
  %h1
    Clients

    %span
      =link_to [:admin, @p_customer] do
        =@p_customer.code
        =@p_customer.show_name

    
    
.qi_row
  .qi_pannel.qi_plain.padding
    .right
      -if !@p_customer.enabled
        .badge.badge-danger
          =ic :lock
          Client bloqué :
          =@p_customer.disabled_raison
    
    
    
    =render :partial => "admin/p_customers/apercu.html.haml", :locals => {:particular => @p_customer.particular, :mask_fin => true}
   

#customer_adresses
  =render(:partial => "admin/particulars/customer_preview", :locals => {:p_customer => @p_customer})
  


=render :partial => "admin/p_customers/financier.html.haml", :locals => {:p_customer => @p_customer}
    

    

:scss
  .qi_tab_content{
    border:1px solid #ddd;
    border-top:0;
    .qi_tab_header{
      padding:10px 20px;
      h3{
        padding:0;
        margin:0;
      }
      
    }
    min-height:1000px;
    margin-bottom:300px;
    background:white;
    
    
  }


    
.qi_row#tabs
  .qi_pannel
    %ul.nav.nav-tabs
      -params[:tab] = params[:tab] || "offres"
      
      %li{:class => ("active" if params[:tab] == "offres")}=link_to "Offres", "?tab=offres#tabs"
      -if false
        %li{:class => ("active" if params[:tab] == "etat")}=link_to "Etat de compte", "?tab=etat#tabs"
      
      -if current_admin.has_permission?("bills")
        %li{:class => ("active" if params[:tab] == "bills")}=link_to "Factures & Avoirs", "?tab=bills#tabs"
      -if current_admin.has_permission?("payments")
        %li{:class => ("active" if params[:tab] == "payments")}=link_to "Paiements", "?tab=payments#tabs"
    
    .qi_tab_content
      -if params[:tab] == "offres"
        #offres
      
          .qi_tab_header
            .right{:style => "text-align:right;"}
              -if @p_customer.enabled
                =link_to ic(:plus)+" Nouvelle offre", new_admin_p_customer_sheet_path(:p_customer_id => @p_customer.id), :class => "btn btn-primary btn-ap-add"

        
   

     
     
     
          -params[:search][:per_page] = params[:search][:per_page] || 50
          -per_page = params[:search][:per_page]
          -page = (params[:page] and params[:page] != "") ? params[:page] : 1 
          -@p_customer_sheets =@p_customer.p_customer_sheets
          -@p_customer_sheets = sort_by_sorting(@p_customer_sheets, "created_at DESC")
          -@p_customer_sheets = @p_customer_sheets.page(page).per(per_page)

          =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_customer_sheets}
     
  
      
        
      -if params[:tab] == "bills"
        #bills
          -params[:search][:per_page] = params[:search][:per_page] || 50
          -per_page = params[:search][:per_page]
          -page = (params[:page] and params[:page] != "") ? params[:page] : 1 
          
          -@price_documents = @p_customer.price_documents.where(:price_document_type_id => [1,2]).order("date DESC, created_at DESC")
          -if params[:price_document_ids]
            -@price_documents = @price_documents.where(:id => params[:price_document_ids])
          

          -@price_documents = sort_by_sorting(@price_documents, "created_at DESC")
          -@price_documents = @price_documents.page(page).per(per_page)
    
          =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_documents}
      


        
      
      -if params[:tab] == "payments"
        #payments
          .qi_tab_header
            .right{:style => "text-align:right;"}
              = link_to 'Ajouter un paiement', new_admin_p_payment_path(:p_customer_id => @p_customer.id), :class => "btn btn-primary bgbd-payments", :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 
          -@p_payments =@p_customer.p_payments
          -@p_payments = sort_by_sorting(@p_payments, "created_at DESC")
          -@p_payments = @p_payments.page(page).per(per_page)
  
          =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_payments}
          
          






 
  