Buchungen anlegen nur für Administratoren
This commit is contained in:
parent
c8ec53ebdd
commit
6a2a9ea342
8 changed files with 67 additions and 32 deletions
|
|
@ -14,6 +14,8 @@
|
|||
/** @var array $employees */
|
||||
/** @var int $bookingCount */
|
||||
/** @var callable $urlFor */
|
||||
/** @var array $user */
|
||||
$canCreate = ($user['role'] ?? '') === 'admin';
|
||||
$cols = count($days);
|
||||
$laneWidth = 150;
|
||||
$minWidth = match ($view) {
|
||||
|
|
@ -27,11 +29,13 @@ $minWidth = match ($view) {
|
|||
<p class="eyebrow">Kalender · <?= $bookingCount ?> Buchung<?= $bookingCount === 1 ? '' : 'en' ?> im Zeitraum</p>
|
||||
<h1><?= e($calTitle) ?></h1>
|
||||
</div>
|
||||
<div class="page-head__actions">
|
||||
<a class="btn primary" href="<?= e(url('/bookings/new?start=' . $date)) ?>">
|
||||
<svg class="ico" aria-hidden="true"><use href="#i-plus"/></svg> Neue Buchung
|
||||
</a>
|
||||
</div>
|
||||
<?php if ($canCreate): ?>
|
||||
<div class="page-head__actions">
|
||||
<a class="btn primary" href="<?= e(url('/bookings/new?start=' . $date)) ?>">
|
||||
<svg class="ico" aria-hidden="true"><use href="#i-plus"/></svg> Neue Buchung
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="cal-toolbar">
|
||||
|
|
@ -108,16 +112,24 @@ $minWidth = match ($view) {
|
|||
<strong><?= e($trailer['label']) ?></strong>
|
||||
<?php if ((int) $trailer['active'] !== 1): ?><small>inaktiv</small><?php endif; ?>
|
||||
</span>
|
||||
<a class="cal-label__add" href="<?= e(url('/bookings/new?trailer=' . (int) $trailer['id'] . '&start=' . $date)) ?>" aria-label="Neue Buchung für <?= e($trailer['label']) ?>">+</a>
|
||||
<?php if ($canCreate): ?>
|
||||
<a class="cal-label__add" href="<?= e(url('/bookings/new?trailer=' . (int) $trailer['id'] . '&start=' . $date)) ?>" aria-label="Neue Buchung für <?= e($trailer['label']) ?>">+</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="cal-track" style="--row-h: <?= (int) $row['height'] ?>px; --lanes: <?= (int) $row['lanes'] ?>" data-trailer-id="<?= (int) $trailer['id'] ?>">
|
||||
<div class="cal-cells">
|
||||
<?php foreach ($days as $day): ?>
|
||||
<a class="cal-cell<?= $day['is_today'] ? ' is-today' : '' ?><?= $day['is_weekend'] ? ' is-weekend' : '' ?>"
|
||||
href="<?= e(url('/bookings/new?trailer=' . (int) $trailer['id'] . '&start=' . $day['iso'] . '&end=' . $day['iso'])) ?>"
|
||||
data-cell="1"
|
||||
data-date="<?= e($day['iso']) ?>"
|
||||
aria-label="Neue Buchung <?= e($trailer['label']) ?> am <?= e(fmt_date($day['iso'])) ?>"></a>
|
||||
<?php if ($canCreate): ?>
|
||||
<a class="cal-cell<?= $day['is_today'] ? ' is-today' : '' ?><?= $day['is_weekend'] ? ' is-weekend' : '' ?>"
|
||||
href="<?= e(url('/bookings/new?trailer=' . (int) $trailer['id'] . '&start=' . $day['iso'] . '&end=' . $day['iso'])) ?>"
|
||||
data-cell="1"
|
||||
data-date="<?= e($day['iso']) ?>"
|
||||
aria-label="Neue Buchung <?= e($trailer['label']) ?> am <?= e(fmt_date($day['iso'])) ?>"></a>
|
||||
<?php else: ?>
|
||||
<span class="cal-cell<?= $day['is_today'] ? ' is-today' : '' ?><?= $day['is_weekend'] ? ' is-weekend' : '' ?>"
|
||||
data-cell="1"
|
||||
data-date="<?= e($day['iso']) ?>"></span>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php foreach ($row['bars'] as $bar): ?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue