feat(groupe-instructeur): admin can preview signature in attestation
Co-Authored-By: Christophe Robillard <christophe.robillard@beta.gouv.fr>
This commit is contained in:
parent
3e1678c17a
commit
ad10335888
3 changed files with 14 additions and 1 deletions
|
@ -381,6 +381,13 @@ module Administrateurs
|
|||
end
|
||||
end
|
||||
|
||||
def preview_attestation
|
||||
attestation_template = procedure.attestation_template || procedure.build_attestation_template
|
||||
@attestation = attestation_template.render_attributes_for({groupe_instructeur: groupe_instructeur})
|
||||
|
||||
render 'administrateurs/attestation_templates/show', formats: [:pdf]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def closed_params?
|
||||
|
|
|
@ -2,9 +2,14 @@
|
|||
= render NestedForms::FormOwnerComponent.new
|
||||
= form_with url: { action: :add_signature }, method: :post, html: { multipart: true } do |f|
|
||||
.card-title Tampon de l'attestation
|
||||
= f.submit 'Ajouter signature', class: 'fr-btn'
|
||||
|
||||
.fr-upload-group.fr-mb-4w
|
||||
%p.fr-text--sm.fr-text-mention--grey.fr-mb-1w
|
||||
Dimensions conseillées : au minimum 500 px de largeur ou de hauteur.
|
||||
= render Attachment::EditComponent.new(attached_file: groupe_instructeur.signature, direct_upload: false)
|
||||
|
||||
.fr-btns-group.fr-btns-group--inline
|
||||
= f.submit 'Ajouter le tampon', class: 'fr-btn'
|
||||
|
||||
- if groupe_instructeur.signature.persisted?
|
||||
= link_to("Prévisualiser", preview_attestation_admin_procedure_groupe_instructeur_path(groupe_instructeur.procedure, groupe_instructeur), class: "fr-btn fr-btn--secondary", **external_link_attributes)
|
||||
|
|
|
@ -533,6 +533,7 @@ Rails.application.routes.draw do
|
|||
get 'reaffecter_dossiers'
|
||||
post 'reaffecter'
|
||||
post 'add_signature'
|
||||
get 'preview_attestation'
|
||||
end
|
||||
|
||||
collection do
|
||||
|
|
Loading…
Add table
Reference in a new issue