Add camper table
parent
453831c611
commit
e4c449f188
@ -0,0 +1,91 @@
|
||||
<?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=editcamper" class="btn btn-success"><i class="fas fa-plus"></i> <?php $Strings->get("Add Camper"); ?></a>
|
||||
</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-male hidden-sm"></i> <?php $Strings->get('Parent'); ?></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-certificate hidden-sm"></i> <?php $Strings->get('Rank'); ?></th>
|
||||
<th data-priority="5"><i class="fas fa-restroom hidden-sm"></i> <?php $Strings->get('Sex'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$campers = $database->select(
|
||||
"people", [
|
||||
"[>]campers" => [
|
||||
"camperid" => "camperid"
|
||||
]
|
||||
], [
|
||||
'personid (id)',
|
||||
'firstname',
|
||||
'lastname',
|
||||
'address',
|
||||
'zip',
|
||||
'phone1',
|
||||
'phone2',
|
||||
'email',
|
||||
'unit',
|
||||
'shirt',
|
||||
'sex',
|
||||
'parentname',
|
||||
'rank'
|
||||
], [
|
||||
'people.camperid[!]' => null
|
||||
]);
|
||||
|
||||
foreach ($campers as $person) {
|
||||
?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<a class="btn btn-info btn-sm" href="app.php?page=viewperson&id=<?php echo $person['id']; ?>"><i class="fas fa-eye"></i> <?php $Strings->get("View"); ?></a>
|
||||
<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 echo $person['parentname']; ?></td>
|
||||
<td><?php echo $person['phone1']; ?></td>
|
||||
<td><?php echo $person['email']; ?></td>
|
||||
<td><?php echo $person['unit']; ?></td>
|
||||
<td><?php echo $person['rank']; ?></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-male hidden-sm"></i> <?php $Strings->get('Parent'); ?></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-certificate hidden-sm"></i> <?php $Strings->get('Rank'); ?></th>
|
||||
<th data-priority="5"><i class="fas fa-restroom hidden-sm"></i> <?php $Strings->get('Sex'); ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
@ -1,91 +0,0 @@
|
||||
<?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']);
|
||||
if (!$user->hasPermission("HACHEPORTAL_VIEW")) {
|
||||
header("Location: ./app.php?msg=no_permission");
|
||||
die();
|
||||
}
|
||||
|
||||
$writeaccess = $user->hasPermission("HACHEPORTAL_EDIT");
|
||||
?>
|
||||
|
||||
<div>
|
||||
<?php if ($writeaccess) { ?>
|
||||
<a href="app.php?page=editfamily" class="btn btn-success"><i class="fas fa-plus"></i> <?php $Strings->get("Add Family"); ?></a>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$expiringfilter = false;
|
||||
if (!empty($_GET['filter']) && $_GET['filter'] == 'expiring') {
|
||||
$expiringfilter = true;
|
||||
?>
|
||||
<div class="alert alert-blue-grey d-inline-block mt-1 ml-md-2"><i class="fa fa-filter fa-fw"></i> <?php $Strings->get("Only showing expired or expiring memberships."); ?> <a href="app.php?page=families" class="btn btn-sm btn-blue-grey text-light"><?php $Strings->get("Remove Filter"); ?></a></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<table id="famtable" 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-users hidden-sm"></i> <?php $Strings->get('Name'); ?></th>
|
||||
<th data-priority="3"><i class="fas fa-male hidden-sm"></i> <?php $Strings->get('Father'); ?></th>
|
||||
<th data-priority="3"><i class="fas fa-female hidden-sm"></i> <?php $Strings->get('Mother'); ?></th>
|
||||
<th data-priority="2"><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-calendar hidden-sm"></i> <?php $Strings->get('Expires'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$where = [];
|
||||
if ($expiringfilter) {
|
||||
$where = ["expires[<]" => date("Y-m-d", strtotime("+1 month"))];
|
||||
}
|
||||
$families = $database->select("families", ['familyid (id)', 'familyname', 'phone', 'email', 'father_name (father)', 'mother_name (mother)', 'expires'], $where);
|
||||
|
||||
foreach ($families as $f) {
|
||||
?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<a class="btn btn-info btn-sm" href="app.php?page=viewfamily&id=<?php echo $f['id']; ?>"><i class="fas fa-eye"></i> <?php $Strings->get("View"); ?></a>
|
||||
<?php
|
||||
if ($writeaccess) {
|
||||
?>
|
||||
<a class="btn btn-primary btn-sm" href="app.php?page=editfamily&id=<?php echo $f['id']; ?>"><i class="fas fa-edit"></i> <?php $Strings->get("Edit"); ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo $f['familyname']; ?></td>
|
||||
<td><?php echo $f['father']; ?></td>
|
||||
<td><?php echo $f['mother']; ?></td>
|
||||
<td><?php echo $f['phone']; ?></td>
|
||||
<td><?php echo $f['email']; ?></td>
|
||||
<td class="<?php echo strtotime($f['expires']) < time() ? "text-red" : ""; ?>"><?php echo $f['expires']; ?></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-users hidden-sm"></i> <?php $Strings->get('Name'); ?></th>
|
||||
<th data-priority="3"><i class="fas fa-male hidden-sm"></i> <?php $Strings->get('Father'); ?></th>
|
||||
<th data-priority="3"><i class="fas fa-female hidden-sm"></i> <?php $Strings->get('Mother'); ?></th>
|
||||
<th data-priority="2"><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-calendar hidden-sm"></i> <?php $Strings->get('Expires'); ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
@ -0,0 +1,34 @@
|
||||
/* 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/. */
|
||||
|
||||
$('#campertable').DataTable({
|
||||
responsive: {
|
||||
details: {
|
||||
display: $.fn.dataTable.Responsive.display.modal({
|
||||
header: function (row) {
|
||||
var data = row.data();
|
||||
return "<i class=\"fas fa-users fa-fw\"></i> " + data[2];
|
||||
}
|
||||
}),
|
||||
renderer: $.fn.dataTable.Responsive.renderer.tableAll({
|
||||
tableClass: 'table'
|
||||
}),
|
||||
type: "column"
|
||||
}
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
className: 'control',
|
||||
orderable: false
|
||||
},
|
||||
{
|
||||
targets: 1,
|
||||
orderable: false
|
||||
}
|
||||
],
|
||||
order: [
|
||||
[2, 'asc']
|
||||
]
|
||||
});
|
Loading…
Reference in New Issue