diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdPositionController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdPositionController.php new file mode 100644 index 000000000..781c264b5 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdPositionController.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/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index 3d88fac22..950715a2b 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -206,6 +206,48 @@ 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', 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 index a9897de25..e3c08b359 100644 --- a/src/Bundle/ChillPersonBundle/Form/OriginType.php +++ b/src/Bundle/ChillPersonBundle/Form/OriginType.php @@ -27,7 +27,7 @@ class OriginType extends AbstractType ->add('noActiveAfter', ChillDateType::class, [ 'required' => false, 'input' => 'datetime_immutable', - 'label' => 'origin.noActiveAfter' + 'label' => 'origin.noActiveAfter', ]); } diff --git a/src/Bundle/ChillPersonBundle/Form/PersonResourceKindType.php b/src/Bundle/ChillPersonBundle/Form/PersonResourceKindType.php index 060c7628c..8e050cbce 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonResourceKindType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonResourceKindType.php @@ -25,11 +25,11 @@ class PersonResourceKindType extends AbstractType $builder ->add('title', TranslatableStringFormType::class) ->add('isActive', ChoiceType::class, [ - 'choices' => [ - 'Active' => true, - 'Inactive' => false, - ], - ]); + 'choices' => [ + 'Active' => true, + 'Inactive' => false, + ], + ]); } public function configureOptions(OptionsResolver $resolver) 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/Menu/AdminMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AdminMenuBuilder.php index af47d4544..ad343feda 100644 --- a/src/Bundle/ChillPersonBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/AdminMenuBuilder.php @@ -49,43 +49,53 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface 'route' => 'chill_crud_person_resource-kind_index', ])->setExtras(['order' => 2030]); - - - $menu->addChild('person_admin.accompanying_period') + $menu->addChild('Household') ->setAttribute('class', 'list-group-item-header') ->setExtras(['order' => 2100, 'header' => true]); - $menu->addChild('person_admin.closing motives', [ - 'route' => 'chill_crud_closing_motive_index', + $menu->addChild('Position', [ + 'route' => 'chill_crud_person_household_position_index', ])->setExtras(['order' => 2110]); - $menu->addChild('person_admin.origin', [ - 'route' => 'chill_crud_origin_index', - ])->setExtras(['order' => 2110]); + $menu->addChild('person_admin.relation', [ + 'route' => 'chill_crud_person_relation_index', + ])->setExtras(['order' => 2120]); - $menu->addChild('person_admin.social_work') + $menu->addChild('person_admin.accompanying_period') ->setAttribute('class', 'list-group-item-header') ->setExtras(['order' => 2200, 'header' => true]); + $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]); + + $menu->addChild('person_admin.social_work') + ->setAttribute('class', 'list-group-item-header') + ->setExtras(['order' => 2300, 'header' => true]); + $menu->addChild('person_admin.social_action', [ 'route' => 'chill_crud_social_action_index', - ])->setExtras(['order' => 2201]); + ])->setExtras(['order' => 2301]); $menu->addChild('person_admin.social_issue', [ 'route' => 'chill_crud_social_issue_index', - ])->setExtras(['order' => 2202]); + ])->setExtras(['order' => 2302]); $menu->addChild('person_admin.social_goal', [ 'route' => 'chill_crud_social_goal_index', - ])->setExtras(['order' => 2210]); + ])->setExtras(['order' => 2310]); $menu->addChild('person_admin.social_evaluation', [ 'route' => 'chill_crud_social_evaluation_index', - ])->setExtras(['order' => 2220]); + ])->setExtras(['order' => 2320]); $menu->addChild('person_admin.social_result', [ 'route' => 'chill_crud_social_result_index', - ])->setExtras(['order' => 2230]); + ])->setExtras(['order' => 2330]); } public static function getMenuIds(): array diff --git a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdPosition/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdPosition/edit.html.twig new file mode 100644 index 000000000..28678bf6d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdPosition/edit.html.twig @@ -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 %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdPosition/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdPosition/index.html.twig new file mode 100644 index 000000000..d1d716434 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdPosition/index.html.twig @@ -0,0 +1,49 @@ +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} + +{% block admin_content %} + {% embed '@ChillMain/CRUD/_index.html.twig' %} + {% block table_entities_thead_tr %} + {{ 'Id'|trans }} + {{ 'Label'|trans }} + {{ 'household.allowHolder'|trans }} + {{ 'household.shareHousehold'|trans }} +   + {% endblock %} + + {% block table_entities_tbody %} + {% for entity in entities %} + + {{ entity.id }} + {{ entity.label|localize_translatable_string }} + + {%- if entity.allowHolder -%} + + {%- else -%} + + {%- endif -%} + + + {%- if entity.shareHousehold -%} + + {%- else -%} + + {%- endif -%} + + + + + + {% endfor %} + {% endblock %} + + {% block actions_before %} +
  • + {{'Back to the admin'|trans}} +
  • + {% endblock %} + {% endembed %} +{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdPosition/new.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdPosition/new.html.twig new file mode 100644 index 000000000..3a28dd85f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdPosition/new.html.twig @@ -0,0 +1,12 @@ +{% 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 %} + diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Relation/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Relation/edit.html.twig new file mode 100644 index 000000000..28678bf6d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/Relation/edit.html.twig @@ -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 %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Relation/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Relation/index.html.twig new file mode 100644 index 000000000..d7634e63e --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/Relation/index.html.twig @@ -0,0 +1,41 @@ +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} + +{% block admin_content %} + {% embed '@ChillMain/CRUD/_index.html.twig' %} + {% block table_entities_thead_tr %} + {{ 'Id'|trans }} + {{ 'Title'|trans }} + {{ 'Active'|trans }} +   + {% endblock %} + + {% block table_entities_tbody %} + {% for entity in entities %} + + {{ entity.id }} + {{ entity.title|localize_translatable_string }} - {{ entity.reverseTitle|localize_translatable_string }} + + {%- if entity.isActive -%} + + {%- else -%} + + {%- endif -%} + + + + + + {% endfor %} + {% endblock %} + + {% block actions_before %} +
  • + {{'Back to the admin'|trans}} +
  • + {% endblock %} + {% endembed %} +{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Relation/new.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Relation/new.html.twig new file mode 100644 index 000000000..3a28dd85f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/Relation/new.html.twig @@ -0,0 +1,12 @@ +{% 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 %} + diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 209a955d8..ea22a2793 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -390,6 +390,18 @@ crud: add_new: Ajouter un nouveau title_new: Nouveau type de personne-ressource title_edit: Modifier le type de personne-ressource + person_household_position: + index: + title: Position + add_new: Ajouter un nouveau + title_new: Nouvelle position + title_edit: Modifier la position + person_relation: + index: + title: Relations de filiations + add_new: Ajouter un nouveau + title_new: Nouvelle relation de filiation + title_edit: Modifier la relation de filiation social_issue: index: title: Liste des problématiques sociales @@ -436,6 +448,14 @@ socialAction: defaultNotificationDelay: Délai de notification par défaut socialIssue: Problématique sociale +household: + allowHolder: Peut être titulaire + shareHousehold: Peut être partagé + +relation: + title: Premier membre + reverseTitle: Deuxième membre + # specific to closing motive closing_motive: any parent: Aucun parent @@ -462,7 +482,7 @@ person_admin: social_result: Résultats social_evaluation: Évaluations social_work: Accompagnement social - + relation: Relations de filiations # specific to accompanying period accompanying_period: