Merge branch 'master' into upgrade-sf5

This commit is contained in:
Julien Fastré 2024-09-16 15:29:43 +02:00
commit 7206e13984
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
3 changed files with 27 additions and 3 deletions

View File

@ -0,0 +1,6 @@
kind: Fixed
body: Show only the current referrer in the page "show" for an accompanying period
workf
time: 2024-09-16T15:18:43.017401122+02:00
custom:
Issue: "308"

View File

@ -290,7 +290,13 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
} }
/** /**
* @return ReadableCollection<int, User> * Retrieves a collection of current referrers.
*
* This method filters the referrer history to get only those entries
* where the end date is null, maps them to their associated users,
* and returns them as a new ReadableCollection.
*
* @return ReadableCollection<int, User> collection of active referrers
*/ */
#[Serializer\Groups(['accompanying_period_work:edit'])] #[Serializer\Groups(['accompanying_period_work:edit'])]
public function getReferrers(): ReadableCollection public function getReferrers(): ReadableCollection
@ -303,6 +309,18 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
return new ArrayCollection(array_values($users)); return new ArrayCollection(array_values($users));
} }
/**
* @return ReadableCollection<int, AccompanyingPeriodWorkReferrerHistory>
*/
public function getReferrersHistoryCurrent(): ReadableCollection
{
return new ArrayCollection(
$this->getReferrersHistory()
->filter(fn (AccompanyingPeriodWorkReferrerHistory $h) => null === $h->getEndDate())
->getValues()
);
}
/** /**
* @return Collection<int, AccompanyingPeriodWorkReferrerHistory> * @return Collection<int, AccompanyingPeriodWorkReferrerHistory>
*/ */

View File

@ -83,10 +83,10 @@
</div> </div>
<div class="wl-col list"> <div class="wl-col list">
{%- if w.referrers|length > 0 -%} {%- if w.referrers|length > 0 -%}
{% for r in w.referrersHistory %} {% for r in w.referrersHistoryCurrent %}
<span class="wl-item"> <span class="wl-item">
<span class="badge-user">{{ r.user|chill_entity_render_box({'at_date': r.startDate}) }}</span> <span class="badge-user">{{ r.user|chill_entity_render_box({'at_date': r.startDate}) }}</span>
{% if not loop.last %}, {% endif %} {%- if not loop.last %}, {% endif %}
</span> </span>
{% endfor %} {% endfor %}
{% else %} {% else %}