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 %} +
+
+
+
+ {{'period'|trans}} #{{ accompanying_period.id }} + {% if accompanying_period.emergency %} +   + + {{- 'Emergency'|trans|upper -}} + + {% endif %} + {% if accompanying_period.confidential %} +   + + {{- 'Confidential'|trans|upper -}} + + {% endif %} + {% if accompanying_period.step == 'DRAFT' %} +   + + {{- 'Draft'|trans|upper -}} + + {% else %} + + {{- 'Confirmed'|trans|upper -}} + + {% endif %} +
+ +
+ {% if chill_accompanying_periods.fields.user == 'visible' %} + {% if accompanying_period.user %} + {{ accompanying_period.user.username }} + {% else %} + {{ 'No accompanying user'|trans }} + {% endif %} + {% endif %} +
+ +
+
+ {% if accompanying_period.closingDate == null %} + {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|format_date('long') } ) }} + {% else %} + {{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({ + '%opening_date%': accompanying_period.openingDate|format_date('long'), + '%closing_date%': accompanying_period.closingDate|format_date('long')} + ) }} + + {% if accompanying_period.isOpen == false %} +
+
{{ 'Closing motive'|trans }} :
+
{{ accompanying_period.closingMotive|chill_entity_render_box }}
+
+ {% endif %} + + {% endif %} +
+ +
+

{{ 'Participants'|trans }}

+ {% if accompanying_period.participations.count > 0 %} + {% for p in accompanying_period.participations %} +

+ + {{ p.person.firstname ~ ' ' ~ p.person.lastname }} + +

+ {% endfor %} + {% else %} + {{ 'No data given'|trans }} + {% endif %} +
+
+

{{ 'Requestor'|trans }}

+ {% if accompanying_period.requestorPerson is not null or accompanying_period.requestorThirdParty is not null %} + {% if accompanying_period.requestorPerson is not null %} +

{{ 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 %} +
+ +
+

{{ 'Social issues'|trans }}

+ {% if accompanying_period.socialIssues.count > 0 %} + {% for si in accompanying_period.socialIssues %} +

{{ si.title|localize_translatable_string }}

+ {% endfor %} + {% else %} + {{ 'No data given'|trans }} + {% endif %} +
+ +
+ +
+ +
+
+

+ {% endfor %} + + +{% endblock content %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig index 4c9c89cce..6abd767b9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig @@ -5,143 +5,11 @@ {% block title %}{{ 'Person accompanying period - %name%'|trans({ '%name%' : person.__toString}) }}{% endblock title %} {% block personcontent %} -

{{ 'Accompanying period list'|trans }}

- {% for accompanying_period in accompanying_periods %} -
-
-
-
- {{'period'|trans}} #{{ accompanying_period.id }} - {% if accompanying_period.emergency %} -   - - {{- 'Emergency'|trans|upper -}} - - {% endif %} - {% if accompanying_period.confidential %} -   - - {{- 'Confidential'|trans|upper -}} - - {% endif %} - {% if accompanying_period.step == 'DRAFT' %} -   - - {{- 'Draft'|trans|upper -}} - - {% else %} - - {{- 'Confirmed'|trans|upper -}} - - {% endif %} -
+{% include 'ChillPersonBundle:AccompanyingPeriod:_list.html.twig' %} -
- {% if chill_accompanying_periods.fields.user == 'visible' %} - {% if accompanying_period.user %} - {{ accompanying_period.user.username }} - {% else %} - {{ 'No accompanying user'|trans }} - {% endif %} - {% endif %} -
- -
-
- {% if accompanying_period.closingDate == null %} - {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|format_date('long') } ) }} - {% else %} - {{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({ - '%opening_date%': accompanying_period.openingDate|format_date('long'), - '%closing_date%': accompanying_period.closingDate|format_date('long')} - ) }} - - {% if accompanying_period.isOpen == false %} -
-
{{ 'Closing motive'|trans }} :
-
{{ accompanying_period.closingMotive|chill_entity_render_box }}
-
- {% endif %} - - {% endif %} -
- -
-

{{ 'Participants'|trans }}

- {% if accompanying_period.participations.count > 0 %} - {% for p in accompanying_period.participations %} -

- - {{ p.person.firstname ~ ' ' ~ p.person.lastname }} - -

- {% endfor %} - {% else %} - {{ 'No data given'|trans }} - {% endif %} -
-
-

{{ 'Requestor'|trans }}

- {% if accompanying_period.requestorPerson is not null or accompanying_period.requestorThirdParty is not null %} - {% if accompanying_period.requestorPerson is not null %} -

{{ 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 %} -
- -
-

{{ 'Social issues'|trans }}

- {% if accompanying_period.socialIssues.count > 0 %} - {% for si in accompanying_period.socialIssues %} -

{{ si.title|localize_translatable_string }}

- {% endfor %} - {% else %} - {{ 'No data given'|trans }} - {% endif %} -
- -
- -
- -
-
-

- {% endfor %} - - -
+
-{% endblock personcontent %} +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/accompanying_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/accompanying_period.html.twig new file mode 100644 index 000000000..132bf5a33 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/accompanying_period.html.twig @@ -0,0 +1,25 @@ +{% extends '@ChillPerson/Household/layout.html.twig' %} + +{% block title 'Household accompanying period'|trans %} + +{% block content %} +

{{ block('title') }}

+ +{% include 'ChillPersonBundle:AccompanyingPeriod:_list.html.twig' %} + +
+ +
+ +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index 18ddea279..2558d7db8 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -38,12 +38,13 @@ household: Edit member household: Modifier l'appartenance au ménage Current household members: Membres actuels Household summary: Résumé + Accompanying period: Parcours d'accompagnement Addresses: Adresses Current address: Adresse actuelle Household does not have any address currently: Le ménage n'a pas d'adresse renseignée actuellement Edit household members: Modifier l'appartenance au ménage and x other persons: >- - {x, plural, + {x, plural, one {et une autre personne} many {et # autres personnes} other {et # autres personnes} @@ -59,7 +60,7 @@ household: data_saved: Données enregistrées Household history for %name%: Historique des ménages pour {name} Household shared: Ménages domiciliés - Household not shared: Ménage non domiciliés + Household not shared: Ménage non domiciliés Never in any household: Membre d'aucun ménage Membership currently running: En cours from: Depuis diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index ec2fedd81..ce9e38d77 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -344,6 +344,8 @@ Members: Membres Addresses: Adresses Move household: Nouveau déménagement Addresses history for household: Historique des adresses +Household accompanying period: Parcours d'accompagnement du ménage +Household summary: Résumé du ménage # accompanying course work Accompanying Course Actions: Actions d'accompagnements