363 lines
8.2 KiB
Plaintext

%h1 Détail d'un inscrit
%h2 Aperçu
%table.table.table-hover.table-striped.annonce_account_table
%thead#annonce_account_rows_header.rows_header
%tr
%td
%td
Nom d'utilisateur
%td Parrain
%td
Pays
%td
Email
%td
Nombre d'annonces
%td
Chiffre d'affaire
%td
Commissions
%td{:style => "width:100px"}
 
%tbody#annonce_account_rows.rows
=render @annonce_account
%h2 Coordonnées
.row
.col-md-6
%table.table.table-striped
%tbody
%tr
%td
Date d'inscription :
%td
=l @annonce_account.created_at
%tr
%td
Compte professionnel ?
%td
-if @annonce_account.pro
%strong Compte professionnel
%tr
%td
Organisation :
%td
=@annonce_account.organisation
%tr
%td
Nom :
%td
=@annonce_account.name
%tr
%td
Prénom :
%td
=@annonce_account.firstname
%tr
%td
Code de recommandation de l'inscrit :
%td
%strong=@annonce_account.mlm_token.upcase
%tr
%td
Lien de recommandation :
%td
=link_to mlm_token_url(@annonce_account.mlm_token), mlm_token_url(@annonce_account.mlm_token)
%tr
%td
Dite de présentation :
%td
=link_to "http://affiliation-sideplace.com/"+@annonce_account.mlm_token, "http://affiliation-sideplace.com/"+@annonce_account.mlm_token
%tr
%td
Facebook
%td
=link_to ic(:facebook)+" facebook", "http://facebook.com/#{@annonce_account.uid}", :target => "_blank" if @annonce_account.provider == "facebook"
%tr
%td Recommandeur
%td
-if !@annonce_account.parent
=form_tag add_parent_admin_annonce_account_path(@annonce_account) do
=text_field_tag :parent_code
=submit_tag "ok"
-else
=link_to @annonce_account.parent.pseudo_admin, [:admin, @annonce_account]
.col-md-6
%table.table.table-striped
%tbody
%tr
%td
Adresse :
%td=@annonce_account.address
%tr
%td
Adresse (suite) :
%td
=@annonce_account.address2
%tr
%td
Code postal
%td
=@annonce_account.cp
%tr
%td
Ville :
%td
=@annonce_account.city
%tr
%td
Pays :
%td
=@annonce_account.country
%tr
%td
Téléphone :
%td
=@annonce_account.tel_number
%tr
%td
Email :
%td
=link_to @annonce_account.email, "mailto:#{@annonce_account.email}"
%tr
%td
Adresse mail validée ?
%td
-if @annonce_account.enabled
Oui
-else
=link_to "Renvoyer le mail de confirmation", reconfirm_admin_annonce_account_path(@annonce_account), :method => :post
%tr
%td
Adresse ip
%td
%h2 Liste des IPs
%table.table.table-striped
%tr
%th Date
%th IP
%th Pays
%th Ville
%th Latitude
%th Longitude
=render @annonce_account.ip_histories.order("created_at DESC")
%h2 Commandes
%table.table.table-hover.table-striped.order_table
%thead#order_rows_header.rows_header
%tr
%th Compte
%th
Date
%th Date de paiement
%th Type de paiement
%th Crédits
%th Points binaires
%th Parts
%th Prix TTC
%th Prix HT
%th Commissions reversées
%th Delta
%th
%td{:style => "width:100px"}
 
%tbody#order_rows.rows
=render @annonce_account.orders.order("created_at")
%p
via callif pour vérification :
=@annonce_account.callif_now[3] if @annonce_account.callif_now
%h2 Commissions
%table.table.table-striped
%tbody
%tr
%td{:style => "width:170px"}
Solde :
%td
%strong=number_to_currency @annonce_account.commissions.sum(:amount)
%tr
%td
Accumulées :
%td
%strong=number_to_currency @annonce_account.commissions.where("amount > 0.0").sum(:amount)
%tr
%td
Delta chiffre d'affaire
%td
%strong
=number_to_currency( @annonce_account.commissions.where("amount > 0.0").sum(:amount) - @annonce_account.orders.where(:paid => true).where("unpaid is null").sum(:amount_ttc))
%table.table
-@annonce_account.commissions.each do |commission|
%tr
%td{:style => "width:120px"}
= l commission.created_at, :format => :date
%td
-if commission.order
=#image_tag(commission.order.annonce_account.avatar_url)
=link_to commission.order.annonce_account.pseudo_admin, admin_annonce_account_path(commission.order.annonce_account)
%td
-if commission.commission_type_id == 1
Commission directe
-elsif commission.commission_type_id == 2
=ic :sitemap
Commission binaire
%td{:style => "text-align:right", :class => (commission.commission_type_id == 4 ? "red" : "green")}
=commission.commission_type_id == 4 ? "" : "+ "
=number_to_currency commission.amount
%h2 Recommandeur
%table.table.table-hover.table-striped.annonce_account_table
%thead#annonce_account_rows_header.rows_header
%tr
%td
%td
Nom d'utilisateur
%td Parrain
%td
Pays
%td
Email
%td
Nombre d'annonces
%td
Chiffre d'affaire
%td
Commissions
%td{:style => "width:100px"}
 
%tbody#annonce_account_rows.rows
=render @annonce_account.parent if @annonce_account.parent
%h2
Affiliés directs
(
=@annonce_account.children.count
)
%table.table.table-hover.table-striped.annonce_account_table
%thead#annonce_account_rows_header.rows_header
%tr
%td
%td
Nom d'utilisateur
%td Parrain
%td
Pays
%td
Email
%td
Nombre d'annonces
%td
Chiffre d'affaire
%td
Commissions
%td{:style => "width:100px"}
 
%tbody#annonce_account_rows.rows
=render @annonce_account.children
%h2 Newsletter
%ul
-Newsgroup.all.each do |newsgroup|
%li
=check_box_tag "newsgroup", "newsgroup", (true if @annonce_account.newsgroups.include?(newsgroup)), {:readonly => "readonly", :disabled => "disabled"}
=newsgroup.name
%h2 Autre
-i = 0
-parents_id = [@annonce_account.id]
-coms= [0, 10,5,5,4,4,3,3,2,1,1, 0, 0]
-coms_sum = 0.0
%table.table.table-striped
-mlm_children_ids = []
-mlm_children_id_by_levels = []
-while i != 14 do
-i += 1
%tr
%td
Niveau
=i
%td{:style => "width:500px"}
=parents_id = AnnonceAccount.where(:parent_id => parents_id).select(:id).map{ |v| v.id}
-mlm_children_id_by_levels[i] = parents_id
-mlm_children_ids.concat parents_id
%td
=number_to_currency Order.where(:annonce_account_id => parents_id, :paid => true, :payment_type_id => 2).sum(:amount_ht)
%td
=coms[i]
%td
=coms_sum += (com = Order.where(:annonce_account_id => parents_id, :paid => true, :payment_type_id => 2).sum(:amount_ht) *(coms[i].to_f/100.00))
=number_to_currency com
%p
%strong= number_to_currency coms_sum
%p
Soit avec les coms de participations
(
-part_com = Commission.where(:annonce_account_id => @annonce_account.id, :commission_type_id => 3).sum(:amount)
=number_to_currency part_com
)
=":"
%p
%strong
=number_to_currency(coms_sum + part_com)
%table.table=render @annonce_account.annonces