2018-05-29 12:16:22 +02:00
|
|
|
|
# Preview all emails at http://localhost:3000/rails/mailers/dossier_mailer
|
|
|
|
|
class DossierMailerPreview < ActionMailer::Preview
|
2018-11-20 11:50:25 +01:00
|
|
|
|
def notify_new_draft
|
2019-07-17 14:40:17 +02:00
|
|
|
|
DossierMailer.notify_new_draft(draft)
|
2018-11-20 11:50:25 +01:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_new_answer
|
2018-12-20 16:49:56 +01:00
|
|
|
|
DossierMailer.notify_new_answer(dossier)
|
2018-11-20 11:50:25 +01:00
|
|
|
|
end
|
|
|
|
|
|
2019-03-25 16:04:33 +01:00
|
|
|
|
def notify_revert_to_instruction
|
|
|
|
|
DossierMailer.notify_revert_to_instruction(dossier)
|
|
|
|
|
end
|
|
|
|
|
|
2019-12-03 15:51:16 +01:00
|
|
|
|
def notify_brouillon_near_deletion
|
2020-03-19 09:49:25 +01:00
|
|
|
|
DossierMailer.notify_brouillon_near_deletion([dossier], usager_email)
|
2019-12-03 15:51:16 +01:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_brouillons_near_deletion
|
2020-03-19 09:49:25 +01:00
|
|
|
|
DossierMailer.notify_brouillon_near_deletion([dossier, dossier], usager_email)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_en_construction_near_deletion_to_user
|
2020-04-01 17:08:50 +02:00
|
|
|
|
DossierMailer.notify_near_deletion_to_user([dossier_en_construction], usager_email)
|
2020-03-19 09:49:25 +01:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_en_construction_near_deletion_to_administration
|
2020-04-01 17:08:50 +02:00
|
|
|
|
DossierMailer.notify_near_deletion_to_administration([dossier_en_construction, dossier_en_construction], administration_email)
|
2019-12-03 15:51:16 +01:00
|
|
|
|
end
|
2019-11-28 18:03:23 +01:00
|
|
|
|
|
2020-04-02 15:05:16 +02:00
|
|
|
|
def notify_termine_near_deletion_to_user
|
|
|
|
|
DossierMailer.notify_near_deletion_to_user([dossier_accepte], usager_email)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_termine_near_deletion_to_administration
|
|
|
|
|
DossierMailer.notify_near_deletion_to_administration([dossier_accepte, dossier_accepte], administration_email)
|
|
|
|
|
end
|
|
|
|
|
|
2019-11-28 18:03:23 +01:00
|
|
|
|
def notify_brouillon_deletion
|
2020-03-19 09:49:25 +01:00
|
|
|
|
DossierMailer.notify_brouillon_deletion([dossier.hash_for_deletion_mail], usager_email)
|
2019-11-28 18:03:23 +01:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_brouillons_deletion
|
|
|
|
|
dossier_hashes = [dossier, dossier].map(&:hash_for_deletion_mail)
|
2020-03-19 09:49:25 +01:00
|
|
|
|
DossierMailer.notify_brouillon_deletion(dossier_hashes, usager_email)
|
|
|
|
|
end
|
|
|
|
|
|
2020-11-17 13:25:35 +01:00
|
|
|
|
def notify_instructeur_deletion_to_user
|
|
|
|
|
DossierMailer.notify_instructeur_deletion_to_user(deleted_dossier, usager_email)
|
|
|
|
|
end
|
|
|
|
|
|
2020-03-19 09:49:25 +01:00
|
|
|
|
def notify_deletion_to_administration
|
|
|
|
|
DossierMailer.notify_deletion_to_administration(deleted_dossier, administration_email)
|
2019-11-28 18:03:23 +01:00
|
|
|
|
end
|
|
|
|
|
|
2020-03-05 17:17:58 +01:00
|
|
|
|
def notify_automatic_deletion_to_user
|
2020-03-19 09:49:25 +01:00
|
|
|
|
DossierMailer.notify_automatic_deletion_to_user([deleted_dossier, deleted_dossier], usager_email)
|
2020-03-05 17:17:58 +01:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_automatic_deletion_to_administration
|
2020-03-19 09:49:25 +01:00
|
|
|
|
DossierMailer.notify_automatic_deletion_to_administration([deleted_dossier, deleted_dossier], administration_email)
|
2020-03-05 17:17:58 +01:00
|
|
|
|
end
|
2020-03-19 03:46:12 +01:00
|
|
|
|
|
|
|
|
|
def notify_brouillon_not_submitted
|
|
|
|
|
DossierMailer.notify_brouillon_not_submitted(draft)
|
2020-02-05 22:10:22 +01:00
|
|
|
|
end
|
2020-03-05 17:17:58 +01:00
|
|
|
|
|
2021-09-07 10:36:09 +02:00
|
|
|
|
def notify_transfer
|
|
|
|
|
DossierMailer.notify_transfer(transfer)
|
|
|
|
|
end
|
|
|
|
|
|
2018-12-20 16:49:56 +01:00
|
|
|
|
private
|
|
|
|
|
|
2020-03-19 09:49:25 +01:00
|
|
|
|
def usager_email
|
|
|
|
|
"usager@example.com"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def administration_email
|
|
|
|
|
"administration@example.com"
|
|
|
|
|
end
|
|
|
|
|
|
2021-09-08 11:40:54 +02:00
|
|
|
|
def user
|
|
|
|
|
User.new(email: "usager@example.com", locale: I18n.locale)
|
|
|
|
|
end
|
|
|
|
|
|
2018-12-20 16:49:56 +01:00
|
|
|
|
def deleted_dossier
|
|
|
|
|
DeletedDossier.new(dossier_id: 1, procedure: procedure)
|
|
|
|
|
end
|
|
|
|
|
|
2019-07-17 14:40:17 +02:00
|
|
|
|
def draft
|
2021-09-08 11:40:54 +02:00
|
|
|
|
Dossier.new(id: 47882, procedure: procedure, user: user)
|
2019-07-17 14:40:17 +02:00
|
|
|
|
end
|
|
|
|
|
|
2018-12-20 16:49:56 +01:00
|
|
|
|
def dossier
|
2021-09-08 11:40:54 +02:00
|
|
|
|
Dossier.new(id: 47882, state: :en_instruction, procedure: procedure, user: user)
|
2018-12-20 16:49:56 +01:00
|
|
|
|
end
|
|
|
|
|
|
2020-04-01 17:08:50 +02:00
|
|
|
|
def dossier_en_construction
|
2021-09-08 11:40:54 +02:00
|
|
|
|
Dossier.new(id: 47882, state: :en_construction, procedure: procedure, user: user)
|
2020-04-01 17:08:50 +02:00
|
|
|
|
end
|
|
|
|
|
|
2020-04-02 15:05:16 +02:00
|
|
|
|
def dossier_accepte
|
2021-09-08 11:40:54 +02:00
|
|
|
|
Dossier.new(id: 47882, state: :accepte, procedure: procedure, user: user)
|
2020-04-02 15:05:16 +02:00
|
|
|
|
end
|
|
|
|
|
|
2018-12-20 16:49:56 +01:00
|
|
|
|
def procedure
|
2020-06-30 17:53:54 +02:00
|
|
|
|
Procedure.new(id: 1234, libelle: 'Dotation d’Équipement des Territoires Ruraux - Exercice 2019', service: service, logo: Rack::Test::UploadedFile.new('spec/fixtures/files/logo_test_procedure.png', 'image/png'), auto_archive_on: Time.zone.today + Dossier::REMAINING_DAYS_BEFORE_CLOSING.days)
|
2019-07-17 14:40:17 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def service
|
|
|
|
|
Service.new(
|
|
|
|
|
nom: 'Direction du Territoire des Vosges',
|
|
|
|
|
email: 'prms@ddt.vosges.gouv.fr',
|
|
|
|
|
telephone: '01 34 22 33 85',
|
|
|
|
|
horaires: 'Du lundi au vendredi, de 9 h à 18 h'
|
|
|
|
|
)
|
2018-05-29 12:16:22 +02:00
|
|
|
|
end
|
2021-09-07 10:36:09 +02:00
|
|
|
|
|
|
|
|
|
def transfer
|
|
|
|
|
DossierTransfer.new(email: usager_email, dossiers: [dossier, dossier_accepte])
|
|
|
|
|
end
|
2018-05-29 12:16:22 +02:00
|
|
|
|
end
|