diff --git a/.changes/unreleased/Feature-20240613-180648.yaml b/.changes/unreleased/Feature-20240613-180648.yaml new file mode 100644 index 000000000..700d5bdd1 --- /dev/null +++ b/.changes/unreleased/Feature-20240613-180648.yaml @@ -0,0 +1,9 @@ +kind: Feature +body: |+ + Improve the list of calendar in the search results: make all calendar clicable, and display a list of calendars + + + +time: 2024-06-13T18:06:48.625006204+02:00 +custom: + Issue: "122" diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/chill/chill.js b/src/Bundle/ChillCalendarBundle/Resources/public/chill/chill.js index 56a8ce563..4d96d095b 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/chill/chill.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/chill/chill.js @@ -1 +1,2 @@ import './scss/badge.scss'; +import './scss/calendar-list.scss'; diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/chill/scss/calendar-list.scss b/src/Bundle/ChillCalendarBundle/Resources/public/chill/scss/calendar-list.scss new file mode 100644 index 000000000..c232b78e2 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Resources/public/chill/scss/calendar-list.scss @@ -0,0 +1,26 @@ +ul.calendar-list { + list-style-type: none; + padding: 0; + & > li { + display: inline-block; + } + & > li:nth-child(n+2) { + margin-left: 0.25rem; + } +} + +div.calendar-list { + + ul.calendar-list { + display: inline-block; + } + + & > a.calendar-list__global { + display: inline-block;; + padding: 0.2rem; + min-width: 2rem; + border: 1px solid var(--bs-chill-blue); + border-radius: 0.25rem; + text-align: center; + } +} diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 03a587620..569e3449a 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -869,19 +869,24 @@ class AccompanyingPeriod implements public function getNextCalendarsForPerson(Person $person, $limit = 5): ReadableCollection { $today = new \DateTimeImmutable('today'); - $criteria = Criteria::create() - ->where(Criteria::expr()->gte('startDate', $today)) - // ->andWhere(Criteria::expr()->memberOf('persons', $person)) - ->orderBy(['startDate' => 'DESC']) - ->setMaxResults($limit * 2); - return $this->calendars->matching($criteria) - ->matching( - // due to a bug, filter two times - Criteria::create() - ->where(Criteria::expr()->memberOf('persons', $person)) - ->setMaxResults($limit) - ); + $criteria = Criteria::create(); + $expr = Criteria::expr(); + + $criteria + ->where( + $expr->gte('startDate', $today), + ) + ->orderBy(['startDate' => 'ASC']); + + $criteriaByPerson = Criteria::create(); + $criteriaByPerson + ->where( + $expr->memberOf('persons', $person) + ) + ->setMaxResults($limit); + + return $this->calendars->matching($criteria)->matching($criteriaByPerson); } /** diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index b03edc7aa..c48771aac 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -171,7 +171,24 @@