amelioration(administrateur/carte-email): la carte des emails affichait toujours 'A configurer'. Desormais si les 5 mail configurable on ete modifiés, on affiche 'Validé' + on affiche le nombre de mail personnalisé
This commit is contained in:
parent
811e5a9eea
commit
e018d2975d
2 changed files with 27 additions and 1 deletions
|
@ -1,8 +1,18 @@
|
|||
class Procedure::Card::EmailsComponent < ApplicationComponent
|
||||
CUSTOMIZABLE_COUNT = 5
|
||||
|
||||
def initialize(procedure:)
|
||||
@procedure = procedure
|
||||
end
|
||||
|
||||
def customized_progress
|
||||
"#{customized_count} / #{CUSTOMIZABLE_COUNT}"
|
||||
end
|
||||
|
||||
def fully_customized?
|
||||
customized_count == CUSTOMIZABLE_COUNT
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def error_messages
|
||||
|
@ -14,4 +24,14 @@ class Procedure::Card::EmailsComponent < ApplicationComponent
|
|||
@procedure.errors.messages_for(:without_continuation_mail)
|
||||
].flatten.to_sentence
|
||||
end
|
||||
|
||||
def customized_count
|
||||
[
|
||||
@procedure.initiated_mail,
|
||||
@procedure.received_mail,
|
||||
@procedure.closed_mail,
|
||||
@procedure.refused_mail,
|
||||
@procedure.without_continuation_mail
|
||||
].map { |mail| mail&.updated_at }.compact.size
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue