diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeController.php new file mode 100644 index 000000000..eb1dc1ea9 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeController.php @@ -0,0 +1,26 @@ +addOrderBy('e.id', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index d7037c1d2..73ebb007c 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -227,6 +227,27 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], ], ], + [ + 'class' => \Chill\PersonBundle\Entity\Household\HouseholdCompositionType::class, + 'name' => 'person_household_composition_type', + 'base_path' => '/admin/person/household/composition-type', + 'form_class' => \Chill\PersonBundle\Form\HouseholdCompositionTypeType::class, + 'controller' => \Chill\PersonBundle\Controller\HouseholdCompositionTypeController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/HouseholdCompositionType/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/HouseholdCompositionType/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/HouseholdCompositionType/edit.html.twig', + ], + ], + ], [ 'class' => \Chill\PersonBundle\Entity\Relationships\Relation::class, 'name' => 'person_relation', diff --git a/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionTypeType.php b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionTypeType.php new file mode 100644 index 000000000..f5d26da7f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionTypeType.php @@ -0,0 +1,39 @@ +add('label', TranslatableStringFormType::class) + ->add('active', CheckboxType::class, [ + 'label' => 'Actif?', + 'required' => false, + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefault('class', HouseholdCompositionType::class); + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Menu/AdminHouseholdMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AdminHouseholdMenuBuilder.php index e68059e1d..4dc43bcaa 100644 --- a/src/Bundle/ChillPersonBundle/Menu/AdminHouseholdMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/AdminHouseholdMenuBuilder.php @@ -46,9 +46,13 @@ class AdminHouseholdMenuBuilder implements LocalMenuBuilderInterface 'route' => 'chill_crud_person_household_position_index', ])->setExtras(['order' => 2110]); + $menu->addChild('Composition', [ + 'route' => 'chill_crud_person_household_composition_type_index', + ])->setExtras(['order' => 2120]); + $menu->addChild('person_admin.relation', [ 'route' => 'chill_crud_person_relation_index', - ])->setExtras(['order' => 2120]); + ])->setExtras(['order' => 2130]); } public static function getMenuIds(): array diff --git a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/edit.html.twig new file mode 100644 index 000000000..28678bf6d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/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/HouseholdCompositionType/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/index.html.twig new file mode 100644 index 000000000..252e932e8 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/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 }} + {{ 'Label'|trans }} + {{ 'Active'|trans }} +   + {% endblock %} + + {% block table_entities_tbody %} + {% for entity in entities %} + + {{ entity.id }} + {{ entity.label|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/HouseholdCompositionType/new.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/new.html.twig new file mode 100644 index 000000000..3a28dd85f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/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 266970698..7fdec7314 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -409,6 +409,12 @@ crud: add_new: Ajouter un nouveau title_new: Nouvelle position title_edit: Modifier la position + person_household_composition_type: + index: + title: Composition + add_new: Ajouter un nouveau + title_new: Nouvelle composition + title_edit: Modifier la composition person_relation: index: title: Relations de filiations