.qi_header
  .right
    =link_to "retour à la liste", admin_donator_transactions_path, :class => "btn"
  %h1 
    Donateurs
    %span
      Détail de l'opération
      = "#"+@donator_transaction.id.to_s


.qi_row
  .qi_pannel.qi_plain.padding


    %table.table
      %tr
        %td{:style => "width:200px;"} ID don
        %td
          %strong= "#"+@donator_transaction.id.to_s
      %tr
        %td{:style => "width:200px;"} Date
        %td
          =l @donator_transaction.created_at
      %tr
        %td{:style => "width:200px;"}
          Date de paiement
        %td
          =l @donator_transaction.tr_payment_ok.paid_at, :format => :short_numbers if @donator_transaction.tr_payment_ok and @donator_transaction.tr_payment_ok.paid_at?
      
      %tr
        %td{:style => "width:200px;"}
          Type de paiement
        %td
    
          =@donator_transaction.tr_payment_ok.tr_payment_type.name if @donator_transaction.tr_payment_ok and @donator_transaction.tr_payment_ok.tr_payment_type
      -if @donator_transaction.prochain_date?
        %tr
          %td{:style => "width:200px;"}
            Prochaine date de prélévement
          %td
            =l @donator_transaction.prochain_date
      %tr
        %td{:style => "width:200px;"} Mensuel ?
    
        %td
          -if @donator_transaction.recurrent
     
            %strong Oui
        
      %tr
        %td{:style => "width:200px;"}
          Recu fiscal
        %td
          -if @donator_transaction.recu_number?
            =link_to @donator_transaction.recu_number, recu_public_donator_transaction_url(:id => @donator_transaction.token, :format => :pdf)
  
      -if @donator_transaction.transaction_items[0].transaction_content_type == "TransactionAbo"
        %tr
          %td{:style => "width:200px;"}
            Numéros d'abonnements :
          %td
            =@donator_transaction.transaction_items[0].transaction_content.number
        %tr
          %td{:style => "width:200px;"}
            Facture :
        
          %td
            =link_to @donator_transaction.facture_number, facture_public_transaction_abo_url(:id => @donator_transaction.token, :format => :pdf)
        
    -#@donator_transaction.generated_recurrent_payment.generate_infos if @donator_transaction.recurrent


    %table.table

      %tr
        %td{:style => "width:200px;"}
          Organisation
        %td
          %strong=@donator_transaction.particular_bill.organisation
      %tr
        %td
          Nom
        %td
          %strong=@donator_transaction.particular_bill.name
      %tr
        %td
          Prénom
        %td
          %strong=@donator_transaction.particular_bill.firstname
      %tr
        %td
          Adresse
        %td
          %strong=@donator_transaction.particular_bill.address_2
          -if @donator_transaction.particular_bill.address_3?
            %br
            %strong=@donator_transaction.particular_bill.address_3

      %tr
        %td
          Code postal, ville
        %td
          %strong=@donator_transaction.particular_bill.cp
          %strong=@donator_transaction.particular_bill.city
      %tr
        %td
          Pays
        %td
          %strong=@donator_transaction.particular_bill.country
      %tr
        %td
          Email
        %td
          %strong=@donator_transaction.particular_bill.email
      %tr
        %td
          Téléphone
        %td
          %strong=@donator_transaction.particular_bill.tel
    
    %table.table
      %tr
        %td{:style => "width:200px;"}
          Type de fiche :
      
    
        -if @donator_transaction.transaction_items[0].transaction_content_type == "TransactionDonate"
          %td
            %strong Don
          %td
        -elsif @donator_transaction.transaction_items[0].transaction_content_type == "TransactionSponsorship"
          %td
            %strong Parrainage
          %td
            =@donator_transaction.transaction_items[0].transaction_content.sponsorship_animal.name
        
      %tr
        %td Total
        %td
          %strong=number_to_currency @donator_transaction.total
    .sub_header
      %h2 Liste des paiements (ou tentatives)
    %table.table
      =render @donator_transaction.tr_payments.order("created_at DESC")

    =# if @donator_transaction.tr_payment_ok and (((@donator_transaction.tr_payment_ok.tr_payment_type and @donator_transaction.tr_payment_ok.tr_payment_type_id != 3) or (@donator_transaction.tr_payment_ok.tr_payment_type and @donator_transaction.tr_payment_ok.tr_payment_type_id == 3 and @donator_transaction.paid == true)) or (@recurrent_date) )



    
    








    =#link_to i(:pencil), edit_admin_@donator_transaction_path(@donator_transaction)
    =#link_to i(:eye), admin_@donator_transaction_path(@donator_transaction)
    =#link_to i(:"trash-o"), admin_@donator_transaction_path(@donator_transaction), :method => :delete, :data => {:confirm => "Voulez-vous vraiment supprimer cette fiche donateur ?"}