mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 15:43:51 +00:00
Implement show and hide logic within workflow form
This commit is contained in:
@@ -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',
|
||||
|
Reference in New Issue
Block a user