You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
5.0 KiB
PHP

<?php
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
redirectIfNotLoggedIn();
$user = new User($_SESSION['uid']);
?>
<div>
<a href="app.php?page=editperson&type=camper" class="btn btn-success mb-1"><i class="fas fa-plus"></i> <?php $Strings->get("Add Camper"); ?></a>
<a href="app.php?page=editperson&type=adult" class="btn btn-success mb-1"><i class="fas fa-plus"></i> <?php $Strings->get("Add Adult"); ?></a>
<a href="app.php?page=editperson&type=youth" class="btn btn-success mb-1"><i class="fas fa-plus"></i> <?php $Strings->get("Add Youth"); ?></a>
<?php
$where = [];
if (!empty($VARS['filter']) && preg_match("/(camper|adult|youth)/", $VARS['filter'])) {
$where = [
$VARS['filter'] . 'id[!]' => null
];
?>
<div class="alert alert-blue-grey d-inline-block mt-1 ml-md-2"><i class="fa fa-filter fa-fw"></i> <?php $Strings->build("Only showing {x}s.", ["x" => $VARS['filter']]); ?> &nbsp; <a href="app.php?page=people" class="btn btn-sm btn-blue-grey text-light"><?php $Strings->get("Remove Filter"); ?></a></div>
<?php
}
?>
</div>
<table id="campertable" class="table table-bordered table-hover table-sm">
<thead>
<tr>
<th data-priority="0"></th>
<th data-priority="1"><?php $Strings->get('Actions'); ?></th>
<th data-priority="1"><i class="fas fa-user hidden-sm"></i> <?php $Strings->get('First'); ?></th>
<th data-priority="2"><i class="fas fa-users hidden-sm"></i> <?php $Strings->get('Last'); ?></th>
<th data-priority="2"><i class="fas fa-user-tag hidden-sm"></i> <?php $Strings->get('Type'); ?></th>
<th data-priority="3"><i class="fas fa-phone hidden-sm"></i> <?php $Strings->get('Phone'); ?></th>
<th data-priority="4"><i class="fas fa-at hidden-sm"></i> <?php $Strings->get('Email'); ?></th>
<th data-priority="5"><i class="fas fa-hashtag hidden-sm"></i> <?php $Strings->get('Unit'); ?></th>
<th data-priority="5"><i class="fas fa-tshirt hidden-sm"></i> <?php $Strings->get('Shirt'); ?></th>
<th data-priority="5"><i class="fas fa-restroom hidden-sm"></i> <?php $Strings->get('Sex'); ?></th>
</tr>
</thead>
<tbody>
<?php
$people = $database->select(
"people", [
'personid (id)',
'camperid',
'adultid',
'youthid',
'firstname',
'lastname',
'address',
'zip',
'phone1',
'phone2',
'email',
'unit',
'shirt',
'sex'
], $where);
foreach ($people as $person) {
?>
<tr>
<td></td>
<td>
<a class="btn btn-primary btn-sm" href="app.php?page=editperson&id=<?php echo $person['id']; ?>"><i class="fas fa-edit"></i> <?php $Strings->get("Edit"); ?></a>
</td>
<td><?php echo $person['firstname']; ?></td>
<td><?php echo $person['lastname']; ?></td>
<td><?php
if (!is_null($person['camperid'])) {
$Strings->get("Camper");
} else if (!is_null($person['adultid'])) {
$Strings->get("Adult");
} else if (!is_null($person['youthid'])) {
$Strings->get("Youth");
}
?></td>
<td><?php echo $person['phone1']; ?></td>
<td><?php echo $person['email']; ?></td>
<td><?php echo $person['unit']; ?></td>
<td><?php echo $person['shirt']; ?></td>
<td><?php echo $person['sex']; ?></td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th data-priority="0"></th>
<th data-priority="1"><?php $Strings->get('Actions'); ?></th>
<th data-priority="1"><i class="fas fa-user hidden-sm"></i> <?php $Strings->get('First'); ?></th>
<th data-priority="2"><i class="fas fa-users hidden-sm"></i> <?php $Strings->get('Last'); ?></th>
<th data-priority="2"><i class="fas fa-user-tag hidden-sm"></i> <?php $Strings->get('Type'); ?></th>
<th data-priority="3"><i class="fas fa-phone hidden-sm"></i> <?php $Strings->get('Phone'); ?></th>
<th data-priority="4"><i class="fas fa-at hidden-sm"></i> <?php $Strings->get('Email'); ?></th>
<th data-priority="5"><i class="fas fa-hashtag hidden-sm"></i> <?php $Strings->get('Unit'); ?></th>
<th data-priority="5"><i class="fas fa-tshirt hidden-sm"></i> <?php $Strings->get('Shirt'); ?></th>
<th data-priority="5"><i class="fas fa-restroom hidden-sm"></i> <?php $Strings->get('Sex'); ?></th>
</tr>
</tfoot>
</table>