=link_to new_public_order_path(:credit_product_id => credit_product.id), :remote => true do
  #credit_product.credit_product.panel.panel-warning{:id => credit_product.id}

    .panel-heading
      %h3.panel-title
        =image_tag "/credit.png"
        = credit_product.nbr_credits_final(current_annonce_account)
        crédits
    %p.price
  
      %strong
        =number_to_currency credit_product.price_ttc_final(current_annonce_account), :unit => credit_product.devise.icon
        TTC
      %br
      %span.ht
        =number_to_currency credit_product.price_ht_final(current_annonce_account), :unit => credit_product.devise.icon
        HT

    %p
      Soit 
      =number_to_currency (credit_product.price_ttc_final(current_annonce_account) / credit_product.nbr_credits_final(current_annonce_account).to_f), :unit => credit_product.devise.icon
      ="TTC / crédit"
    
    -callif_credits = current_annonce_account.callif_credits(current_annonce_account.credits_boughts(Date.today) + credit_product.nbr_credits)
    
    
    -callif_credits = current_annonce_account.callif_credits(current_annonce_account.credits_boughts(Date.today) +  credit_product.nbr_credits_final(current_annonce_account))
      
    .btn.btn-primary
      =qit("credit-products-commander", "Commander")
    %br
    %br
    
    .panel-footer{:datatest => "$(this).find('.affiliation_detail').toggle(); event.stopPropagation();return false;"}
      =qit "credit-products-p1" do
        %p 
          en achetant ces crédits supplémentaires vous aurez le statut
          %br
        %strong='"'+callif_credits[0]+'"'
        
      .affiliation_detail{:style => "display:none;"}
        .inner
          %h4
            Statut 
            ='"'+callif_credits[0]+'"'
    
    
          %ul
            %li
              =callif_credits[3] 
              =qit("credit-products-parts-participations", "parts de participations")
          
            %li
              =qit("credit-products-commissions-achats-credits", "Commissions sur les achats de crédits effectués par vos affiliés directs et indirects :")
              %table.table
                -i = 0

                -while i < callif_credits[5]
                  -i += 1
                  %tr
                    %td
                      =qit("credit-products-generation", "Génération")
                      =i
                    %td
                      =callif_credits[4][i]
                      ="%"
              %p
                =qit("credit-products-p2", "Et si vous avez au moins 5 affiliés ayant effectué des achats de crédits d'annonce :"
              %table.table
 

                -while i < callif_credits[6]
                  -i += 1
                  %tr
                    %td
                      Génération
                      =i
                    %td
                      =callif_credits[4][i]
                      ="%"
    
  
    