diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowSignatureMetadataType.php b/src/Bundle/ChillMainBundle/Form/WorkflowSignatureMetadataType.php new file mode 100644 index 000000000..923f8da55 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Form/WorkflowSignatureMetadataType.php @@ -0,0 +1,62 @@ +parameterBag->get('chill_main.document_type_choices'); + $locale = $this->requestStack->getCurrentRequest()->getLocale(); + + $choices = []; + + foreach ($documentTypeChoices as $documentType) { + foreach ($documentType['labels'] as $label) { + if ($label['lang'] === $locale) { + $choices[$label['label']] = $documentType['key']; + break; + } + } + } + + $builder + ->add('documentType', ChoiceType::class, [ + 'label' => 'workflow.signature_zone.metadata.docType', + 'expanded' => false, + 'required' => true, + 'choices' => $choices, + ]) + ->add('documentNumber', TextType::class, [ + 'required' => true, + 'label' => 'workflow.signature_zone.metadata.docNumber', + ]) + ->add('expirationDate', ChillDateType::class, [ + 'required' => true, + 'input' => 'datetime_immutable', + 'label' => 'workflow.signature_zone.metadata.docExpiration', + ]); + } + +/* public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => EntityWorkflowStepSignature::class, + ]); + }*/ +} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_signature_metadata.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_signature_metadata.html.twig new file mode 100644 index 000000000..5b828832d --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_signature_metadata.html.twig @@ -0,0 +1,24 @@ +{% extends '@ChillMain/layout.html.twig' %} + +{% block title %} + {{ 'Signature'|trans }} +{% endblock %} + +{% block content %} +
+

{{ 'workflow.signature_zone.metadata.sign_by'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname}) }}

+ + {% if metadata_form is not null %} + {{ form_start(metadata_form) }} + {{ form_row(metadata_form.documentType) }} + {{ form_row(metadata_form.documentNumber) }} + {{ form_row(metadata_form.expirationDate) }} + + {{ form_end(metadata_form) }} + {% endif %} +
+{% endblock %} diff --git a/src/Bundle/ChillMainBundle/config/services/form.yaml b/src/Bundle/ChillMainBundle/config/services/form.yaml index ce303701c..f6b50cb57 100644 --- a/src/Bundle/ChillMainBundle/config/services/form.yaml +++ b/src/Bundle/ChillMainBundle/config/services/form.yaml @@ -133,6 +133,8 @@ services: Chill\MainBundle\Form\WorkflowStepType: ~ + Chill\MainBundle\Form\WorkflowSignatureMetadataType: ~ + Chill\MainBundle\Form\DataMapper\PrivateCommentDataMapper: autowire: true autoconfigure: true