2017-01-23 15:41:09 +01:00
|
|
|
class NotificationMailerPreview < ActionMailer::Preview
|
2021-04-29 19:10:22 +02:00
|
|
|
def send_en_construction_notification
|
|
|
|
NotificationMailer.send_en_construction_notification(dossier_with_image)
|
2017-01-23 15:41:09 +01:00
|
|
|
end
|
2018-11-19 18:14:35 +01:00
|
|
|
|
2021-04-29 19:10:22 +02:00
|
|
|
def send_en_instruction_notification
|
|
|
|
NotificationMailer.send_en_instruction_notification(dossier)
|
2019-07-23 14:59:57 +02:00
|
|
|
end
|
|
|
|
|
2021-04-29 19:10:22 +02:00
|
|
|
def send_accepte_notification
|
|
|
|
NotificationMailer.send_accepte_notification(dossier)
|
2018-11-19 18:14:35 +01:00
|
|
|
end
|
|
|
|
|
2021-04-29 19:10:22 +02:00
|
|
|
def send_refuse_notification
|
|
|
|
NotificationMailer.send_refuse_notification(dossier_with_motivation)
|
2018-11-19 18:14:35 +01:00
|
|
|
end
|
|
|
|
|
2021-04-29 19:10:22 +02:00
|
|
|
def send_sans_suite_notification
|
|
|
|
NotificationMailer.send_sans_suite_notification(dossier)
|
|
|
|
end
|
|
|
|
|
2023-11-23 10:35:31 +01:00
|
|
|
def send_notification_for_tiers
|
|
|
|
NotificationMailer.send_notification_for_tiers(dossier)
|
|
|
|
end
|
|
|
|
|
2021-04-29 19:10:22 +02:00
|
|
|
private
|
|
|
|
|
|
|
|
def dossier
|
|
|
|
Dossier.last
|
|
|
|
end
|
|
|
|
|
|
|
|
def dossier_with_image
|
2022-05-10 15:58:27 +02:00
|
|
|
Dossier.joins(procedure: [:initiated_mail]).where("initiated_mails.body like ?", "%<img%").order('RANDOM()').first
|
2021-04-29 19:10:22 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def dossier_with_motivation
|
|
|
|
Dossier.last.tap { |d| d.assign_attributes(motivation: 'Le montant demandé dépasse le plafond autorisé') }
|
2018-11-19 18:14:35 +01:00
|
|
|
end
|
2017-01-23 15:41:09 +01:00
|
|
|
end
|