Compare commits

..

1 Commits

Author SHA1 Message Date
cacb7a0340 Display calendar item info on cancel page 2025-11-24 16:47:30 +01:00
9 changed files with 20 additions and 44 deletions

View File

@@ -1,6 +0,0 @@
kind: Feature
body: Add a counter for invitations awaiting reply
time: 2025-11-25T16:58:11.780678466+01:00
custom:
Issue: "459"
SchemaChange: No schema change

View File

@@ -0,0 +1,6 @@
kind: UX
body: Display calendar item info on cancel page
time: 2025-11-24T16:47:23.020302054+01:00
custom:
Issue: "460"
SchemaChange: No schema change

View File

@@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Chill\CalendarBundle\Menu; namespace Chill\CalendarBundle\Menu;
use Chill\CalendarBundle\Repository\InviteRepository;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem; use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
@@ -19,12 +18,10 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class UserMenuBuilder implements LocalMenuBuilderInterface class UserMenuBuilder implements LocalMenuBuilderInterface
{ {
public function __construct(private readonly Security $security, public TranslatorInterface $translator, private readonly InviteRepository $inviteRepository) {} public function __construct(private readonly Security $security, public TranslatorInterface $translator) {}
public function buildMenu($menuId, MenuItem $menu, array $parameters) public function buildMenu($menuId, MenuItem $menu, array $parameters)
{ {
$invitationsPending = $this->inviteRepository->countPendingInvitesByUser($this->security->getUser());
if ($this->security->isGranted('ROLE_USER')) { if ($this->security->isGranted('ROLE_USER')) {
$menu->addChild('My calendar list', [ $menu->addChild('My calendar list', [
'route' => 'chill_calendar_calendar_list_my', 'route' => 'chill_calendar_calendar_list_my',
@@ -33,14 +30,12 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
'order' => 8, 'order' => 8,
'icon' => 'tasks', 'icon' => 'tasks',
]); ]);
$menu->addChild( $menu->addChild('invite.list.title', [
$this->translator->trans('invite.menu with counter', ['nb' => $invitationsPending]), 'route' => 'chill_calendar_invitations_list_my',
['route' => 'chill_calendar_invitations_list_my'] ])
)
->setExtras([ ->setExtras([
'order' => 9, 'order' => 9,
'icon' => 'tasks', 'icon' => 'tasks',
'counter' => 0 < $invitationsPending ? $invitationsPending : null,
]); ]);
} }
} }

View File

@@ -75,25 +75,6 @@ class InviteRepository implements ObjectRepository
->getSingleScalarResult(); ->getSingleScalarResult();
} }
public function countPendingInvitesByUser(User $user): int
{
$qb = $this->entityRepository->createQueryBuilder('i');
$qb->select('COUNT(i)')
->where(
$qb->expr()->andX(
$qb->expr()->eq('i.user', ':user'),
$qb->expr()->eq('i.status', ':status')
)
)
->setParameters([
'user' => $user,
'status' => Invite::PENDING,
]);
return $qb->getQuery()->getSingleScalarResult();
}
public function buildAcceptedInviteByUserAndDateRangeQuery(User $user, \DateTimeImmutable $from, \DateTimeImmutable $to) public function buildAcceptedInviteByUserAndDateRangeQuery(User $user, \DateTimeImmutable $from, \DateTimeImmutable $to)
{ {
$qb = $this->entityRepository->createQueryBuilder('i'); $qb = $this->entityRepository->createQueryBuilder('i');

View File

@@ -162,6 +162,7 @@
{% endif %} {% endif %}
<div class="item-row separator"> <div class="item-row separator">
{% if show_record_actions is not defined or show_record_actions %}
<ul class="record_actions"> <ul class="record_actions">
{% if is_granted('CHILL_CALENDAR_DOC_EDIT', calendar) and calendar.status is not constant('STATUS_CANCELED', calendar) %} {% if is_granted('CHILL_CALENDAR_DOC_EDIT', calendar) and calendar.status is not constant('STATUS_CANCELED', calendar) %}
{% if templates|length == 0 %} {% if templates|length == 0 %}
@@ -245,7 +246,7 @@
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
{% endif %}
</div> </div>
</div> </div>

View File

@@ -6,6 +6,10 @@
{% block content %} {% block content %}
<div class="flex-table list-records context-accompanyingCourse">
{{ include('@ChillCalendar/Calendar/_list.html.twig', {context: 'accompanying_course', show_record_actions: false}) }}
</div>
{{ form_start(form) }} {{ form_start(form) }}
{{ form_row(form.cancelReason) }} {{ form_row(form.cancelReason) }}

View File

@@ -6,6 +6,10 @@
{% block content %} {% block content %}
<div class="flex-table list-records context-person">
{{ include('@ChillCalendar/Calendar/_list.html.twig', {context: 'person', show_record_actions: false}) }}
</div>
{{ form_start(form) }} {{ form_start(form) }}
{{ form_row(form.cancelReason) }} {{ form_row(form.cancelReason) }}

View File

@@ -6,11 +6,3 @@ chill_calendar:
few {# rendez-vous sont ignorés par le filtre de date. Modifiez le filtre de date pour les voir apparaitre.} few {# rendez-vous sont ignorés par le filtre de date. Modifiez le filtre de date pour les voir apparaitre.}
other {# rendez-vous sont ignorés par le filtre de date. Modifiez le filtre de date pour les voir apparaitre.} other {# rendez-vous sont ignorés par le filtre de date. Modifiez le filtre de date pour les voir apparaitre.}
} }
invite:
menu with counter: >-
{nb, plural,
=0 {Mes invitations}
one {# invitation}
few {# invitations}
other {# invitations}
}

View File

@@ -96,7 +96,6 @@ invite:
list: list:
none: Il n'y aucun invitation none: Il n'y aucun invitation
title: Mes invitations title: Mes invitations
number of invitations waiting: Invitations en attente
# exports # exports
Exports of calendar: Exports des rendez-vous Exports of calendar: Exports des rendez-vous