drink-it-cold/views/search.php

60 lines
2.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/** @var string $query */
/** @var array $results */
?>
<div class="page-head page-head--compact">
<div>
<p class="eyebrow">Buchungssuche</p>
<h1>Kunde finden</h1>
<p class="page-head__lede">Suche nach Kundenname, Straße oder Ort – auch in stornierten Buchungen.</p>
</div>
</div>
<form class="search-hero" method="get" action="<?= e(url('/search')) ?>" role="search">
<svg class="ico" aria-hidden="true"><use href="#i-search"/></svg>
<label class="sr-only" for="q">Suchbegriff</label>
<input type="search" id="q" name="q" value="<?= e($query) ?>" placeholder="Name, Straße oder Ort …" autofocus>
<button class="btn primary" type="submit">Suchen</button>
</form>
<?php if ($query !== ''): ?>
<section class="panel">
<div class="panel__head">
<div>
<h2><?= count($results) ?> Treffer</h2>
<p>für „<?= e($query) ?>“</p>
</div>
</div>
<?php if (!$results): ?>
<div class="empty-state">
<svg class="ico" aria-hidden="true"><use href="#i-search"/></svg>
<h3>Keine Buchung gefunden</h3>
<p>Bitte einen anderen Namen, eine Straße oder einen Ort versuchen.</p>
</div>
<?php else: ?>
<ul class="result-list">
<?php foreach ($results as $booking): ?>
<?php $cancelled = $booking['status'] === 'cancelled'; ?>
<li class="result-row<?= $cancelled ? ' is-cancelled' : '' ?>">
<span class="trailer-dot" style="--trailer: <?= e($booking['trailer_color']) ?>"></span>
<div class="result-row__main">
<strong><?= e($booking['customer_name']) ?></strong>
<span><?= e(fmt_date_range($booking['start_date'], $booking['end_date'])) ?> · <?= e($booking['trailer_label']) ?> · <?= e($booking['employee_name']) ?></span>
</div>
<div class="result-row__meta">
<span><?= e($booking['city'] ?: '–') ?></span>
<?php if ($cancelled): ?><span class="pill pill--grey">storniert</span><?php endif; ?>
</div>
<a class="btn small" href="<?= e(url('/bookings/' . (int) $booking['id'])) ?>" data-panel="<?= (int) $booking['id'] ?>">Details</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</section>
<?php else: ?>
<div class="empty-state empty-state--plain">
<svg class="ico" aria-hidden="true"><use href="#i-search"/></svg>
<h3>Welchen Kunden suchen Sie?</h3>
<p>Ein Teil des Namens genügt. Die Suche berücksichtigt alle Buchungen, auch vergangene und stornierte.</p>
</div>
<?php endif; ?>