Merge pull request #8234 from mfo/US/enhance-procedure-email-card-component
amelioration(administrateur/carte-email): la carte des emails affiche en permanence à configurer
This commit is contained in:
commit
d489419220
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
|
||||
|
|
|
@ -5,10 +5,16 @@
|
|||
- if error_messages.present?
|
||||
%span.icon.refuse
|
||||
%p.fr-tile-status-error À modifier
|
||||
- elsif fully_customized?
|
||||
%span.icon.accept
|
||||
%p.fr-tile-status-todo Validé
|
||||
- else
|
||||
%span.icon.clock
|
||||
%p.fr-tile-status-todo À configurer
|
||||
%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-btn.fr-btn--tertiary= t('views.shared.actions.edit')
|
||||
|
|
Loading…
Add table
Reference in a new issue