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

master
Skylar Ittner 5 years ago
parent 2ae1f97af1
commit 223c37c04b

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

@ -9,5 +9,6 @@
"No interests selected.": "No interests selected.",
"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.",
"Payment saved.": "Payment saved."
"Payment saved.": "Payment saved.",
"Only showing expired or expiring memberships.": "Only showing expired or expiring memberships."
}

@ -13,15 +13,23 @@ if (!$user->hasPermission("HACHEPORTAL_VIEW")) {
}
$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) { ?>
<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."); ?> &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>
<table id="famtable" class="table table-bordered table-hover table-sm">
<thead>
<tr>
@ -37,6 +45,12 @@ $families = $database->select("families", ['familyid (id)', 'familyname', 'phone
</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>

@ -13,20 +13,34 @@
<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 class="card bg-green text-light">
<div class="card-body">
<h4 class="card-title"><?php $Strings->get("Recent Payments") ?></h4>
<h1><i class="fas fa-fw fa-dollar-sign"></i> <?php
$amounts = $database->select("payments", "amount", ["AND" => ["paid" => 1, "date[>]" => date("Y-m-d H:i:s", strtotime("-30 days"))]]);
$total = 0.0;
foreach ($amounts as $amt) {
$total += $amt;
}
echo number_format($total, 2);
?></h1>
$amounts = $database->select("payments", "amount", ["AND" => ["paid" => 1, "date[>]" => date("Y-m-d H:i:s", strtotime("-30 days"))]]);
$total = 0.0;
foreach ($amounts as $amt) {
$total += $amt;
}
echo number_format($total, 2);
?></h1>
</div>
<div class="card-footer">
<a href="app.php?page=payments" class="text-light"><i class="fas fa-arrow-right"></i> <?php $Strings->get("View Payments"); ?></a>
</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>

Loading…
Cancel
Save