.qi_header
  .right= link_to ic(:plus)+' Ajouter un paiement', new_admin_p_payment_path(), :class => "btn btn-primary btn-ap-add", :remote => true
  %h1
    Paiements
    %span
      Liste des paiements

.qi_search_row
  =form_tag "", :method => "get",  :onsubmit => "" do
    -params[:search] =params[:search] || {}

    
    %table
      %table.search_table
        %tr
          %td
            Début
          %td
            .input-group
              =text_field_tag :start, params[:start],:class => "form-control datepicker", :placeholder => "Début"
              %span.input-group-addon.btn{:onclick => "$(this).prev('input').val('');"}
                =ic(:times)
          
            %br
            -if @start and @stop
            
              =link_to "< Mois précédent",request.query_parameters.merge({start: ((@start - 1.month).beginning_of_month.strftime('%d/%m/%Y')), stop: ((@stop - 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-default"
          
    
          %td
            Fin
          %td
            .input-group
              =text_field_tag :stop, params[:stop],:class => "form-control datepicker", :placeholder => "Fin"
              %span.input-group-addon.btn{:onclick => "$(this).prev('input').val('');"}
                =ic(:times)
            %br
            -if @start and @stop
              =link_to "Mois suivant >",request.query_parameters.merge({start: ((@start + 1.month).beginning_of_month.strftime('%d/%m/%Y')), stop: ((@stop + 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-default"
        
        
          -params[:p_payment_type_ids] = params[:p_payment_type_ids] || []
          %td
            Type de paiement :
          %td
          
            -PPaymentType.where(:enabled => true).order("name").each do |pdt|
              %p
                = check_box_tag :"p_payment_type_ids[]", pdt.id, (true if params[:p_payment_type_ids].include?(pdt.id.to_s)), {:id => "p_payment_type_ids_#{pdt.id}"}
                = label_tag "p_payment_type_ids_"+pdt.id.to_s, pdt.name
          

          %td
          %td
            Montant : 
          %td
            de
          %td
            =number_field_tag :amount_min, params[:amount_min],:class => "form-control", :placeholder => "Min", :step => 0.01
          %td
            à
          %td
            =number_field_tag :amount_max, params[:amount_max],:class => "form-control", :placeholder => "Max", :step => 0.01
          %td
      
  
    =render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_payments}


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


:scss
  .qi_search_row{
    td{
      vertical-align:top;
    }
    p{
    margin:0;
    }
  }
    