Add payment viewing
This commit is contained in:
parent
fd44dd9a93
commit
5bab3580bf
@ -7,5 +7,6 @@
|
||||
"Cancel": "Cancel",
|
||||
"Edit Family": "Edit Family",
|
||||
"View Families": "View Families",
|
||||
"View Payments": "View Payments"
|
||||
"View Payments": "View Payments",
|
||||
"Manual Entry": "Manual Entry"
|
||||
}
|
||||
|
@ -31,5 +31,8 @@
|
||||
"Member Directory": "Member Directory",
|
||||
"Office (ODT)": "Office (ODT)",
|
||||
"HTML": "HTML",
|
||||
"DOCX": "DOCX"
|
||||
"DOCX": "DOCX",
|
||||
"Amount": "Amount",
|
||||
"Date": "Date",
|
||||
"Paid": "Paid"
|
||||
}
|
||||
|
@ -6,5 +6,6 @@
|
||||
"Family": "Family",
|
||||
"Delete Family": "Delete Family",
|
||||
"Events": "Events",
|
||||
"Reports": "Reports"
|
||||
"Reports": "Reports",
|
||||
"Payments": "Payments"
|
||||
}
|
||||
|
13
pages.php
13
pages.php
@ -36,6 +36,19 @@ define("PAGES", [
|
||||
"confirmdelete" => [
|
||||
"title" => "Delete Family"
|
||||
],
|
||||
"payments" => [
|
||||
"title" => "Payments",
|
||||
"navbar" => true,
|
||||
"icon" => "fas fa-dollar-sign",
|
||||
"styles" => [
|
||||
"static/css/datatables.min.css",
|
||||
"static/css/tables.css"
|
||||
],
|
||||
"scripts" => [
|
||||
"static/js/datatables.min.js",
|
||||
"static/js/payments.js"
|
||||
]
|
||||
],
|
||||
"events" => [
|
||||
"title" => "Events",
|
||||
"navbar" => true,
|
||||
|
70
pages/payments.php
Normal file
70
pages/payments.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?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");
|
||||
|
||||
$payments = $database->select("payments", ['paymentid (id)', 'familyid', 'amount', 'paid', 'date']);
|
||||
?>
|
||||
|
||||
<div class="btn-group">
|
||||
<?php if ($writeaccess) { ?>
|
||||
<a href="app.php?page=editpayment" class="btn btn-success"><i class="fas fa-plus"></i> <?php $Strings->get("Manual Entry"); ?></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<table id="paytable" 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('Family'); ?></th>
|
||||
<th data-priority="1"><i class="fas fa-dollar-sign hidden-sm"></i> <?php $Strings->get('Amount'); ?></th>
|
||||
<th data-priority="2"><i class="fas fa-calendar hidden-sm"></i> <?php $Strings->get('Date'); ?></th>
|
||||
<th data-priority="2"><i class="far fa-check-square hidden-sm"></i> <?php $Strings->get('Paid'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($payments as $p) {
|
||||
?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<?php
|
||||
if ($writeaccess) {
|
||||
?>
|
||||
<a class="btn btn-primary btn-sm" href="app.php?page=editpayment&id=<?php echo $p['id']; ?>"><i class="fas fa-edit"></i> <?php $Strings->get("Edit"); ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><a href="./app.php?page=viewfamily&id=<?php echo $p['familyid']; ?>"><?php echo (new Family())->load($p['familyid'])->getName(); ?></a></td>
|
||||
<td>$<?php echo number_format($p['amount'], 2); ?></td>
|
||||
<td><?php echo date("Y-m-d H:i:s", strtotime($p['date'])); ?></td>
|
||||
<td><?php $p['paid'] ? $Strings->get("Yes") : $Strings->get("No"); ?></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('Family'); ?></th>
|
||||
<th data-priority="1"><i class="fas fa-dollar-sign hidden-sm"></i> <?php $Strings->get('Amount'); ?></th>
|
||||
<th data-priority="2"><i class="fas fa-calendar hidden-sm"></i> <?php $Strings->get('Date'); ?></th>
|
||||
<th data-priority="2"><i class="far fa-check-square hidden-sm"></i> <?php $Strings->get('Paid'); ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
34
static/js/payments.js
Normal file
34
static/js/payments.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/. */
|
||||
|
||||
$('#paytable').DataTable({
|
||||
responsive: {
|
||||
details: {
|
||||
display: $.fn.dataTable.Responsive.display.modal({
|
||||
header: function (row) {
|
||||
var data = row.data();
|
||||
return "<i class=\"fas fa-dollar-sign 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: [
|
||||
[4, 'desc']
|
||||
]
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user