Convert add person buttons to dropdown menu, add dropdown for filter

master
Skylar Ittner 5 years ago
parent 1b8847ec1d
commit 17d974f6ef

@ -1,4 +1,6 @@
{
"New": "New",
"Add Person": "Add Person",
"Add Camper": "Add Camper",
"Add Adult": "Add Adult",
"Add Youth": "Add Youth",
@ -15,5 +17,6 @@
"View Payments": "View Payments",
"Manual Entry": "Manual Entry",
"View Expiring": "View Expiring",
"Filter": "Filter",
"Remove Filter": "Remove Filter"
}

@ -7,6 +7,7 @@
"Adult": "Adult",
"Adults": "Adults",
"Youth": "Youth",
"All": "All",
"Days": "Days",
"Position": "Position",
"Parent Phone": "Parent Phone",

@ -17,7 +17,8 @@ define("PAGES", [
"icon" => "fas fa-user",
"styles" => [
"static/css/datatables.min.css",
"static/css/tables.css"
"static/css/tables.css",
"static/css/people.css"
],
"scripts" => [
"static/js/datatables.min.js",

@ -7,23 +7,43 @@
redirectIfNotLoggedIn();
$user = new User($_SESSION['uid']);
$where = [];
$filter = $Strings->get("Filter", false);
if (!empty($VARS['filter']) && preg_match("/(camper|adult|youth)/", $VARS['filter'])) {
$where = [
$VARS['filter'] . 'id[!]' => null
];
$filter = $Strings->get(ucfirst($VARS['filter'] . ($VARS['filter'] == "youth" ? "" : "s")), false);
}
?>
<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 class="btn-toolbar mb-2">
<div class="btn-group mr-2">
<div class="dropdown">
<button id="addpersonbtn" type="button" class="btn btn-green dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-plus"></i> <?php $Strings->get("New"); ?>
</button>
<div class="dropdown-menu" aria-labelledby="addpersonbtn">
<a href="app.php?page=editperson&type=camper" class="dropdown-item"><i class="fas fa-campground fa-fw"></i> <?php $Strings->get("Camper"); ?></a>
<a href="app.php?page=editperson&type=adult" class="dropdown-item"><i class="fas fa-hiking fa-fw"></i> <?php $Strings->get("Adult"); ?></a>
<a href="app.php?page=editperson&type=youth" class="dropdown-item"><i class="fas fa-walking fa-fw"></i> <?php $Strings->get("Youth"); ?></a>
</div>
</div>
</div>
<div class="btn-group">
<div class="dropdown">
<button id="filterdropbtn" type="button" class="btn btn-blue-grey dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-filter"></i> <?php echo $filter; ?>
</button>
<div class="dropdown-menu" aria-labelledby="filterdropbtn">
<a class="dropdown-item" href="./app.php?page=people"><i class="fas fa-users fa-fw"></i> <?php $Strings->get("All"); ?></a>
<a class="dropdown-item" href="./app.php?page=people&amp;filter=camper"><i class="fas fa-campground fa-fw"></i> <?php $Strings->get("Campers"); ?></a>
<a class="dropdown-item" href="./app.php?page=people&amp;filter=adult"><i class="fas fa-hiking fa-fw"></i> <?php $Strings->get("Adults"); ?></a>
<a class="dropdown-item" href="./app.php?page=people&amp;filter=youth"><i class="fas fa-walking fa-fw"></i> <?php $Strings->get("Youth"); ?></a>
</div>
</div>
</div>
</div>
<table id="campertable" class="table table-bordered table-hover table-sm">

@ -0,0 +1,9 @@
/*
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/.
*/
.btn.dropdown-toggle:before {
display: none;
}
Loading…
Cancel
Save