Erinnerungen: Admin-Umschalter "Alle" für die Gesamtsicht

- Seite Erinnerungen behält die Beschränkung auf den zugeordneten
  Mitarbeiter; Admins können per ?all=1 auf die Gesamtsicht wechseln
- Umschalter "Nur meine" / "Alle"; Mitarbeiterfilter erscheint in der
  Gesamtsicht
- Alle-Links der Übersicht führen für Admins in die Gesamtsicht
- reminder_list_for_user() um $showAll erweitert (nur für Admins wirksam)
- README, ROADMAP und docs/architecture.md aktualisiert
This commit is contained in:
torsten 2026-11-25 20:50:26 +01:00
parent 9425b1dcf1
commit 0e7f77b9bd
7 changed files with 62 additions and 19 deletions

View file

@ -6,12 +6,14 @@
/** @var bool $showDone */
/** @var array $employees */
/** @var bool $hasEmployee */
/** @var bool $hasOwnEmployee */
/** @var bool $canChooseEmployee */
/** @var bool $showAll */
/** @var bool $isAdmin */
/** @var string $today */
/** @var bool $mailEnabled */
/** @var bool $pushEnabled */
$rangeUrl = static function (string $r) use ($employeeFilter, $showDone): string {
$rangeUrl = static function (string $r) use ($employeeFilter, $showDone, $showAll): string {
$params = ['range' => $r];
if ($employeeFilter > 0) {
$params['employee'] = $employeeFilter;
@ -19,6 +21,19 @@ $rangeUrl = static function (string $r) use ($employeeFilter, $showDone): string
if ($showDone) {
$params['done'] = '1';
}
if ($showAll) {
$params['all'] = '1';
}
return '/reminders?' . http_build_query($params);
};
$scopeUrl = static function (bool $all) use ($range, $showDone): string {
$params = ['range' => $range];
if ($showDone) {
$params['done'] = '1';
}
if ($all) {
$params['all'] = '1';
}
return '/reminders?' . http_build_query($params);
};
$openCount = 0;
@ -45,6 +60,12 @@ foreach ($rows as $row) {
</div>
<div class="reminder-toolbar">
<?php if ($isAdmin && $hasOwnEmployee): ?>
<div class="segmented" role="group" aria-label="Umfang">
<a href="<?= e(url($scopeUrl(false))) ?>"<?= $showAll ? '' : ' class="is-active" aria-current="page"' ?>>Nur meine</a>
<a href="<?= e(url($scopeUrl(true))) ?>"<?= $showAll ? ' class="is-active" aria-current="page"' : '' ?>>Alle</a>
</div>
<?php endif; ?>
<div class="segmented" role="group" aria-label="Zeitraum">
<?php foreach (['7' => '7 Tage', '14' => '14 Tage', '30' => '30 Tage', 'all' => 'Alle offenen'] as $key => $label): ?>
<a href="<?= e(url($rangeUrl($key))) ?>"<?= $range === $key ? ' class="is-active" aria-current="page"' : '' ?>><?= $label ?></a>
@ -52,6 +73,9 @@ foreach ($rows as $row) {
</div>
<form class="cal-filters" method="get" action="<?= e(url('/reminders')) ?>">
<input type="hidden" name="range" value="<?= e($range) ?>">
<?php if ($showAll): ?>
<input type="hidden" name="all" value="1">
<?php endif; ?>
<?php if ($canChooseEmployee && count($employees) > 1): ?>
<label class="inline-field">
<span>Mitarbeiter</span>
@ -84,9 +108,12 @@ foreach ($rows as $row) {
<?php if ($isAdmin): ?>
<a class="btn primary" href="<?= e(url('/bookings/new')) ?>">Neue Buchung anlegen</a>
<?php endif; ?>
<?php if ($isAdmin && $hasOwnEmployee && !$showAll): ?>
<p><a href="<?= e(url($scopeUrl(true))) ?>">Alle Erinnerungen anzeigen</a></p>
<?php endif; ?>
</div>
<?php else: ?>
<p class="list-summary"><?= $openCount ?> offene Erinnerung<?= $openCount === 1 ? '' : 'en' ?><?= $isAdmin ? '' : ' für Sie' ?><?= $employeeFilter > 0 ? ' · ' . e(employees_map()[$employeeFilter]['name'] ?? '') : '' ?></p>
<p class="list-summary"><?= $openCount ?> offene Erinnerung<?= $openCount === 1 ? '' : 'en' ?><?= ($isAdmin && (!$hasOwnEmployee || $showAll)) ? '' : ' für Sie' ?><?= $employeeFilter > 0 ? ' · ' . e(employees_map()[$employeeFilter]['name'] ?? '') : '' ?></p>
<?php foreach ($groups as $date => $items): ?>
<?php $isPast = $date < $today; $isToday = $date === $today; ?>
<section class="reminder-day<?= $isPast ? ' is-past' : '' ?>">