This commit is contained in:
parent
cd65cba8c4
commit
95837394a9
@ -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');
|
||||
|
@ -1,12 +1,21 @@
|
||||
<h2>Dein Name wie der auf Teilnahmelisten zu finden ist</h2>
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
<div id="search-results"></div>
|
||||
|
Reference in New Issue
Block a user