Add home info card and families filter for expiring members (close #17)

This commit is contained in:
Skylar Ittner 2018-12-17 19:37:07 -07:00
parent 2ae1f97af1
commit 223c37c04b
4 changed files with 43 additions and 12 deletions

View File

@ -8,5 +8,7 @@
"Edit Family": "Edit Family", "Edit Family": "Edit Family",
"View Families": "View Families", "View Families": "View Families",
"View Payments": "View Payments", "View Payments": "View Payments",
"Manual Entry": "Manual Entry" "Manual Entry": "Manual Entry",
"View Expiring": "View Expiring",
"Remove Filter": "Remove Filter"
} }

View File

@ -9,5 +9,6 @@
"No interests selected.": "No interests selected.", "No interests selected.": "No interests selected.",
"Events updated.": "Events updated.", "Events updated.": "Events updated.",
"You agree to use the information in this directory for homeschool use ONLY. All other purposes, such as soliciting, is strictly prohibited.": "You agree to use the information in this directory for homeschool use ONLY. All other purposes, such as soliciting, is strictly prohibited.", "You agree to use the information in this directory for homeschool use ONLY. All other purposes, such as soliciting, is strictly prohibited.": "You agree to use the information in this directory for homeschool use ONLY. All other purposes, such as soliciting, is strictly prohibited.",
"Payment saved.": "Payment saved." "Payment saved.": "Payment saved.",
"Only showing expired or expiring memberships.": "Only showing expired or expiring memberships."
} }

View File

@ -13,15 +13,23 @@ if (!$user->hasPermission("HACHEPORTAL_VIEW")) {
} }
$writeaccess = $user->hasPermission("HACHEPORTAL_EDIT"); $writeaccess = $user->hasPermission("HACHEPORTAL_EDIT");
$families = $database->select("families", ['familyid (id)', 'familyname', 'phone', 'email', 'father_name (father)', 'mother_name (mother)', 'expires']);
?> ?>
<div class="btn-group"> <div>
<?php if ($writeaccess) { ?> <?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> <a href="app.php?page=editfamily" class="btn btn-success"><i class="fas fa-plus"></i> <?php $Strings->get("Add Family"); ?></a>
<?php } ?> <?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."); ?> &nbsp; <a href="app.php?page=families" class="btn btn-sm btn-blue-grey text-light"><?php $Strings->get("Remove Filter"); ?></a></div>
<?php
}
?>
</div> </div>
<table id="famtable" class="table table-bordered table-hover table-sm"> <table id="famtable" class="table table-bordered table-hover table-sm">
<thead> <thead>
<tr> <tr>
@ -37,6 +45,12 @@ $families = $database->select("families", ['familyid (id)', 'familyname', 'phone
</thead> </thead>
<tbody> <tbody>
<?php <?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) { foreach ($families as $f) {
?> ?>
<tr> <tr>

View File

@ -13,6 +13,7 @@
<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=families" class="text-light"><i class="fas fa-arrow-right"></i> <?php $Strings->get("View Families"); ?></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("Recent Payments") ?></h4>
@ -29,4 +30,17 @@
<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>