From 8d543be5cc47cebc423872c90e84c0e05c4b49bb Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 11 Jul 2024 15:15:04 +0200 Subject: [PATCH 01/14] Add configuration on id_document_types to avoid errors --- .../ChillMainExtension.php | 5 +++++ .../DependencyInjection/Configuration.php | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 4dde2076c..bf041b5b3 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -193,6 +193,11 @@ class ChillMainExtension extends Extension implements [] ); + $container->setParameter( + 'chill_main.id_document_kinds', + $config['id_document_kinds'] + ); + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); $loader->load('services.yaml'); $loader->load('services/doctrine.yaml'); diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php index 8bd3e35f4..9c890d9fe 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php @@ -151,6 +151,28 @@ class Configuration implements ConfigurationInterface ->append($this->addWidgetsConfiguration('homepage', $this->containerBuilder)) ->end() // end of widgets/children ->end() // end of widgets + ->arrayNode('id_document_kinds')->defaultValue([]) + ->arrayPrototype() + ->children() + ->scalarNode('key')->isRequired()->cannotBeEmpty() + ->info('the key stored in database') + ->example('id_card') + ->end() + ->arrayNode('labels')->isRequired()->requiresAtLeastOneElement() + ->arrayPrototype() + ->children() + ->scalarNode('lang')->isRequired()->cannotBeEmpty() + ->example('fr') + ->end() + ->scalarNode('label')->isRequired()->cannotBeEmpty() + ->example('Carte de séjour') + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() // end of document types ->arrayNode('cruds') ->defaultValue([]) ->arrayPrototype() From 52a3d1be1b2317afd79c5821ba35b733201d52fc Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 11 Jul 2024 15:15:41 +0200 Subject: [PATCH 02/14] Implement show and hide logic within workflow form --- .../ChillMainBundle/Form/WorkflowStepType.php | 26 ++++++ .../public/page/workflow-show/index.js | 86 +++++++++++++++++-- .../views/Workflow/_decision.html.twig | 23 ++++- 3 files changed, 126 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index 284781d54..8949432b2 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -17,6 +17,7 @@ use Chill\MainBundle\Form\Type\ChillTextareaType; use Chill\MainBundle\Form\Type\PickUserDynamicType; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\MainBundle\Workflow\WorkflowTransitionContextDTO; +use Chill\PersonBundle\Form\Type\PickPersonDynamicType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\EmailType; @@ -102,6 +103,7 @@ class WorkflowStepType extends AbstractType 'choice_attr' => static function (Transition $transition) use ($workflow) { $toFinal = true; $isForward = 'neutral'; + $isSignature = []; $metadata = $workflow->getMetadataStore()->getTransitionMetadata($transition); @@ -121,15 +123,38 @@ class WorkflowStepType extends AbstractType ) { $toFinal = false; } + + if (\array_key_exists('isSignature', $meta)) { + $isSignature = $meta['isSignature']; + } } return [ 'data-is-transition' => 'data-is-transition', 'data-to-final' => $toFinal ? '1' : '0', 'data-is-forward' => $isForward, + 'data-is-signature' => json_encode($isSignature), ]; }, ]) + ->add('isPersonOrUserSignature', ChoiceType::class, [ + 'mapped' => false, + 'multiple' => false, + 'expanded' => true, + 'label' => 'workflow.Type of signature', + 'choices' => [ + 'person' => 'person', + 'user' => 'user', + ], + ]) + ->add('futurePersonSignatures', PickPersonDynamicType::class, [ + 'label' => 'workflow.person signatures', + 'multiple' => true, + ]) + ->add('futureUserSignature', PickUserDynamicType::class, [ + 'label' => 'workflow.user signatures', + 'multiple' => false, + ]) ->add('futureDestUsers', PickUserDynamicType::class, [ 'label' => 'workflow.dest for next steps', 'multiple' => true, @@ -140,6 +165,7 @@ class WorkflowStepType extends AbstractType 'multiple' => true, 'required' => false, 'suggested' => $options['suggested_users'], + 'attr' => ['class' => 'future-cc-users'], ]) ->add('futureDestEmails', ChillCollectionType::class, [ 'label' => 'workflow.dest by email', diff --git a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js index 2f91c7777..6829dad8e 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js @@ -4,8 +4,86 @@ window.addEventListener('DOMContentLoaded', function() { let divTransitions = document.querySelector('#transitions'), futureDestUsersContainer = document.querySelector('#futureDests') + personSignatureField = document.querySelector('#person-signature-field'); + userSignatureField = document.querySelector('#user-signature-field'); + signatureTypeChoices = document.querySelector('#signature-type-choice'); ; + console.log('signature type', signatureTypeChoices); + + let + transitionFilterContainer = document.querySelector('#transitionFilter'), + transitionsContainer = document.querySelector('#transitions') + ; + + personSignatureField.style.display = 'none'; + userSignatureField.style.display = 'none'; + futureDestUsersContainer.style.display = 'none'; + signatureTypeChoices.style.display = 'none'; + + // ShowHide instance for signatureTypeChoices and futureDestUsersContainer + new ShowHide({ + load_event: null, + froms: [transitionsContainer], + container: [signatureTypeChoices, futureDestUsersContainer], + test: function() { + const selectedTransition = document.querySelector('input[name="workflow_step[transition]"]:checked'); + console.log('transition', selectedTransition) + if (!selectedTransition) { + return false; // No transition selected, hide all + } + + const isSignature = JSON.parse(selectedTransition.getAttribute('data-is-signature') || '[]'); + + if (isSignature.includes('person') && isSignature.includes('user')) { + signatureTypeChoices.style.display = ''; + } else { + signatureTypeChoices.style.display = 'none'; + } + + if (!isSignature.length) { + futureDestUsersContainer.style.display = ''; + personSignatureField.style.display = 'none'; + userSignatureField.style.display = 'none'; + } else { + futureDestUsersContainer.style.display = 'none'; + } + + return true; // Always return true to ensure ShowHide manages visibility + } + }); + + // Event listener for changes in signature type selection + signatureTypeChoices.addEventListener('change', function() { + // ShowHide instance for personSignatureField and userSignatureField + new ShowHide({ + load_event: null, + froms: [signatureTypeChoices], + container: [personSignatureField, userSignatureField], + test: function() { + console.log(signatureTypeChoices) + const selectedSignatureType = document.querySelector('input[name="workflow_step[isPersonOrUserSignature]"]:checked'); + console.log('signataure type', selectedSignatureType) + if (!selectedSignatureType) { + return false; // No signature type selected, hide both fields + } + + if (selectedSignatureType.value === 'person') { + personSignatureField.style.display = ''; + userSignatureField.style.display = 'none'; + } else if (selectedSignatureType.value === 'user') { + personSignatureField.style.display = 'none'; + userSignatureField.style.display = ''; + } else { + personSignatureField.style.display = 'none'; + userSignatureField.style.display = 'none'; + } + + return true; // Always return true to ensure ShowHide manages visibility + } + }); + }); + if (null !== divTransitions) { new ShowHide({ load_event: null, @@ -29,13 +107,8 @@ window.addEventListener('DOMContentLoaded', function() { }); } - let - transitionFilterContainer = document.querySelector('#transitionFilter'), - transitions = document.querySelector('#transitions') - ; - if (null !== transitionFilterContainer) { - transitions.querySelectorAll('.form-check').forEach(function(row) { + transitionsContainer.querySelectorAll('.form-check').forEach(function(row) { const isForward = row.querySelector('input').dataset.isForward; @@ -66,5 +139,4 @@ window.addEventListener('DOMContentLoaded', function() { }); }); } - }); diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig index 35f587e38..391e42324 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig @@ -58,15 +58,34 @@ {{ form_row(transition_form.transition) }} +
+
+ {{ form_row(transition_form.isPersonOrUserSignature) }} + {{ form_errors(transition_form.isPersonOrUserSignature) }} +
+
+ {{ form_row(transition_form.futureUserSignature) }} + {{ form_errors(transition_form.futureUserSignature) }} +
+
+ {{ form_row(transition_form.futurePersonSignatures) }} + {{ form_errors(transition_form.futurePersonSignatures) }} +
+
+
+
{{ form_row(transition_form.futureDestUsers) }} {{ form_errors(transition_form.futureDestUsers) }} - +
+
{{ form_row(transition_form.futureCcUsers) }} {{ form_errors(transition_form.futureCcUsers) }} - +
+
{{ form_row(transition_form.futureDestEmails) }} {{ form_errors(transition_form.futureDestEmails) }} +

