diff --git a/CHANGELOG.md b/CHANGELOG.md index a261ba247..96685b5f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ and this project adheres to * [phonenumber] Remove placeholder in phonenumber field (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/496) * [person_resource] separate create page created to avoid confusion (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/504) * [contact] add contact button color changed plus the pipe at the side removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/506) +* [household] create-edit household composition placed in separate page to avoid confusion (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/505) * [blur] Improved positioning of toggle icon (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/486) ## Test releases diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php index 22e92eb02..1144688fe 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php @@ -134,7 +134,7 @@ class HouseholdCompositionController extends AbstractController public function index(Household $household, Request $request): Response { if (!$this->security->isGranted(HouseholdVoter::SEE, $household)) { - throw new AccessDeniedException('not allowed to edit an household'); + throw new AccessDeniedException('not allowed to edit a household'); } $count = $this->householdCompositionRepository->countByHousehold($household); @@ -146,6 +146,20 @@ class HouseholdCompositionController extends AbstractController $paginator->getCurrentPageFirstItemNumber() ); + return new Response($this->engine->render( + '@ChillPerson/HouseholdComposition/index.html.twig', + [ + 'household' => $household, + 'compositions' => $compositions, + ] + )); + } + + /** + * @Route("/{_locale}/person/household/{id}/composition/new", name="chill_person_household_composition_new") + */ + public function newAction(Household $household, Request $request): Response + { if ($this->security->isGranted(HouseholdVoter::EDIT, $household)) { $isEdit = $request->query->has('edit'); @@ -195,10 +209,9 @@ class HouseholdCompositionController extends AbstractController } return new Response($this->engine->render( - '@ChillPerson/HouseholdComposition/index.html.twig', + '@ChillPerson/HouseholdComposition/create.html.twig', [ 'household' => $household, - 'compositions' => $compositions, 'form' => isset($form) ? $form->createView() : null, 'isPosted' => isset($form) ? $form->isSubmitted() : false, 'editId' => $request->query->getInt('edit', -1), diff --git a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/create.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/create.html.twig new file mode 100644 index 000000000..334832a63 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/create.html.twig @@ -0,0 +1,26 @@ +{% extends '@ChillPerson/Household/layout.html.twig' %} + +{% block title 'household_composition.create'|trans %} + +{% block block_post_menu %} +
+{% endblock %} + +{% block content %} + +

{{ 'household_composition.Create'|trans }}

+ +
+ {{ form_start(form) }} + + {{ form_widget(form) }} + + + {{ form_end(form) }} +
+ +{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/index.html.twig index 7ff72b2cd..7d3adc04a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/index.html.twig @@ -15,7 +15,7 @@ {% else %}
{% for c in compositions %} - {% if c.id != editId %} + {# {% if c.id != editId %} #}
@@ -42,7 +42,7 @@
- {{ form_end(form) }} - {% endif %} {% endfor %}
{% endif %} -
- {{ form_start(form) }} - - {{ form_widget(form) }} - -
    -
  • - -
  • -
- {{ form_end(form) }} -
- - {% if editId == -1 %} + {% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', household) %} {% endif %}
diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index e4265fca0..bc238570d 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -566,6 +566,7 @@ household_composition: Currently no composition: Aucune composition familiale renseignée. Add a composition: Ajouter une composition familiale Update composition: Modifier la composition familiale + Create: Créér une nouvelle composition familiale # docgen Linked evaluations: Évaluations associées