notification & admin
This commit is contained in:
parent
0add8f5ca4
commit
07f42507bb
@ -20,6 +20,15 @@ class Admin::CustomersController < ApplicationController
|
|||||||
@customer = Customer.find(params[:id])
|
@customer = Customer.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def validate
|
||||||
|
@customer = Customer.find(params[:id])
|
||||||
|
@customer.account_validated = true
|
||||||
|
@customer.account_validated_at = Time.now
|
||||||
|
@customer.save
|
||||||
|
CustomerMailer.validate_account(@customer).deliver
|
||||||
|
|
||||||
|
redirect_to :back
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def edit
|
def edit
|
@ -64,6 +64,8 @@ class Public::CustomersController < ApplicationController
|
|||||||
|
|
||||||
if @customer.save
|
if @customer.save
|
||||||
CustomerMailer.confirm(@customer).deliver
|
CustomerMailer.confirm(@customer).deliver
|
||||||
|
CustomerMailer.notify_ins(@customer).deliver
|
||||||
|
|
||||||
|
|
||||||
@customer.authenticate(params[:password])
|
@customer.authenticate(params[:password])
|
||||||
|
|
||||||
|
@ -11,6 +11,12 @@ class CustomerMailer < ApplicationMailer
|
|||||||
mail from: "contact@negos-pro.fr", to: customer.email, :subject => "Important : Activation de votre compte Négos"
|
mail from: "contact@negos-pro.fr", to: customer.email, :subject => "Important : Activation de votre compte Négos"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def validate_account(customer)
|
||||||
|
@customer = customer
|
||||||
|
|
||||||
|
mail from: "contact@negos-pro.fr", to: customer.email, :subject => "Important : Validation de votre compte Négos"
|
||||||
|
end
|
||||||
|
|
||||||
def confirm_ins(customer)
|
def confirm_ins(customer)
|
||||||
@customer = customer
|
@customer = customer
|
||||||
|
|
||||||
@ -23,6 +29,12 @@ class CustomerMailer < ApplicationMailer
|
|||||||
mail from: "contact@negos-pro.fr", to: customer.email, :subject => "Bienvenue chez NEGOS"
|
mail from: "contact@negos-pro.fr", to: customer.email, :subject => "Bienvenue chez NEGOS"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def notify_ins(customer)
|
||||||
|
@customer = customer
|
||||||
|
|
||||||
|
mail from: "contact@negos-pro.fr", to: "daniel@videlier.fr", bcc: "info@nicolasbally.com", :subject => "Nouveau compte client sur Negos"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,35 +2,6 @@
|
|||||||
|
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-4
|
|
||||||
.panel.panel-default
|
|
||||||
.panel-heading
|
|
||||||
Chiffre d'affaire
|
|
||||||
.panel-body
|
|
||||||
%p
|
|
||||||
-total_ht = Order.between(Time.now.beginning_of_day, Time.now.end_of_day).where("unpaid is null").where("payment_type_id = 2").where(:paid => true).sum(:price_ht)
|
|
||||||
%strong{:style => "color:green"}
|
|
||||||
=number_to_currency total_ht
|
|
||||||
HT
|
|
||||||
(
|
|
||||||
=number_to_currency (total_ht*1.2)
|
|
||||||
TTC
|
|
||||||
)
|
|
||||||
aujourd'hui
|
|
||||||
%p
|
|
||||||
-total_ht = Order.between(start_date, Time.now.end_of_day).where("unpaid is null").where("payment_type_id = 2", ((start_date).beginning_of_day)).where(:paid => true).sum(:price_ht)
|
|
||||||
%strong{:style => "color:green"}
|
|
||||||
=number_to_currency total_ht
|
|
||||||
HT
|
|
||||||
(
|
|
||||||
=number_to_currency (total_ht*1.2)
|
|
||||||
TTC
|
|
||||||
)
|
|
||||||
%p
|
|
||||||
depuis le
|
|
||||||
=l start_date, :format => :date
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.col-md-4
|
.col-md-4
|
||||||
.panel.panel-default
|
.panel.panel-default
|
||||||
@ -42,521 +13,5 @@
|
|||||||
=link_to admin_customers_path do
|
=link_to admin_customers_path do
|
||||||
%strong=Customer.count
|
%strong=Customer.count
|
||||||
comptes
|
comptes
|
||||||
dont :
|
utilisateur
|
||||||
%p
|
|
||||||
%strong=Customer.where("binary_parent_id IS NOT NULL").count
|
|
||||||
dans le binaire
|
|
||||||
%p
|
|
||||||
%strong=Customer.where("binary_parent_id IS NULL").count
|
|
||||||
gratuits
|
|
||||||
%p
|
|
||||||
=link_to "/search.html" do
|
|
||||||
%strong=Annonce.valid_to_show.count
|
|
||||||
annonces
|
|
||||||
|
|
||||||
.col-md-4
|
|
||||||
.panel.panel-default
|
|
||||||
.panel-heading
|
|
||||||
Commissions depuis le
|
|
||||||
=l start_date, :format => :date
|
|
||||||
.panel-body
|
|
||||||
|
|
||||||
%p
|
|
||||||
Commissions directes :
|
|
||||||
-com_direct = Commission.where("created_at >= ?", ((start_date).beginning_of_day)).where(:commission_type_id => 1).sum(:amount)
|
|
||||||
%strong=number_to_currency com_direct
|
|
||||||
%p
|
|
||||||
Commissions binaires :
|
|
||||||
-com_binaire = Commission.where("created_at >= ?", ((start_date).beginning_of_day)).where(:commission_type_id => 2).sum(:amount)
|
|
||||||
%strong=number_to_currency com_binaire
|
|
||||||
%p
|
|
||||||
Commissions de participation :
|
|
||||||
-com_part_1 = Commission.where("created_at >= ?", ((start_date).beginning_of_day)).where(:commission_type_id => 3).sum(:amount)
|
|
||||||
%strong=number_to_currency com_part_1
|
|
||||||
|
|
||||||
%p
|
|
||||||
Cumul des 3 commissions :
|
|
||||||
-com_part_1 = Commission.where("created_at >= ?", ((start_date).beginning_of_day)).where(:commission_type_id => 3).sum(:amount)
|
|
||||||
%strong=number_to_currency com_binaire + com_direct + com_part_1
|
|
||||||
.row
|
|
||||||
.col-md-4
|
|
||||||
.panel.panel-default
|
|
||||||
.panel-heading
|
|
||||||
Commissions versées
|
|
||||||
=l start_date, :format => :date
|
|
||||||
.panel-body
|
|
||||||
%p
|
|
||||||
Demandes de virements :
|
|
||||||
-com_virements = Commission.where("created_at >= ?", ((start_date).beginning_of_day)).where(:commission_type_id => 4).sum(:amount)
|
|
||||||
%strong=number_to_currency com_virements
|
|
||||||
%p
|
|
||||||
Utilisé pour acheté des crédits :
|
|
||||||
-com_credits = Commission.where("created_at >= ?", ((start_date).beginning_of_day)).where(:commission_type_id => 5).sum(:amount)
|
|
||||||
%strong=number_to_currency com_credits
|
|
||||||
|
|
||||||
%p
|
|
||||||
Solde commissions à verser :
|
|
||||||
%strong=number_to_currency Commission.where("created_at >= ?", ((start_date).beginning_of_day)).sum(:amount)
|
|
||||||
|
|
||||||
|
|
||||||
.col-md-4
|
|
||||||
.panel.panel-default
|
|
||||||
.panel-heading
|
|
||||||
Prochain versement de coms de participations
|
|
||||||
|
|
||||||
.panel-body
|
|
||||||
|
|
||||||
-last_cpc = CountPartCom.last_paid
|
|
||||||
|
|
||||||
%p
|
|
||||||
|
|
||||||
Date de début du calcul :
|
|
||||||
%strong=start = CountPartCom.last_paid.last_day.tomorrow.beginning_of_day
|
|
||||||
%p
|
|
||||||
|
|
||||||
Date de fin du calcul :
|
|
||||||
%strong=stop = CountPartCom.order("last_day DESC").first.last_day.end_of_day
|
|
||||||
|
|
||||||
%p
|
|
||||||
Montant :
|
|
||||||
%strong=number_to_currency(next_part_com = Order.com_part_between(start, stop))
|
|
||||||
|
|
||||||
|
|
||||||
.alert.alert-info
|
|
||||||
%p
|
|
||||||
Points binaires
|
|
||||||
%strong= Order.points_binaires_between(start, stop)
|
|
||||||
%p
|
|
||||||
Points binaires MLM
|
|
||||||
%strong= Order.points_binaires_mlm_between(start, stop)
|
|
||||||
|
|
||||||
%p
|
|
||||||
Points binaires hors MLM
|
|
||||||
%strong= Order.points_binaires_direct_between(start, stop)
|
|
||||||
|
|
||||||
|
|
||||||
.col-md-4
|
|
||||||
.panel.panel-default
|
|
||||||
.panel-heading
|
|
||||||
Commissions reversées
|
|
||||||
|
|
||||||
.panel-body
|
|
||||||
%p
|
|
||||||
Avant le prochain versement :
|
|
||||||
%strong=number_to_currency com_binaire + com_direct + com_part_1
|
|
||||||
%p
|
|
||||||
Avec le prochain :
|
|
||||||
%strong=number_to_currency com_binaire + com_direct + com_part_1 + next_part_com
|
|
||||||
|
|
||||||
%p
|
|
||||||
Soit
|
|
||||||
%strong=number_to_percentage ((com_binaire + com_direct + com_part_1 + next_part_com)*100)/total_ht, precision: 1
|
|
||||||
du chiffre d'affaire total HT
|
|
||||||
="."
|
|
||||||
|
|
||||||
%p
|
|
||||||
Soit
|
|
||||||
%strong=number_to_percentage ((Commission.where("created_at >= ?", ((start_date).beginning_of_day)).where(:commission_type_id =>[1,2,3] ).sum(:amount) + next_part_com - Commission.where("created_at >= ?", ((start_date).beginning_of_day)).where(:commission_type_id =>[1,2,3] ).where(:customer_id => [1,2,5]).sum(:amount))*100)/total_ht, precision: 1
|
|
||||||
du chiffre d'affaire total HT
|
|
||||||
en excluant les 3 premiers comptes
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.container
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.stats
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%p
|
|
||||||
Chiffre d'affaire aujourd'hui :
|
|
||||||
-total_ht = Order.between(Time.now.beginning_of_day, Time.now.end_of_day).where("unpaid is null").where("payment_type_id = 2").where(:paid => true).sum(:price_ht)
|
|
||||||
%strong{:style => "color:green"}
|
|
||||||
=number_to_currency total_ht
|
|
||||||
HT
|
|
||||||
(
|
|
||||||
=number_to_currency (total_ht*1.2)
|
|
||||||
TTC
|
|
||||||
)
|
|
||||||
%p
|
|
||||||
%strong
|
|
||||||
Depuis le :
|
|
||||||
=l start_date, :format => :date
|
|
||||||
%p
|
|
||||||
|
|
||||||
Chiffre d'affaire :
|
|
||||||
-total_ht = Order.between(start_date, Time.now.end_of_day).where("unpaid is null").where("payment_type_id = 2", ((start_date).beginning_of_day)).where(:paid => true).sum(:price_ht)
|
|
||||||
%strong{:style => "color:green"}
|
|
||||||
=number_to_currency total_ht
|
|
||||||
HT
|
|
||||||
(
|
|
||||||
=number_to_currency (total_ht*1.2)
|
|
||||||
TTC
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<canvas id="ca_stats" height="200" width="600"></canvas>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
-labels = []
|
|
||||||
-datas_ht = []
|
|
||||||
-datas_ttc = []
|
|
||||||
|
|
||||||
-date = start_date.end_of_day
|
|
||||||
|
|
||||||
|
|
||||||
-while date <= Time.now.end_of_day
|
|
||||||
-labels << l(date, :format => "%a %d %b")
|
|
||||||
-ht = Order.between(start_date,date).where("unpaid is null").where("payment_type_id = 2", ((start_date).beginning_of_day)).where(:paid => true).sum(:price_ht)
|
|
||||||
|
|
||||||
-datas_ht << ht
|
|
||||||
-datas_ttc << (ht * 1.2)
|
|
||||||
-date = date.tomorrow.end_of_day
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
var lineChartData2 = {
|
|
||||||
=raw"labels : #{labels.to_json},"
|
|
||||||
datasets : [
|
|
||||||
{
|
|
||||||
label: "Chiffre HT",
|
|
||||||
fillColor : "rgba(22,156,67,0.1)",
|
|
||||||
strokeColor : "rgba(22,156,67,1)",
|
|
||||||
pointColor : "rgba(22,156,67,1)",
|
|
||||||
pointStrokeColor : "#fff",
|
|
||||||
pointHighlightFill : "#fff",
|
|
||||||
pointHighlightStroke : "rgba(220,220,220,1)",
|
|
||||||
=raw"data : #{datas_ht.to_json}"
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Chiffre TTC",
|
|
||||||
fillColor : "rgba(20,133,201,0.1)",
|
|
||||||
strokeColor : "rgba(20,133,201,1)",
|
|
||||||
pointColor : "rgba(20,133,201,1)",
|
|
||||||
pointStrokeColor : "#fff",
|
|
||||||
pointHighlightFill : "#fff",
|
|
||||||
pointHighlightStroke : "rgba(220,220,220,1)",
|
|
||||||
=raw"data : #{datas_ttc.to_json}"
|
|
||||||
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var ctx2 = document.getElementById("ca_stats").getContext("2d");
|
|
||||||
new Chart(ctx2).Line(lineChartData2, {
|
|
||||||
responsive: true,
|
|
||||||
bezierCurve : false
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
%p
|
|
||||||
TVA :
|
|
||||||
%strong= number_to_currency (total_ht*0.2)
|
|
||||||
%p
|
|
||||||
25% directement commissionné à Alpinea pour commercialisation (ne prend pas en compte les coms non versées "bonus"):
|
|
||||||
%br
|
|
||||||
%strong= number_to_currency (total_ht*0.25)
|
|
||||||
%p
|
|
||||||
Commissions directes les 7 derniers jours :
|
|
||||||
-com_direct = Commission.where("created_at >= ?", ((start_date).beginning_of_day)).where(:commission_type_id => 1).sum(:amount)
|
|
||||||
=number_to_currency com_direct
|
|
||||||
%p
|
|
||||||
Commissions binaires les 7 derniers jours :
|
|
||||||
-com_binaire = Commission.where("created_at >= ?", ((start_date).beginning_of_day)).where(:commission_type_id => 2).sum(:amount)
|
|
||||||
=number_to_currency com_binaire
|
|
||||||
|
|
||||||
%p
|
|
||||||
Cumul des comissions directes & binaires :
|
|
||||||
%strong{:style => "color:orange"}= number_to_currency (com_binaire + com_direct)
|
|
||||||
|
|
||||||
%p
|
|
||||||
Solde point binaires 7 derniers jours (points sur les achats réalisés) :
|
|
||||||
|
|
||||||
%strong=points_binaires = Order.points_binaires_between(start_date, Time.now.end_of_day)
|
|
||||||
%p
|
|
||||||
20 % des points binaires :
|
|
||||||
-com_part = Order.com_part_between(start_date, Time.now.end_of_day)
|
|
||||||
%strong=number_to_currency com_part
|
|
||||||
|
|
||||||
%p
|
|
||||||
Cumul comissions directes, binaires & participation :
|
|
||||||
%strong{:style => "color:red"}= number_to_currency com_part + com_binaire + com_direct
|
|
||||||
(
|
|
||||||
= (com_part + com_binaire + com_direct - Commission.where("created_at >= ?", ((start_date).beginning_of_day)).where(:customer_id => [1,2,5]).sum(:amount))
|
|
||||||
en excluant les 3 premiers comptes
|
|
||||||
)
|
|
||||||
%p
|
|
||||||
Pour contrôle :
|
|
||||||
-c = Commission.where("created_at >= ?", ((start_date).beginning_of_day)).where(:commission_type_id => [1,2,3]).sum(:amount)
|
|
||||||
=number_to_currency c
|
|
||||||
|
|
||||||
%p
|
|
||||||
Soit
|
|
||||||
%strong=number_to_percentage ((com_part + com_binaire + com_direct)*100)/total_ht, precision: 1
|
|
||||||
du chiffre d'affaire total HT
|
|
||||||
="."
|
|
||||||
%p
|
|
||||||
%strong=number_to_percentage ((com_part + com_binaire + com_direct - Commission.where("created_at >= ?", ((start_date).beginning_of_day)).where(:customer_id => [1,2,5]).sum(:amount))*100)/total_ht, precision: 1
|
|
||||||
en ignorant les 3 premiers comptes.
|
|
||||||
%p
|
|
||||||
Reste :
|
|
||||||
%strong{:style => "color:green"}=number_to_currency (total_ht - (com_part + com_binaire + com_direct))
|
|
||||||
|
|
||||||
|
|
||||||
%p
|
|
||||||
Marges de sécurité de commissions (50% du CA HT - les coms à verser, servira aux investissements où bonus, où nouvelle commissions) :
|
|
||||||
%br
|
|
||||||
-securite = (total_ht * 0.5) - (com_part + com_binaire + com_direct)
|
|
||||||
=number_to_currency(securite)
|
|
||||||
%p
|
|
||||||
divisé par deux :
|
|
||||||
=number_to_currency(securite/2)
|
|
||||||
|
|
||||||
%p
|
|
||||||
Nombre de comptes :
|
|
||||||
=Customer.count
|
|
||||||
%p
|
|
||||||
Nombre d'inscrits dans le binaire :
|
|
||||||
=Customer.where("binary_parent_id IS NOT NULL").count
|
|
||||||
%p
|
|
||||||
Nombre de personnes non inscrite dans le binaire :
|
|
||||||
=Customer.where("binary_parent_id IS NULL").count
|
|
||||||
|
|
||||||
%h3 premier essai, à vérifier ! :
|
|
||||||
%p
|
|
||||||
Nombre de parts actives aujourd'hui
|
|
||||||
%strong (pas encore sûr du calcul) :
|
|
||||||
|
|
||||||
- parts = Credit.parts_at(Date.today)
|
|
||||||
%strong= parts
|
|
||||||
%p
|
|
||||||
Parts pour controle
|
|
||||||
-icont = 0.0
|
|
||||||
-Customer.all.each do |customer|
|
|
||||||
-if customer.callif(Time.now)
|
|
||||||
-icont = icont + customer.callif(Time.now)[3]
|
|
||||||
=icont
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%p
|
|
||||||
Ce qui donnerait
|
|
||||||
|
|
||||||
%strong=number_to_currency com_part/parts
|
|
||||||
par parts (donnée brut :
|
|
||||||
=com_part/parts
|
|
||||||
).
|
|
||||||
|
|
||||||
%hr
|
|
||||||
|
|
||||||
%p Date de dernière distribution de coms
|
|
||||||
%table.table
|
|
||||||
%tr
|
|
||||||
%th
|
|
||||||
Date
|
|
||||||
%th
|
|
||||||
Nombre de parts
|
|
||||||
%th
|
|
||||||
Prix par parts
|
|
||||||
%th
|
|
||||||
Montant total
|
|
||||||
-amount = 0.0
|
|
||||||
-CountPartCom.where(:paid => true).order(:last_day).each do |cpc|
|
|
||||||
|
|
||||||
%tr
|
|
||||||
%td=l cpc.last_day.end_of_day
|
|
||||||
%td=cpc.nbr_parts
|
|
||||||
%td=number_to_currency cpc.part_price
|
|
||||||
%td=number_to_currency cpc.control_amount
|
|
||||||
-amount = amount + cpc.control_amount.to_f
|
|
||||||
|
|
||||||
%tr
|
|
||||||
%td{:colspan => 2}
|
|
||||||
%td
|
|
||||||
Montant total :
|
|
||||||
%td=number_to_currency amount
|
|
||||||
%p
|
|
||||||
Montant des coms parts versée pour controle
|
|
||||||
%strong=number_to_currency Commission.where(:commission_type_id => 3).sum(:amount)
|
|
||||||
|
|
||||||
%hr
|
|
||||||
-last_cpc = CountPartCom.last_paid
|
|
||||||
%p
|
|
||||||
Date de début pour le calcul des nouvelles parts :
|
|
||||||
%strong=start = CountPartCom.last_paid.last_day.tomorrow.beginning_of_day
|
|
||||||
|
|
||||||
%p
|
|
||||||
Date de fin pour le calcul des nouvelles parts :
|
|
||||||
%strong=stop = CountPartCom.order("last_day DESC").first.last_day.end_of_day
|
|
||||||
|
|
||||||
%p
|
|
||||||
Nombre de parts à la date de fin :
|
|
||||||
%strong=nbr_parts = Credit.parts_at(stop)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%p
|
|
||||||
Points binaires réalisés entre les deux dates :
|
|
||||||
%strong=points = Order.points_binaires_between(start, stop)
|
|
||||||
%p
|
|
||||||
CA réalisé sur la période :
|
|
||||||
%strong=number_to_currency ca = Order.between(start, stop).where("unpaid is null").where("payment_type_id = 2").where(:paid => true).sum(:price_ht)
|
|
||||||
%p
|
|
||||||
Com normale :
|
|
||||||
%strong=number_to_currency Order.com_part_between(start, stop)
|
|
||||||
(
|
|
||||||
|
|
||||||
=number_to_percentage((Order.com_part_between(start, stop)*100)/ca, :precision => 2)
|
|
||||||
|
|
||||||
du CA de la période)
|
|
||||||
|
|
||||||
%br
|
|
||||||
Soit
|
|
||||||
=number_to_currency(Order.com_part_between(start, stop) / nbr_parts)
|
|
||||||
part parts
|
|
||||||
|
|
||||||
%p
|
|
||||||
Com à 50% :
|
|
||||||
-com = points * 0.5
|
|
||||||
%strong=number_to_currency com
|
|
||||||
(
|
|
||||||
|
|
||||||
=number_to_percentage((com*100)/ca, :precision => 2)
|
|
||||||
|
|
||||||
du CA de la période)
|
|
||||||
%br
|
|
||||||
Soit
|
|
||||||
=number_to_currency(com / nbr_parts)
|
|
||||||
par parts
|
|
||||||
|
|
||||||
%p
|
|
||||||
-com = points * 0.7
|
|
||||||
|
|
||||||
Com à 70% :
|
|
||||||
%strong=number_to_currency com
|
|
||||||
(
|
|
||||||
|
|
||||||
=number_to_percentage((com*100)/ca, :precision => 2)
|
|
||||||
|
|
||||||
du CA de la période)
|
|
||||||
|
|
||||||
%br
|
|
||||||
Soit
|
|
||||||
=number_to_currency(com / nbr_parts)
|
|
||||||
par parts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%h3 Evolution du nombre de comptes
|
|
||||||
|
|
||||||
.chart_legend
|
|
||||||
.pastille{:style => "background:rgba(22,156,67,1);"}
|
|
||||||
Nombre de comptes
|
|
||||||
|
|
||||||
.pastille{:style => "background:rgba(20,133,201,1);"}
|
|
||||||
Nombre de comptes payants
|
|
||||||
|
|
||||||
.pastille{:style => "background:rgba(239,75,41,1);"}
|
|
||||||
Nombre de comptes gratuits
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<canvas id="account_stats" height="300" width="600"></canvas>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
-labels = []
|
|
||||||
-datas = []
|
|
||||||
-data_gratuits = []
|
|
||||||
-data_payants = []
|
|
||||||
|
|
||||||
-date = start_date.end_of_day
|
|
||||||
-while date <= Time.now.end_of_day
|
|
||||||
-labels << l(date, :format => "%a %d %b")
|
|
||||||
-nbr = Customer.where("created_at <= ?", date).count
|
|
||||||
-nbr_payants = Customer.where("binary_parent_id is not null and created_at <= ?", date).count
|
|
||||||
-datas << nbr
|
|
||||||
-data_payants << nbr_payants
|
|
||||||
-data_gratuits << (nbr - nbr_payants)
|
|
||||||
-date = date.tomorrow.end_of_day
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
var lineChartData = {
|
|
||||||
=raw"labels : #{labels.to_json},"
|
|
||||||
datasets : [
|
|
||||||
{
|
|
||||||
label: "Nombre de comptes",
|
|
||||||
fillColor : "rgba(22,156,67,0.1)",
|
|
||||||
strokeColor : "rgba(22,156,67,1)",
|
|
||||||
pointColor : "rgba(22,156,67,1)",
|
|
||||||
pointStrokeColor : "#fff",
|
|
||||||
pointHighlightFill : "#fff",
|
|
||||||
pointHighlightStroke : "rgba(220,220,220,1)",
|
|
||||||
=raw"data : #{datas.to_json}"
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Nombre de comptes payants",
|
|
||||||
fillColor : "rgba(20,133,201,0.1)",
|
|
||||||
strokeColor : "rgba(20,133,201,1)",
|
|
||||||
pointColor : "rgba(20,133,201,1)",
|
|
||||||
pointStrokeColor : "#fff",
|
|
||||||
pointHighlightFill : "#fff",
|
|
||||||
pointHighlightStroke : "rgba(220,220,220,1)",
|
|
||||||
=raw"data : #{data_payants.to_json}"
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Nombre de comptes gratuits",
|
|
||||||
fillColor : "rgba(239,75,41,0.1)",
|
|
||||||
strokeColor : "rgba(239,75,41,1)",
|
|
||||||
pointColor : "rgba(239,75,41,1)",
|
|
||||||
pointStrokeColor : "#fff",
|
|
||||||
pointHighlightFill : "#fff",
|
|
||||||
pointHighlightStroke : "rgba(220,220,220,1)",
|
|
||||||
=raw"data : #{data_gratuits.to_json}"
|
|
||||||
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
window.onload = function(){
|
|
||||||
var ctx = document.getElementById("account_stats").getContext("2d");
|
|
||||||
window.myLine = new Chart(ctx).Line(lineChartData, {
|
|
||||||
responsive: true,
|
|
||||||
bezierCurve : false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
@ -1,27 +0,0 @@
|
|||||||
%tr#customer_row{:id => customer.id, :class => ("danger" if customer.lock)}
|
|
||||||
%td
|
|
||||||
=image_tag(customer.avatar_url, :style => "height:40px;max-width:40px;width:40px !important;border-radius:50%;")
|
|
||||||
%td
|
|
||||||
=customer.pseudo_admin
|
|
||||||
%td
|
|
||||||
= "Oui" if customer.parent_id
|
|
||||||
%td
|
|
||||||
=customer.country
|
|
||||||
%td=customer.email
|
|
||||||
%td
|
|
||||||
=link_to public_customer_path(customer) do
|
|
||||||
=customer.annonces.count
|
|
||||||
=ic(:eye)
|
|
||||||
|
|
||||||
%td=number_to_currency customer.orders.where(:paid => true).sum(:price_ht)
|
|
||||||
%td=number_to_currency customer.commissions.sum(:amount)
|
|
||||||
|
|
||||||
|
|
||||||
%td.actions
|
|
||||||
=# link_to i(:"trash-o"), [:admin, customer], :confirm => 'Voulez-vous vraiment supprimer ce compte utilisateur ?', :method => :delete, :remote => true
|
|
||||||
= link_to i(:eye), [:admin, customer]
|
|
||||||
= link_to i(:pencil), edit_admin_customer_path(customer), :remote => true if current_admin.super_admin
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
=semantic_form_for [:admin, @customer], :remote => true do |f|
|
|
||||||
.content
|
|
||||||
|
|
||||||
|
|
||||||
=f.inputs do
|
|
||||||
=f.input :newsgroups, :label => "Les types d'informations qui m'intéressent :", :collection => Newsgroup.all, :as => :check_boxes
|
|
||||||
|
|
||||||
-if current_admin.super_admin?
|
|
||||||
=f.inputs do
|
|
||||||
= f.input :lock, :label => "Bloqué ?"
|
|
||||||
|
|
||||||
|
|
||||||
.actions= f.submit "Sauvegarder", :class => "btn btn-primary"
|
|
||||||
|
|
26
app/views/admin/customers/_customer.html.haml
Normal file
26
app/views/admin/customers/_customer.html.haml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
-css_class = ""
|
||||||
|
-css_class "danger" if customer.lock
|
||||||
|
|
||||||
|
%tr#customer_row{:id => customer.id, :class => css_class}
|
||||||
|
%td
|
||||||
|
=customer.organisation
|
||||||
|
%td
|
||||||
|
=customer.name
|
||||||
|
=customer.firstname
|
||||||
|
|
||||||
|
%td
|
||||||
|
=customer.city
|
||||||
|
|
||||||
|
%td
|
||||||
|
= "Oui" if customer.enabled
|
||||||
|
|
||||||
|
%td
|
||||||
|
=link_to customer.email, "mailto:#{customer.email}"
|
||||||
|
|
||||||
|
|
||||||
|
%td.actions
|
||||||
|
=# link_to i(:"trash-o"), [:admin, customer], :confirm => 'Voulez-vous vraiment supprimer ce compte utilisateur ?', :method => :delete, :remote => true
|
||||||
|
=# link_to i(:eye), [:admin, customer]
|
||||||
|
= link_to i(:pencil), edit_admin_customer_path(customer)
|
||||||
|
= link_to i(:check), validate_admin_customer_path(customer), :data => {:confirm => "Voulez-vous vraiment valider ce compte ?"} if !customer.account_validated
|
||||||
|
|
41
app/views/admin/customers/_form.html.haml
Normal file
41
app/views/admin/customers/_form.html.haml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=semantic_form_for [:admin, @customer] do |f|
|
||||||
|
.content
|
||||||
|
|
||||||
|
|
||||||
|
=f.inputs do
|
||||||
|
=f.input :organisation, :label => "Société : "
|
||||||
|
|
||||||
|
=f.input :name, :label => "Nom : "
|
||||||
|
=f.input :firstname, :label => "Prénom : "
|
||||||
|
=f.input :email, :label => "Email : "
|
||||||
|
=f.input :phone, :label => "Tél : "
|
||||||
|
=f.input :password, :label => "Mot de passe : "
|
||||||
|
|
||||||
|
=f.hidden_field :step2
|
||||||
|
=f.input :tva_number, :label => "Numéro de TVA intra. :"
|
||||||
|
=f.input :siret, :label => "Numéro de siret :"
|
||||||
|
= f.input :address, :label => "Adresse"
|
||||||
|
= f.input :address2, :label => "Adresse (suite)"
|
||||||
|
= f.input :cp, :label => "Code postal"
|
||||||
|
= f.input :city, :label => "Ville"
|
||||||
|
|
||||||
|
|
||||||
|
=f.hidden_field :step3
|
||||||
|
|
||||||
|
=f.input :need_1, :label => "1er besoin : ",:as => :select, :collection => [ "Materiel professionnel", "Matériel informatique", "Achat de véhicules", "Energie"]
|
||||||
|
=f.input :need_2, :label => "2ième besoin : ",:as => :select, :collection => [ "Materiel professionnel", "Matériel informatique", "Achat de véhicules", "Energie"]
|
||||||
|
=f.input :need_3, :label => "3ième besoin : ", :placeholder => "Autre, précisez ",:rows => 5, :input_html => {:style => "height:100px;"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=f.input :newsgroups, :label => "Newsletters :", :collection => Newsgroup.all, :as => :check_boxes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.actions= f.submit "Sauvegarder", :class => "btn btn-primary"
|
||||||
|
|
||||||
|
|
2
app/views/admin/customers/edit.html.haml
Normal file
2
app/views/admin/customers/edit.html.haml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
%h1 Modifier une fiche client
|
||||||
|
=render :partial => "form"
|
@ -8,19 +8,16 @@
|
|||||||
|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
|
Société
|
||||||
%td
|
%td
|
||||||
Nom d'utilisateur
|
Nom
|
||||||
%td Parrain
|
|
||||||
%td
|
%td
|
||||||
Pays
|
Ville
|
||||||
|
%td
|
||||||
|
Email confirmé ?
|
||||||
%td
|
%td
|
||||||
Email
|
Email
|
||||||
%td
|
|
||||||
Nombre d'annonces
|
|
||||||
%td
|
|
||||||
Chiffre d'affaire
|
|
||||||
%td
|
|
||||||
Commissions
|
|
||||||
|
|
||||||
|
|
||||||
|
|
11
app/views/customer_mailer/notify_ins.html.haml
Normal file
11
app/views/customer_mailer/notify_ins.html.haml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
%p Bonjour,
|
||||||
|
|
||||||
|
%p Vous avez un nouveau client sur Negos :
|
||||||
|
%p
|
||||||
|
=@customer.organisation
|
||||||
|
%p
|
||||||
|
=@customer.name
|
||||||
|
=@customer.firstname
|
||||||
|
%p
|
||||||
|
Plus d'infos :
|
||||||
|
=link_to "détail", edit_admin_customer_url(@customer)
|
11
app/views/customer_mailer/validate_account.html.haml
Normal file
11
app/views/customer_mailer/validate_account.html.haml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
%p
|
||||||
|
Merci et bienvenue sur le site de NEGOS
|
||||||
|
%p
|
||||||
|
Votre inscription a été validée et je suis heureux de vous accueillir parmi nos membres.
|
||||||
|
|
||||||
|
%p
|
||||||
|
Découvrez désormais ce que NEGOS peut vous apporter.
|
||||||
|
%p
|
||||||
|
Cordialement
|
||||||
|
%p
|
||||||
|
Daniel VIDELIER
|
@ -39,53 +39,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
%li.dropdown
|
%li= link_to "Comptes utilisateurs", admin_customers_path
|
||||||
%a{:href => "#", :data => {:toggle => "dropdown"}}
|
|
||||||
Clients
|
|
||||||
%b.caret
|
|
||||||
%ul.dropdown-menu
|
|
||||||
%li= link_to "Comptes utilisateurs", admin_customers_path
|
|
||||||
%li= link_to "Ribs", admin_customer_ribs_path
|
|
||||||
-if current_admin.super_admin
|
|
||||||
%li= link_to "Commandes", admin_orders_path
|
|
||||||
%li= link_to "Newsletter", admin_newsletters_path if current_admin.super_admin
|
|
||||||
%li= link_to "Demande de virements", admin_virements_path
|
|
||||||
%li= link_to "Remises", admin_virement_remises_path
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%li.dropdown
|
|
||||||
%a{:href => "#", :data => {:toggle => "dropdown"}}
|
|
||||||
Contenu
|
|
||||||
%b.caret
|
|
||||||
%ul.dropdown-menu
|
|
||||||
-if current_admin.super_admin
|
|
||||||
%li
|
|
||||||
-Menu.all.each do |menu|
|
|
||||||
= link_to "Pages", admin_menu_items_path(:menu_id => menu.id)
|
|
||||||
|
|
||||||
|
|
||||||
%li= link_to "Articles", admin_articles_path
|
|
||||||
|
|
||||||
-if current_admin.super_admin
|
|
||||||
%li= link_to "Catégories", admin_categories_path
|
|
||||||
|
|
||||||
%li= link_to "Commentaires", admin_comments_path
|
|
||||||
%li= link_to "Images", admin_image_files_path
|
|
||||||
%li= link_to "Fichiers", admin_data_files_path
|
|
||||||
|
|
||||||
|
|
||||||
%li.dropdown
|
|
||||||
%a{:href => "#", :data => {:toggle => "dropdown"}}
|
|
||||||
Annonces
|
|
||||||
%b.caret
|
|
||||||
%ul.dropdown-menu
|
|
||||||
%li= link_to "Modération photos", admin_annonce_photos_path
|
|
||||||
%li= link_to "Modération annonces", admin_annonces_path
|
|
||||||
-if current_admin.super_admin
|
|
||||||
%li= link_to "Catégories d'annonce", admin_annonce_cats_path
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -232,7 +232,12 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
resources :customers
|
resources :customers do
|
||||||
|
member do
|
||||||
|
get :validate
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
resources :categories do
|
resources :categories do
|
||||||
collection do
|
collection do
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
class AddAccountValidatedToCustomers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :customers, :account_validated, :boolean
|
||||||
|
add_column :customers, :account_validated_at, :datetime
|
||||||
|
end
|
||||||
|
end
|
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20150730183145) do
|
ActiveRecord::Schema.define(version: 20151118213358) do
|
||||||
|
|
||||||
create_table "admins", force: :cascade do |t|
|
create_table "admins", force: :cascade do |t|
|
||||||
t.string "name", limit: 255
|
t.string "name", limit: 255
|
||||||
@ -190,6 +190,12 @@ ActiveRecord::Schema.define(version: 20150730183145) do
|
|||||||
t.datetime "locked_at"
|
t.datetime "locked_at"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.text "need_1", limit: 65535
|
||||||
|
t.text "need_2", limit: 65535
|
||||||
|
t.text "need_3", limit: 65535
|
||||||
|
t.string "tva_number", limit: 255
|
||||||
|
t.boolean "account_validated", limit: 1
|
||||||
|
t.datetime "account_validated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "data_files", force: :cascade do |t|
|
create_table "data_files", force: :cascade do |t|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user