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
|
class Procedure::Card::EmailsComponent < ApplicationComponent
|
||||||
|
CUSTOMIZABLE_COUNT = 5
|
||||||
|
|
||||||
def initialize(procedure:)
|
def initialize(procedure:)
|
||||||
@procedure = procedure
|
@procedure = procedure
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def customized_progress
|
||||||
|
"#{customized_count} / #{CUSTOMIZABLE_COUNT}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def fully_customized?
|
||||||
|
customized_count == CUSTOMIZABLE_COUNT
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def error_messages
|
def error_messages
|
||||||
|
@ -14,4 +24,14 @@ class Procedure::Card::EmailsComponent < ApplicationComponent
|
||||||
@procedure.errors.messages_for(:without_continuation_mail)
|
@procedure.errors.messages_for(:without_continuation_mail)
|
||||||
].flatten.to_sentence
|
].flatten.to_sentence
|
||||||
end
|
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
|
end
|
||||||
|
|
|
@ -5,10 +5,16 @@
|
||||||
- if error_messages.present?
|
- if error_messages.present?
|
||||||
%span.icon.refuse
|
%span.icon.refuse
|
||||||
%p.fr-tile-status-error À modifier
|
%p.fr-tile-status-error À modifier
|
||||||
|
- elsif fully_customized?
|
||||||
|
%span.icon.accept
|
||||||
|
%p.fr-tile-status-todo Validé
|
||||||
- else
|
- else
|
||||||
%span.icon.clock
|
%span.icon.clock
|
||||||
%p.fr-tile-status-todo À configurer
|
%p.fr-tile-status-todo À configurer
|
||||||
%div
|
%div
|
||||||
%h3.fr-h6.fr-mt-10v= t('.title')
|
.line-count.fr-my-1w
|
||||||
|
%p.fr-tag= customized_progress
|
||||||
|
|
||||||
|
%h3.fr-h6= t('.title')
|
||||||
%p.fr-tile-subtitle Notifications automatiques
|
%p.fr-tile-subtitle Notifications automatiques
|
||||||
%p.fr-btn.fr-btn--tertiary= t('views.shared.actions.edit')
|
%p.fr-btn.fr-btn--tertiary= t('views.shared.actions.edit')
|
||||||
|
|
Loading…
Add table
Reference in a new issue