diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php index 9d647a84e..1580c5932 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php @@ -30,7 +30,7 @@ class HouseholdController extends AbstractController $this->translator = $translator; $this->positionRepository = $positionRepository; } - + /** * @Route( * "/{household_id}/summary", @@ -47,7 +47,7 @@ class HouseholdController extends AbstractController ->findByActiveOrdered() ; - // little performance improvement: + // little performance improvement: // initialize members collection, which will avoid // some queries $household->getMembers()->initialize(); @@ -67,6 +67,31 @@ class HouseholdController extends AbstractController ); } + /** + * @Route( + * "/{household_id}/accompanying-period", + * name="chill_person_household_accompanying_period", + * methods={"GET", "HEAD"} + * ) + * @ParamConverter("household", options={"id" = "household_id"}) + */ + public function accompanyingPeriod(Request $request, Household $household) + { + // TODO ACL + + $members = $household->getMembers(); + foreach($members as $m) { + $accompanyingPeriods = $m->getPerson()->getAccompanyingPeriods(); + } + + return $this->render('@ChillPerson/Household/accompanying_period.html.twig', + [ + 'household' => $household, + 'accompanying_periods' => $accompanyingPeriods + ] + ); + } + /** * @Route( * "/{household_id}/addresses", diff --git a/src/Bundle/ChillPersonBundle/Menu/HouseholdMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/HouseholdMenuBuilder.php index 367a53890..c9eade17a 100644 --- a/src/Bundle/ChillPersonBundle/Menu/HouseholdMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/HouseholdMenuBuilder.php @@ -9,22 +9,22 @@ use Symfony\Contracts\Translation\TranslatorInterface; class HouseholdMenuBuilder implements LocalMenuBuilderInterface { - + /** * @var TranslatorInterface */ protected $translator; - + public function __construct(TranslatorInterface $translator) { $this->translator = $translator; } - + public static function getMenuIds(): array { return [ 'household' ]; } - + public function buildMenu($menuId, MenuItem $menu, array $parameters): void { $household = $parameters['household']; @@ -35,15 +35,22 @@ class HouseholdMenuBuilder implements LocalMenuBuilderInterface 'household_id' => $household->getId() ]]) ->setExtras(['order' => 10]); - + + $menu->addChild($this->translator->trans('household.Accompanying period'), [ + 'route' => 'chill_person_household_accompanying_period', + 'routeParameters' => [ + 'household_id' => $household->getId() + ]]) + ->setExtras(['order' => 20]); + $menu->addChild($this->translator->trans('household.Addresses'), [ 'route' => 'chill_person_household_addresses', 'routeParameters' => [ 'household_id' => $household->getId() ]]) ->setExtras(['order' => 30]); - + } - - + + } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig new file mode 100644 index 000000000..0b4604283 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig @@ -0,0 +1,136 @@ +{% block content %} + + {% for accompanying_period in accompanying_periods %} +
+ + {{ p.person.firstname ~ ' ' ~ p.person.lastname }} + +
+ {% endfor %} + {% else %} + {{ 'No data given'|trans }} + {% endif %} +{{ accompanying_period.requestorPerson.firstname ~ ' ' ~ accompanying_period.requestorPerson.lastname }}
+ {% endif %} + {% if accompanying_period.requestorThirdParty is not null %} +{{ accompanying_period.requestorThirdParty.name }}
+ {% endif %} + {% else %} + {{ 'No data given'|trans }} + {% endif %} +{{ si.title|localize_translatable_string }}
+ {% endfor %} + {% else %} + {{ 'No data given'|trans }} + {% endif %} +- - {{ p.person.firstname ~ ' ' ~ p.person.lastname }} - -
- {% endfor %} - {% else %} - {{ 'No data given'|trans }} - {% endif %} -{{ accompanying_period.requestorPerson.firstname ~ ' ' ~ accompanying_period.requestorPerson.lastname }}
- {% endif %} - {% if accompanying_period.requestorThirdParty is not null %} -{{ accompanying_period.requestorThirdParty.name }}
- {% endif %} - {% else %} - {{ 'No data given'|trans }} - {% endif %} -{{ si.title|localize_translatable_string }}
- {% endfor %} - {% else %} - {{ 'No data given'|trans }} - {% endif %} -