Add payment viewing
parent
fd44dd9a93
commit
5bab3580bf
@ -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>
|
@ -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…
Reference in New Issue