2016-02-16 21:09:48 +01:00

95 lines
2.6 KiB
Plaintext
Executable File

.center.padding
=render :partial => "public/my_account/menu"
%h1 Mes affiliés
-i = 0
.white
%table.table.table-striped
%tr
%th
Génération
%th
Nombre d'affiliés
%th
Affiliés ayant acheté des crédits
%th
Affiliés n'ayant pas encore acheté de crédits
%th
Nombre d'annonces publiées
=#%th commissions touchées
-while i != 10 do
-i += 1
%tr
%td
=i
%td
=current_customer.mlm_children_id_by_levels[i].size
%td
=payants = Customer.where(:id => current_customer.mlm_children_id_by_levels[i]).where("binary_parent_id is not NULL").count
%td
=current_customer.mlm_children_id_by_levels[i].size - payants
%td
=Annonce.valid_to_show.where(:customer_id => current_customer.mlm_children_id_by_levels[i]).count
=#%td
=#current_customer.commissions.joins(:order).where("orders.customer_id IN (?)", current_customer.mlm_children_id_by_levels[i] ).sum(:amount)
-i = 0
- parents_id = current_customer.id
%table.table.table-striped
-while i != 10 do
-i += 1
-filleuls = Customer.where(:parent_id => parents_id)
-parents_id = filleuls.select(:id).map{ |v| v.id}
%h2
Génération
=i
%table.table
%tr
%th
%th Nom
%th Nbr de coffrets achetés
%th Nombre d'affiliés
%th
-filleuls.each do |filleul|
%tr.filleul
%td{:style => "width:50px;"}=image_tag(filleul.avatar_url)
%td{:style => "vertical-align:middle;"}= filleul.pseudo
%td{:style => "vertical-align:middle;"}
-if filleul.orders.where(:paid => true).count > 0
=filleul.orders.where(:paid => true).count
%td{:style => "vertical-align:middle;"}
=filleul.children.count
%td{:style => "vertical-align:middle;text-align:right"}
=link_to i(:eye)+" détail", show_details_public_customer_path(filleul), :class => "btn btn-primary"
=link_to i(:envelope)+" envoyer un message privé", mail_public_customer_path(filleul), :class => "btn btn-primary" if i == 1
=#link_to i(:sitemap)+" voir la position dans le binaire", public_binary_path(:parrain_id => filleul.id), :class => "btn btn-primary" if filleul.binary_parent_id