Merge pull request #6635 from tchak/fix-dossier-traitements
Corriger l'affichage des traitements d'un dossier
This commit is contained in:
commit
a859726686
3 changed files with 27 additions and 17 deletions
|
@ -83,14 +83,16 @@ class Dossier < ApplicationRecord
|
||||||
has_many :avis, inverse_of: :dossier, dependent: :destroy
|
has_many :avis, inverse_of: :dossier, dependent: :destroy
|
||||||
has_many :experts, through: :avis
|
has_many :experts, through: :avis
|
||||||
has_many :traitements, -> { order(:processed_at) }, inverse_of: :dossier, dependent: :destroy do
|
has_many :traitements, -> { order(:processed_at) }, inverse_of: :dossier, dependent: :destroy do
|
||||||
def passer_en_construction(processed_at: Time.zone.now)
|
def passer_en_construction(instructeur: nil, processed_at: Time.zone.now)
|
||||||
build(state: Dossier.states.fetch(:en_construction),
|
build(state: Dossier.states.fetch(:en_construction),
|
||||||
|
instructeur_email: instructeur&.email,
|
||||||
process_expired: false,
|
process_expired: false,
|
||||||
processed_at: processed_at)
|
processed_at: processed_at)
|
||||||
end
|
end
|
||||||
|
|
||||||
def passer_en_instruction(processed_at: Time.zone.now)
|
def passer_en_instruction(instructeur: nil, processed_at: Time.zone.now)
|
||||||
build(state: Dossier.states.fetch(:en_instruction),
|
build(state: Dossier.states.fetch(:en_instruction),
|
||||||
|
instructeur_email: instructeur&.email,
|
||||||
process_expired: false,
|
process_expired: false,
|
||||||
processed_at: processed_at)
|
processed_at: processed_at)
|
||||||
end
|
end
|
||||||
|
@ -735,7 +737,7 @@ class Dossier < ApplicationRecord
|
||||||
self.en_construction_close_to_expiration_notice_sent_at = nil
|
self.en_construction_close_to_expiration_notice_sent_at = nil
|
||||||
self.conservation_extension = 0.days
|
self.conservation_extension = 0.days
|
||||||
self.en_instruction_at = self.traitements
|
self.en_instruction_at = self.traitements
|
||||||
.passer_en_instruction
|
.passer_en_instruction(instructeur: instructeur)
|
||||||
.processed_at
|
.processed_at
|
||||||
save!
|
save!
|
||||||
|
|
||||||
|
@ -759,7 +761,7 @@ class Dossier < ApplicationRecord
|
||||||
self.en_construction_close_to_expiration_notice_sent_at = nil
|
self.en_construction_close_to_expiration_notice_sent_at = nil
|
||||||
self.conservation_extension = 0.days
|
self.conservation_extension = 0.days
|
||||||
self.en_construction_at = self.traitements
|
self.en_construction_at = self.traitements
|
||||||
.passer_en_construction
|
.passer_en_construction(instructeur: instructeur)
|
||||||
.processed_at
|
.processed_at
|
||||||
save!
|
save!
|
||||||
log_dossier_operation(instructeur, :repasser_en_construction)
|
log_dossier_operation(instructeur, :repasser_en_construction)
|
||||||
|
@ -770,7 +772,7 @@ class Dossier < ApplicationRecord
|
||||||
self.termine_close_to_expiration_notice_sent_at = nil
|
self.termine_close_to_expiration_notice_sent_at = nil
|
||||||
self.conservation_extension = 0.days
|
self.conservation_extension = 0.days
|
||||||
self.en_instruction_at = self.traitements
|
self.en_instruction_at = self.traitements
|
||||||
.passer_en_instruction
|
.passer_en_instruction(instructeur: instructeur)
|
||||||
.processed_at
|
.processed_at
|
||||||
attestation&.destroy
|
attestation&.destroy
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,12 @@
|
||||||
- if traitements.any?
|
- if traitements.any?
|
||||||
%ul.tab-list
|
%ul.tab-list
|
||||||
- traitements.each do |traitement|
|
- traitements.each do |traitement|
|
||||||
- if traitement.instructeur_email.present?
|
%li
|
||||||
%li
|
- processed_at = l(traitement.processed_at, format: '%d %B %Y à %R')
|
||||||
= "Le #{l(traitement.processed_at, format: '%d %B %Y à %R')}, "
|
- if traitement.instructeur_email.present?
|
||||||
= traitement.instructeur_email
|
= t(".with_email.#{traitement.state}", processed_at: processed_at, email: traitement.instructeur_email)
|
||||||
a
|
- else
|
||||||
%strong= t(traitement.state, scope: 'activerecord.attributes.traitement.state').downcase
|
= t(".without_email.#{traitement.state}", processed_at: processed_at)
|
||||||
ce dossier
|
|
||||||
- else
|
|
||||||
%li
|
|
||||||
= "Le #{l(traitement.processed_at, format: '%d %B %Y à %R')}, "
|
|
||||||
ce dossier a été
|
|
||||||
%strong= t(traitement.state, scope: 'activerecord.attributes.traitement.state').downcase
|
|
||||||
- else
|
- else
|
||||||
%p.tab-paragraph Aucune décision n’a été rendue
|
%p.tab-paragraph Aucune décision n’a été rendue
|
||||||
|
|
||||||
|
|
|
@ -17,3 +17,17 @@ fr:
|
||||||
download_archive: Télécharger une archive au format .zip de tous les dossiers et leurs pièces jointes
|
download_archive: Télécharger une archive au format .zip de tous les dossiers et leurs pièces jointes
|
||||||
archive_pending_html: Archive en cours de création<br>(demandée il y a %{created_period})
|
archive_pending_html: Archive en cours de création<br>(demandée il y a %{created_period})
|
||||||
archive_ready_html: Télécharger l’archive<br>(demandée il y a %{generated_period})
|
archive_ready_html: Télécharger l’archive<br>(demandée il y a %{generated_period})
|
||||||
|
dossiers:
|
||||||
|
decisions_rendues_block:
|
||||||
|
without_email:
|
||||||
|
en_construction: Le %{processed_at} ce dossier a été passé en construction
|
||||||
|
en_instruction: Le %{processed_at} ce dossier a été passé en instruction
|
||||||
|
accepte: Le %{processed_at} ce dossier a été accepté
|
||||||
|
refuse: Le %{processed_at} ce dossier a été refusé
|
||||||
|
classe_sans_suite: Le %{processed_at} ce dossier a été classé sans suite
|
||||||
|
with_email:
|
||||||
|
en_construction: Le %{processed_at}, %{email} a passé ce dossier en construction
|
||||||
|
en_instruction: Le %{processed_at}, %{email} a passé ce dossier en instruction
|
||||||
|
accepte: Le %{processed_at}, %{email} a accepté ce dossier
|
||||||
|
refuse: Le %{processed_at}, %{email} a refusé ce dossier
|
||||||
|
classe_sans_suite: Le %{processed_at}, %{email} a classé ce dossier sans suite
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue