Resolve "Fusion actions d'accompagnement"

This commit is contained in:
2025-07-02 10:53:16 +00:00
committed by Julien Fastré
parent b4bbb1a456
commit 840ef6eed8
30 changed files with 1367 additions and 32 deletions

View File

@@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Form;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Form\Type\PickLinkedAccompanyingPeriodWorkType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class FindAccompanyingPeriodWorkType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('acpw', PickLinkedAccompanyingPeriodWorkType::class, [
'label' => 'Social action',
'multiple' => false,
'accompanyingPeriod' => $options['accompanyingPeriod'],
])
->add('direction', HiddenType::class, [
'data' => 'starting',
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setRequired('accompanyingPeriod')
->setAllowedTypes('accompanyingPeriod', AccompanyingPeriod::class);
}
}

View File

@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Form\Type;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PickLinkedAccompanyingPeriodWorkType extends AbstractType
{
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['multiple'] = $options['multiple'];
$view->vars['types'] = ['acpw'];
$view->vars['uniqid'] = uniqid('pick_acpw_dyn');
$view->vars['as_id'] = true === $options['as_id'] ? '1' : '0';
$view->vars['submit_on_adding_new_entity'] = false;
$view->vars['pick-entities-type'] = 'acpw';
$view->vars['attr']['data-accompanying-period-id'] = $options['accompanyingPeriod']->getId();
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setRequired('accompanyingPeriod')
->setAllowedTypes('accompanyingPeriod', [AccompanyingPeriod::class])
->setDefault('multiple', false)
->setAllowedTypes('multiple', ['bool'])
->setDefault('compound', false)
->setDefault('as_id', false)
->setAllowedTypes('as_id', ['bool'])
->setDefault('submit_on_adding_new_entity', false)
->setAllowedTypes('submit_on_adding_new_entity', ['bool']);
}
public function getBlockPrefix()
{
return 'pick_linked_entities';
}
}