mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch '122-improve-list-rendez-vous' into 'master'
Update calendar list display for the the next calendar in search results Closes #122 See merge request Chill-Projet/chill-bundles!700
This commit is contained in:
commit
5ca222b501
9
.changes/unreleased/Feature-20240613-180648.yaml
Normal file
9
.changes/unreleased/Feature-20240613-180648.yaml
Normal file
@ -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"
|
@ -1 +1,2 @@
|
||||
import './scss/badge.scss';
|
||||
import './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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -171,7 +171,24 @@
|
||||
<h3>{{ 'chill_calendar.Next calendars'|trans }}</h3>
|
||||
</div>
|
||||
<div class="wl-col list">
|
||||
{% for c in calendars %}<span>{{ c.startDate|format_datetime('long', 'short') }}</span>{% if not loop.last %}, {% endif %}{% endfor %}
|
||||
<div class="calendar-list">
|
||||
<ul class="calendar-list">
|
||||
{% for c in calendars %}
|
||||
<li>
|
||||
{% if is_granted('CHILL_CALENDAR_CALENDAR_EDIT', c) %}
|
||||
<a href="{{ chill_path_add_return_path('chill_calendar_calendar_edit', {id: c.id}) }}">
|
||||
<span class="badge bg-secondary">{{ c.startDate|format_datetime('long', 'short') }}</span>
|
||||
</a>
|
||||
{% else %}
|
||||
<span class="badge bg-secondary">{{ c.startDate|format_datetime('long', 'short') }}</span>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if is_granted('CHILL_CALENDAR_CALENDAR_SEE', acp) %}
|
||||
<a href="{{ chill_path_add_return_path('chill_calendar_calendar_list_by_period', {'id': acp.id}) }}" class="calendar-list__global"><i class="fa fa-list"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user