{{ form_label(transition_form.comment) }}

From 3836622d2733040ef7c76fa8ed85675dcceec876 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 18 Jul 2024 16:03:45 +0200 Subject: [PATCH 03/14] Use better namespacing for configuring workflow signature documents --- .../ChillMainExtension.php | 4 +- .../DependencyInjection/Configuration.php | 48 ++++++++++--------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index bf041b5b3..0d90854b4 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -194,8 +194,8 @@ class ChillMainExtension extends Extension implements ); $container->setParameter( - 'chill_main.id_document_kinds', - $config['id_document_kinds'] + 'chill_main.workflow_signatures.base_signer.document_kinds', + $config['workflow_signature']['base_signer']['document_kinds'] ); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php index 9c890d9fe..2185375b6 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php @@ -151,28 +151,6 @@ class Configuration implements ConfigurationInterface ->append($this->addWidgetsConfiguration('homepage', $this->containerBuilder)) ->end() // end of widgets/children ->end() // end of widgets - ->arrayNode('id_document_kinds')->defaultValue([]) - ->arrayPrototype() - ->children() - ->scalarNode('key')->isRequired()->cannotBeEmpty() - ->info('the key stored in database') - ->example('id_card') - ->end() - ->arrayNode('labels')->isRequired()->requiresAtLeastOneElement() - ->arrayPrototype() - ->children() - ->scalarNode('lang')->isRequired()->cannotBeEmpty() - ->example('fr') - ->end() - ->scalarNode('label')->isRequired()->cannotBeEmpty() - ->example('Carte de séjour') - ->end() - ->end() - ->end() - ->end() - ->end() - ->end() - ->end() // end of document types ->arrayNode('cruds') ->defaultValue([]) ->arrayPrototype() @@ -299,6 +277,32 @@ class Configuration implements ConfigurationInterface ->end() // end of root ; + $rootNode->children() + ->arrayNode('workflow_signature') + ->children() + ->arrayNode('base_signer') + ->children() + ->arrayNode('document_kinds') + ->arrayPrototype() + ->children() + ->scalarNode('key')->cannotBeEmpty()->end() + ->arrayNode('labels') + ->arrayPrototype() + ->children() + ->scalarNode('lang')->cannotBeEmpty()->end() + ->scalarNode('label')->cannotBeEmpty()->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end(); + $rootNode->children() ->arrayNode('add_address')->addDefaultsIfNotSet()->children() ->scalarNode('default_country')->cannotBeEmpty()->defaultValue('BE')->end() From 0a46b5304ddfc51196aaf8bb53b6d2ee7ca13524 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 23 Jul 2024 12:18:14 +0200 Subject: [PATCH 04/14] Adjust implementation of showHide (wip) --- .../public/page/workflow-show/index.js | 59 +++++++------------ 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js index 6829dad8e..93096a910 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js @@ -9,8 +9,6 @@ window.addEventListener('DOMContentLoaded', function() { signatureTypeChoices = document.querySelector('#signature-type-choice'); ; - console.log('signature type', signatureTypeChoices); - let transitionFilterContainer = document.querySelector('#transitionFilter'), transitionsContainer = document.querySelector('#transitions') @@ -21,39 +19,26 @@ window.addEventListener('DOMContentLoaded', function() { futureDestUsersContainer.style.display = 'none'; signatureTypeChoices.style.display = 'none'; - // ShowHide instance for signatureTypeChoices and futureDestUsersContainer - new ShowHide({ - load_event: null, - froms: [transitionsContainer], - container: [signatureTypeChoices, futureDestUsersContainer], - test: function() { - const selectedTransition = document.querySelector('input[name="workflow_step[transition]"]:checked'); - console.log('transition', selectedTransition) - if (!selectedTransition) { - return false; // No transition selected, hide all + // ShowHide instance for signatureTypeChoices + new ShowHide({ + debug: true, + froms: [divTransitions], + container: [signatureTypeChoices], + test: function(transitions) { + for (let transition of transitions) { + for (let input of transition.querySelectorAll('input')) { + if (input.checked) { + const inputData = JSON.parse(input.getAttribute('data-is-signature')) + return inputData.includes('person') || inputData.includes('user'); + } } - - const isSignature = JSON.parse(selectedTransition.getAttribute('data-is-signature') || '[]'); - - if (isSignature.includes('person') && isSignature.includes('user')) { - signatureTypeChoices.style.display = ''; - } else { - signatureTypeChoices.style.display = 'none'; - } - - if (!isSignature.length) { - futureDestUsersContainer.style.display = ''; - personSignatureField.style.display = 'none'; - userSignatureField.style.display = 'none'; - } else { - futureDestUsersContainer.style.display = 'none'; - } - - return true; // Always return true to ensure ShowHide manages visibility } - }); - // Event listener for changes in signature type selection + return true; + } + }); + +/* // Event listener for changes in signature type selection signatureTypeChoices.addEventListener('change', function() { // ShowHide instance for personSignatureField and userSignatureField new ShowHide({ @@ -61,9 +46,7 @@ window.addEventListener('DOMContentLoaded', function() { froms: [signatureTypeChoices], container: [personSignatureField, userSignatureField], test: function() { - console.log(signatureTypeChoices) const selectedSignatureType = document.querySelector('input[name="workflow_step[isPersonOrUserSignature]"]:checked'); - console.log('signataure type', selectedSignatureType) if (!selectedSignatureType) { return false; // No signature type selected, hide both fields } @@ -82,15 +65,15 @@ window.addEventListener('DOMContentLoaded', function() { return true; // Always return true to ensure ShowHide manages visibility } }); - }); + });*/ - if (null !== divTransitions) { +/* if (null !== divTransitions) { new ShowHide({ load_event: null, froms: [divTransitions], container: [futureDestUsersContainer], test: function(divs, arg2, arg3) { - for (let div of divs) { + for (let div of divs) { for (let input of div.querySelectorAll('input')) { if (input.checked) { if (input.dataset.toFinal === "1") { @@ -105,7 +88,7 @@ window.addEventListener('DOMContentLoaded', function() { return true; }, }); - } + }*/ if (null !== transitionFilterContainer) { transitionsContainer.querySelectorAll('.form-check').forEach(function(row) { From 72e3325626fe104d5b20a2ab9dc76c35e99df450 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 11 Jul 2024 15:15:41 +0200 Subject: [PATCH 05/14] Implement show and hide logic within workflow form --- .../ChillMainBundle/Form/WorkflowStepType.php | 26 ++++++ .../public/page/workflow-show/index.js | 86 +++++++++++++++++-- .../views/Workflow/_decision.html.twig | 23 ++++- 3 files changed, 126 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index 284781d54..8949432b2 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -17,6 +17,7 @@ use Chill\MainBundle\Form\Type\ChillTextareaType; use Chill\MainBundle\Form\Type\PickUserDynamicType; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\MainBundle\Workflow\WorkflowTransitionContextDTO; +use Chill\PersonBundle\Form\Type\PickPersonDynamicType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\EmailType; @@ -102,6 +103,7 @@ class WorkflowStepType extends AbstractType 'choice_attr' => static function (Transition $transition) use ($workflow) { $toFinal = true; $isForward = 'neutral'; + $isSignature = []; $metadata = $workflow->getMetadataStore()->getTransitionMetadata($transition); @@ -121,15 +123,38 @@ class WorkflowStepType extends AbstractType ) { $toFinal = false; } + + if (\array_key_exists('isSignature', $meta)) { + $isSignature = $meta['isSignature']; + } } return [ 'data-is-transition' => 'data-is-transition', 'data-to-final' => $toFinal ? '1' : '0', 'data-is-forward' => $isForward, + 'data-is-signature' => json_encode($isSignature), ]; }, ]) + ->add('isPersonOrUserSignature', ChoiceType::class, [ + 'mapped' => false, + 'multiple' => false, + 'expanded' => true, + 'label' => 'workflow.Type of signature', + 'choices' => [ + 'person' => 'person', + 'user' => 'user', + ], + ]) + ->add('futurePersonSignatures', PickPersonDynamicType::class, [ + 'label' => 'workflow.person signatures', + 'multiple' => true, + ]) + ->add('futureUserSignature', PickUserDynamicType::class, [ + 'label' => 'workflow.user signatures', + 'multiple' => false, + ]) ->add('futureDestUsers', PickUserDynamicType::class, [ 'label' => 'workflow.dest for next steps', 'multiple' => true, @@ -140,6 +165,7 @@ class WorkflowStepType extends AbstractType 'multiple' => true, 'required' => false, 'suggested' => $options['suggested_users'], + 'attr' => ['class' => 'future-cc-users'], ]) ->add('futureDestEmails', ChillCollectionType::class, [ 'label' => 'workflow.dest by email', diff --git a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js index 2f91c7777..6829dad8e 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js @@ -4,8 +4,86 @@ window.addEventListener('DOMContentLoaded', function() { let divTransitions = document.querySelector('#transitions'), futureDestUsersContainer = document.querySelector('#futureDests') + personSignatureField = document.querySelector('#person-signature-field'); + userSignatureField = document.querySelector('#user-signature-field'); + signatureTypeChoices = document.querySelector('#signature-type-choice'); ; + console.log('signature type', signatureTypeChoices); + + let + transitionFilterContainer = document.querySelector('#transitionFilter'), + transitionsContainer = document.querySelector('#transitions') + ; + + personSignatureField.style.display = 'none'; + userSignatureField.style.display = 'none'; + futureDestUsersContainer.style.display = 'none'; + signatureTypeChoices.style.display = 'none'; + + // ShowHide instance for signatureTypeChoices and futureDestUsersContainer + new ShowHide({ + load_event: null, + froms: [transitionsContainer], + container: [signatureTypeChoices, futureDestUsersContainer], + test: function() { + const selectedTransition = document.querySelector('input[name="workflow_step[transition]"]:checked'); + console.log('transition', selectedTransition) + if (!selectedTransition) { + return false; // No transition selected, hide all + } + + const isSignature = JSON.parse(selectedTransition.getAttribute('data-is-signature') || '[]'); + + if (isSignature.includes('person') && isSignature.includes('user')) { + signatureTypeChoices.style.display = ''; + } else { + signatureTypeChoices.style.display = 'none'; + } + + if (!isSignature.length) { + futureDestUsersContainer.style.display = ''; + personSignatureField.style.display = 'none'; + userSignatureField.style.display = 'none'; + } else { + futureDestUsersContainer.style.display = 'none'; + } + + return true; // Always return true to ensure ShowHide manages visibility + } + }); + + // Event listener for changes in signature type selection + signatureTypeChoices.addEventListener('change', function() { + // ShowHide instance for personSignatureField and userSignatureField + new ShowHide({ + load_event: null, + froms: [signatureTypeChoices], + container: [personSignatureField, userSignatureField], + test: function() { + console.log(signatureTypeChoices) + const selectedSignatureType = document.querySelector('input[name="workflow_step[isPersonOrUserSignature]"]:checked'); + console.log('signataure type', selectedSignatureType) + if (!selectedSignatureType) { + return false; // No signature type selected, hide both fields + } + + if (selectedSignatureType.value === 'person') { + personSignatureField.style.display = ''; + userSignatureField.style.display = 'none'; + } else if (selectedSignatureType.value === 'user') { + personSignatureField.style.display = 'none'; + userSignatureField.style.display = ''; + } else { + personSignatureField.style.display = 'none'; + userSignatureField.style.display = 'none'; + } + + return true; // Always return true to ensure ShowHide manages visibility + } + }); + }); + if (null !== divTransitions) { new ShowHide({ load_event: null, @@ -29,13 +107,8 @@ window.addEventListener('DOMContentLoaded', function() { }); } - let - transitionFilterContainer = document.querySelector('#transitionFilter'), - transitions = document.querySelector('#transitions') - ; - if (null !== transitionFilterContainer) { - transitions.querySelectorAll('.form-check').forEach(function(row) { + transitionsContainer.querySelectorAll('.form-check').forEach(function(row) { const isForward = row.querySelector('input').dataset.isForward; @@ -66,5 +139,4 @@ window.addEventListener('DOMContentLoaded', function() { }); }); } - }); diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig index 35f587e38..391e42324 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig @@ -58,15 +58,34 @@ {{ form_row(transition_form.transition) }} +
+
+ {{ form_row(transition_form.isPersonOrUserSignature) }} + {{ form_errors(transition_form.isPersonOrUserSignature) }} +
+
+ {{ form_row(transition_form.futureUserSignature) }} + {{ form_errors(transition_form.futureUserSignature) }} +
+
+ {{ form_row(transition_form.futurePersonSignatures) }} + {{ form_errors(transition_form.futurePersonSignatures) }} +
+
+
+
{{ form_row(transition_form.futureDestUsers) }} {{ form_errors(transition_form.futureDestUsers) }} - +
+
{{ form_row(transition_form.futureCcUsers) }} {{ form_errors(transition_form.futureCcUsers) }} - +
+
{{ form_row(transition_form.futureDestEmails) }} {{ form_errors(transition_form.futureDestEmails) }} +

