2018-11-20 11:57:51 +01:00
|
|
|
# Preview all emails at http://localhost:3000/rails/mailers/gestionnaire_mailer
|
2016-02-09 11:00:13 +01:00
|
|
|
class GestionnaireMailer < ApplicationMailer
|
2017-06-27 17:58:16 +02:00
|
|
|
layout 'mailers/layout'
|
|
|
|
|
2018-04-27 12:29:01 +02:00
|
|
|
def invite_gestionnaire(gestionnaire, reset_password_token)
|
|
|
|
@reset_password_token = reset_password_token
|
|
|
|
@gestionnaire = gestionnaire
|
2018-08-29 22:11:38 +02:00
|
|
|
subject = "Activez votre compte instructeur"
|
2018-05-31 23:58:10 +02:00
|
|
|
|
2018-04-27 12:29:01 +02:00
|
|
|
mail(to: gestionnaire.email,
|
2018-09-20 14:34:49 +02:00
|
|
|
subject: subject,
|
|
|
|
reply_to: CONTACT_EMAIL)
|
2018-04-11 19:37:53 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def user_to_gestionnaire(email)
|
2018-05-31 15:56:57 +02:00
|
|
|
@email = email
|
2018-08-29 22:11:38 +02:00
|
|
|
subject = "Vous avez été nommé instructeur"
|
2018-05-31 15:26:02 +02:00
|
|
|
|
2018-05-31 15:56:57 +02:00
|
|
|
mail(to: @email, subject: subject)
|
2016-02-09 11:00:13 +01:00
|
|
|
end
|
|
|
|
|
2018-02-21 17:40:41 +01:00
|
|
|
def last_week_overview(gestionnaire)
|
2018-05-31 15:56:57 +02:00
|
|
|
email = gestionnaire.email
|
2018-05-31 16:41:58 +02:00
|
|
|
@subject = 'Votre activité hebdomadaire'
|
2019-04-04 10:41:44 +02:00
|
|
|
@overview = gestionnaire.last_week_overview
|
2018-05-31 23:58:10 +02:00
|
|
|
|
2019-04-04 10:41:44 +02:00
|
|
|
if @overview.present?
|
|
|
|
headers['X-mailjet-campaign'] = 'last_week_overview'
|
|
|
|
mail(to: email, subject: @subject)
|
|
|
|
end
|
2017-05-12 16:56:46 +02:00
|
|
|
end
|
|
|
|
|
2018-01-30 19:11:07 +01:00
|
|
|
def send_dossier(sender, dossier, recipient)
|
|
|
|
@sender = sender
|
|
|
|
@dossier = dossier
|
|
|
|
subject = "#{sender.email} vous a envoyé le dossier nº #{dossier.id}"
|
|
|
|
|
|
|
|
mail(to: recipient.email, subject: subject)
|
|
|
|
end
|
2018-10-03 11:11:02 +02:00
|
|
|
|
|
|
|
def send_login_token(gestionnaire, login_token)
|
|
|
|
@gestionnaire_id = gestionnaire.id
|
|
|
|
@login_token = login_token
|
|
|
|
subject = "Connexion sécurisée à demarches-simplifiees.fr"
|
|
|
|
|
|
|
|
mail(to: gestionnaire.email, subject: subject)
|
|
|
|
end
|
2019-03-13 17:59:33 +01:00
|
|
|
|
|
|
|
def send_notifications(gestionnaire, data)
|
|
|
|
@data = data
|
|
|
|
subject = "Vous avez du nouveau sur vos démarches"
|
|
|
|
|
|
|
|
mail(to: gestionnaire.email, subject: subject)
|
|
|
|
end
|
2016-02-09 11:00:13 +01:00
|
|
|
end
|