From 07f42507bbca973e7732bdada945c80ea6fb6284 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Wed, 18 Nov 2015 22:46:18 +0100 Subject: [PATCH] notification & admin --- ..._controller.rb => customers_controller.rb} | 9 + .../public/customers_controller.rb | 2 + app/mailers/customer_mailer.rb | 12 + app/views/admin/admin_auths/index.haml | 551 +----------------- .../_annonce_account.html.haml | 27 - .../admin/annonce_accounts/_form.html.haml | 17 - app/views/admin/customers/_customer.html.haml | 26 + app/views/admin/customers/_form.html.haml | 41 ++ app/views/admin/customers/edit.html.haml | 2 + .../edit.js.erb | 0 .../index.html.haml | 17 +- .../show.html.haml | 0 .../update.js.erb | 0 .../customer_mailer/notify_ins.html.haml | 11 + .../validate_account.html.haml | 11 + app/views/layouts/admin.html.haml | 50 +- config/routes.rb | 7 +- ...3358_add_account_validated_to_customers.rb | 6 + db/schema.rb | 8 +- 19 files changed, 145 insertions(+), 652 deletions(-) rename app/controllers/admin/{annonce_accounts_controller.rb => customers_controller.rb} (75%) delete mode 100644 app/views/admin/annonce_accounts/_annonce_account.html.haml delete mode 100644 app/views/admin/annonce_accounts/_form.html.haml create mode 100644 app/views/admin/customers/_customer.html.haml create mode 100644 app/views/admin/customers/_form.html.haml create mode 100644 app/views/admin/customers/edit.html.haml rename app/views/admin/{annonce_accounts => customers}/edit.js.erb (100%) rename app/views/admin/{annonce_accounts => customers}/index.html.haml (71%) rename app/views/admin/{annonce_accounts => customers}/show.html.haml (100%) rename app/views/admin/{annonce_accounts => customers}/update.js.erb (100%) create mode 100644 app/views/customer_mailer/notify_ins.html.haml create mode 100644 app/views/customer_mailer/validate_account.html.haml create mode 100644 db/migrate/20151118213358_add_account_validated_to_customers.rb diff --git a/app/controllers/admin/annonce_accounts_controller.rb b/app/controllers/admin/customers_controller.rb similarity index 75% rename from app/controllers/admin/annonce_accounts_controller.rb rename to app/controllers/admin/customers_controller.rb index f3489db..f8b0fb2 100644 --- a/app/controllers/admin/annonce_accounts_controller.rb +++ b/app/controllers/admin/customers_controller.rb @@ -20,6 +20,15 @@ class Admin::CustomersController < ApplicationController @customer = Customer.find(params[:id]) 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 diff --git a/app/controllers/public/customers_controller.rb b/app/controllers/public/customers_controller.rb index decf5ab..14b1693 100644 --- a/app/controllers/public/customers_controller.rb +++ b/app/controllers/public/customers_controller.rb @@ -64,7 +64,9 @@ class Public::CustomersController < ApplicationController if @customer.save CustomerMailer.confirm(@customer).deliver + CustomerMailer.notify_ins(@customer).deliver + @customer.authenticate(params[:password]) cookies[:customer_auth_token] = @customer.token diff --git a/app/mailers/customer_mailer.rb b/app/mailers/customer_mailer.rb index 55f74f7..40a365c 100644 --- a/app/mailers/customer_mailer.rb +++ b/app/mailers/customer_mailer.rb @@ -11,6 +11,12 @@ class CustomerMailer < ApplicationMailer mail from: "contact@negos-pro.fr", to: customer.email, :subject => "Important : Activation de votre compte Négos" 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) @customer = customer @@ -23,6 +29,12 @@ class CustomerMailer < ApplicationMailer mail from: "contact@negos-pro.fr", to: customer.email, :subject => "Bienvenue chez NEGOS" 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 + diff --git a/app/views/admin/admin_auths/index.haml b/app/views/admin/admin_auths/index.haml index 94ffbda..25e1232 100644 --- a/app/views/admin/admin_auths/index.haml +++ b/app/views/admin/admin_auths/index.haml @@ -2,36 +2,7 @@ .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 .panel.panel-default .panel-heading @@ -42,521 +13,5 @@ =link_to admin_customers_path do %strong=Customer.count comptes - dont : - %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 - ) - - -
- -
- - -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 - - - - - - - - %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 - -
- -
- - -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 - - - - - \ No newline at end of file + utilisateur + \ No newline at end of file diff --git a/app/views/admin/annonce_accounts/_annonce_account.html.haml b/app/views/admin/annonce_accounts/_annonce_account.html.haml deleted file mode 100644 index c08ced0..0000000 --- a/app/views/admin/annonce_accounts/_annonce_account.html.haml +++ /dev/null @@ -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 - - - - \ No newline at end of file diff --git a/app/views/admin/annonce_accounts/_form.html.haml b/app/views/admin/annonce_accounts/_form.html.haml deleted file mode 100644 index 3be473b..0000000 --- a/app/views/admin/annonce_accounts/_form.html.haml +++ /dev/null @@ -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" - diff --git a/app/views/admin/customers/_customer.html.haml b/app/views/admin/customers/_customer.html.haml new file mode 100644 index 0000000..4650fbc --- /dev/null +++ b/app/views/admin/customers/_customer.html.haml @@ -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 + \ No newline at end of file diff --git a/app/views/admin/customers/_form.html.haml b/app/views/admin/customers/_form.html.haml new file mode 100644 index 0000000..a690a95 --- /dev/null +++ b/app/views/admin/customers/_form.html.haml @@ -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" + + diff --git a/app/views/admin/customers/edit.html.haml b/app/views/admin/customers/edit.html.haml new file mode 100644 index 0000000..1a0d6f3 --- /dev/null +++ b/app/views/admin/customers/edit.html.haml @@ -0,0 +1,2 @@ +%h1 Modifier une fiche client +=render :partial => "form" \ No newline at end of file diff --git a/app/views/admin/annonce_accounts/edit.js.erb b/app/views/admin/customers/edit.js.erb similarity index 100% rename from app/views/admin/annonce_accounts/edit.js.erb rename to app/views/admin/customers/edit.js.erb diff --git a/app/views/admin/annonce_accounts/index.html.haml b/app/views/admin/customers/index.html.haml similarity index 71% rename from app/views/admin/annonce_accounts/index.html.haml rename to app/views/admin/customers/index.html.haml index 53d666f..85bf8f6 100644 --- a/app/views/admin/annonce_accounts/index.html.haml +++ b/app/views/admin/customers/index.html.haml @@ -8,20 +8,17 @@ %tr %td + Société %td - Nom d'utilisateur - %td Parrain + Nom + %td - Pays + Ville + %td + Email confirmé ? %td Email - %td - Nombre d'annonces - %td - Chiffre d'affaire - %td - Commissions - + %td{:style => "width:100px"} diff --git a/app/views/admin/annonce_accounts/show.html.haml b/app/views/admin/customers/show.html.haml similarity index 100% rename from app/views/admin/annonce_accounts/show.html.haml rename to app/views/admin/customers/show.html.haml diff --git a/app/views/admin/annonce_accounts/update.js.erb b/app/views/admin/customers/update.js.erb similarity index 100% rename from app/views/admin/annonce_accounts/update.js.erb rename to app/views/admin/customers/update.js.erb diff --git a/app/views/customer_mailer/notify_ins.html.haml b/app/views/customer_mailer/notify_ins.html.haml new file mode 100644 index 0000000..348ce0d --- /dev/null +++ b/app/views/customer_mailer/notify_ins.html.haml @@ -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) \ No newline at end of file diff --git a/app/views/customer_mailer/validate_account.html.haml b/app/views/customer_mailer/validate_account.html.haml new file mode 100644 index 0000000..516c711 --- /dev/null +++ b/app/views/customer_mailer/validate_account.html.haml @@ -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 diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index ef17e35..5c4dcde 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -39,54 +39,8 @@ - %li.dropdown - %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 - - + %li= link_to "Comptes utilisateurs", admin_customers_path + %ul.nav.navbar-nav.navbar-right diff --git a/config/routes.rb b/config/routes.rb index 4886da8..d558d19 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -232,7 +232,12 @@ Rails.application.routes.draw do end - resources :customers + resources :customers do + member do + get :validate + end + + end resources :categories do collection do diff --git a/db/migrate/20151118213358_add_account_validated_to_customers.rb b/db/migrate/20151118213358_add_account_validated_to_customers.rb new file mode 100644 index 0000000..b3e75b7 --- /dev/null +++ b/db/migrate/20151118213358_add_account_validated_to_customers.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 9a68d2f..c70f674 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # 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| t.string "name", limit: 255 @@ -190,6 +190,12 @@ ActiveRecord::Schema.define(version: 20150730183145) do t.datetime "locked_at" t.datetime "created_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 create_table "data_files", force: :cascade do |t|