sorted
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s

This commit is contained in:
Chris 2023-11-26 10:52:43 +01:00
parent cd65cba8c4
commit 95837394a9
2 changed files with 25 additions and 7 deletions

View File

@ -23,9 +23,18 @@ class Smart extends Page {
$results = [];
while($row = $res->fetchArray())
{
$row['event'] = $db->querySingle("SELECT name FROM events WHERE id = ".$row['event']);
$row['date'] = $db->querySingle("SELECT date FROM events WHERE id = ".$row['event']);
$row['unixtimestamp'] = strtotime($row['date']);
$row['run'] = $db->querySingle("SELECT name FROM runs WHERE id = ".$row['run']);
$results[] = $row;
}
//sort results by date
usort($results, function($a, $b) {
return $a['unixtimestamp'] <=> $b['unixtimestamp'];
});
$this->set('results', $results);
$this->set('query', $query);
$this->set('template', 'search.html.php');

View File

@ -1,11 +1,20 @@
<h2>Dein Name wie der auf Teilnahmelisten zu finden ist</h2>
<input type="text" name="q"
<div class="mb-3">
<label for="basic-url" class="form-label">Dein Name wie der auf Teilnahmelisten zu finden ist (Nachname Vorname)</label>
<div class="input-group">
<input type="text" name="q"
hx-post="/smart/search"
hx-trigger="keyup changed delay:500ms"
hx-target="#search-results"
placeholder="Suchen..."
hx-indicator="#indicator"
>
class="form-control" id="basic-url"
>
</div>
</div>
<i id="indicator" class="fad fa-spinner-third fa-spin htmx-indicator"></i>