.qi_header
  .right= link_to 'Ajouter un client', new_admin_p_customer_path(), :class => "btn btn-primary", :remote => true
  %h1
    Ventes
    %span
      Clients
 
  

-if params[:search].to_s == "" and ! params[:page]
  .qi_row
    .qi_pannel.qi_plain.padding
  
  
      %table.table.table-hover.table-striped
        %tr
          %th
          %th Code
          %th Nom
          %th CA (HT)
          %th Encours
          %th
  

        %tbody#p_customers_rows
          =render @fav_p_customers
        

.qi_row
  .qi_pannel.qi_plain.padding
  
    =form_tag "", :method => "get",  :onsubmit => "" do
    
      %table
        %tr
          
          %td=text_field_tag :code, params[:code],:class => "form-control", :placeholder => "Code client"
          
          %td=text_field_tag :name, params[:name],:class => "form-control", :placeholder => "Nom"
          %td=text_field_tag :city, params[:city],:class => "form-control", :placeholder => "Ville"
          
          %td=text_field_tag :tel, params[:tel],:class => "form-control", :placeholder => "Tel"
          %td=text_field_tag :document_number, params[:document_number],:class => "form-control", :placeholder => "N° document"
          
          
          
          
          
      =#text_field_tag :search, params[:search],:class => "form-control", :placeholder => "Rechercher"
      %table
        %tr
          %td.search_label
            Encours : 
          %td.search_op
            de
          %td.search_number_input
            =number_field_tag :encours_min, params[:encours_min],:class => "form-control", :placeholder => "Enc. min", :step => 0.01
          %td.search_op
            à
          %td.search_number_input
            =number_field_tag :encours_max, params[:encours_max],:class => "form-control", :placeholder => "Enc. max", :step => 0.01
          
          %td.search_op
          
          %td.search_label
            Chiffre d'affaire : 
          %td.search_op
            de
          %td.search_number_input
            =number_field_tag :ca_min, params[:ca_min],:class => "form-control", :placeholder => "CA min", :step => 0.01
          %td.search_op
            à
          %td.search_number_input
            =number_field_tag :ca_max, params[:ca_max],:class => "form-control", :placeholder => "CA max", :step => 0.01
          
          %td
          
      :scss
        .search_label{
          width:110px;
          text-align:right;
          padding-right:5px;
        }
        .search_op{
          width:25px;
          text-align:center;
          color:rgba(0,0,0,0.5);
        }
        
        .search_number_input{
          width:100px;
        }
        
            
            
            
        
      =submit_tag "Recherche", :class => "btn btn-default", :style => "margin-bottom: 10px;"
    
    
    %p
      ="(#{@p_customers.total_count}) résultat(s)"
  
    %table.table
      %tr
        %th
        %th=sort_link "code", "Code"
        %th Nom
        %th Adresse
        %th 
          =sort_link "cache_ca", "CA (HT)"
        %th
          =sort_link "cache_encours_th", "Encours"
        %th
  

      %tbody#p_customers_rows
        =render @p_customers
        
      
    .qi_pagination
      = paginate @p_customers #, :remote => true


.qi_row
  .qi_pannel.qi_plain.padding
    =render :partial => "search_etat_form"