mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-28 04:56:13 +00:00
Merge branch 'add-dependents' into 'master'
add household properties : number of dependents and number of dependents with disabilities See merge request Chill-Projet/chill-bundles!778
This commit is contained in:
commit
fc32f9eca9
@ -18,6 +18,7 @@ use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
class ExportType extends AbstractType
|
||||
{
|
||||
@ -29,7 +30,15 @@ class ExportType extends AbstractType
|
||||
|
||||
final public const PICK_FORMATTER_KEY = 'pick_formatter';
|
||||
|
||||
public function __construct(private readonly ExportManager $exportManager, private readonly SortExportElement $sortExportElement) {}
|
||||
private array $personFieldsConfig;
|
||||
|
||||
public function __construct(
|
||||
private readonly ExportManager $exportManager,
|
||||
private readonly SortExportElement $sortExportElement,
|
||||
protected ParameterBagInterface $parameterBag,
|
||||
) {
|
||||
$this->personFieldsConfig = $parameterBag->get('chill_person.person_fields');
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
@ -77,6 +86,17 @@ class ExportType extends AbstractType
|
||||
);
|
||||
|
||||
foreach ($aggregators as $alias => $aggregator) {
|
||||
/*
|
||||
* eventually mask aggregator
|
||||
*/
|
||||
if (str_starts_with((string) $alias, 'person_') and str_ends_with((string) $alias, '_aggregator')) {
|
||||
$field = preg_replace(['/person_/', '/_aggregator/'], '', (string) $alias);
|
||||
if (array_key_exists($field, $this->personFieldsConfig) and 'visible' !== $this->personFieldsConfig[$field]) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$aggregatorBuilder->add($alias, AggregatorType::class, [
|
||||
'aggregator_alias' => $alias,
|
||||
'export_manager' => $this->exportManager,
|
||||
|
@ -0,0 +1,26 @@
|
||||
<?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\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class AdministrativeStatusController extends CRUDController
|
||||
{
|
||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
|
||||
{
|
||||
$query->addOrderBy('e.order', 'ASC');
|
||||
|
||||
return parent::orderQuery($action, $query, $request, $paginator);
|
||||
}
|
||||
}
|
@ -33,9 +33,12 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Serializer\Exception;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
class HouseholdMemberController extends ApiController
|
||||
{
|
||||
private array $household_fields_visibility;
|
||||
|
||||
public function __construct(
|
||||
private readonly UrlGeneratorInterface $generator,
|
||||
private readonly TranslatorInterface $translator,
|
||||
@ -45,7 +48,10 @@ class HouseholdMemberController extends ApiController
|
||||
private readonly Security $security,
|
||||
private readonly PositionRepository $positionRepository,
|
||||
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
|
||||
) {}
|
||||
protected ParameterBagInterface $parameterBag,
|
||||
) {
|
||||
$this->household_fields_visibility = $parameterBag->get('chill_person.household_fields');
|
||||
}
|
||||
|
||||
#[Route(path: '/{_locale}/person/household/member/{id}/edit', name: 'chill_person_household_member_edit')]
|
||||
public function editMembership(Request $request, HouseholdMember $member): Response
|
||||
@ -144,6 +150,7 @@ class HouseholdMemberController extends ApiController
|
||||
'allowHouseholdCreate' => $allowHouseholdCreate ?? true,
|
||||
'allowHouseholdSearch' => $allowHouseholdSearch ?? true,
|
||||
'allowLeaveWithoutHousehold' => $allowLeaveWithoutHousehold ?? $request->query->has('allow_leave_without_household'),
|
||||
'displayDependents' => ('visible' == $this->household_fields_visibility['number_of_dependents']) ? true : false,
|
||||
];
|
||||
|
||||
// context
|
||||
|
@ -0,0 +1,43 @@
|
||||
<?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\DataFixtures\ORM;
|
||||
|
||||
use Chill\PersonBundle\Entity\AdministrativeStatus;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
class LoadAdministrativeStatus extends Fixture implements FixtureGroupInterface
|
||||
{
|
||||
public static function getGroups(): array
|
||||
{
|
||||
return ['administrative_status'];
|
||||
}
|
||||
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
$status = [
|
||||
['name' => ['fr' => 'situation administrative régulière']],
|
||||
['name' => ['fr' => 'sans papier']],
|
||||
['name' => ['fr' => 'séjour provisoire']],
|
||||
];
|
||||
|
||||
foreach ($status as $val) {
|
||||
$administrativeStatus = (new AdministrativeStatus())
|
||||
->setName($val['name'])
|
||||
->setActive(true);
|
||||
$manager->persist($administrativeStatus);
|
||||
}
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
}
|
@ -15,12 +15,15 @@ use Chill\MainBundle\DependencyInjection\MissingBundleException;
|
||||
use Chill\MainBundle\Security\Authorization\ChillExportVoter;
|
||||
use Chill\PersonBundle\Controller\AccompanyingPeriodCommentApiController;
|
||||
use Chill\PersonBundle\Controller\AccompanyingPeriodResourceApiController;
|
||||
use Chill\PersonBundle\Controller\AdministrativeStatusController;
|
||||
use Chill\PersonBundle\Controller\EmploymentStatusController;
|
||||
use Chill\PersonBundle\Controller\HouseholdCompositionTypeApiController;
|
||||
use Chill\PersonBundle\Controller\RelationApiController;
|
||||
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AdministrativeStatus;
|
||||
use Chill\PersonBundle\Entity\EmploymentStatus;
|
||||
use Chill\PersonBundle\Form\AdministrativeStatusType;
|
||||
use Chill\PersonBundle\Form\EmploymentStatusType;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodCommentVoter;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodResourceVoter;
|
||||
@ -57,6 +60,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
|
||||
$this->handlePersonFieldsParameters($container, $config['person_fields']);
|
||||
$this->handleAccompanyingPeriodsFieldsParameters($container, $config['accompanying_periods_fields']);
|
||||
$this->handleHouseholdFieldsParameters($container, $config['household_fields']);
|
||||
|
||||
$container->setParameter(
|
||||
'chill_person.allow_multiple_simultaneous_accompanying_periods',
|
||||
@ -132,6 +136,9 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
'chill_accompanying_periods' => [
|
||||
'fields' => $config['accompanying_periods_fields'],
|
||||
],
|
||||
'chill_household' => [
|
||||
'fields' => $config['household_fields'],
|
||||
],
|
||||
],
|
||||
'form_themes' => ['@ChillPerson/Export/ListPersonFormFields.html.twig'],
|
||||
];
|
||||
@ -195,6 +202,28 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => AdministrativeStatus::class,
|
||||
'name' => 'administrative_status',
|
||||
'base_path' => '/admin/administrative',
|
||||
'base_role' => 'ROLE_ADMIN',
|
||||
'form_class' => AdministrativeStatusType::class,
|
||||
'controller' => AdministrativeStatusController::class,
|
||||
'actions' => [
|
||||
'index' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillPerson/AdministrativeStatus/index.html.twig',
|
||||
],
|
||||
'new' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillPerson/AdministrativeStatus/new.html.twig',
|
||||
],
|
||||
'edit' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillPerson/AdministrativeStatus/edit.html.twig',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => EmploymentStatus::class,
|
||||
'name' => 'employment_status',
|
||||
@ -1117,6 +1146,23 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
}
|
||||
}
|
||||
|
||||
private function handleHouseholdFieldsParameters(ContainerBuilder $container, $config)
|
||||
{
|
||||
$container->setParameter('chill_person.household_fields', $config);
|
||||
|
||||
foreach ($config as $key => $value) {
|
||||
switch ($key) {
|
||||
case 'enabled':
|
||||
break;
|
||||
|
||||
default:
|
||||
$container->setParameter('chill_person.household_fields.'.$key, $value);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function handlePersonFieldsParameters(ContainerBuilder $container, $config)
|
||||
{
|
||||
if (\array_key_exists('enabled', $config)) {
|
||||
|
@ -83,9 +83,11 @@ class Configuration implements ConfigurationInterface
|
||||
->append($this->addFieldNode('accompanying_period'))
|
||||
->append($this->addFieldNode('memo'))
|
||||
->append($this->addFieldNode('number_of_children'))
|
||||
->append($this->addFieldNode('number_of_dependents', 'hidden'))
|
||||
->append($this->addFieldNode('acceptEmail'))
|
||||
->append($this->addFieldNode('deathdate'))
|
||||
->append($this->addFieldNode('employment_status', 'hidden'))
|
||||
->append($this->addFieldNode('administrative_status', 'hidden'))
|
||||
->arrayNode('alt_names')
|
||||
->defaultValue([])
|
||||
->arrayPrototype()
|
||||
@ -108,6 +110,12 @@ class Configuration implements ConfigurationInterface
|
||||
->end()
|
||||
->end() // children for 'person_fields', parent = array 'person_fields'
|
||||
->end() // person_fields, parent = children of root
|
||||
->arrayNode('household_fields')
|
||||
->canBeDisabled()
|
||||
->children()
|
||||
->append($this->addFieldNode('number_of_dependents', 'hidden'))
|
||||
->end()
|
||||
->end()
|
||||
->arrayNode('accompanying_periods_fields')
|
||||
->canBeDisabled()
|
||||
->children()
|
||||
|
81
src/Bundle/ChillPersonBundle/Entity/AdministrativeStatus.php
Normal file
81
src/Bundle/ChillPersonBundle/Entity/AdministrativeStatus.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?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\Entity;
|
||||
|
||||
use Chill\PersonBundle\Repository\AdministrativeStatusRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
|
||||
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_person_administrative_status' => AdministrativeStatus::class])]
|
||||
#[ORM\Entity(repositoryClass: AdministrativeStatusRepository::class)]
|
||||
#[ORM\Table(name: 'chill_person_administrative_status')]
|
||||
class AdministrativeStatus
|
||||
{
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
private ?int $id = null;
|
||||
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
|
||||
#[Serializer\Context(['is-translatable' => true], groups: ['docgen:read'])]
|
||||
private array $name = [];
|
||||
|
||||
#[Serializer\Groups(['read'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
private bool $active = true;
|
||||
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'ordering', nullable: true, options: ['default' => '0.0'])]
|
||||
private float $order = 0;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getActive(): ?bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function getName(): ?array
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getOrder(): ?float
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
public function setActive(bool $active): self
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setName(array $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setOrder(float $order): self
|
||||
{
|
||||
$this->order = $order;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -11,11 +11,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Entity;
|
||||
|
||||
use Chill\PersonBundle\Repository\EmploymentStatusRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
|
||||
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_person_employment_status' => EmploymentStatus::class])]
|
||||
#[ORM\Entity]
|
||||
#[ORM\Entity(repositoryClass: EmploymentStatusRepository::class)]
|
||||
#[ORM\Table(name: 'chill_person_employment_status')]
|
||||
class EmploymentStatus
|
||||
{
|
||||
|
@ -58,6 +58,18 @@ class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterfa
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true, options: ['default' => null])]
|
||||
private ?int $numberOfChildren = null;
|
||||
|
||||
#[Assert\NotNull]
|
||||
#[Assert\GreaterThanOrEqual(0, groups: ['Default', 'household_composition'])]
|
||||
#[Serializer\Groups(['docgen:read'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true, options: ['default' => null])]
|
||||
private ?int $numberOfDependents = null;
|
||||
|
||||
#[Assert\NotNull]
|
||||
#[Assert\GreaterThanOrEqual(0, groups: ['Default', 'household_composition'])]
|
||||
#[Serializer\Groups(['docgen:read'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true, options: ['default' => null])]
|
||||
private ?int $numberOfDependentsWithDisabilities = null;
|
||||
|
||||
#[Assert\NotNull(groups: ['Default', 'household_composition'])]
|
||||
#[Serializer\Groups(['docgen:read'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: false)]
|
||||
@ -98,6 +110,16 @@ class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterfa
|
||||
return $this->numberOfChildren;
|
||||
}
|
||||
|
||||
public function getNumberOfDependents(): ?int
|
||||
{
|
||||
return $this->numberOfDependents;
|
||||
}
|
||||
|
||||
public function getNumberOfDependentsWithDisabilities(): ?int
|
||||
{
|
||||
return $this->numberOfDependentsWithDisabilities;
|
||||
}
|
||||
|
||||
public function getStartDate(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->startDate;
|
||||
@ -142,6 +164,20 @@ class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterfa
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setNumberOfDependents(?int $numberOfDependents): HouseholdComposition
|
||||
{
|
||||
$this->numberOfDependents = $numberOfDependents;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setNumberOfDependentsWithDisabilities(?int $numberOfDependentsWithDisabilities): HouseholdComposition
|
||||
{
|
||||
$this->numberOfDependentsWithDisabilities = $numberOfDependentsWithDisabilities;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setStartDate(?\DateTimeImmutable $startDate): HouseholdComposition
|
||||
{
|
||||
$this->startDate = $startDate;
|
||||
|
@ -304,6 +304,13 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
private string $memo = '';
|
||||
|
||||
/**
|
||||
* The person's administrative status.
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: AdministrativeStatus::class)]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?AdministrativeStatus $administrativeStatus = null;
|
||||
|
||||
/**
|
||||
* The person's mobile phone number.
|
||||
*/
|
||||
@ -777,6 +784,11 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
return $this->addresses;
|
||||
}
|
||||
|
||||
public function getAdministrativeStatus(): ?AdministrativeStatus
|
||||
{
|
||||
return $this->administrativeStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the age of a person, calculated at the date 'now'.
|
||||
*
|
||||
@ -1420,6 +1432,13 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAdministrativeStatus(?AdministrativeStatus $administrativeStatus): self
|
||||
{
|
||||
$this->administrativeStatus = $administrativeStatus;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAcceptSMS(bool $acceptSMS): self
|
||||
{
|
||||
$this->acceptSMS = $acceptSMS;
|
||||
|
@ -0,0 +1,76 @@
|
||||
<?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\Export\Aggregator\PersonAggregators;
|
||||
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Repository\AdministrativeStatusRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
final readonly class AdministrativeStatusAggregator implements AggregatorInterface
|
||||
{
|
||||
public function __construct(private AdministrativeStatusRepository $administrativeStatusRepository, private TranslatableStringHelper $translatableStringHelper) {}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->leftJoin('person.administrativeStatus', 'admin_status');
|
||||
$qb->addSelect('admin_status.id as administrative_status_aggregator');
|
||||
|
||||
$qb->addGroupBy('administrative_status_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn()
|
||||
{
|
||||
return Declarations::PERSON_TYPE;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder) {}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'Administrative status';
|
||||
}
|
||||
|
||||
if (null === $value || '' === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$g = $this->administrativeStatusRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize($g->getName());
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
{
|
||||
return ['administrative_status_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return 'Group people by administrative status';
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
<?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\Export\Aggregator\PersonAggregators;
|
||||
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Repository\EmploymentStatusRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
final readonly class EmploymentStatusAggregator implements AggregatorInterface
|
||||
{
|
||||
public function __construct(private EmploymentStatusRepository $employmentStatusRepository, private TranslatableStringHelper $translatableStringHelper) {}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->leftJoin('person.employmentStatus', 'es');
|
||||
$qb->addSelect('es.id as employment_status_aggregator');
|
||||
|
||||
$qb->addGroupBy('employment_status_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn()
|
||||
{
|
||||
return Declarations::PERSON_TYPE;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder) {}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'Employment status';
|
||||
}
|
||||
|
||||
if (null === $value || '' === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$g = $this->employmentStatusRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize($g->getName());
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
{
|
||||
return ['employment_status_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return 'Group people by employment status';
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
<?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\MainBundle\Form\Type\TranslatableStringFormType;
|
||||
use Chill\PersonBundle\Entity\AdministrativeStatus;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class AdministrativeStatusType extends \Symfony\Component\Form\AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name', TranslatableStringFormType::class, [
|
||||
'required' => true,
|
||||
])
|
||||
->add('active', ChoiceType::class, [
|
||||
'choices' => [
|
||||
'Active' => true,
|
||||
'Inactive' => false,
|
||||
],
|
||||
])
|
||||
->add('order', NumberType::class);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => AdministrativeStatus::class,
|
||||
]);
|
||||
}
|
||||
}
|
@ -19,10 +19,19 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
class HouseholdCompositionType extends AbstractType
|
||||
{
|
||||
public function __construct(private readonly HouseholdCompositionTypeRepository $householdCompositionTypeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) {}
|
||||
private array $household_fields_visibility;
|
||||
|
||||
public function __construct(
|
||||
private readonly HouseholdCompositionTypeRepository $householdCompositionTypeRepository,
|
||||
private readonly TranslatableStringHelperInterface $translatableStringHelper,
|
||||
protected ParameterBagInterface $parameterBag,
|
||||
) {
|
||||
$this->household_fields_visibility = $parameterBag->get('chill_person.household_fields');
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
@ -42,7 +51,19 @@ class HouseholdCompositionType extends AbstractType
|
||||
->add('numberOfChildren', IntegerType::class, [
|
||||
'required' => true,
|
||||
'label' => 'household_composition.numberOfChildren',
|
||||
]);
|
||||
if ('visible' == $this->household_fields_visibility['number_of_dependents']) {
|
||||
$builder
|
||||
->add('numberOfDependents', IntegerType::class, [
|
||||
'required' => true,
|
||||
'label' => 'household_composition.numberOfDependents',
|
||||
])
|
||||
->add('numberOfDependentsWithDisabilities', IntegerType::class, [
|
||||
'required' => true,
|
||||
'label' => 'household_composition.numberOfDependentsWithDisabilities',
|
||||
]);
|
||||
}
|
||||
$builder
|
||||
->add('comment', CommentType::class, [
|
||||
'required' => false,
|
||||
]);
|
||||
|
@ -26,6 +26,7 @@ use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\PersonPhone;
|
||||
use Chill\PersonBundle\Form\Type\PersonAltNameType;
|
||||
use Chill\PersonBundle\Form\Type\PersonPhoneType;
|
||||
use Chill\PersonBundle\Form\Type\PickAdministrativeStatusType;
|
||||
use Chill\PersonBundle\Form\Type\PickEmploymentStatusType;
|
||||
use Chill\PersonBundle\Form\Type\PickGenderType;
|
||||
use Chill\PersonBundle\Form\Type\Select2MaritalStatusType;
|
||||
@ -108,6 +109,11 @@ class PersonType extends AbstractType
|
||||
->add('employmentStatus', PickEmploymentStatusType::class, ['required' => false]);
|
||||
}
|
||||
|
||||
if ('visible' === $this->config['administrative_status']) {
|
||||
$builder
|
||||
->add('administrativeStatus', PickAdministrativeStatusType::class, ['required' => false]);
|
||||
}
|
||||
|
||||
if ('visible' === $this->config['place_of_birth']) {
|
||||
$builder->add('placeOfBirth', TextType::class, [
|
||||
'required' => false,
|
||||
|
@ -0,0 +1,50 @@
|
||||
<?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 Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Entity\AdministrativeStatus;
|
||||
|
||||
class PickAdministrativeStatusType extends AbstractType
|
||||
{
|
||||
public function __construct(
|
||||
private readonly TranslatableStringHelperInterface $translatableStringHelper,
|
||||
) {}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver
|
||||
->setDefault('label', 'Administrative Status')
|
||||
->setDefault(
|
||||
'choice_label',
|
||||
fn (AdministrativeStatus $administrativeStatus): string => $this->translatableStringHelper->localize($administrativeStatus->getName())
|
||||
)
|
||||
->setDefault(
|
||||
'query_builder',
|
||||
static fn (EntityRepository $er): QueryBuilder => $er->createQueryBuilder('c')
|
||||
->where('c.active = true')
|
||||
->orderBy('c.order'),
|
||||
)
|
||||
->setDefault('placeholder', $this->translatableStringHelper->localize(['Select an option…']))
|
||||
->setDefault('class', AdministrativeStatus::class);
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return EntityType::class;
|
||||
}
|
||||
}
|
@ -65,6 +65,12 @@ class AdminPersonMenuBuilder implements LocalMenuBuilderInterface
|
||||
])->setExtras(['order' => 2035]);
|
||||
}
|
||||
|
||||
if ('visible' == $this->fields_visibility['administrative_status']) {
|
||||
$menu->addChild('Administrative status', [
|
||||
'route' => 'chill_crud_administrative_status_index',
|
||||
])->setExtras(['order' => 2036]);
|
||||
}
|
||||
|
||||
$menu->addChild('person_admin.person_resource_kind', [
|
||||
'route' => 'chill_crud_person_resource-kind_index',
|
||||
])->setExtras(['order' => 2040]);
|
||||
|
@ -0,0 +1,24 @@
|
||||
<?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\Repository;
|
||||
|
||||
use Chill\PersonBundle\Entity\AdministrativeStatus;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class AdministrativeStatusRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, AdministrativeStatus::class);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?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\Repository;
|
||||
|
||||
use Chill\PersonBundle\Entity\EmploymentStatus;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class EmploymentStatusRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, EmploymentStatus::class);
|
||||
}
|
||||
}
|
@ -47,6 +47,36 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="this.displayDependents" class="mb-3 row">
|
||||
<label class="col-form-label col-sm-4 required">{{
|
||||
$t("household_members_editor.composition.number_of_dependents")
|
||||
}}</label>
|
||||
<div class="col-sm-8">
|
||||
<input
|
||||
type="number"
|
||||
v-model="numberOfDependents"
|
||||
min="0"
|
||||
max="30"
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="this.displayDependents" class="mb-3 row">
|
||||
<label class="col-form-label col-sm-4 required">{{
|
||||
$t(
|
||||
"household_members_editor.composition.number_of_dependents_with_disabilities",
|
||||
)
|
||||
}}</label>
|
||||
<div class="col-sm-8">
|
||||
<input
|
||||
type="number"
|
||||
v-model="numberOfDependentsWithDisabilities"
|
||||
min="0"
|
||||
max="30"
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -62,6 +92,11 @@ export default {
|
||||
computed: {
|
||||
...mapState(["householdCompositionTypes"]),
|
||||
...mapGetters(["isHouseholdNew"]),
|
||||
displayDependents: {
|
||||
get() {
|
||||
return window.household_members_editor_data.displayDependents;
|
||||
},
|
||||
},
|
||||
householdCompositionType: {
|
||||
get() {
|
||||
if (this.$store.state.householdCompositionType !== null) {
|
||||
@ -81,6 +116,22 @@ export default {
|
||||
this.$store.commit("setNumberOfChildren", value);
|
||||
},
|
||||
},
|
||||
numberOfDependents: {
|
||||
get() {
|
||||
return this.$store.state.numberOfDependents;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit("setNumberOfDependents", value);
|
||||
},
|
||||
},
|
||||
numberOfDependentsWithDisabilities: {
|
||||
get() {
|
||||
return this.$store.state.numberOfDependentsWithDisabilities;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit("setNumberOfDependentsWithDisabilities", value);
|
||||
},
|
||||
},
|
||||
startDate: {
|
||||
get() {
|
||||
return this.$store.state.startDate;
|
||||
|
@ -91,6 +91,9 @@ const appMessages = {
|
||||
composition: "Composition familiale",
|
||||
household_composition: "Composition du ménage",
|
||||
number_of_children: "Nombre d'enfants mineurs au sein du ménage",
|
||||
number_of_dependents: "Nombre de personnes majeures à charge",
|
||||
number_of_dependents_with_disabilities:
|
||||
"Nombre de personnes à charge reconnues handicapées",
|
||||
},
|
||||
confirmation: {
|
||||
save: "Enregistrer",
|
||||
|
@ -73,6 +73,8 @@ const store = createStore({
|
||||
window.household_members_editor_expand_suggestions === 1,
|
||||
householdCompositionType: null,
|
||||
numberOfChildren: 0,
|
||||
numberOfDependents: 0,
|
||||
numberOfDependentsWithDisabilities: 0,
|
||||
addressesSuggestion: [],
|
||||
showAddressSuggestion: true,
|
||||
householdCompositionTypes: [],
|
||||
@ -322,6 +324,9 @@ const store = createStore({
|
||||
start_date: {
|
||||
datetime: datetimeToISO(ISOToDate(state.startDate)),
|
||||
},
|
||||
number_of_dependents: state.numberOfDependents,
|
||||
number_of_dependents_with_disabilities:
|
||||
state.numberOfDependentsWithDisabilities,
|
||||
};
|
||||
}
|
||||
|
||||
@ -455,6 +460,12 @@ const store = createStore({
|
||||
setNumberOfChildren(state, number) {
|
||||
state.numberOfChildren = Number.parseInt(number);
|
||||
},
|
||||
setNumberOfDependents(state, number) {
|
||||
state.numberOfDependents = Number.parseInt(number);
|
||||
},
|
||||
setNumberOfDependentsWithDisabilities(state, number) {
|
||||
state.numberOfDependentsWithDisabilities = Number.parseInt(number);
|
||||
},
|
||||
addAddressesSuggestion(state, addresses) {
|
||||
let existingIds = state.addressesSuggestion.map((a) => a.address_id);
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
|
||||
|
||||
{% block title %}
|
||||
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
|
||||
{% endblock %}
|
||||
|
||||
{% block admin_content %}
|
||||
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
||||
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock admin_content %}
|
@ -0,0 +1,42 @@
|
||||
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
|
||||
|
||||
{% block admin_content %}
|
||||
{% embed '@ChillMain/CRUD/_index.html.twig' %}
|
||||
{% block table_entities_thead_tr %}
|
||||
<th>id</th>
|
||||
<th>{{ 'name'|trans }}</th>
|
||||
<th>{{ 'active'|trans }}</th>
|
||||
<th>{{ 'ordering'|trans }}</th>
|
||||
<th></th>
|
||||
{% endblock %}
|
||||
{% block table_entities_tbody %}
|
||||
{% for entity in entities %}
|
||||
<tr>
|
||||
<td>{{ entity.id }}</td>
|
||||
<td>{{ entity.name|localize_translatable_string }}</td>
|
||||
<td style="text-align:center;">
|
||||
{%- if entity.active -%}
|
||||
<i class="fa fa-check-square-o"></i>
|
||||
{%- else -%}
|
||||
<i class="fa fa-square-o"></i>
|
||||
{%- endif -%}
|
||||
</td>
|
||||
<td>{{ entity.order }}</td>
|
||||
<td>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_crud_administrative_status_edit', { 'id': entity.id}) }}" class="btn btn-sm btn-edit btn-mini"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block actions_before %}
|
||||
<li class='cancel'>
|
||||
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
|
||||
</li>
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
@ -0,0 +1,11 @@
|
||||
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
|
||||
|
||||
{% block title %}
|
||||
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
|
||||
{% endblock %}
|
||||
|
||||
{% block admin_content %}
|
||||
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
|
||||
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock admin_content %}
|
@ -63,6 +63,12 @@
|
||||
</h6>
|
||||
<p>
|
||||
{{ 'household_composition.numberOfChildren children in household'|trans({'numberOfChildren': currentComposition.numberOfChildren}) }}
|
||||
{% if chill_household.fields.number_of_dependents == 'visible' %}
|
||||
<br />
|
||||
{{ 'household_composition.numberOfDependents adult dependents'|trans({'numberOfDependents': currentComposition.numberOfDependents}) }}
|
||||
<br />
|
||||
{{ 'household_composition.numberOfDependentsWithDisabilities dependents with disabilities'|trans({'numberOfDependentsWithDisabilities': currentComposition.numberOfDependentsWithDisabilities}) }}
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>
|
||||
{{ 'household_composition.Since'|trans({'startDate': currentComposition.startDate}) }}
|
||||
|
@ -21,6 +21,10 @@
|
||||
<div class="item-col">
|
||||
<h3>{{ c.householdCompositionType.label|localize_translatable_string }}</h3>
|
||||
<p>{{ 'household_composition.numberOfChildren'|trans }}: {{ c.numberOfChildren }}</p>
|
||||
{% if chill_household.fields.number_of_dependents == 'visible' %}
|
||||
<p>{{ 'household_composition.numberOfDependents'|trans }}: {{ c.numberOfDependents }}</p>
|
||||
<p>{{ 'household_composition.numberOfDependentsWithDisabilities'|trans }}: {{ c.numberOfDependentsWithDisabilities }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="item-col" style="justify-content: flex-end">{{ 'household_composition.Since'|trans({'startDate': c.startDate}) }}</div>
|
||||
</div>
|
||||
|
@ -107,6 +107,9 @@
|
||||
{%- if form.spokenLanguages is defined -%}
|
||||
{{ form_row(form.spokenLanguages, {'label' : 'Spoken languages'}) }}
|
||||
{%- endif -%}
|
||||
{%- if form.administrativeStatus is defined -%}
|
||||
{{ form_row(form.administrativeStatus, {'label' : 'Administrative status'}) }}
|
||||
{%- endif -%}
|
||||
{%- if form.employmentStatus is defined -%}
|
||||
{{ form_row(form.employmentStatus, {'label' : 'Employment status'}) }}
|
||||
{%- endif -%}
|
||||
|
@ -170,8 +170,20 @@ This view should receive those arguments:
|
||||
</dd>
|
||||
</dl>
|
||||
{%- endif -%}
|
||||
{% if chill_person.fields.administrative_status == 'visible' %}
|
||||
<dl>
|
||||
<dt>{{ 'Administrative status'|trans }} :</dt>
|
||||
<dd>
|
||||
{% if person.administrativeStatus is not empty %}
|
||||
{{ person.administrativeStatus.name|localize_translatable_string }}
|
||||
{% else %}
|
||||
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
|
||||
{% endif %}
|
||||
</dd>
|
||||
</dl>
|
||||
{% endif %}
|
||||
{% if chill_person.fields.employment_status == 'visible' %}
|
||||
<dl>
|
||||
<dt>{{ 'Employment status'|trans }} :</dt>
|
||||
<dd>
|
||||
{% if person.employmentStatus is not empty %}
|
||||
@ -180,8 +192,8 @@ This view should receive those arguments:
|
||||
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
{% endif %}
|
||||
{%- if chill_person.fields.number_of_children == 'visible' -%}
|
||||
<dl>
|
||||
<dt>{{'Number of children'|trans}} :</dt>
|
||||
@ -194,6 +206,28 @@ This view should receive those arguments:
|
||||
</dd>
|
||||
</dl>
|
||||
{%- endif -%}
|
||||
{%- if chill_person.fields.number_of_dependents == 'isible' -%}
|
||||
<dl>
|
||||
<dt>{{'Number of dependents'|trans}} :</dt>
|
||||
<dd>
|
||||
{% if person.numberOfDependents is not null %}
|
||||
{{ person.numberOfDependents }}
|
||||
{% else %}
|
||||
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
|
||||
{% endif %}
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{{'Number of dependents with disabilities'|trans}} :</dt>
|
||||
<dd>
|
||||
{% if person.numberOfDependents is not null %}
|
||||
{{ person.numberOfDependentsWithDisabilities }}
|
||||
{% else %}
|
||||
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
|
||||
{% endif %}
|
||||
</dd>
|
||||
</dl>
|
||||
{%- endif -%}
|
||||
{%- if chill_person.fields.marital_status == 'visible' -%}
|
||||
<dl>
|
||||
<dt>{{'Marital status'|trans}} :</dt>
|
||||
|
@ -147,6 +147,8 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize
|
||||
if (null !== $data['composition']) {
|
||||
$compositionType = $this->denormalizer->denormalize($data['composition']['household_composition_type'], HouseholdCompositionType::class, $format, $context);
|
||||
$numberOfChildren = $data['composition']['number_of_children'];
|
||||
$numberOfDependents = $data['composition']['number_of_dependents'];
|
||||
$numberOfDependentsWithDisabilities = $data['composition']['number_of_dependents_with_disabilities'];
|
||||
$startDate = $this->denormalizer->denormalize($data['composition']['start_date'], \DateTimeImmutable::class, $format, $context);
|
||||
|
||||
if (null === $compositionType) {
|
||||
@ -156,6 +158,8 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize
|
||||
$householdComposition = (new HouseholdComposition())
|
||||
->setHouseholdCompositionType($compositionType)
|
||||
->setNumberOfChildren($numberOfChildren)
|
||||
->setNumberOfDependents($numberOfDependents)
|
||||
->setNumberOfDependentsWithDisabilities($numberOfDependentsWithDisabilities)
|
||||
->setStartDate($startDate);
|
||||
|
||||
$household->addComposition($householdComposition);
|
||||
|
@ -164,6 +164,20 @@ services:
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: person_marital_status_aggregator }
|
||||
|
||||
chill.person.export.aggregator_administrative_status:
|
||||
class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\AdministrativeStatusAggregator
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: person_administrative_status_aggregator }
|
||||
|
||||
chill.person.export.aggregator_employment_status:
|
||||
class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\EmploymentStatusAggregator
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: person_employment_status_aggregator }
|
||||
|
||||
chill.person.export.aggregator_household_position:
|
||||
class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\HouseholdPositionAggregator
|
||||
autowire: true
|
||||
|
@ -0,0 +1,40 @@
|
||||
<?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\Migrations\Person;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20241127160628 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add administrative status';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE SEQUENCE chill_person_administrative_status_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE chill_person_administrative_status (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, ordering DOUBLE PRECISION DEFAULT \'0.0\', PRIMARY KEY(id))');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD administrativeStatus_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD CONSTRAINT FK_BF210A146E64B00C FOREIGN KEY (administrativeStatus_id) REFERENCES chill_person_administrative_status (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_BF210A146E64B00C ON chill_person_person (administrativeStatus_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP SEQUENCE chill_person_administrative_status_id_seq CASCADE');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP CONSTRAINT FK_BF210A146E64B00C');
|
||||
$this->addSql('DROP TABLE chill_person_administrative_status');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP administrativeStatus_id');
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?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\Migrations\Person;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20241220102357 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add numberOfDependents and numberOfDependentsWithDisabilities';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_household_composition ADD numberOfDependents INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_household_composition ADD numberOfDependentsWithDisabilities INT DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_household_composition DROP numberOfDependents');
|
||||
$this->addSql('ALTER TABLE chill_person_household_composition DROP numberOfDependentsWithDisabilities');
|
||||
}
|
||||
}
|
@ -116,6 +116,20 @@ household_composition:
|
||||
few {# enfants dans le ménage}
|
||||
other {# enfants dans le ménage}
|
||||
}
|
||||
numberOfDependents adult dependents: >-
|
||||
{numberOfDependents, plural,
|
||||
=0 {Aucune personne majeure à charge}
|
||||
one {1 personne majeure à charge}
|
||||
few {# personnes majeures à charge}
|
||||
other {# personnes majeures à charge}
|
||||
}
|
||||
numberOfDependentsWithDisabilities dependents with disabilities: >-
|
||||
{numberOfDependentsWithDisabilities, plural,
|
||||
=0 {Aucune personne à charge reconnue handicapée}
|
||||
one {1 personne à charge reconnue handicapée}
|
||||
few {# personnes à charge reconnue handicapée}
|
||||
other {# personnes à charge reconnue handicapée}
|
||||
}
|
||||
|
||||
periods:
|
||||
title: Parcours d'accompagnement (n°{id})
|
||||
|
@ -100,6 +100,7 @@ numberOfChildren: Nombre d'enfants
|
||||
contactInfo: Commentaire des contacts
|
||||
spokenLanguages: Langues parlées
|
||||
Employment status: Situation professionelle
|
||||
Administrative status: Situation administrative
|
||||
|
||||
|
||||
# dédoublonnage
|
||||
@ -637,6 +638,8 @@ Group by country: Grouper par pays
|
||||
Group people by gender: Grouper les usagers par genre
|
||||
Group people by their professional situation: Grouper les usagers par situation professionelle
|
||||
Group people by marital status: Grouper les usagers par état matrimonial
|
||||
Group people by administrative status: Grouper les usagers par situation administrative
|
||||
Group people by employment status: Grouper les usagers par situation professionelle
|
||||
|
||||
Aggregate by household position: Grouper les usagers par position dans le ménage
|
||||
Household position in relation to this date: Position dans le ménage par rapport à cette date
|
||||
@ -649,6 +652,12 @@ Group people by country of birth: Grouper les usagers par pays de naissance
|
||||
Similar persons: Usagers similaires
|
||||
|
||||
crud:
|
||||
administrative_status:
|
||||
index:
|
||||
title: Situations administratives
|
||||
add_new: Ajouter une nouvelle
|
||||
title_new: Ajouter une situation administrative
|
||||
title_edit: Modifier cette situation administrative
|
||||
closing_motive:
|
||||
index:
|
||||
title: Liste des motifs de clotûre
|
||||
@ -955,6 +964,8 @@ household_composition:
|
||||
Add a composition: Ajouter une composition familiale
|
||||
Update composition: Modifier la composition familiale
|
||||
Create: Créér une nouvelle composition familiale
|
||||
numberOfDependents: Nombre de personnes majeures à charges
|
||||
numberOfDependentsWithDisabilities: Nombre de personnes à charge reconnues handicapées
|
||||
|
||||
# docgen
|
||||
Linked evaluations: Évaluations associées
|
||||
|
Loading…
x
Reference in New Issue
Block a user