Add camper table
This commit is contained in:
parent
453831c611
commit
e4c449f188
@ -1,12 +1,13 @@
|
|||||||
{
|
{
|
||||||
"Add Family": "Add Family",
|
"Add Camper": "Add Camper",
|
||||||
"Edit": "Edit",
|
"Edit": "Edit",
|
||||||
"View": "View",
|
"View": "View",
|
||||||
"Save": "Save",
|
"Save": "Save",
|
||||||
"Delete": "Delete",
|
"Delete": "Delete",
|
||||||
"Cancel": "Cancel",
|
"Cancel": "Cancel",
|
||||||
"Edit Family": "Edit Family",
|
"Edit Family": "Edit Family",
|
||||||
"View Families": "View Families",
|
"View Campers": "View Campers",
|
||||||
|
"View Volunteers": "View Volunteers",
|
||||||
"View Payments": "View Payments",
|
"View Payments": "View Payments",
|
||||||
"Manual Entry": "Manual Entry",
|
"Manual Entry": "Manual Entry",
|
||||||
"View Expiring": "View Expiring",
|
"View Expiring": "View Expiring",
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
{
|
{
|
||||||
"Name": "Name",
|
"Name": "Name",
|
||||||
"Actions": "Actions",
|
"Actions": "Actions",
|
||||||
"Father": "Father",
|
"Campers": "Campers",
|
||||||
"Mother": "Mother",
|
"Volunteers": "Volunteers",
|
||||||
|
"Card Payments": "Card Payments",
|
||||||
|
"First": "First",
|
||||||
|
"Last": "Last",
|
||||||
|
"Parent": "Parent",
|
||||||
|
"Unit": "Unit",
|
||||||
|
"Rank": "Rank",
|
||||||
|
"Sex": "Sex",
|
||||||
"Phone": "Phone",
|
"Phone": "Phone",
|
||||||
"Email": "Email",
|
"Email": "Email",
|
||||||
"Address": "Address",
|
"Address": "Address",
|
||||||
@ -10,7 +17,6 @@
|
|||||||
"State": "State",
|
"State": "State",
|
||||||
"ZIP Code": "ZIP Code",
|
"ZIP Code": "ZIP Code",
|
||||||
"ZIP": "ZIP",
|
"ZIP": "ZIP",
|
||||||
"Photo Permission": "Photo Permission",
|
|
||||||
"Yes": "Yes",
|
"Yes": "Yes",
|
||||||
"No": "No",
|
"No": "No",
|
||||||
"Newsletter": "Newsletter",
|
"Newsletter": "Newsletter",
|
||||||
|
@ -11,17 +11,17 @@ define("PAGES", [
|
|||||||
"navbar" => true,
|
"navbar" => true,
|
||||||
"icon" => "fas fa-home"
|
"icon" => "fas fa-home"
|
||||||
],
|
],
|
||||||
"families" => [
|
"campers" => [
|
||||||
"title" => "Families",
|
"title" => "Campers",
|
||||||
"navbar" => true,
|
"navbar" => true,
|
||||||
"icon" => "fas fa-users",
|
"icon" => "fas fa-campground",
|
||||||
"styles" => [
|
"styles" => [
|
||||||
"static/css/datatables.min.css",
|
"static/css/datatables.min.css",
|
||||||
"static/css/tables.css"
|
"static/css/tables.css"
|
||||||
],
|
],
|
||||||
"scripts" => [
|
"scripts" => [
|
||||||
"static/js/datatables.min.js",
|
"static/js/datatables.min.js",
|
||||||
"static/js/families.js"
|
"static/js/campers.js"
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"viewfamily" => [
|
"viewfamily" => [
|
||||||
|
91
pages/campers.php
Normal file
91
pages/campers.php
Normal file
@ -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>
|
|
@ -4,21 +4,31 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
?>
|
?>
|
||||||
<div class="card-deck">
|
<div class="card-deck">
|
||||||
<div class="card bg-indigo text-light">
|
<div class="card bg-blue text-light">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4 class="card-title"><?php $Strings->get("Families") ?></h4>
|
<h4 class="card-title"><?php $Strings->get("Campers") ?></h4>
|
||||||
<h1><i class="fas fa-fw fa-users"></i> <?php echo $database->count('families'); ?></h1>
|
<h1><i class="fas fa-fw fa-users"></i> <?php echo $database->count('campers'); ?></h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<a href="app.php?page=families" class="text-light"><i class="fas fa-arrow-right"></i> <?php $Strings->get("View Families"); ?></a>
|
<a href="app.php?page=campers" class="text-light"><i class="fas fa-arrow-right"></i> <?php $Strings->get("View Campers"); ?></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card bg-indigo text-light">
|
||||||
|
<div class="card-body">
|
||||||
|
<h4 class="card-title"><?php $Strings->get("Volunteers") ?></h4>
|
||||||
|
<h1><i class="fas fa-fw fa-users"></i> <?php echo $database->count('adults'); ?></h1>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<a href="app.php?page=volunteers" class="text-light"><i class="fas fa-arrow-right"></i> <?php $Strings->get("View Volunteers"); ?></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card bg-green text-light">
|
<div class="card bg-green text-light">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4 class="card-title"><?php $Strings->get("Recent Payments") ?></h4>
|
<h4 class="card-title"><?php $Strings->get("Card Payments") ?></h4>
|
||||||
<h1><i class="fas fa-fw fa-dollar-sign"></i> <?php
|
<h1><i class="fas fa-fw fa-credit-card"></i> $<?php
|
||||||
$amounts = $database->select("payments", "amount", ["AND" => ["paid" => 1, "date[>]" => date("Y-m-d H:i:s", strtotime("-30 days"))]]);
|
$amounts = $database->select("payments", "amountpaid");
|
||||||
$total = 0.0;
|
$total = 0.0;
|
||||||
foreach ($amounts as $amt) {
|
foreach ($amounts as $amt) {
|
||||||
$total += $amt;
|
$total += $amt;
|
||||||
@ -30,17 +40,4 @@
|
|||||||
<a href="app.php?page=payments" class="text-light"><i class="fas fa-arrow-right"></i> <?php $Strings->get("View Payments"); ?></a>
|
<a href="app.php?page=payments" class="text-light"><i class="fas fa-arrow-right"></i> <?php $Strings->get("View Payments"); ?></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
|
||||||
$expiring = $database->count('families', ["expires[<]" => date("Y-m-d", strtotime("+1 month"))]);
|
|
||||||
?>
|
|
||||||
<div class="card bg-<?php echo ($expiring > 0 ? "purple" : "blue"); ?> text-light">
|
|
||||||
<div class="card-body">
|
|
||||||
<h4 class="card-title"><?php $Strings->get("Expiring Memberships") ?></h4>
|
|
||||||
<h1><i class="fas fa-fw fa-user-clock"></i> <?php echo $expiring; ?></h1>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer">
|
|
||||||
<a href="app.php?page=families&filter=expiring" class="text-light"><i class="fas fa-arrow-right"></i> <?php $Strings->get("View Expiring"); ?></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
34
static/js/campers.js
Normal file
34
static/js/campers.js
Normal file
@ -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…
x
Reference in New Issue
Block a user