2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
module Instructeurs
|
|
|
|
class AvisController < InstructeurController
|
2018-10-31 14:56:01 +01:00
|
|
|
include CreateAvisConcern
|
|
|
|
|
2021-02-25 09:53:09 +01:00
|
|
|
before_action :authenticate_instructeur!
|
2017-09-06 11:21:29 +02:00
|
|
|
A_DONNER_STATUS = 'a-donner'
|
|
|
|
DONNES_STATUS = 'donnes'
|
|
|
|
|
2020-07-16 11:14:37 +02:00
|
|
|
def revoquer
|
|
|
|
avis = Avis.find(params[:id])
|
2020-07-16 20:42:50 +02:00
|
|
|
if avis.revoke_by!(current_instructeur)
|
2021-02-25 09:53:09 +01:00
|
|
|
flash.notice = "#{avis.expert.email} ne peut plus donner son avis sur ce dossier."
|
2020-07-16 11:14:37 +02:00
|
|
|
redirect_back(fallback_location: avis_instructeur_dossier_path(avis.procedure, avis.dossier))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-01-26 16:19:06 +01:00
|
|
|
def remind
|
2020-07-20 16:26:16 +02:00
|
|
|
avis = Avis.find(params[:id])
|
2023-01-23 21:02:59 +01:00
|
|
|
if avis.remind_by!(current_instructeur)
|
2024-07-23 10:52:51 +02:00
|
|
|
if avis.expert.user.unverified_email?
|
|
|
|
avis.expert.user.invite_expert_and_send_avis!(avis)
|
|
|
|
else
|
|
|
|
AvisMailer.avis_invitation(avis).deliver_later
|
|
|
|
end
|
2023-01-23 21:02:59 +01:00
|
|
|
flash.notice = "Un mail de relance a été envoyé à #{avis.expert.email}"
|
|
|
|
redirect_back(fallback_location: avis_instructeur_dossier_path(avis.procedure, avis.dossier))
|
2020-07-20 16:26:16 +02:00
|
|
|
end
|
|
|
|
end
|
2017-09-06 11:21:29 +02:00
|
|
|
end
|
|
|
|
end
|