Nicolas Bally d52c017848 suite
2016-04-28 22:41:58 +02:00

97 lines
2.4 KiB
Plaintext

=render :partial => "public/my_account/menu"
.center.padding
%h1 Mes affiliés
-i = 0
-if current_product_customer.mlm_children_id_by_levels[1].size > 0
.white
%table.table.table-striped
%tr
%th
Génération
%th
Nombre d'affiliés
-while i != 10 do
-i += 1
-if current_product_customer.mlm_children_id_by_levels[i].size > 0
%tr
%td
=i
%td
=current_product_customer.mlm_children_id_by_levels[i].size
-else
.white
%p
Vous n'avez pas encore d'affiliés, n'hésitez pas à donner votre lien de recommandation à vos amis !
%p
Votre code de recommandation :
%span{:style => "font-size:1.2em;"}
=current_product_customer.mlm_token.upcase
%p
Votre lien de recommandation :
=link_to mlm_token_url(current_product_customer.mlm_token), mlm_token_url(current_product_customer.mlm_token)
%p
Lorsque que quelqu'un s'inscrit avec votre lien de recommandation nous lui offrons 10 crédits gratuits et nous vous en offrons 5, utilisables pour mettre en valeur vos annonces.
-i = 0
- parents_id = current_product_customer.id
%table.table.table-striped
-while i != 10 do
-i += 1
-filleuls = ProductCustomer.where(:parent_id => parents_id)
-parents_id = filleuls.select(:id).map{ |v| v.id}
-if filleuls.count > 0
%h3
Génération
=i
%table.table
%tr
%th Nom
%th Nombre de commandes
%th Affiliés
%th Code de recommandation
-filleuls.each do |filleul|
%tr.filleul
%td{:style => "vertical-align:middle;"}= filleul.pseudo
%td{:style => "vertical-align:middle;"}
-if filleul.product_orders.where(:paid => true).count > 0
=filleul.product_orders.where(:paid => true).count
%td{:style => "vertical-align:middle;"}
=filleul.children.count
%td
=link_to filleul.mlm_token.upcase, mlm_token_url(filleul.mlm_token)# if filleul.not_blocked