%tr#p_payment_row{:id => p_payment.id}
  -tr = {}

  -tr[:p_payment_type] = capture do
    %td= p_payment.p_payment_type.name if p_payment.p_payment_type
  -tr[:paid_at] = capture do
    %td= l(p_payment.paid_at, :format => :date) if p_payment.paid_at
  -tr[:received_at] = capture do
    %td= l(p_payment.received_at, :format => :date) if p_payment.received_at
  -tr[:p_customer] = capture do
    %td=link_to(p_payment.p_customer.show_name, [:admin, p_payment.p_customer]) if p_payment.p_customer
  -tr[:amount] = capture do
    %td= number_to_currency p_payment.amount
  
  -tr[:reste_to_affect] = capture do
    %td
      - if p_payment.i_archive
        Affectation forcée
      -elsif (p_payment.amount.to_f-p_payment.total_affected.to_f) != 0
        = number_to_currency(p_payment.reste_to_affect)
    
  
  -tr[:label] = capture do
    %td= p_payment.label
  -tr[:piece] = capture do
    %td= p_payment.piece
  
  
  

  -tr[:actions] = capture do
    %td.actions
      -if !p_payment.compta_locked
        = link_to i(:"trash-o"), [:admin, p_payment], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer ce paiement ? ' } , :remote => true
        = link_to i(:pencil), edit_admin_p_payment_path(p_payment), :remote => true
      -else
        =ic :lock
        = link_to i(:pencil), edit_admin_p_payment_path(p_payment), :remote => true


  =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => p_payment}
  