{{ form_label(transition_form.comment) }}

From 7351a35c4205e327f7b2cee630d8163f9b3cad9a Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 18 Jul 2024 16:03:45 +0200 Subject: [PATCH 06/14] Use better namespacing for configuring workflow signature documents --- .../ChillMainExtension.php | 4 +- .../DependencyInjection/Configuration.php | 48 ++++++++++--------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index bf041b5b3..0d90854b4 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -194,8 +194,8 @@ class ChillMainExtension extends Extension implements ); $container->setParameter( - 'chill_main.id_document_kinds', - $config['id_document_kinds'] + 'chill_main.workflow_signatures.base_signer.document_kinds', + $config['workflow_signature']['base_signer']['document_kinds'] ); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php index 9c890d9fe..2185375b6 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php @@ -151,28 +151,6 @@ class Configuration implements ConfigurationInterface ->append($this->addWidgetsConfiguration('homepage', $this->containerBuilder)) ->end() // end of widgets/children ->end() // end of widgets - ->arrayNode('id_document_kinds')->defaultValue([]) - ->arrayPrototype() - ->children() - ->scalarNode('key')->isRequired()->cannotBeEmpty() - ->info('the key stored in database') - ->example('id_card') - ->end() - ->arrayNode('labels')->isRequired()->requiresAtLeastOneElement() - ->arrayPrototype() - ->children() - ->scalarNode('lang')->isRequired()->cannotBeEmpty() - ->example('fr') - ->end() - ->scalarNode('label')->isRequired()->cannotBeEmpty() - ->example('Carte de séjour') - ->end() - ->end() - ->end() - ->end() - ->end() - ->end() - ->end() // end of document types ->arrayNode('cruds') ->defaultValue([]) ->arrayPrototype() @@ -299,6 +277,32 @@ class Configuration implements ConfigurationInterface ->end() // end of root ; + $rootNode->children() + ->arrayNode('workflow_signature') + ->children() + ->arrayNode('base_signer') + ->children() + ->arrayNode('document_kinds') + ->arrayPrototype() + ->children() + ->scalarNode('key')->cannotBeEmpty()->end() + ->arrayNode('labels') + ->arrayPrototype() + ->children() + ->scalarNode('lang')->cannotBeEmpty()->end() + ->scalarNode('label')->cannotBeEmpty()->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end(); + $rootNode->children() ->arrayNode('add_address')->addDefaultsIfNotSet()->children() ->scalarNode('default_country')->cannotBeEmpty()->defaultValue('BE')->end() From c33e4adeec9ca8ba2b2353024a4c6416dc6427cc Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 23 Jul 2024 12:18:14 +0200 Subject: [PATCH 07/14] Adjust implementation of showHide (wip) --- .../public/page/workflow-show/index.js | 59 +++++++------------ 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js index 6829dad8e..93096a910 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js @@ -9,8 +9,6 @@ window.addEventListener('DOMContentLoaded', function() { signatureTypeChoices = document.querySelector('#signature-type-choice'); ; - console.log('signature type', signatureTypeChoices); - let transitionFilterContainer = document.querySelector('#transitionFilter'), transitionsContainer = document.querySelector('#transitions') @@ -21,39 +19,26 @@ window.addEventListener('DOMContentLoaded', function() { futureDestUsersContainer.style.display = 'none'; signatureTypeChoices.style.display = 'none'; - // ShowHide instance for signatureTypeChoices and futureDestUsersContainer - new ShowHide({ - load_event: null, - froms: [transitionsContainer], - container: [signatureTypeChoices, futureDestUsersContainer], - test: function() { - const selectedTransition = document.querySelector('input[name="workflow_step[transition]"]:checked'); - console.log('transition', selectedTransition) - if (!selectedTransition) { - return false; // No transition selected, hide all + // ShowHide instance for signatureTypeChoices + new ShowHide({ + debug: true, + froms: [divTransitions], + container: [signatureTypeChoices], + test: function(transitions) { + for (let transition of transitions) { + for (let input of transition.querySelectorAll('input')) { + if (input.checked) { + const inputData = JSON.parse(input.getAttribute('data-is-signature')) + return inputData.includes('person') || inputData.includes('user'); + } } - - const isSignature = JSON.parse(selectedTransition.getAttribute('data-is-signature') || '[]'); - - if (isSignature.includes('person') && isSignature.includes('user')) { - signatureTypeChoices.style.display = ''; - } else { - signatureTypeChoices.style.display = 'none'; - } - - if (!isSignature.length) { - futureDestUsersContainer.style.display = ''; - personSignatureField.style.display = 'none'; - userSignatureField.style.display = 'none'; - } else { - futureDestUsersContainer.style.display = 'none'; - } - - return true; // Always return true to ensure ShowHide manages visibility } - }); - // Event listener for changes in signature type selection + return true; + } + }); + +/* // Event listener for changes in signature type selection signatureTypeChoices.addEventListener('change', function() { // ShowHide instance for personSignatureField and userSignatureField new ShowHide({ @@ -61,9 +46,7 @@ window.addEventListener('DOMContentLoaded', function() { froms: [signatureTypeChoices], container: [personSignatureField, userSignatureField], test: function() { - console.log(signatureTypeChoices) const selectedSignatureType = document.querySelector('input[name="workflow_step[isPersonOrUserSignature]"]:checked'); - console.log('signataure type', selectedSignatureType) if (!selectedSignatureType) { return false; // No signature type selected, hide both fields } @@ -82,15 +65,15 @@ window.addEventListener('DOMContentLoaded', function() { return true; // Always return true to ensure ShowHide manages visibility } }); - }); + });*/ - if (null !== divTransitions) { +/* if (null !== divTransitions) { new ShowHide({ load_event: null, froms: [divTransitions], container: [futureDestUsersContainer], test: function(divs, arg2, arg3) { - for (let div of divs) { + for (let div of divs) { for (let input of div.querySelectorAll('input')) { if (input.checked) { if (input.dataset.toFinal === "1") { @@ -105,7 +88,7 @@ window.addEventListener('DOMContentLoaded', function() { return true; }, }); - } + }*/ if (null !== transitionFilterContainer) { transitionsContainer.querySelectorAll('.form-check').forEach(function(row) { From 1396304af5a3f4531c784bedc0803f2053c6b880 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 23 Jul 2024 16:20:27 +0200 Subject: [PATCH 08/14] Change funtioning of showHide (wip) --- .../public/page/workflow-show/index.js | 124 +++++++++++------- 1 file changed, 73 insertions(+), 51 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js index 93096a910..5afb6fcd8 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js @@ -14,60 +14,82 @@ window.addEventListener('DOMContentLoaded', function() { transitionsContainer = document.querySelector('#transitions') ; - personSignatureField.style.display = 'none'; - userSignatureField.style.display = 'none'; - futureDestUsersContainer.style.display = 'none'; - signatureTypeChoices.style.display = 'none'; - - // ShowHide instance for signatureTypeChoices - new ShowHide({ - debug: true, - froms: [divTransitions], - container: [signatureTypeChoices], - test: function(transitions) { - for (let transition of transitions) { - for (let input of transition.querySelectorAll('input')) { - if (input.checked) { - const inputData = JSON.parse(input.getAttribute('data-is-signature')) - return inputData.includes('person') || inputData.includes('user'); - } - } - } - - return true; - } - }); - -/* // Event listener for changes in signature type selection - signatureTypeChoices.addEventListener('change', function() { - // ShowHide instance for personSignatureField and userSignatureField - new ShowHide({ - load_event: null, - froms: [signatureTypeChoices], - container: [personSignatureField, userSignatureField], - test: function() { - const selectedSignatureType = document.querySelector('input[name="workflow_step[isPersonOrUserSignature]"]:checked'); - if (!selectedSignatureType) { - return false; // No signature type selected, hide both fields - } - - if (selectedSignatureType.value === 'person') { - personSignatureField.style.display = ''; - userSignatureField.style.display = 'none'; - } else if (selectedSignatureType.value === 'user') { - personSignatureField.style.display = 'none'; - userSignatureField.style.display = ''; + new ShowHide({ + debug: false, + froms: [signatureTypeChoices], + container: [personSignatureField], + test: function(froms, event) { + // console.log('froms', froms) + for (let container of froms) { + if (container.children.length === 0) { + console.log('im empty dont show person or user picker'); + return false } else { - personSignatureField.style.display = 'none'; - userSignatureField.style.display = 'none'; + return container.querySelector('input[value="person"]').checked; } - - return true; // Always return true to ensure ShowHide manages visibility } - }); - });*/ + return false; + }, + }); -/* if (null !== divTransitions) { + // ShowHide instance for userSignatureField + new ShowHide({ + debug: false, + froms: [signatureTypeChoices], + container: [userSignatureField], + test: function(froms, event) { + for (let container of froms) { + if (container.children.length === 0) { + console.log('im empty dont show person or user picker'); + return false + } else { + return container.querySelector('input[value="person"]').checked; + } + } + return false; + }, + }); + + // ShowHide instance for signatureTypeChoices + new ShowHide({ + debug: false, + load_event: null, + froms: [divTransitions], + container: [signatureTypeChoices], + test: function(froms, event) { + for (let transition of froms) { + for (let input of transition.querySelectorAll('input')) { + if (input.checked) { + const inputData = JSON.parse(input.getAttribute('data-is-signature')) + return inputData.includes('person') && inputData.includes('user'); + } + } + } + + return false; + } + }); + + // ShowHide instance for future dest users + new ShowHide({ + debug: false, + load_event: null, + froms: [divTransitions], + container: [futureDestUsersContainer], + test: function(froms, event) { + for (let transition of froms) { + for (let input of transition.querySelectorAll('input')) { + if (input.checked) { + const inputData = JSON.parse(input.getAttribute('data-is-signature')) + return !(inputData.includes('person') || inputData.includes('user')); + } + } + } + return false; + } + }); + + if (null !== divTransitions) { new ShowHide({ load_event: null, froms: [divTransitions], @@ -88,7 +110,7 @@ window.addEventListener('DOMContentLoaded', function() { return true; }, }); - }*/ + } if (null !== transitionFilterContainer) { transitionsContainer.querySelectorAll('.form-check').forEach(function(row) { From 0a6f3a99daa8b9aea7b418aa0f472a47b5756d96 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 23 Jul 2024 19:59:10 +0200 Subject: [PATCH 09/14] Fix functioning of show hide --- .../ChillMainBundle/Form/WorkflowStepType.php | 12 +- .../public/page/workflow-show/index.js | 121 +++++++++--------- .../views/Workflow/_decision.html.twig | 2 +- .../translations/messages.fr.yml | 5 + 4 files changed, 77 insertions(+), 63 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index 8949432b2..8d5f8c819 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -141,23 +141,25 @@ class WorkflowStepType extends AbstractType 'mapped' => false, 'multiple' => false, 'expanded' => true, - 'label' => 'workflow.Type of signature', + 'label' => 'workflow.signature_zone.type of signature', 'choices' => [ - 'person' => 'person', - 'user' => 'user', + 'workflow.signature_zone.persons' => 'person', + 'workflow.signature_zone.user' => 'user', ], ]) ->add('futurePersonSignatures', PickPersonDynamicType::class, [ - 'label' => 'workflow.person signatures', + 'label' => 'workflow.signature_zone.person signatures', 'multiple' => true, + 'data' => [] ]) ->add('futureUserSignature', PickUserDynamicType::class, [ - 'label' => 'workflow.user signatures', + 'label' => 'workflow.signature_zone.user signature', 'multiple' => false, ]) ->add('futureDestUsers', PickUserDynamicType::class, [ 'label' => 'workflow.dest for next steps', 'multiple' => true, + 'data' => [], 'suggested' => $options['suggested_users'], ]) ->add('futureCcUsers', PickUserDynamicType::class, [ diff --git a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js index dc1dc9643..1536417b1 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js @@ -7,69 +7,20 @@ window.addEventListener('DOMContentLoaded', function() { personSignatureField = document.querySelector('#person-signature-field'); userSignatureField = document.querySelector('#user-signature-field'); signatureTypeChoices = document.querySelector('#signature-type-choice'); - ; + personChoice = document.querySelector('#workflow_step_isPersonOrUserSignature_0'); + userChoice = document.querySelector('#workflow_step_isPersonOrUserSignature_1'); + signatureZone = document.querySelector('#signature-zone'); + ; let transitionFilterContainer = document.querySelector('#transitionFilter'), transitionsContainer = document.querySelector('#transitions') ; - // ShowHide instance for personSignatureField - new ShowHide({ - debug: false, - froms: [signatureTypeChoices], - container: [personSignatureField], - test: function(froms, event) { - // console.log('froms', froms) - for (let container of froms) { - if (container.children.length === 0) { - console.log('im empty dont show person or user picker'); - return false - } else { - return container.querySelector('input[value="person"]').checked; - } - } - return false; - }, - }); + // ShowHide instance for signatureTypeChoices. This should always be present in the DOM and we toggle visibility. + // The field is not mapped and so not submitted with the form. Without it's presence upon DOM loading other show hides do not function well. + signatureTypeChoices.style.display = 'none'; - // ShowHide instance for userSignatureField - new ShowHide({ - debug: false, - froms: [signatureTypeChoices], - container: [userSignatureField], - test: function(froms, event) { - for (let container of froms) { - if (container.children.length === 0) { - console.log('im empty dont show person or user picker'); - return false - } else { - return container.querySelector('input[value="person"]').checked; - } - } - return false; - }, - }); - - // ShowHide instance for signatureTypeChoices - new ShowHide({ - debug: false, - load_event: null, - froms: [divTransitions], - container: [signatureTypeChoices], - test: function(froms, event) { - for (let transition of froms) { - for (let input of transition.querySelectorAll('input')) { - if (input.checked) { - const inputData = JSON.parse(input.getAttribute('data-is-signature')) - return inputData.includes('person') && inputData.includes('user'); - } - } - } - - return false; - } - }); // ShowHide instance for future dest users new ShowHide({ @@ -82,7 +33,16 @@ window.addEventListener('DOMContentLoaded', function() { for (let input of transition.querySelectorAll('input')) { if (input.checked) { const inputData = JSON.parse(input.getAttribute('data-is-signature')) - return !(inputData.includes('person') || inputData.includes('user')); + if (inputData.includes('person') || inputData.includes('user')) { + signatureTypeChoices.style.display = ''; + return false; + } else { + personChoice.checked = false + userChoice.checked = false + + signatureTypeChoices.style.display = 'none'; + return true; + } } } } @@ -90,6 +50,53 @@ window.addEventListener('DOMContentLoaded', function() { } }); + // ShowHide signature zone + new ShowHide({ + debug: false, + load_event: null, + froms: [divTransitions], + container: [signatureZone], + test: function(froms, event) { + for (let transition of froms) { + for (let input of transition.querySelectorAll('input')) { + if (input.checked) { + const inputData = JSON.parse(input.getAttribute('data-is-signature')) + if (inputData.includes('person') || inputData.includes('user')) { + signatureTypeChoices.style.display = ''; + return true; + } + } + } + } + return false; + } + }); + + // ShowHides for personSignatureField or userSignatureField within signature zone + new ShowHide({ + debug: false, + froms: [signatureTypeChoices], + container: [personSignatureField], + test: function(froms, event) { + for (let container of froms) { + return personChoice.checked; + } + return false; + }, + }); + + new ShowHide({ + debug: false, + froms: [signatureTypeChoices], + container: [userSignatureField], + test: function(froms, event) { + for (let container of froms) { + return userChoice.checked; + } + return false; + }, + }); + if (null !== divTransitions) { new ShowHide({ load_event: null, diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig index 391e42324..ac85525a6 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig @@ -58,7 +58,7 @@ {{ form_row(transition_form.transition) }} -
+
{{ form_row(transition_form.isPersonOrUserSignature) }} {{ form_errors(transition_form.isPersonOrUserSignature) }} diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 924ccec3a..9a90b7fa1 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -536,6 +536,11 @@ workflow: docType: Type de document docNumber: Numéro de document docExpiration: Date d'expiration + type of signature: Type de signature + person signatures: Selectionner usagers pour signer + user signature: Selectionner utilisateur pour signer + persons: Usagers + user: Utilisateur Subscribe final: Recevoir une notification à l'étape finale From 5623cf946e3dbdbec165977e9220e504ca6b3de4 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 24 Jul 2024 11:06:30 +0200 Subject: [PATCH 10/14] Set empty_data option to allow empty array to be passed --- .../DependencyInjection/Configuration.php | 50 +++++++++---------- .../ChillMainBundle/Form/WorkflowStepType.php | 5 +- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php index 2185375b6..bf62e0322 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php @@ -85,6 +85,30 @@ class Configuration implements ConfigurationInterface ->end() ->end() ->end() // end of notifications + ->arrayNode('workflow_signature') + ->children() + ->arrayNode('base_signer') + ->children() + ->arrayNode('document_kinds') + ->arrayPrototype() + ->children() + ->scalarNode('key')->cannotBeEmpty()->end() + ->arrayNode('labels') + ->arrayPrototype() + ->children() + ->scalarNode('lang')->cannotBeEmpty()->end() + ->scalarNode('label')->cannotBeEmpty()->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() // end of workflow signature document types ->arrayNode('phone_helper') ->canBeUnset() ->children() @@ -277,32 +301,6 @@ class Configuration implements ConfigurationInterface ->end() // end of root ; - $rootNode->children() - ->arrayNode('workflow_signature') - ->children() - ->arrayNode('base_signer') - ->children() - ->arrayNode('document_kinds') - ->arrayPrototype() - ->children() - ->scalarNode('key')->cannotBeEmpty()->end() - ->arrayNode('labels') - ->arrayPrototype() - ->children() - ->scalarNode('lang')->cannotBeEmpty()->end() - ->scalarNode('label')->cannotBeEmpty()->end() - ->end() - ->end() - ->end() - ->end() - ->end() - ->end() - ->end() - ->end() - ->end() - ->end() - ->end(); - $rootNode->children() ->arrayNode('add_address')->addDefaultsIfNotSet()->children() ->scalarNode('default_country')->cannotBeEmpty()->defaultValue('BE')->end() diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index 8d5f8c819..a113c62c5 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -150,7 +150,7 @@ class WorkflowStepType extends AbstractType ->add('futurePersonSignatures', PickPersonDynamicType::class, [ 'label' => 'workflow.signature_zone.person signatures', 'multiple' => true, - 'data' => [] + 'empty_data' => '[]', ]) ->add('futureUserSignature', PickUserDynamicType::class, [ 'label' => 'workflow.signature_zone.user signature', @@ -159,7 +159,7 @@ class WorkflowStepType extends AbstractType ->add('futureDestUsers', PickUserDynamicType::class, [ 'label' => 'workflow.dest for next steps', 'multiple' => true, - 'data' => [], + 'empty_data' => '[]', 'suggested' => $options['suggested_users'], ]) ->add('futureCcUsers', PickUserDynamicType::class, [ @@ -167,6 +167,7 @@ class WorkflowStepType extends AbstractType 'multiple' => true, 'required' => false, 'suggested' => $options['suggested_users'], + 'empty_data' => '[]', 'attr' => ['class' => 'future-cc-users'], ]) ->add('futureDestEmails', ChillCollectionType::class, [ From 15f3e474a08ec734e97bd529b43ab5a119ecc343 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 24 Jul 2024 11:32:08 +0200 Subject: [PATCH 11/14] Remove trailing end() in MainBundle configuration --- src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php index bf62e0322..16130f193 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php @@ -107,7 +107,6 @@ class Configuration implements ConfigurationInterface ->end() ->end() ->end() - ->end() ->end() // end of workflow signature document types ->arrayNode('phone_helper') ->canBeUnset() From bf66af0f25ce4a022cb903ec45572776cdba0bf9 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 24 Jul 2024 11:54:07 +0200 Subject: [PATCH 12/14] Fix configuration of workflow signature document kinds --- .../DependencyInjection/ChillMainExtension.php | 4 ++-- .../ChillMainBundle/Form/WorkflowSignatureMetadataType.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 0d90854b4..df2b6532a 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -193,10 +193,10 @@ class ChillMainExtension extends Extension implements [] ); - $container->setParameter( +/* $container->setParameter( 'chill_main.workflow_signatures.base_signer.document_kinds', $config['workflow_signature']['base_signer']['document_kinds'] - ); + );*/ $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); $loader->load('services.yaml'); diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowSignatureMetadataType.php b/src/Bundle/ChillMainBundle/Form/WorkflowSignatureMetadataType.php index 47be9b88c..a23164784 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowSignatureMetadataType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowSignatureMetadataType.php @@ -25,7 +25,7 @@ class WorkflowSignatureMetadataType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options): void { - $documentTypeChoices = $this->parameterBag->get('chill_main.id_document_kinds'); + $documentTypeChoices = $this->parameterBag->get('chill_main.workflow_signatures.base_signer.document_kinds'); $choices = []; From d75607a1d2c265eadda520a7c5fcca68ca17a655 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 24 Jul 2024 12:00:10 +0200 Subject: [PATCH 13/14] Php cs fixes --- .../DependencyInjection/ChillMainExtension.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index df2b6532a..66fbae633 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -193,10 +193,10 @@ class ChillMainExtension extends Extension implements [] ); -/* $container->setParameter( - 'chill_main.workflow_signatures.base_signer.document_kinds', - $config['workflow_signature']['base_signer']['document_kinds'] - );*/ + /* $container->setParameter( + 'chill_main.workflow_signatures.base_signer.document_kinds', + $config['workflow_signature']['base_signer']['document_kinds'] + );*/ $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); $loader->load('services.yaml'); From 44226d6f7f28e134ce31952a56c7348ffd839189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 24 Jul 2024 13:07:47 +0200 Subject: [PATCH 14/14] Fix the config's path to workflow signature - typo - load the config's array instead of the path to the config --- .../DependencyInjection/ChillMainExtension.php | 5 ----- .../ChillMainBundle/Form/WorkflowSignatureMetadataType.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 66fbae633..4dde2076c 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -193,11 +193,6 @@ class ChillMainExtension extends Extension implements [] ); - /* $container->setParameter( - 'chill_main.workflow_signatures.base_signer.document_kinds', - $config['workflow_signature']['base_signer']['document_kinds'] - );*/ - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); $loader->load('services.yaml'); $loader->load('services/doctrine.yaml'); diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowSignatureMetadataType.php b/src/Bundle/ChillMainBundle/Form/WorkflowSignatureMetadataType.php index a23164784..114a462f6 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowSignatureMetadataType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowSignatureMetadataType.php @@ -25,7 +25,7 @@ class WorkflowSignatureMetadataType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options): void { - $documentTypeChoices = $this->parameterBag->get('chill_main.workflow_signatures.base_signer.document_kinds'); + $documentTypeChoices = $this->parameterBag->get('chill_main')['workflow_signature']['base_signer']['document_kinds']; $choices = [];