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:
parent
9425b1dcf1
commit
0e7f77b9bd
7 changed files with 62 additions and 19 deletions
|
|
@ -11,6 +11,8 @@
|
|||
/** @var bool $remindersWithoutEmployee */
|
||||
/** @var array $user */
|
||||
$canCreate = ($user['role'] ?? '') === 'admin';
|
||||
// Admins dürfen aus der Übersicht heraus die Gesamtsicht aller Erinnerungen öffnen.
|
||||
$remindersUrl = $canCreate ? '/reminders?all=1' : '/reminders';
|
||||
$rentedTrailers = 0;
|
||||
$rentedChests = 0;
|
||||
$freeTrailers = 0;
|
||||
|
|
@ -181,7 +183,7 @@ $isEmployeeView = $employeeScope > 0;
|
|||
<h2>Erinnerungen</h2>
|
||||
<p>Fällig bis <?= e(fmt_date(add_days($today, 7))) ?>.</p>
|
||||
</div>
|
||||
<a class="link-arrow" href="<?= e(url('/reminders')) ?>">Alle <svg class="ico" aria-hidden="true"><use href="#i-right"/></svg></a>
|
||||
<a class="link-arrow" href="<?= e(url($remindersUrl)) ?>">Alle <svg class="ico" aria-hidden="true"><use href="#i-right"/></svg></a>
|
||||
</div>
|
||||
<?php if ($remindersWithoutEmployee): ?>
|
||||
<div class="empty-state small">
|
||||
|
|
@ -239,7 +241,7 @@ $isEmployeeView = $employeeScope > 0;
|
|||
<span><strong>Kunde suchen</strong><small>Buchung nach Name finden</small></span>
|
||||
<svg class="ico chev" aria-hidden="true"><use href="#i-right"/></svg>
|
||||
</a>
|
||||
<a class="quick-link" href="<?= e(url('/reminders?range=all')) ?>">
|
||||
<a class="quick-link" href="<?= e(url($canCreate ? '/reminders?range=all&all=1' : '/reminders?range=all')) ?>">
|
||||
<span class="quick-link__icon"><svg class="ico" aria-hidden="true"><use href="#i-bell"/></svg></span>
|
||||
<span><strong>Alle Erinnerungen</strong><small>Offene Aufgaben prüfen</small></span>
|
||||
<svg class="ico chev" aria-hidden="true"><use href="#i-right"/></svg>
|
||||
|
|
|
|||
|
|
@ -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' : '' ?>">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue