diff --git a/.editorconfig b/.editorconfig index fe115d4c0..d51908caf 100644 --- a/.editorconfig +++ b/.editorconfig @@ -18,3 +18,10 @@ max_line_length = 80 [COMMIT_EDITMSG] max_line_length = 0 +<<<<<<< Updated upstream +======= + +[*.{js, vue, ts}] +indent_size = 2 +indent_style = space +>>>>>>> Stashed changes diff --git a/CHANGELOG.md b/CHANGELOG.md index e9b78cdf9..de2a62a0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,16 +11,29 @@ and this project adheres to ## Unreleased +* [admin] refactorisation of the admin section: reorganisation of the menu, translations, form types, new entities (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/592) +* [admin] add admin section for languages and countries (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/596) +* [activity] activity admin: translations + remove label field for comment on admin activity type (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/587) +* [main] admin user_job: improvements (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/588) +* [address] can add extra address info even if noAddress (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/576) + + +## Test releases + +### 2022-05-06 + +* [person] add civility when creating a person (with the on-the-fly component or in the php form) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/557) +* [person] add address when creating a person (with the on-the-fly component or in the php form) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/557) +* [person] add household creation API point (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/557) + +### 2021-04-29 + * [person] prevent circular references in PersonDocGenNormalizer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/527) * [person] add maritalStatusComment to PersonDocGenNormalizer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/582) * Load relationships without gender in french fixtures * Add command to remove old draft accompanying periods * [parcours]: If users assings him/herself as referrer and job is not null. Update parcours job (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/578) - - -## Test releases - ### 2021-04-28 * [address] fix bug when editing address: update location and addressreferenceId + better update of the map in edition (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/593) diff --git a/CONVENTIONS.md b/CONVENTIONS.md index 5b9da225e..f1892e244 100644 --- a/CONVENTIONS.md +++ b/CONVENTIONS.md @@ -2,7 +2,14 @@ en cours de rédaction +## Translations + +Par bundle, toutes les traductions des pages twig se trouvent dans un seul fichier `translations/messages.fr.yaml`. + +## Emplacement des fichiers + +Les controllers, form type & templates twig sont placés à la racine des dossiers `Controller`, `Form` & `Ressources/views`, respectivement. Pour les pages Admin, on ne les mets plus dans des sous-dossiers Admin. ## Assets: nommage des entrypoints Trois types d'entrypoint: @@ -146,19 +153,20 @@ Ces règles n'ont pas toujours été utilisées par le passé. Elles sont souhai Les routes sont nommées de cette manière: -`chill_bundle_entite_action` +`chill_(api|crud)_bundle_(api)_entite_action` 1. d'abord chill_ (pour tous les modules chill) -2. ensuite une string qui est identique, par bundle -3. si le point est un point d'api (json), alors ajouter la string `api` -4. ensuite une string qui indique sur quelle entité porte la route, voire également les sous-entités -5. ensuite une action (`list`, `view`, `edit`, `new`, ...) +2. ensuite `crud` ou `api`, optionnel, automatiquement ajouté si la route est générée par la configuration +3. ensuite une string qui indique le bundle (`main`, `person`, `activity`, ...) +4. ensuite, `api`, si la route est une route d'api. +5. ensuite une string qui indique sur quelle entité porte la route, voire également les sous-entités +6. ensuite une action (`list`, `view`, `edit`, `new`, ...) -Le fait d'indiquer `api` en 3 permet de distinguer les routes d'api qui sont générées par la configuration (qui sont toutes préfixées par `chill_api`, de celles générées manuellement. (Exemple: `chill_api_household__index`, et `chill_person_api_household_members_move`) +Le fait d'indiquer `api` en quatrième position permet de distinguer les routes d'api qui sont générées par la configuration (qui sont toutes préfixées par `chill_api`, de celles générées manuellement. (Exemple: `chill_api_household__index`, et `chill_person_api_household_members_move`) Si les points 4 et 5 sont inexistants, alors ils sont remplacés par d'autres éléments de manière à garantir l'unicité de la route, et sa bonne compréhension. -### URL +### Nommage des URL Les URL respectent également une convention: @@ -219,6 +227,14 @@ Les éléments suivants devraient se trouver dans la liste: Ces éléments peuvent être entrecoupés de l'identifiant d'une entité. Dans ce cas, cet identifiant se place juste après l'entité auquel il se rapporte. +#### Pour les URL de l'espace Admin + +Même conventions que dans les autres pages html de l'application, **mais `admin` est ajouté en deuxième position**. Soit: + + +`/{_locale}/admin/bundle/entity/{id}/action` + + ## Règles UI chill ### Titre des pages diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index 0c0632722..db0d5c7d1 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -15,6 +15,7 @@ use Chill\ActivityBundle\Validator\Constraints as ActivityValidator; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; +use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable; use Chill\MainBundle\Entity\HasCenterInterface; use Chill\MainBundle\Entity\HasScopeInterface; use Chill\MainBundle\Entity\Location; @@ -134,6 +135,12 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac */ private ?Collection $persons = null; + /** + * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_") + * @Groups({"docgen:read"}) + */ + private PrivateCommentEmbeddable $privateComment; + /** * @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason") * @Groups({"docgen:read"}) @@ -193,6 +200,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac { $this->reasons = new ArrayCollection(); $this->comment = new CommentEmbeddable(); + $this->privateComment = new PrivateCommentEmbeddable(); $this->persons = new ArrayCollection(); $this->thirdParties = new ArrayCollection(); $this->documents = new ArrayCollection(); @@ -400,6 +408,11 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac return []; } + public function getPrivateComment(): PrivateCommentEmbeddable + { + return $this->privateComment; + } + public function getReasons(): Collection { return $this->reasons; @@ -586,6 +599,13 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac return $this; } + public function setPrivateComment(PrivateCommentEmbeddable $privateComment): self + { + $this->privateComment = $privateComment; + + return $this; + } + public function setReasons(?ArrayCollection $reasons): self { $this->reasons = $reasons; diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index bdf75ed05..845b31ca2 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -167,6 +167,16 @@ class ActivityType */ private int $personVisible = self::FIELD_REQUIRED; + /** + * @ORM\Column(type="string", nullable=false, options={"default": ""}) + */ + private string $privateCommentLabel = ''; + + /** + * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) + */ + private int $privateCommentVisible = self::FIELD_OPTIONAL; + /** * @ORM\Column(type="string", nullable=false, options={"default": ""}) */ @@ -416,6 +426,16 @@ class ActivityType return $this->personVisible; } + public function getPrivateCommentLabel(): string + { + return $this->privateCommentLabel; + } + + public function getPrivateCommentVisible(): int + { + return $this->privateCommentVisible; + } + public function getReasonsLabel(): string { return $this->reasonsLabel; @@ -688,6 +708,20 @@ class ActivityType return $this; } + public function setPrivateCommentLabel(string $privateCommentLabel): self + { + $this->privateCommentLabel = $privateCommentLabel; + + return $this; + } + + public function setPrivateCommentVisible(int $privateCommentVisible): self + { + $this->privateCommentVisible = $privateCommentVisible; + + return $this; + } + public function setReasonsLabel(string $reasonsLabel): self { $this->reasonsLabel = $reasonsLabel; diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 6e75bde25..4c767cd54 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -20,6 +20,7 @@ use Chill\MainBundle\Entity\User; use Chill\MainBundle\Form\Type\ChillCollectionType; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\CommentType; +use Chill\MainBundle\Form\Type\PrivateCommentType; use Chill\MainBundle\Form\Type\ScopePickerType; use Chill\MainBundle\Form\Type\UserPickerType; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; @@ -251,6 +252,13 @@ class ActivityType extends AbstractType ]); } + if ($activityType->isVisible('privateComment')) { + $builder->add('privateComment', PrivateCommentType::class, [ + 'label' => '' === $activityType->getLabel('privateComment') ? 'private comment' : $activityType->getPrivateCommentLabel(), + 'required' => false, + ]); + } + if ($activityType->isVisible('persons')) { $builder->add('persons', HiddenType::class); $builder->get('persons') diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php index 28947d72b..4cdcb31f2 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php @@ -57,7 +57,7 @@ class ActivityTypeType extends AbstractType $fields = [ 'persons', 'user', 'date', 'location', 'persons', 'thirdParties', 'durationTime', 'travelTime', 'attendee', - 'reasons', 'comment', 'sentReceived', 'documents', + 'reasons', 'comment', 'privateComment', 'sentReceived', 'documents', 'emergency', 'socialIssues', 'socialActions', 'users', ]; @@ -69,6 +69,9 @@ class ActivityTypeType extends AbstractType 'empty_data' => '', ]); } + + $builder + ->add('commentVisible', ActivityFieldPresence::class); } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php index 13c3b3e6a..1d887fead 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php @@ -15,8 +15,6 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Knp\Menu\MenuItem; use Symfony\Component\Security\Core\Security; -use function in_array; - final class AdminMenuBuilder implements LocalMenuBuilderInterface { private Security $security; @@ -32,27 +30,38 @@ final class AdminMenuBuilder implements LocalMenuBuilderInterface return; } - if (in_array($menuId, ['admin_index', 'admin_section'], true)) { - $menu->addChild('Activities', [ - 'route' => 'chill_admin_activity_index', - ]) - ->setExtras([ - 'order' => 2000, - 'explain' => 'Activity configuration', - ]); - } else { - $menu - ->addChild('Activities', [ - 'route' => 'chill_admin_activity_index', - ]) - ->setExtras([ - 'order' => '60', - ]); - } + $menu->addChild('Activities', [ + 'route' => 'chill_activity_admin_index', + ]) + ->setAttribute('class', 'list-group-item-header') + ->setExtras([ + 'order' => 5000, + 'icons' => ['exchange'], + ]); + + $menu->addChild('Activity Reasons', [ + 'route' => 'chill_activity_activityreason', + ])->setExtras(['order' => 5010]); + + $menu->addChild('Activity Reasons Category', [ + 'route' => 'chill_activity_activityreasoncategory', + ])->setExtras(['order' => 5020]); + + $menu->addChild('Activity type', [ + 'route' => 'chill_activity_type_admin', + ])->setExtras(['order' => 5030]); + + $menu->addChild('Activity Presences', [ + 'route' => 'chill_crud_activity_presence_index', + ])->setExtras(['order' => 5040]); + + $menu->addChild('Activity Types Categories', [ + 'route' => 'chill_activity_type_category_admin', + ])->setExtras(['order' => 5050]); } public static function getMenuIds(): array { - return ['admin_index', 'admin_section', 'admin_activity']; + return ['admin_section', 'admin_activity']; } } diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig index 218dc37b0..8d9ee878c 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig @@ -83,6 +83,10 @@ {{ form_row(edit_form.comment) }} {% endif %} +{%- if edit_form.privateComment is defined -%} + {{ form_row(edit_form.privateComment) }} +{% endif %} + {%- if edit_form.attendee is defined -%} {{ form_row(edit_form.attendee) }} {% endif %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig index 8e078702c..6f6e1fe53 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig @@ -81,10 +81,13 @@ {% endif %} {%- if form.comment is defined -%} - {# TODO .. public and private #} {{ form_row(form.comment) }} {% endif %} +{%- if form.privateComment is defined -%} + {{ form_row(form.privateComment) }} +{% endif %} + {%- if form.attendee is defined -%} {{ form_row(form.attendee) }} {% endif %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig index ce4c22304..8b47f4de2 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig @@ -1,4 +1,5 @@ {%- set t = entity.type -%} +{% set userId = app.user.id %} {%- import "@ChillDocStore/Macro/macro.html.twig" as m -%}
@@ -34,5 +34,11 @@ {% endfor %} {% endblock %} + + {% block actions_before %} + |
---|
{{ 'Welcome to the admin section !'|trans }}
- {{ chill_menu('admin_index', { - 'layout': '@ChillMain/Admin/menu_admin_index.html.twig' - }) }} - {% endblock %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Admin/indexLanguage.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Admin/indexLanguage.html.twig new file mode 100644 index 000000000..6c7655686 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Admin/indexLanguage.html.twig @@ -0,0 +1,13 @@ +{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %} + +{% block vertical_menu_content %} + {{ chill_menu('admin_language', { + 'layout': '@ChillMain/Admin/menu_admin_section.html.twig', + }) }} +{% endblock %} + +{% block layout_wvm_content %} + {% block admin_content %} +{{ 'Name'|trans }} | -{{ entity.name }} | -
---|
{{ address.postCode.country.name|localize_translatable_string }}
{% endif %} + {% if address.extra is not empty %} + + {{ address.extra }} + + {% endif %} {{ 'address.consider homeless'|trans }} @@ -89,6 +94,11 @@{{ address.postCode.country.name|localize_translatable_string }}
{{ 'Name'|trans }} | -{{ 'Phonenumber1'|trans }} | -{{ 'Phonenumber2'|trans }} | -{{ 'Email'|trans }} | -{{ 'Address'|trans }} | -{{ 'Active'|trans }} | -{{ 'Name'|trans }} | +{{ 'Phonenumber1'|trans }} | +{{ 'Phonenumber2'|trans }} | +{{ 'Email'|trans }} | +{{ 'Address'|trans }} | +{{ 'Active'|trans }} | + {% endblock %} + {% block table_entities_tbody %} {% for entity in entities %}
---|---|---|---|---|---|
{{ entity.name }} | @@ -44,17 +40,12 @@
{{ 'Title'|trans }} | -{{ 'Available for users'|trans }} | -{{ 'Editable by users'|trans }} | -{{ 'Address required'|trans }} | -{{ 'Contact data'|trans }} | -{{ 'Active'|trans }} | -{{ 'Default for'|trans }} | -{{ 'Title'|trans }} | +{{ 'Available for users'|trans }} | +{{ 'Editable by users'|trans }} | +{{ 'Address required'|trans }} | +{{ 'Contact data'|trans }} | +{{ 'Active'|trans }} | +{{ 'Default for'|trans }} | + {% endblock %} + {% block table_entities_tbody %} {% for entity in entities %}
---|---|---|---|---|---|---|
{{ entity.title | localize_translatable_string }} | @@ -52,14 +48,12 @@
{{ 'Role'|trans }} | {{ 'Circle'|trans }} | {{ 'Actions'|trans }} | -
---|---|---|
- {{ role_scope.role|trans }}
+ {{ role_scope.role|trans }}
{% if expanded_roles[role_scope.role]|length > 1 %}
{{ 'Which implies'|trans }} : {% for role in expanded_roles[role_scope.role] %}{{ role|trans }}{% if not loop.last %}, {% endif %}{% endfor %} @@ -56,40 +56,40 @@ {{ form_end(delete_role_scopes_form[role_scope.id]) }} |
{{ 'This group does not provide any permission'|trans }}
{%- endif -%} - -{{ 'Role'|trans }} | {{ 'Circle'|trans }} | -
---|---|
- {{ role_scope.role|trans }}
+ {{ role_scope.role|trans }}
{% if expanded_roles[role_scope.role]|length > 1 %}
{{ 'Which implies'|trans }} : {% for role in expanded_roles[role_scope.role] %}{{ role|trans }}{% if not loop.last %}, {% endif %}{% endfor %} @@ -47,16 +47,17 @@ |
{{ 'This group does not provide any permission'|trans }}. +
{{ 'This group does not provide any permission'|trans }}. - {{ 'add permissions'|trans|capitalize }}
+ {{ 'add permissions'|trans|capitalize }} + + {% endif %} -{{ 'Name'|trans }} | -{{ entity.name|localize_translatable_string }} | -
---|
Dans l'interface d'administration, vous pouvez configurer votre instance selon vos besoins.
- - diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 452ad306c..e25045131 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -65,6 +65,7 @@ Read more: Lire la suite # comment embeddable No comment associated: Aucun commentaire +private comment: Notes privées #pagination Previous: Précédent @@ -120,6 +121,10 @@ Main admin menu: Menu d'administration principal Actions: Actions Users and permissions: Utilisateurs et permissions Location and location type: Localisations et types de localisation +Back to the admin: Menu d'administration +"Administration interface": Interface d'administration +Welcome to the admin section !: > + Bienvenue dans l'interface d'administration ! #permissions Permissions Menu: Gestion des droits @@ -129,11 +134,6 @@ Permissions management of your chill installation: Gestion des permissions de vo Location Menu: Localisations et types de localisation Management of location: Gestion des localisations et types de localisation -#admin section -"Administration interface": Interface d'administration -Welcome to the admin section !: > - Bienvenue dans l'interface d'administration ! - #admin section for center's administration Create a new center: Créer un nouveau centre Center list: Liste des centres @@ -149,7 +149,7 @@ Permission group "%name%": Groupe de permissions "%name%" Grant those permissions: Attribue ces permissions Which implies: Ce qui implique Permission group: Groupe de permissions -Permissionsgroup: Group de permissions +Permissionsgroup: Groupe de permissions New permission group: Nouveau groupe de permissions PermissionsGroup "%name%" edit: Modification du groupe de permission '%name%' Role: Rôle @@ -158,8 +158,10 @@ Add permission: Ajouter les permissions This group does not provide any permission: Ce groupe n'attribue aucune permission The role '%role%' has been removed: Le rôle "%role%" a été enlevé de ce groupe de permission The role '%role%' on circle '%scope%' has been removed: Le rôle "%role%" sur le cercle "%scope%" a été enlevé de ce groupe de permission +Unclassified: Non classifié #admin section for users +User configuration: Gestion des utilisateurs User edit: Modification d'un utilisateur User'status: Statut de l'utilisateur Disabled, the user is not allowed to login: Désactivé, l'utilisateur n'est pas autorisé à se connecter @@ -181,6 +183,14 @@ Change password: Changer le mot de passe Back to the user edition: Retour au formulaire d'édition Password successfully updated!: Mot de passe mis à jour Flags: Drapeaux +Main location: Localisation principale +Main scope: Cercle +Main center: Centre +user job: Métier de l'utilisateur +Choose a main center: Choisir un centre +Choose a main scope: Choisir un cercle +choose a job: Choisir un métier +choose a location: Choisir une localisation # admin section for users jobs User jobs: Métiers @@ -217,12 +227,24 @@ Location list: Liste des localisations Location type: Type de localisation Phonenumber1: Numéro de téléphone Phonenumber2: Autre numéro de téléphone -Configure location and location type: Configuration des localisations +Location configuration: Configuration des localisations Default for: Type de localisation par défaut pour none: aucun person: usager thirdparty: tiers +#admin section for civility +abbreviation: abbréviation + +#admin section for language and country +Language and countries menu: Menu Langues & Pays +Languages and countries: Langues & Pays +Management of languages and countries: Gestion des langues & pays +Language configuration: Configuration des langues & pays +Language list: Liste des langues +Country list: Liste des pays +Country code: Code du pays + # circles / scopes Choose the circle: Choisir le cercle Scopes: Services @@ -332,6 +354,8 @@ crud: index: title: Utilisateurs add_new: Créer + title_edit: Modifier un utilisateur + title_new: Créer un utilisateur admin_user_job: index: title: Métiers @@ -339,11 +363,35 @@ crud: title_new: Nouveau métier title_edit: Modifier un métier main_location_type: + index: + title: Liste des types de localisations + add_new: Ajouter un type de localisation title_new: Nouveau type de localisation title_edit: Modifier un type de localisation main_location: + index: + title: Liste des localisations + add_new: Ajouter une localisation title_new: Nouvelle localisation title_edit: Modifier une localisation + main_language: + index: + title: Liste des langues + add_new: Ajouter une langue + title_new: Nouvelle langue + title_edit: Modifier une langue + main_country: + index: + title: Liste des pays + add_new: Ajouter un pays + title_new: Nouveau pays + title_edit: Modifier un pays + main_civility: + index: + title: Liste des civilités + add_new: Ajouter une civilité + title_new: Nouvelle civilité + title_edit: Modifier une civilité No entities: Aucun élément diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php index 21db6b00c..d1730d977 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php @@ -247,7 +247,7 @@ final class AccompanyingCourseApiController extends ApiController } if (null === $requestor) { - throw new BadRequestHttpException('Could not find any person or thirdparty', 0, null); + throw new BadRequestHttpException('Could not find any person or thirdparty'); } $accompanyingPeriod->setRequestor($requestor); diff --git a/src/Bundle/ChillPersonBundle/Controller/AdminController.php b/src/Bundle/ChillPersonBundle/Controller/AdminController.php index 9d16bdc13..b59cbc4a5 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AdminController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AdminController.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\Routing\Annotation\Route; /** * Class AdminController. @@ -19,13 +20,35 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; class AdminController extends AbstractController { /** - * @param $_locale - * - * @return \Symfony\Component\HttpFoundation\Response + * @Route("/{_locale}/admin/accompanying-course", name="chill_accompanying-course_admin_index") */ - public function indexAction($_locale) + public function indexAccompanyingCourseAdminAction() { - return $this->render('ChillPersonBundle:Admin:layout.html.twig', []); + return $this->render('ChillPersonBundle:Admin:indexAccompanyingCourse.html.twig'); + } + + /** + * @Route("/{_locale}/admin/household", name="chill_household_admin_index") + */ + public function indexHouseholdAdminAction() + { + return $this->render('ChillPersonBundle:Admin:indexHousehold.html.twig'); + } + + /** + * @Route("/{_locale}/admin/person", name="chill_person_admin_index") + */ + public function indexPersonAdminAction() + { + return $this->render('ChillPersonBundle:Admin:indexPerson.html.twig'); + } + + /** + * @Route("/{_locale}/admin/social-work", name="chill_social-work_admin_index") + */ + public function indexSocialWorkAdminAction() + { + return $this->render('ChillPersonBundle:Admin:indexSocialWork.html.twig'); } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/AdminMaritalStatusController.php b/src/Bundle/ChillPersonBundle/Controller/AdminMaritalStatusController.php deleted file mode 100644 index d27ebe2e8..000000000 --- a/src/Bundle/ChillPersonBundle/Controller/AdminMaritalStatusController.php +++ /dev/null @@ -1,22 +0,0 @@ -addOrderBy('e.id', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} diff --git a/src/Bundle/ChillPersonBundle/Controller/MaritalStatusController.php b/src/Bundle/ChillPersonBundle/Controller/MaritalStatusController.php new file mode 100644 index 000000000..2297dee32 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/MaritalStatusController.php @@ -0,0 +1,26 @@ +addOrderBy('e.id', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} diff --git a/src/Bundle/ChillPersonBundle/Controller/OriginController.php b/src/Bundle/ChillPersonBundle/Controller/OriginController.php new file mode 100644 index 000000000..b7caae3be --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/OriginController.php @@ -0,0 +1,26 @@ +addOrderBy('e.id', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index bd53cd8b3..a4a29216c 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -12,12 +12,15 @@ declare(strict_types=1); namespace Chill\PersonBundle\Controller; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; +use Chill\PersonBundle\Entity\Household\Household; +use Chill\PersonBundle\Entity\Household\HouseholdMember; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Form\CreationPersonType; use Chill\PersonBundle\Form\PersonType; use Chill\PersonBundle\Privacy\PrivacyEvent; use Chill\PersonBundle\Repository\PersonRepository; use Chill\PersonBundle\Search\SimilarPersonMatcher; +use DateTimeImmutable; use Doctrine\ORM\EntityManagerInterface; use Psr\Log\LoggerInterface; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; @@ -31,8 +34,8 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Security; use Symfony\Component\Validator\Validator\ValidatorInterface; -use Symfony\Contracts\Translation\TranslatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; use function count; use function hash; use function implode; @@ -248,6 +251,31 @@ final class PersonController extends AbstractController $this->em->flush(); $this->lastPostDataReset(); + $address = $form->get('address')->getData(); + $addressForm = (bool) $form->get('addressForm')->getData(); + + if (null !== $address && $addressForm) { + $household = new Household(); + + $member = new HouseholdMember(); + $member->setPerson($person); + $member->setStartDate(new DateTimeImmutable()); + + $household->addMember($member); + $household->setForceAddress($address); + + $this->em->persist($member); + $this->em->persist($household); + $this->em->flush(); + + if ($form->get('createHousehold')->isClicked()) { + return $this->redirectToRoute('chill_person_household_members_editor', [ + 'persons' => [$person->getId()], + 'household' => $household->getId(), + ]); + } + } + if ($form->get('createPeriod')->isClicked()) { return $this->redirectToRoute('chill_person_accompanying_course_new', [ 'person_id' => [$person->getId()], diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonResourceKindController.php b/src/Bundle/ChillPersonBundle/Controller/PersonResourceKindController.php new file mode 100644 index 000000000..ca3047a97 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/PersonResourceKindController.php @@ -0,0 +1,26 @@ +addOrderBy('e.id', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} diff --git a/src/Bundle/ChillPersonBundle/Controller/RelationController.php b/src/Bundle/ChillPersonBundle/Controller/RelationController.php new file mode 100644 index 000000000..8f0c7fa44 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/RelationController.php @@ -0,0 +1,26 @@ +addOrderBy('e.id', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminEvaluationController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminEvaluationController.php deleted file mode 100644 index 8105066e9..000000000 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminEvaluationController.php +++ /dev/null @@ -1,22 +0,0 @@ -addOrderBy('e.id', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/GoalController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/GoalController.php new file mode 100644 index 000000000..38bd13267 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/GoalController.php @@ -0,0 +1,26 @@ +addOrderBy('e.id', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/ResultController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/ResultController.php new file mode 100644 index 000000000..f2d9a1d4d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/ResultController.php @@ -0,0 +1,26 @@ +addOrderBy('e.id', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/SocialActionController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/SocialActionController.php new file mode 100644 index 000000000..47cc246bd --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/SocialActionController.php @@ -0,0 +1,26 @@ +addOrderBy('e.ordering', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/SocialIssueController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/SocialIssueController.php new file mode 100644 index 000000000..57dd38e80 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/SocialIssueController.php @@ -0,0 +1,26 @@ +addOrderBy('e.ordering', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index 25fc251e5..d7037c1d2 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -146,13 +146,13 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac [ 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class, 'name' => 'closing_motive', - 'base_path' => '/admin/closing-motive', + 'base_path' => '/admin/person/closing-motive', 'form_class' => \Chill\PersonBundle\Form\ClosingMotiveType::class, - 'controller' => \Chill\PersonBundle\Controller\AdminClosingMotiveController::class, + 'controller' => \Chill\PersonBundle\Controller\ClosingMotiveController::class, 'actions' => [ 'index' => [ - 'template' => '@ChillPerson/ClosingMotive/index.html.twig', 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/ClosingMotive/index.html.twig', ], 'new' => [ 'role' => 'ROLE_ADMIN', @@ -164,12 +164,33 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], ], ], + [ + 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Origin::class, + 'name' => 'origin', + 'base_path' => '/admin/person/origin', + 'form_class' => \Chill\PersonBundle\Form\OriginType::class, + 'controller' => \Chill\PersonBundle\Controller\OriginController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/Origin/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/Origin/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/Origin/edit.html.twig', + ], + ], + ], [ 'class' => \Chill\PersonBundle\Entity\MaritalStatus::class, - 'name' => 'marital_status', - 'base_path' => '/admin/marital-status', + 'name' => 'person_marital-status', + 'base_path' => '/admin/person/marital-status', 'form_class' => \Chill\PersonBundle\Form\MaritalStatusType::class, - 'controller' => \Chill\PersonBundle\Controller\AdminMaritalStatusController::class, + 'controller' => \Chill\PersonBundle\Controller\MaritalStatusController::class, 'actions' => [ 'index' => [ 'role' => 'ROLE_ADMIN', @@ -185,12 +206,75 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], ], ], + [ + 'class' => \Chill\PersonBundle\Entity\Household\Position::class, + 'name' => 'person_household_position', + 'base_path' => '/admin/person/household/position', + 'form_class' => \Chill\PersonBundle\Form\HouseholdPositionType::class, + 'controller' => \Chill\PersonBundle\Controller\HouseholdPositionController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/HouseholdPosition/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/HouseholdPosition/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/HouseholdPosition/edit.html.twig', + ], + ], + ], + [ + 'class' => \Chill\PersonBundle\Entity\Relationships\Relation::class, + 'name' => 'person_relation', + 'base_path' => '/admin/person/relation', + 'form_class' => \Chill\PersonBundle\Form\RelationType::class, + 'controller' => \Chill\PersonBundle\Controller\RelationController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/Relation/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/Relation/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/Relation/edit.html.twig', + ], + ], + ], + [ + 'class' => \Chill\PersonBundle\Entity\Person\PersonResourceKind::class, + 'name' => 'person_resource-kind', + 'base_path' => '/admin/person/resource-kind', + 'form_class' => \Chill\PersonBundle\Form\PersonResourceKindType::class, + 'controller' => \Chill\PersonBundle\Controller\PersonResourceKindController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/PersonResourceKind/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/PersonResourceKind/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/PersonResourceKind/edit.html.twig', + ], + ], + ], [ 'class' => \Chill\PersonBundle\Entity\SocialWork\SocialIssue::class, 'name' => 'social_issue', 'base_path' => '/admin/social-work/social-issue', 'form_class' => \Chill\PersonBundle\Form\SocialWork\SocialIssueType::class, - 'controller' => \Chill\PersonBundle\Controller\SocialWork\AdminSocialIssueController::class, + 'controller' => \Chill\PersonBundle\Controller\SocialWork\SocialIssueController::class, 'actions' => [ 'index' => [ 'role' => 'ROLE_ADMIN', @@ -202,7 +286,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], 'edit' => [ 'role' => 'ROLE_ADMIN', - 'template' => '@ChillPerson/SocialWork/edit.html.twig', + 'template' => '@ChillPerson/SocialWork/SocialIssue/edit.html.twig', ], ], ], @@ -211,7 +295,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac 'name' => 'social_action', 'base_path' => '/admin/social-work/social-action', 'form_class' => \Chill\PersonBundle\Form\SocialWork\SocialActionType::class, - 'controller' => \Chill\PersonBundle\Controller\SocialWork\AdminSocialActionController::class, + 'controller' => \Chill\PersonBundle\Controller\SocialWork\SocialActionController::class, 'actions' => [ 'index' => [ 'role' => 'ROLE_ADMIN', @@ -223,7 +307,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], 'edit' => [ 'role' => 'ROLE_ADMIN', - 'template' => '@ChillPerson/SocialWork/edit.html.twig', + 'template' => '@ChillPerson/SocialWork/SocialAction/edit.html.twig', ], ], ], @@ -232,7 +316,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac 'name' => 'social_goal', 'base_path' => '/admin/social-work/goal', 'form_class' => \Chill\PersonBundle\Form\SocialWork\GoalType::class, - 'controller' => \Chill\PersonBundle\Controller\SocialWork\AdminGoalController::class, + 'controller' => \Chill\PersonBundle\Controller\SocialWork\GoalController::class, 'actions' => [ 'index' => [ 'role' => 'ROLE_ADMIN', @@ -253,7 +337,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac 'name' => 'social_result', 'base_path' => '/admin/social-work/result', 'form_class' => \Chill\PersonBundle\Form\SocialWork\ResultType::class, - 'controller' => \Chill\PersonBundle\Controller\SocialWork\AdminResultController::class, + 'controller' => \Chill\PersonBundle\Controller\SocialWork\ResultController::class, 'actions' => [ 'index' => [ 'role' => 'ROLE_ADMIN', @@ -274,7 +358,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac 'name' => 'social_evaluation', 'base_path' => '/admin/social-work/evaluation', 'form_class' => \Chill\PersonBundle\Form\SocialWork\EvaluationType::class, - 'controller' => \Chill\PersonBundle\Controller\SocialWork\AdminEvaluationController::class, + 'controller' => \Chill\PersonBundle\Controller\SocialWork\EvaluationController::class, 'actions' => [ 'index' => [ 'role' => 'ROLE_ADMIN', @@ -555,6 +639,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac 'methods' => [ Request::METHOD_GET => true, Request::METHOD_HEAD => true, + Request::METHOD_POST => true, ], ], 'suggestHouseholdByAccompanyingPeriodParticipation' => [ diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 055507162..9c0eade3b 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\MainBundle\Doctrine\Model\TrackCreationInterface; use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; +use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable; use Chill\MainBundle\Entity\User; use Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodLinkedWithSocialIssuesEntityInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; @@ -143,6 +144,12 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues */ private Collection $persons; + /** + * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_") + * @Serializer\Groups({"read", "accompanying_period_work:edit"}) + */ + private PrivateCommentEmbeddable $privateComment; + /** * @ORM\ManyToMany(targetEntity=User::class) * @ORM\JoinTable(name="chill_person_accompanying_period_work_referrer") @@ -202,6 +209,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues public function __construct() { $this->goals = new ArrayCollection(); + $this->privateComment = new PrivateCommentEmbeddable(); $this->results = new ArrayCollection(); $this->thirdParties = new ArrayCollection(); $this->persons = new ArrayCollection(); @@ -328,6 +336,11 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues return $this->persons; } + public function getPrivateComment(): PrivateCommentEmbeddable + { + return $this->privateComment; + } + /** * @return Collection|User[] */ @@ -505,6 +518,13 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues return $this; } + public function setPrivateComment(PrivateCommentEmbeddable $privateComment): self + { + $this->privateComment->merge($privateComment); + + return $this; + } + public function setSocialAction(?SocialAction $socialAction): self { $this->socialAction = $socialAction; diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php index 22c33f85f..2de526ee6 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php @@ -35,7 +35,7 @@ class HouseholdMember /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) * @Serializer\Groups({"read", "docgen:read"}) - * @Assert\GreaterThan( + * @Assert\GreaterThanOrEqual( * propertyPath="startDate", * message="household_membership.The end date must be after start date", * groups={"household_memberships"} @@ -82,14 +82,13 @@ class HouseholdMember /** * @ORM\ManyToOne(targetEntity=Position::class) * @Serializer\Groups({"read", "docgen:read"}) - * @Assert\NotNull(groups={"household_memberships_created"}) */ private ?Position $position = null; /** * @ORM\Column(type="boolean", name="sharedhousehold") */ - private bool $shareHousehold = false; + private bool $shareHousehold = true; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) @@ -201,15 +200,18 @@ class HouseholdMember return $this; } - public function setPosition(Position $position): self + public function setPosition(?Position $position): self { - if ($this->position instanceof Position) { + if ($this->position instanceof Position && $this->position !== $position) { throw new LogicException('The position is already set. You cannot change ' . 'a position of a membership'); } $this->position = $position; - $this->shareHousehold = $position->getShareHousehold(); + + if (null !== $position) { + $this->shareHousehold = $position->getShareHousehold(); + } return $this; } diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php index 9349c335e..e9c7496ff 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php @@ -121,14 +121,14 @@ class Evaluation return $this; } - public function setDelay(DateInterval $delay): self + public function setDelay(?DateInterval $delay): self { $this->delay = $delay; return $this; } - public function setNotificationDelay(DateInterval $notificationDelay): self + public function setNotificationDelay(?DateInterval $notificationDelay): self { $this->notificationDelay = $notificationDelay; diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php index b4a9b6aa2..e147ec9d8 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php @@ -45,7 +45,7 @@ class Result /** * @ORM\Column(type="datetime", nullable=true) */ - private DateTime $desactivationDate; + private ?DateTime $desactivationDate; /** * @ORM\ManyToMany(targetEntity=Goal::class, mappedBy="results") diff --git a/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php b/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php index 2aed9df97..124db26eb 100644 --- a/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php @@ -11,10 +11,13 @@ declare(strict_types=1); namespace Chill\PersonBundle\Form; +use Chill\MainBundle\Entity\Address; use Chill\MainBundle\Form\Event\CustomizeFormEvent; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\ChillPhoneNumberType; +use Chill\MainBundle\Form\Type\PickAddressType; use Chill\MainBundle\Form\Type\PickCenterType; +use Chill\MainBundle\Form\Type\PickCivilityType; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Form\Type\GenderType; @@ -24,9 +27,12 @@ use libphonenumber\PhoneNumberType; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Context\ExecutionContextInterface; final class CreationPersonType extends AbstractType { @@ -55,6 +61,11 @@ final class CreationPersonType extends AbstractType $builder ->add('firstName') ->add('lastName') + ->add('civility', PickCivilityType::class, [ + 'required' => false, + 'label' => 'Civility', + 'placeholder' => 'choose civility', + ]) ->add('gender', GenderType::class, [ 'required' => true, 'placeholder' => null, ]) @@ -71,6 +82,17 @@ final class CreationPersonType extends AbstractType ]) ->add('email', EmailType::class, [ 'required' => false, + ]) + ->add('addressForm', CheckboxType::class, [ + 'label' => 'Create a household and add an address', + 'required' => false, + 'mapped' => false, + 'help' => 'A new household will be created. The person will be member of this household.', + ]) + ->add('address', PickAddressType::class, [ + 'required' => false, + 'mapped' => false, + 'label' => false, ]); if ($this->askCenters) { @@ -97,6 +119,9 @@ final class CreationPersonType extends AbstractType { $resolver->setDefaults([ 'data_class' => Person::class, + 'constraints' => [ + new Callback([$this, 'validateCheckedAddress']), + ], ]); } @@ -107,4 +132,18 @@ final class CreationPersonType extends AbstractType { return self::NAME; } + + public function validateCheckedAddress($data, ExecutionContextInterface $context, $payload): void + { + /** @var bool $addressFrom */ + $addressFrom = $context->getObject()->get('addressForm')->getData(); + /** @var ?Address $address */ + $address = $context->getObject()->get('address')->getData(); + + if ($addressFrom && null === $address) { + $context->buildViolation('person_creation.If you want to create an household, an address is required') + ->atPath('addressForm') + ->addViolation(); + } + } } diff --git a/src/Bundle/ChillPersonBundle/Form/HouseholdMemberType.php b/src/Bundle/ChillPersonBundle/Form/HouseholdMemberType.php index 99c698c91..192142043 100644 --- a/src/Bundle/ChillPersonBundle/Form/HouseholdMemberType.php +++ b/src/Bundle/ChillPersonBundle/Form/HouseholdMemberType.php @@ -26,12 +26,15 @@ class HouseholdMemberType extends AbstractType 'input' => 'datetime_immutable', ]); - if (!$options['data']->getPosition()->getShareHousehold()) { - $builder->add('endDate', ChillDateType::class, [ - 'label' => 'household.End date', - 'input' => 'datetime_immutable', - ]); + if (null !== $options['data']->getPosition()) { + if (!$options['data']->getPosition()->getShareHousehold()) { + $builder->add('endDate', ChillDateType::class, [ + 'label' => 'household.End date', + 'input' => 'datetime_immutable', + ]); + } } + $builder ->add('comment', ChillTextareaType::class, [ 'label' => 'household.Comment', diff --git a/src/Bundle/ChillPersonBundle/Form/HouseholdPositionType.php b/src/Bundle/ChillPersonBundle/Form/HouseholdPositionType.php new file mode 100644 index 000000000..ebd0ac966 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Form/HouseholdPositionType.php @@ -0,0 +1,47 @@ +add('label', TranslatableStringFormType::class) + ->add('allowHolder', CheckboxType::class, [ + 'required' => false, + 'label' => 'household.allowHolder', + ]) + ->add('shareHousehold', CheckboxType::class, [ + 'required' => false, + 'label' => 'household.shareHousehold', + ]) + ->add('ordering', NumberType::class, [ + 'required' => true, + 'scale' => 5, + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefault('class', Position::class); + } +} diff --git a/src/Bundle/ChillPersonBundle/Form/OriginType.php b/src/Bundle/ChillPersonBundle/Form/OriginType.php new file mode 100644 index 000000000..e3c08b359 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Form/OriginType.php @@ -0,0 +1,39 @@ +add('label', TranslatableStringFormType::class) + ->add('noActiveAfter', ChillDateType::class, [ + 'required' => false, + 'input' => 'datetime_immutable', + 'label' => 'origin.noActiveAfter', + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefault('class', Origin::class); + } +} diff --git a/src/Bundle/ChillPersonBundle/Form/PersonResourceKindType.php b/src/Bundle/ChillPersonBundle/Form/PersonResourceKindType.php new file mode 100644 index 000000000..8e050cbce --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Form/PersonResourceKindType.php @@ -0,0 +1,40 @@ +add('title', TranslatableStringFormType::class) + ->add('isActive', ChoiceType::class, [ + 'choices' => [ + 'Active' => true, + 'Inactive' => false, + ], + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefault('class', PersonResourceKind::class); + } +} diff --git a/src/Bundle/ChillPersonBundle/Form/RelationType.php b/src/Bundle/ChillPersonBundle/Form/RelationType.php new file mode 100644 index 000000000..e1887115f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Form/RelationType.php @@ -0,0 +1,42 @@ +add('title', TranslatableStringFormType::class, [ + 'label' => 'relation.title', + ]) + ->add('reverseTitle', TranslatableStringFormType::class, [ + 'label' => 'relation.reverseTitle', + ]) + ->add('isActive', CheckboxType::class, [ + 'required' => false, + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefault('class', Relation::class); + } +} diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php index 0c6bb0d32..bbe82b59f 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Form\SocialWork; +use Chill\MainBundle\Form\Type\DateIntervalType; use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\SocialWork\Evaluation; @@ -39,9 +40,14 @@ class EvaluationType extends AbstractType ->add('title', TranslatableStringFormType::class, [ 'label' => 'Nom', ]) - ->add('delay') - - ->add('notificationDelay'); + ->add('delay', DateIntervalType::class, [ + 'label' => 'evaluation.delay', + 'required' => false, + ]) + ->add('notificationDelay', DateIntervalType::class, [ + 'label' => 'evaluation.notificationDelay', + 'required' => false, + ]); } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php index 4ea0a5e70..45a43897d 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php @@ -11,13 +11,14 @@ declare(strict_types=1); namespace Chill\PersonBundle\Form\SocialWork; +use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\SocialWork\Goal; +use Chill\PersonBundle\Entity\SocialWork\Result; use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -52,11 +53,18 @@ class GoalType extends AbstractType }, ]) - ->add('desactivationDate', DateType::class, [ - 'attr' => ['class' => 'datepicker'], - 'widget' => 'single_text', - 'format' => 'dd-MM-yyyy', + ->add('results', EntityType::class, [ + 'class' => Result::class, 'required' => false, + 'multiple' => true, + 'choice_label' => function (Result $r) { + return $this->translatableStringHelper->localize($r->getTitle()); + }, + ]) + + ->add('desactivationDate', ChillDateType::class, [ + 'required' => false, + 'label' => 'goal.desactivationDate', ]); } diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/ResultType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/ResultType.php index a0219aaf3..b8a130950 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/ResultType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/ResultType.php @@ -11,11 +11,11 @@ declare(strict_types=1); namespace Chill\PersonBundle\Form\SocialWork; +use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\SocialWork\Result; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -40,13 +40,10 @@ class ResultType extends AbstractType ->add('title', TranslatableStringFormType::class, [ 'label' => 'Nom', ]) - ->add('accompanyingPeriodWorks') - ->add('accompanyingPeriodWorkGoals') - ->add('desactivationDate', DateType::class, [ - 'attr' => ['class' => 'datepicker'], - 'widget' => 'single_text', - 'format' => 'dd-MM-yyyy', + + ->add('desactivationDate', ChillDateType::class, [ 'required' => false, + 'label' => 'goal.desactivationDate', ]); } diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php index 1f1ae0810..77c94fa9d 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php @@ -11,13 +11,18 @@ declare(strict_types=1); namespace Chill\PersonBundle\Form\SocialWork; +use Chill\MainBundle\Form\Type\ChillDateType; +use Chill\MainBundle\Form\Type\DateIntervalType; use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Chill\MainBundle\Templating\TranslatableStringHelper; +use Chill\PersonBundle\Entity\SocialWork\Evaluation; +use Chill\PersonBundle\Entity\SocialWork\Goal; +use Chill\PersonBundle\Entity\SocialWork\Result; use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\DateType; +use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -44,6 +49,7 @@ class SocialActionType extends AbstractType ]) ->add('issue', EntityType::class, [ 'class' => SocialIssue::class, + 'label' => 'socialAction.socialIssue', 'choice_label' => function (SocialIssue $issue) { return $this->translatableStringHelper->localize($issue->getTitle()); }, @@ -55,12 +61,47 @@ class SocialActionType extends AbstractType return $this->translatableStringHelper->localize($issue->getTitle()); }, ]) - ->add('defaultNotificationDelay') - ->add('desactivationDate', DateType::class, [ - 'attr' => ['class' => 'datepicker'], - 'widget' => 'single_text', - 'format' => 'dd-MM-yyyy', + ->add('ordering', NumberType::class, [ + 'required' => true, + 'scale' => 6, + ]) + ->add('results', EntityType::class, [ + 'class' => Result::class, 'required' => false, + 'multiple' => true, + 'attr' => ['class' => 'select2'], + 'choice_label' => function (Result $r) { + return $this->translatableStringHelper->localize($r->getTitle()); + }, + ]) + + ->add('goals', EntityType::class, [ + 'class' => Goal::class, + 'required' => false, + 'multiple' => true, + 'attr' => ['class' => 'select2'], + 'choice_label' => function (Goal $g) { + return $this->translatableStringHelper->localize($g->getTitle()); + }, + ]) + + ->add('evaluations', EntityType::class, [ + 'class' => Evaluation::class, + 'required' => false, + 'multiple' => true, + 'attr' => ['class' => 'select2'], + 'choice_label' => function (Evaluation $e) { + return $this->translatableStringHelper->localize($e->getTitle()); + }, + ]) + + ->add('defaultNotificationDelay', DateIntervalType::class, [ + 'label' => 'socialAction.defaultNotificationDelay', + 'required' => false, + ]) + ->add('desactivationDate', ChillDateType::class, [ + 'required' => false, + 'label' => 'goal.desactivationDate', ]); } diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php index 0058b1e51..5aa76fbc6 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php @@ -11,12 +11,13 @@ declare(strict_types=1); namespace Chill\PersonBundle\Form\SocialWork; +use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\DateType; +use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -41,10 +42,12 @@ class SocialIssueType extends AbstractType 'required' => false, 'choice_label' => fn (SocialIssue $issue): ?string => $this->translatableStringHelper->localize($issue->getTitle()), ]) - ->add('desactivationDate', DateType::class, [ - 'attr' => ['class' => 'datepicker'], - 'widget' => 'single_text', - 'format' => 'dd-MM-yyyy', + ->add('ordering', NumberType::class, [ + 'required' => true, + 'scale' => 6, + ]) + ->add('desactivationDate', ChillDateType::class, [ + 'label' => 'goal.desactivationDate', 'required' => false, ]); } diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php index 1c7cbb538..8ae41a98b 100644 --- a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php +++ b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php @@ -55,7 +55,7 @@ class MembersEditor $this->eventDispatcher = $eventDispatcher; } - public function addMovement(DateTimeImmutable $date, Person $person, Position $position, ?bool $holder = false, ?string $comment = null): self + public function addMovement(DateTimeImmutable $date, Person $person, ?Position $position, ?bool $holder = false, ?string $comment = null): self { if (null === $this->household) { throw new LogicException('You must define a household first'); @@ -69,68 +69,70 @@ class MembersEditor ->setComment($comment); $this->household->addMember($membership); - if ($position->getShareHousehold()) { - // launch event only if moving to a "share household" position, - // and if the destination household is different than the previous one - $event = new PersonAddressMoveEvent($person); - $event->setNextMembership($membership); + if (null !== $position) { + if ($position->getShareHousehold()) { + // launch event only if moving to a "share household" position, + // and if the destination household is different than the previous one + $event = new PersonAddressMoveEvent($person); + $event->setNextMembership($membership); - $counter = 0; + $counter = 0; - foreach ($person->getHouseholdParticipationsShareHousehold() as $participation) { - if ($participation === $membership) { - continue; - } + foreach ($person->getHouseholdParticipationsShareHousehold() as $participation) { + if ($participation === $membership) { + continue; + } - if ($participation->getStartDate() > $membership->getStartDate()) { - continue; - } + if ($participation->getStartDate() > $membership->getStartDate()) { + continue; + } - ++$counter; + ++$counter; - if ($participation->getEndDate() === null || $participation->getEndDate() > $date) { - $participation->setEndDate($date); - $this->membershipsAffected[] = $participation; - $this->oldMembershipsHashes[] = spl_object_hash($participation); + if ($participation->getEndDate() === null || $participation->getEndDate() > $date) { + $participation->setEndDate($date); + $this->membershipsAffected[] = $participation; + $this->oldMembershipsHashes[] = spl_object_hash($participation); - if ($participation->getHousehold() !== $this->household) { - $event->setPreviousMembership($participation); - $this->events[] = $event; + if ($participation->getHousehold() !== $this->household) { + $event->setPreviousMembership($participation); + $this->events[] = $event; + } } } - } - // send also the event if there was no participation before - if (0 === $counter) { - $this->events[] = $event; - } - - foreach ($person->getHouseholdParticipationsNotShareHousehold() as $participation) { - if ($participation->getHousehold() === $this->household - && $participation->getEndDate() === null || $participation->getEndDate() > $membership->getStartDate() - && $participation->getStartDate() <= $membership->getStartDate() - ) { - $participation->setEndDate($membership->getStartDate()); - } - } - } else { - // if a members is moved to the same household than the one he belongs to, - // we should make it leave the household - if ($person->getCurrentHousehold($date) === $this->household) { - $this->leaveMovement($date, $person); - } - - // if there are multiple belongings not sharing household, close the others - foreach ($person->getHouseholdParticipationsNotShareHousehold() as $participation) { - if ($participation === $membership) { - continue; + // send also the event if there was no participation before + if (0 === $counter) { + $this->events[] = $event; } - if ($participation->getHousehold() === $this->household - && ($participation->getEndDate() === null || $participation->getEndDate() > $membership->getStartDate()) - && $participation->getStartDate() <= $membership->getStartDate() - ) { - $participation->setEndDate($membership->getStartDate()); + foreach ($person->getHouseholdParticipationsNotShareHousehold() as $participation) { + if ($participation->getHousehold() === $this->household + && $participation->getEndDate() === null || $participation->getEndDate() > $membership->getStartDate() + && $participation->getStartDate() <= $membership->getStartDate() + ) { + $participation->setEndDate($membership->getStartDate()); + } + } + } else { + // if a members is moved to the same household than the one he belongs to, + // we should make it leave the household + if ($person->getCurrentHousehold($date) === $this->household) { + $this->leaveMovement($date, $person); + } + + // if there are multiple belongings not sharing household, close the others + foreach ($person->getHouseholdParticipationsNotShareHousehold() as $participation) { + if ($participation === $membership) { + continue; + } + + if ($participation->getHousehold() === $this->household + && ($participation->getEndDate() === null || $participation->getEndDate() > $membership->getStartDate()) + && $participation->getStartDate() <= $membership->getStartDate() + ) { + $participation->setEndDate($membership->getStartDate()); + } } } } diff --git a/src/Bundle/ChillPersonBundle/Menu/AdminAccompanyingCourseMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AdminAccompanyingCourseMenuBuilder.php new file mode 100644 index 000000000..afd9f9484 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Menu/AdminAccompanyingCourseMenuBuilder.php @@ -0,0 +1,58 @@ +authorizationChecker = $authorizationChecker; + } + + public function buildMenu($menuId, MenuItem $menu, array $parameters) + { + if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) { + return; + } + + $menu->addChild('person_admin.accompanying_period', [ + 'route' => 'chill_accompanying-course_admin_index', + ]) + ->setAttribute('class', 'list-group-item-header') + ->setExtras([ + 'order' => 2200, + 'icons' => ['random'], + ]); + + $menu->addChild('person_admin.closing motives', [ + 'route' => 'chill_crud_closing_motive_index', + ])->setExtras(['order' => 2210]); + + $menu->addChild('person_admin.origin', [ + 'route' => 'chill_crud_origin_index', + ])->setExtras(['order' => 2210]); + } + + public static function getMenuIds(): array + { + return ['admin_section', 'admin_accompanying_course']; + } +} diff --git a/src/Bundle/ChillPersonBundle/Menu/AdminHouseholdMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AdminHouseholdMenuBuilder.php new file mode 100644 index 000000000..e68059e1d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Menu/AdminHouseholdMenuBuilder.php @@ -0,0 +1,58 @@ +authorizationChecker = $authorizationChecker; + } + + public function buildMenu($menuId, MenuItem $menu, array $parameters) + { + if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) { + return; + } + + $menu->addChild('Household', [ + 'route' => 'chill_household_admin_index', + ]) + ->setAttribute('class', 'list-group-item-header') + ->setExtras([ + 'order' => 2100, + 'icons' => ['home'], + ]); + + $menu->addChild('Position', [ + 'route' => 'chill_crud_person_household_position_index', + ])->setExtras(['order' => 2110]); + + $menu->addChild('person_admin.relation', [ + 'route' => 'chill_crud_person_relation_index', + ])->setExtras(['order' => 2120]); + } + + public static function getMenuIds(): array + { + return ['admin_section', 'admin_household']; + } +} diff --git a/src/Bundle/ChillPersonBundle/Menu/AdminPersonMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AdminPersonMenuBuilder.php new file mode 100644 index 000000000..683f4e7b6 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Menu/AdminPersonMenuBuilder.php @@ -0,0 +1,62 @@ +authorizationChecker = $authorizationChecker; + } + + public function buildMenu($menuId, MenuItem $menu, array $parameters) + { + if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) { + return; + } + + $menu->addChild('Person', [ + 'route' => 'chill_person_admin_index', + ]) + ->setAttribute('class', 'list-group-item-header') + ->setExtras([ + 'order' => 2000, + 'icons' => ['child'], + ]); + + $menu->addChild('Civility', [ + 'route' => 'chill_crud_main_civility_index', + ])->setExtras(['order' => 2010]); + + $menu->addChild('Marital status', [ + 'route' => 'chill_crud_person_marital-status_index', + ])->setExtras(['order' => 2020]); + + $menu->addChild('person_admin.person_resource_kind', [ + 'route' => 'chill_crud_person_resource-kind_index', + ])->setExtras(['order' => 2030]); + } + + public static function getMenuIds(): array + { + return ['admin_section', 'admin_person']; + } +} diff --git a/src/Bundle/ChillPersonBundle/Menu/AdminSocialWorkMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AdminSocialWorkMenuBuilder.php new file mode 100644 index 000000000..a7244ac15 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Menu/AdminSocialWorkMenuBuilder.php @@ -0,0 +1,70 @@ +authorizationChecker = $authorizationChecker; + } + + public function buildMenu($menuId, MenuItem $menu, array $parameters) + { + if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) { + return; + } + + $menu->addChild('person_admin.social_work', [ + 'route' => 'chill_social-work_admin_index', + ]) + ->setAttribute('class', 'list-group-item-header') + ->setExtras([ + 'order' => 2300, + 'icons' => ['handshake-o'], + ]); + + $menu->addChild('person_admin.social_action', [ + 'route' => 'chill_crud_social_action_index', + ])->setExtras(['order' => 2301]); + + $menu->addChild('person_admin.social_issue', [ + 'route' => 'chill_crud_social_issue_index', + ])->setExtras(['order' => 2302]); + + $menu->addChild('person_admin.social_goal', [ + 'route' => 'chill_crud_social_goal_index', + ])->setExtras(['order' => 2310]); + + $menu->addChild('person_admin.social_evaluation', [ + 'route' => 'chill_crud_social_evaluation_index', + ])->setExtras(['order' => 2320]); + + $menu->addChild('person_admin.social_result', [ + 'route' => 'chill_crud_social_result_index', + ])->setExtras(['order' => 2330]); + } + + public static function getMenuIds(): array + { + return ['admin_section', 'admin_social_work']; + } +} diff --git a/src/Bundle/ChillPersonBundle/Resources/public/page/person/create-person.js b/src/Bundle/ChillPersonBundle/Resources/public/page/person/create-person.js new file mode 100644 index 000000000..7e29c4530 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/public/page/person/create-person.js @@ -0,0 +1,18 @@ +import { ShowHide } from 'ShowHide'; + +const addressForm = document.getElementById("addressForm"); +const address = document.getElementById("address"); + +new ShowHide({ + froms: [addressForm], + container: [address], + test: function(froms) { + for (let f of froms.values()) { + for (let input of f.querySelectorAll('input').values()) { + return input.checked; + } + } + return false; + }, + event_name: 'change' +}); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue index 1a1a7e26e..b5ee21caa 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue @@ -123,6 +123,7 @@ export default { body.email = payload.data.email; body.altNames = payload.data.altNames; body.gender = payload.data.gender; + if (payload.data.civility !== null) { body.civility = {id: payload.data.civility.id, type: payload.data.civility.type }; } makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body) .then(response => { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue index df2bd0c35..140a0e8b4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue @@ -150,6 +150,7 @@ export default { body.email = payload.data.email; body.altNames = payload.data.altNames; body.gender = payload.data.gender; + if (payload.data.civility !== null) { body.civility = {id: payload.data.civility.id, type: payload.data.civility.type}; } makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body) .then(response => { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue index bab64018a..fb8796de5 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue @@ -24,6 +24,15 @@{{ $t('person.address.warning') }}
+