<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/bootstrap.php';
\MyClasses\Auth\AuthMaster::redirectIfNotLoggedIn();
$page['title'] = 'People';
echo get_partial('header.php', ['page' => $page]);
$wheres = [];
$order_bys = [];
if (!empty($_GET['older_than'])) {
    $wheres[] = ['age', '>=', $_GET['older_than']];
}
if (!empty($_GET['order_by'])) {
    $order_bys[] = $_GET['order_by'];
}
$people = \MyClasses\Models\Person::getAll($wheres, $order_bys);
$existing_query_params = $_GET;
?>

<div class="row">
    <div class="col-sm-4">
        <h1>All People</h1>
    </div>
    <div class="col-sm-8">
        <form action="">
            <div class="row" style="padding-top: 40px;">
                <div class="col-sm-3 text-right">
                    <label>Minimum Age: </label>
                </div>
                <div class="col-sm-3">
                    <input type="number" min="18" name="older_than" value="<?php 
echo !empty($_GET['older_than']) ? $_GET['older_than'] : '';