demarches-normaliennes/app/views/shared/avis/_list.html.haml

63 lines
3.5 KiB
Text

%section
%h1.tab-title
Avis des invités
%span.fr-badge= avis.count
%ul.list-style-type-none.fr-p-0
- avis.each do |avis|
%li
%h2.fr-text--sm.fr-mb-2w
%span.fr-icon-questionnaire-line.fr-mr-1v
= "#{t('claimant', scope: 'activerecord.attributes.avis')} :"
%span= (avis.claimant.email == expert_or_instructeur.email) ? 'Vous' : avis.claimant.email
- if avis.confidentiel?
%span.fr-badge.fr-badge--sm.fr-badge--warning.fr-badge--no-icon
= t('confidentiel', scope: 'activerecord.attributes.avis')
%span.fr-text--xs.fr-text-mention--grey.pull-right{ class: highlight_if_unseen_class(avis_seen_at, avis.created_at) }
= t('demande_envoyee_le', scope: 'views.shared.avis', date: l(avis.created_at, format: '%d/%m/%y à %H:%M'))
.border-left
%p= avis.introduction
- if avis.question_label
%p= avis.question_label
%h2.fr-text--sm.fr-mt-5w.fr-mb-2w
%span.fr-icon-message-2-line.fr-mr-1v
= (avis.expert.email == expert_or_instructeur.email) ? 'Vous' : avis.expert.email
- if avis.answer.present?
- if avis.revoked?
%span.fr-badge.fr-badge--sm{ class: highlight_if_unseen_class(avis_seen_at, avis.revoked_at) }
= t('demande_revoquee_le', scope: 'views.shared.avis', date: l(avis.revoked_at, format: '%d/%m/%y à %H:%M'))
%span.fr-text--xs.fr-text-mention--grey.pull-right{ class: highlight_if_unseen_class(avis_seen_at, avis.updated_at) }
= t('reponse_donnee_le', scope: 'views.shared.avis', date: l(avis.updated_at, format: '%d/%m/%y à %H:%M'))
- else
%span.fr-badge.fr-badge--sm
= t('en_attente', scope: 'views.shared.avis')
.fr-mb-2w
- if avis.reminded_at
%span.date.fr-text--xs.fr-text-mention--grey{ class: highlight_if_unseen_class(avis_seen_at, avis.reminded_at) }
= t('relance_effectuee_le', scope: 'views.shared.avis', date: l(avis.reminded_at, format: '%d/%m/%y à %H:%M'))
- if expert_or_instructeur.is_a?(Instructeur)
- if avis.answer.blank?
= link_to(t('remind', scope: 'helpers.label'), remind_instructeur_avis_path(avis.procedure, params[:statut], avis), class:'fr-btn fr-btn--sm fr-btn--tertiary-no-outline', data: { confirm: t('remind', scope: 'helpers.confirmation', email: avis.expert.email) })
- if avis.revokable_by?(expert_or_instructeur)
= link_to(t('revoke', scope: 'helpers.label'), revoquer_instructeur_avis_path(avis.procedure, params[:statut], avis), class:'fr-btn fr-btn--sm fr-btn--tertiary-no-outline', data: { confirm: t('revoke', scope: 'helpers.confirmation', email: avis.expert.email) }, method: :patch)
.border-left
- if avis.introduction_file.attached?
= render Attachment::ShowComponent.new(attachment: avis.introduction_file.attachment)
.fr-mb-2w
%p #{t('views.instructeurs.avis.introduction_file_explaination')} #{avis.claimant.email}
- if avis.piece_justificative_file.attached?
= render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment)
.fr-mb-2w
- if [true, false].include? avis.question_answer
%p= t("question_answer.#{avis.question_answer}", scope: 'helpers.label')
= render SimpleFormatComponent.new(avis.answer, allow_a: false)
%hr.fr-mt-2w.fr-mb-2w