.qi_header
  
  -if params[:offre].to_s != "true"
    
    -if current_admin.has_permission?("customers-c")
      .right= link_to ic(:plus)+' Ajouter un client', new_admin_p_customer_path(), :class => "btn btn-primary btn-ap-add", :remote => false
  -else
    .right
      =link_to "< Retour aux demandes de commande", admin_p_customer_sheets_path
  
  %h1
    Ventes
    %span
      Clients
 
  

-if false
  -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 Commercial
            %th Nom
            %th CA (HT)
            %th Encours
            %th
  

          %tbody#p_customers_rows
            =render @fav_p_customers
        


.qi_search_row
  =form_tag "", :method => "get",  :onsubmit => "" do
    -params[:search] =params[:search] || {}
    %table
      %tr
        =hidden_field_tag :offre,  params[:offre]
        
        %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"
        
        -if false
          %td=text_field_tag :document_number, params[:document_number],:class => "form-control", :placeholder => "N° document"
    
    
    
    %table
      %tr

        %td
          Catégorie :
          =select_tag "search[p_customer_cat_id]", options_for_select([["",""],["Aucune","null"]]+PCustomerCat.order(:name).all.map{|a| [a.name, a.id]}, params[:search][:p_customer_cat_id])
    
        -if !current_admin.p_commercial
          %td
            Commercial :
            =select_tag "search[p_commercial_id]", options_for_select([["",""],["Aucun","null"]]+PCommercial.order(:name).all.map{|a| [a.member_label, a.id]}, params[:search][:p_commercial_id])
    
        
        

      
      
  
    =render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_customers}


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



