2019-08-06 11:02:54 +02:00
|
|
|
# Preview all emails at http://localhost:3000/rails/mailers/instructeur_mailer
|
|
|
|
class InstructeurMailer < ApplicationMailer
|
2021-04-29 17:29:47 +02:00
|
|
|
helper MailerHelper
|
|
|
|
|
2017-06-27 17:58:16 +02:00
|
|
|
layout 'mailers/layout'
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
def user_to_instructeur(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
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
def last_week_overview(instructeur)
|
|
|
|
email = instructeur.email
|
2018-05-31 16:41:58 +02:00
|
|
|
@subject = 'Votre activité hebdomadaire'
|
2019-08-06 11:02:54 +02:00
|
|
|
@overview = instructeur.last_week_overview
|
2018-05-31 23:58:10 +02:00
|
|
|
|
2019-04-04 10:41:44 +02:00
|
|
|
if @overview.present?
|
|
|
|
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
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
def send_login_token(instructeur, login_token)
|
|
|
|
@instructeur_id = instructeur.id
|
2018-10-03 11:11:02 +02:00
|
|
|
@login_token = login_token
|
2024-03-26 17:23:42 +01:00
|
|
|
subject = "Connexion sécurisée à #{Current.application_name}"
|
2018-10-03 11:11:02 +02:00
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
mail(to: instructeur.email, subject: subject)
|
2018-10-03 11:11:02 +02:00
|
|
|
end
|
2019-03-13 17:59:33 +01:00
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
def send_notifications(instructeur, data)
|
2019-03-13 17:59:33 +01:00
|
|
|
@data = data
|
|
|
|
subject = "Vous avez du nouveau sur vos démarches"
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
mail(to: instructeur.email, subject: subject)
|
2019-03-13 17:59:33 +01:00
|
|
|
end
|
2023-01-23 14:56:05 +01:00
|
|
|
|
2023-10-18 07:10:26 +02:00
|
|
|
def self.critical_email?(action_name)
|
2023-01-23 14:56:05 +01:00
|
|
|
action_name == "send_login_token"
|
|
|
|
end
|
2016-02-09 11:00:13 +01:00
|
|
|
end
|