From f44566037cf95e2a9d6560f7c34e64e38f8a8a78 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 13 Oct 2021 12:17:51 +0200 Subject: [PATCH 01/30] person: fix showHide import/export --- .../ChillMainBundle/Resources/public/lib/show_hide/index.js | 6 +++++- .../Resources/public/lib/show_hide/show_hide.js | 2 +- .../ChillPersonBundle/Resources/views/Person/edit.html.twig | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/show_hide/index.js b/src/Bundle/ChillMainBundle/Resources/public/lib/show_hide/index.js index 34f3b80b5..88890ab40 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/show_hide/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/show_hide/index.js @@ -1 +1,5 @@ -require("./show_hide.js"); \ No newline at end of file +//require("./show_hide.js"); + +import { ShowHide } from './show_hide.js' + +export { ShowHide } \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/show_hide/show_hide.js b/src/Bundle/ChillMainBundle/Resources/public/lib/show_hide/show_hide.js index dd4dfd6db..ec6b796ec 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/show_hide/show_hide.js +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/show_hide/show_hide.js @@ -134,4 +134,4 @@ var ShowHide = function(options) { }; }; -export {ShowHide}; +export { ShowHide }; diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig index 2bb7fa4bb..b981eb31e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig @@ -142,5 +142,5 @@ {% endblock %} {% block js %} - {{ encore_entry_link_tags('page_person') }} + {{ encore_entry_script_tags('page_person') }} {% endblock %} From 6a1cf4eb9265a7d2b1b9b4e18d34d00444a04ca6 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 13 Oct 2021 16:22:33 +0200 Subject: [PATCH 02/30] person: capitalize entry in person form --- .../Resources/views/Person/edit.html.twig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig index b981eb31e..98ac7c5d0 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig @@ -135,7 +135,6 @@ - {{ form_end(form) }} @@ -144,3 +143,11 @@ {% block js %} {{ encore_entry_script_tags('page_person') }} {% endblock %} + +{% block css %} + +{% endblock %} \ No newline at end of file From b800b62e8892d214f69570b84f544cc8b561ffb3 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 14 Oct 2021 22:33:31 +0200 Subject: [PATCH 03/30] person: capitalise place of birth (frontend + backend) --- src/Bundle/ChillPersonBundle/Form/PersonType.php | 16 +++++++++++++++- .../Resources/views/Person/edit.html.twig | 8 -------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php index 8bc982713..f2fd8ea3a 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php @@ -35,6 +35,7 @@ use Chill\PersonBundle\Form\Type\Select2MaritalStatusType; use Symfony\Component\Form\AbstractType; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\CommentType; +use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\TelType; use Symfony\Component\Form\Extension\Core\Type\TextType; @@ -114,7 +115,19 @@ class PersonType extends AbstractType } if ($this->config['place_of_birth'] === 'visible') { - $builder->add('placeOfBirth', TextType::class, array('required' => false)); + $builder->add('placeOfBirth', TextType::class, array( + 'required' => false, + 'attr' => ['style' => 'text-transform: uppercase;'], + )); + + $builder->get('placeOfBirth')->addModelTransformer(new CallbackTransformer( + function ($string) { + return strtoupper($string); + }, + function ($string) { + return strtoupper($string); + } + )); } if ($this->config['contact_info'] === 'visible') { @@ -192,6 +205,7 @@ class PersonType extends AbstractType array('attr' => array('class' => 'cf-fields'), 'group' => $options['cFGroup'])) ; } + } /** diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig index 98ac7c5d0..fdbc0d8ad 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig @@ -143,11 +143,3 @@ {% block js %} {{ encore_entry_script_tags('page_person') }} {% endblock %} - -{% block css %} - -{% endblock %} \ No newline at end of file From 69ae252da63cda22ec26a648d7036cb6fad67dc7 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 15 Oct 2021 21:46:09 +0200 Subject: [PATCH 04/30] person: delete accept Email --- src/Bundle/ChillPersonBundle/Form/PersonType.php | 3 +-- .../ChillPersonBundle/Resources/views/Person/edit.html.twig | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php index f2fd8ea3a..85b8619c2 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php @@ -163,8 +163,7 @@ class PersonType extends AbstractType if ($this->config['email'] === 'visible') { $builder - ->add('email', EmailType::class, array('required' => false)) - ->add('acceptEmail', CheckboxType::class, array('required' => false)); + ->add('email', EmailType::class, array('required' => false)); } if ($this->config['country_of_birth'] === 'visible') { diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig index fdbc0d8ad..a8fc88f5e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig @@ -95,9 +95,6 @@
{{ form_row(form.email, {'label': 'Email'}) }}
-
- {{ form_row(form.acceptEmail, {'label' : 'Accept emails ?'}) }} -
{%- endif -%} {%- if form.phonenumber is defined -%} From f6806f7743e355db643d197d61be06885853eb04 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 15 Oct 2021 21:56:49 +0200 Subject: [PATCH 05/30] person: new translation for accept SMS --- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index a17bbc55f..2a82d8c09 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -47,8 +47,8 @@ Phonenumber: 'Numéro de téléphone' phonenumber: numéro de téléphone Mobilenumber: 'Numéro de téléphone portable' mobilenumber: numéro de téléphone portable -Accept short text message ?: Accepte les SMS? -Accept short text message: Accepte les SMS +Accept short text message ?: La personne a donné l'autorisation d'utiliser ce no de téléphone pour l'envoi de rappel par SMS +Accept short text message: La personne a donné l'autorisation d'utiliser ce no de téléphone pour l'envoi de rappel par SMS Other phonenumber: Autre numéro de téléphone Description: description Add new phone: Ajouter un numéro de téléphone From 816855e6f8020607eb2cf02b3cd1bc0acc396d2b Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 26 Oct 2021 14:12:53 +0200 Subject: [PATCH 06/30] mod input address: add an event listener to add this component for collections --- .../vuejs/Address/mod_input_address_index.js | 139 +++++++++--------- 1 file changed, 73 insertions(+), 66 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/mod_input_address_index.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/mod_input_address_index.js index ad4a648f5..9c5f9eaa7 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/mod_input_address_index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/mod_input_address_index.js @@ -5,82 +5,89 @@ import App from './App.vue'; const i18n = _createI18n(addressMessages); -let inputs = document.querySelectorAll('input[type="hidden"][data-input-address]'); +const addAddressInput = (inputs) => { -const isNumeric = function(v) { return !isNaN(v); }; + inputs.forEach(el => { + let + addressId = el.value, + uniqid = el.dataset.inputAddress, + container = document.querySelector('div[data-input-address-container="' + uniqid + '"]'), + isEdit = addressId !== '', + addressIdInt = addressId !== '' ? parseInt(addressId) : null + ; -inputs.forEach(el => { - let - addressId = el.value, - uniqid = el.dataset.inputAddress, - container = document.querySelector('div[data-input-address-container="' + uniqid + '"]'), - isEdit = addressId !== '', - addressIdInt = addressId !== '' ? parseInt(addressId) : null - ; + if (container === null) { + throw Error("no container"); + } + console.log('useValidFrom', el.dataset.useValidFrom === '1'); - if (container === null) { - throw Error("no container"); - } - console.log('useValidFrom', el.dataset.useValidFrom === '1'); - - const app = createApp({ - template: ``, - data() { - return { - addAddress: { - context: { - // for legacy ? can be remove ? - target: { - name: 'input-address', - id: addressIdInt, - }, - edit: isEdit, - addressId: addressIdInt, - }, - options: { - /// Options override default. - /// null value take default component value defined in AddAddress data() - button: { - text: { - create: el.dataset.buttonTextCreate || null, - edit: el.dataset.buttonTextUpdate || null, + const app = createApp({ + template: ``, + data() { + return { + addAddress: { + context: { + // for legacy ? can be remove ? + target: { + name: 'input-address', + id: addressIdInt, }, - size: null, - displayText: true + edit: isEdit, + addressId: addressIdInt, }, + options: { + /// Options override default. + /// null value take default component value defined in AddAddress data() + button: { + text: { + create: el.dataset.buttonTextCreate || null, + edit: el.dataset.buttonTextUpdate || null, + }, + size: null, + displayText: true + }, - /// Modal title text if create or edit address (trans chain, see i18n) - title: { - create: null, - edit: null, - }, + /// Modal title text if create or edit address (trans chain, see i18n) + title: { + create: null, + edit: null, + }, - /// Display panes in Modal for step123 - openPanesInModal: true, + /// Display panes in Modal for step123 + openPanesInModal: true, - /// Display actions buttons of panes in a sticky-form-button navbar - stickyActions: false, - showMessageWhenNoAddress: true, + /// Display actions buttons of panes in a sticky-form-button navbar + stickyActions: false, + showMessageWhenNoAddress: true, - /// Use Date fields - useDate: { - validFrom: el.dataset.useValidFrom === '1' || false, //boolean, default: false - validTo: el.dataset.useValidTo === '1' || false, //boolean, default: false - }, + /// Use Date fields + useDate: { + validFrom: el.dataset.useValidFrom === '1' || false, //boolean, default: false + validTo: el.dataset.useValidTo === '1' || false, //boolean, default: false + }, - /// Don't display show renderbox Address: showPane display only a button - onlyButton: false, + /// Don't display show renderbox Address: showPane display only a button + onlyButton: false, + } } } + }, + methods: { + associateToInput(payload) { + el.value = payload.addressId; + } } - }, - methods: { - associateToInput(payload) { - el.value = payload.addressId; - } - } - }) - .use(i18n) - .component('app', App) - .mount(container); -}); + }) + .use(i18n) + .component('app', App) + .mount(container); + }); +}; + +document.addEventListener('DOMContentLoaded', (_e) => + addAddressInput(document.querySelectorAll('input[type="hidden"][data-input-address]')) +); + +window.addEventListener('collection-add-entry', (_e) => + addAddressInput(document.querySelectorAll('input[type="hidden"][data-input-address]')) +); \ No newline at end of file From c90f9ee5bc9b5b390622ec31eb9f298c2e5a68a0 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 28 Oct 2021 08:07:01 +0200 Subject: [PATCH 07/30] add mod_input_address_index to collection event: better addition of the event listener to the DOM --- .../Resources/public/vuejs/Address/mod_input_address_index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/mod_input_address_index.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/mod_input_address_index.js index 9c5f9eaa7..0f39c5e75 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/mod_input_address_index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/mod_input_address_index.js @@ -88,6 +88,6 @@ document.addEventListener('DOMContentLoaded', (_e) => addAddressInput(document.querySelectorAll('input[type="hidden"][data-input-address]')) ); -window.addEventListener('collection-add-entry', (_e) => - addAddressInput(document.querySelectorAll('input[type="hidden"][data-input-address]')) +window.addEventListener('collection-add-entry', (e) => + addAddressInput(e.detail.entry.querySelectorAll('input[type="hidden"][data-input-address]')) ); \ No newline at end of file From 046f65f5ff408ad6e0862aae82666bf926144f56 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 28 Oct 2021 09:45:27 +0200 Subject: [PATCH 08/30] person: re-add accpet email and add possibility of hidding this field --- .../ChillPersonBundle/DependencyInjection/Configuration.php | 1 + src/Bundle/ChillPersonBundle/Form/PersonType.php | 5 +++++ .../ChillPersonBundle/Resources/views/Person/edit.html.twig | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php index bf2d18922..4218174eb 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php @@ -82,6 +82,7 @@ class Configuration implements ConfigurationInterface ->append($this->addFieldNode('accompanying_period')) ->append($this->addFieldNode('memo')) ->append($this->addFieldNode('number_of_children')) + ->append($this->addFieldNode('acceptEmail')) ->arrayNode('alt_names') ->defaultValue([]) ->arrayPrototype() diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php index 85b8619c2..abe4750f2 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php @@ -166,6 +166,11 @@ class PersonType extends AbstractType ->add('email', EmailType::class, array('required' => false)); } + if ($this->config['acceptEmail'] === 'visible') { + $builder + ->add('acceptEmail', CheckboxType::class, array('required' => false)); + } + if ($this->config['country_of_birth'] === 'visible') { $builder->add('countryOfBirth', Select2CountryType::class, array( 'required' => false diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig index a8fc88f5e..80c1e76f9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig @@ -95,6 +95,11 @@
{{ form_row(form.email, {'label': 'Email'}) }}
+ {% endif %} + {%- if form.acceptEmail is defined -%} +
+ {{ form_row(form.acceptEmail, {'label' : 'Accept emails ?'}) }} +
{%- endif -%} {%- if form.phonenumber is defined -%} From e9d20a56ffac70116318afc7d22db7a9a3981700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sat, 30 Oct 2021 02:08:31 +0200 Subject: [PATCH 09/30] show members without position in list --- .../Entity/Household/Household.php | 30 ++++ .../Entity/Household/HouseholdMember.php | 2 +- .../Household/MembersEditor.php | 16 +- .../views/Household/banner.html.twig | 7 +- .../views/Household/summary.html.twig | 144 ++++++++++-------- .../translations/messages+intl-icu.fr.yaml | 1 + 6 files changed, 128 insertions(+), 72 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php index 46ae02ce0..2669aed32 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php @@ -245,6 +245,16 @@ class Household $members->getIterator() ->uasort( function (HouseholdMember $a, HouseholdMember $b) { + if ($a->getPosition() === NULL) { + if ($b->getPosition() === NULL) { + return 0; + } else { + return -1; + } + } elseif ($b->getPosition() === NULL) { + return 1; + } + if ($a->getPosition()->getOrdering() < $b->getPosition()->getOrdering()) { return -1; } @@ -334,6 +344,26 @@ class Household return $this->getNonCurrentMembers($now)->matching($criteria); } + public function getCurrentMembersWithoutPosition(\DateTimeInterface $now = null) + { + $criteria = new Criteria(); + $expr = Criteria::expr(); + + $criteria->where($expr->isNull('position')); + + return $this->getCurrentMembers($now)->matching($criteria); + } + + public function getNonCurrentMembersWithoutPosition(\DateTimeInterface $now = null) + { + $criteria = new Criteria(); + $expr = Criteria::expr(); + + $criteria->where($expr->isNull('position')); + + return $this->getNonCurrentMembers($now)->matching($criteria); + } + public function addMember(HouseholdMember $member): self { if (!$this->members->contains($member)) { diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php index 985084623..89ec4feb5 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php @@ -29,7 +29,7 @@ class HouseholdMember /** * @ORM\ManyToOne(targetEntity=Position::class) * @Serializer\Groups({"read"}) - * @Assert\NotNull(groups={"household_memberships"}) + * @Assert\NotNull(groups={"household_memberships_created"}) */ private ?Position $position = null; diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php index 2fd322bb4..f718bb8a9 100644 --- a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php +++ b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php @@ -19,15 +19,17 @@ class MembersEditor private array $persistables = []; private array $membershipsAffected = []; + private array $oldMembershipsHashes = []; - public const VALIDATION_GROUP = 'household_memberships'; + public const VALIDATION_GROUP_CREATED = 'household_memberships_created'; + public const VALIDATION_GROUP_AFFECTED = 'household_memberships'; public function __construct(ValidatorInterface $validator, ?Household $household) { $this->validator = $validator; $this->household = $household; } - + public function addMovement(\DateTimeImmutable $date, Person $person, Position $position, ?bool $holder = false, ?string $comment = null): self { if (NULL === $this->household) { @@ -56,6 +58,7 @@ class MembersEditor if ($participation->getEndDate() === NULL || $participation->getEndDate() > $date) { $participation->setEndDate($date); $this->membershipsAffected[] = $participation; + $this->oldMembershipsHashes[] = \spl_object_hash($participation); } } } @@ -97,13 +100,18 @@ class MembersEditor { if ($this->hasHousehold()) { $list = $this->validator - ->validate($this->getHousehold(), null, [ self::VALIDATION_GROUP ]); + ->validate($this->getHousehold(), null, [ self::VALIDATION_GROUP_AFFECTED ]); } else { $list = new ConstraintViolationList(); } foreach ($this->membershipsAffected as $m) { - $list->addAll($this->validator->validate($m, null, [ self::VALIDATION_GROUP ])); + if (\in_array(\spl_object_hash($m), $this->oldMembershipsHashes)) { + $list->addAll($this->validator->validate($m, null, [ self::VALIDATION_GROUP_AFFECTED ])); + } else { + $list->addAll($this->validator->validate($m, null, [ self::VALIDATION_GROUP_CREATED, + self::VALIDATION_GROUP_AFFECTED ])); + } } return $list; diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/banner.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/banner.html.twig index 990a7cdd3..50822794c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/banner.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/banner.html.twig @@ -22,8 +22,11 @@ {%- for m in members -%} + class="badge-member{%- if m.holder %} holder{% endif -%}" + {% if m.position is not null %} + title="{{ m.position.label.fr }}" + {% endif %} + > {%- if m.holder %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig index e99c1dc1a..3567d1f7e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig @@ -106,81 +106,95 @@

{{ 'household.Household members'|trans }}

- {% for p in positions %} -
-

{{ p.label|localize_translatable_string }} - {% if false == p.shareHousehold %} - - {% endif %} -

+ {% for p in positions|merge([ '_none' ]) %} - {%- set members = household.currentMembersByPosition(p) %} + {% if p == '_none' %} + {% set members = household.currentMembersWithoutPosition %} + {% set old_members = household.nonCurrentMembersWithoutPosition %} + {% else %} + {%- set members = household.currentMembersByPosition(p) %} + {% set old_members = household.nonCurrentMembersByPosition(p) %} + {% endif %} - {% macro customButtons(member, household) %} -
  • - -
  • -
  • - -
  • - {% endmacro %} + {% if not (p == '_none' and members|length == 0 and old_members|length == 0) %} +
    + {% if p != '_none' %} +

    {{ p.label|localize_translatable_string }} + {% if false == p.shareHousehold %} + + {% endif %} +

    + {% else %} +

    {{ 'household.Members without position'|trans }}

    + {% endif %} - {% if members|length > 0 %} -
    - {% for m in members %} - {% include '@ChillPerson/Household/_render_member.html.twig' with { - 'member': m, - 'customButtons': { 'after': _self.customButtons(m, household) } - } %} - {% endfor %} -
    - {% else %} -

    {{ 'household.Any persons into this position'|trans }}

    - {% endif %} - {% set members = household.nonCurrentMembersByPosition(p) %} - {% if members|length > 0 %} + {% macro customButtons(member, household) %} +
  • + +
  • +
  • + +
  • + {% endmacro %} - -
    -
    -

    - -

    -
    -
    - {% for m in members %} - {% include '@ChillPerson/Household/_render_member.html.twig' with { 'member': m } %} - {% endfor %} + {% if members|length > 0 %} +
    + {% for m in members %} + {% include '@ChillPerson/Household/_render_member.html.twig' with { + 'member': m, + 'customButtons': { 'after': _self.customButtons(m, household) } + } %} + {% endfor %} +
    + {% else %} +

    {{ 'household.Any persons into this position'|trans }}

    + {% endif %} + + {% if old_members|length > 0 %} + +
    +
    +

    + +

    +
    +
    + {% for m in old_members %} + {% include '@ChillPerson/Household/_render_member.html.twig' with { 'member': m } %} + {% endfor %} +
    +
    -
    -
    - {% endif %} + {% endif %} -
    +
    + {% endif %} {% endfor %} + +