132 lines
6.0 KiB
PHP
132 lines
6.0 KiB
PHP
<!-- start page title -->
|
|
<div class="row d-flex align-items-center">
|
|
<div class="col-md-4">
|
|
<div class="page-title-box page-title-box-alt">
|
|
<h4 class="page-title"><?= !empty($showPayment) ? 'Payment Logs' : 'Log Files' ?></h4>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-8 text-md-right">
|
|
<?php if (!empty($showPayment)): ?>
|
|
<a href="<?= site_url('logs') ?>" class="btn btn-secondary">
|
|
<i class="mdi mdi-arrow-left"></i> View All Logs
|
|
</a>
|
|
<?php else: ?>
|
|
<a href="<?= site_url('logs?payment=1') ?>" class="btn btn-warning">
|
|
<i class="mdi mdi-credit-card-outline"></i> View Payment Logs
|
|
</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<!-- end page title -->
|
|
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
|
|
<?php if (session()->getFlashdata('message')): ?>
|
|
<div class="alert alert-success"><?= esc(session()->getFlashdata('message')) ?></div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (session()->getFlashdata('error')): ?>
|
|
<div class="alert alert-danger"><?= esc(session()->getFlashdata('error')) ?></div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($showPayment)): ?>
|
|
<p class="text-muted mb-3">
|
|
Showing <strong><?= (int) $lineCount ?></strong> log <?= $lineCount === 1 ? 'entry' : 'entries' ?>
|
|
containing <code>[PAYMENT]</code> across all log files.
|
|
</p>
|
|
|
|
<?php if (empty($entries)): ?>
|
|
<div class="alert alert-info mb-0">
|
|
No payment log entries found. Payment activity is logged with the <code>[PAYMENT]</code> tag.
|
|
</div>
|
|
<?php else: ?>
|
|
<?php foreach ($entries as $entry): ?>
|
|
<h5 class="mt-3 mb-2">
|
|
<i class="mdi mdi-file-document-outline"></i> <?= esc($entry['file']) ?>
|
|
<span class="badge badge-soft-warning"><?= count($entry['lines']) ?> entries</span>
|
|
<a href="<?= site_url('logs/view/' . $entry['file'] . '?payment=1') ?>" class="btn btn-sm btn-outline-warning ml-2">
|
|
Open File
|
|
</a>
|
|
</h5>
|
|
<pre class="payment-log-block"><?= esc(implode("\n", $entry['lines'])) ?></pre>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
<?php else: ?>
|
|
<div class="table-responsive">
|
|
<table id="datatable-buttons" class="table table-striped nowrap w-100">
|
|
<thead>
|
|
<tr>
|
|
<th>File Name</th>
|
|
<th>Size</th>
|
|
<th>Last Modified</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if (empty($files)): ?>
|
|
<tr>
|
|
<td colspan="4" class="text-center text-muted">No log files found.</td>
|
|
</tr>
|
|
<?php else: ?>
|
|
<?php foreach ($files as $file): ?>
|
|
<tr>
|
|
<td><?= esc($file['name']) ?></td>
|
|
<td><span class="badge badge-soft-secondary"><?= esc($file['size']) ?></span></td>
|
|
<td><?= esc($file['modified']) ?></td>
|
|
<td>
|
|
<a href="<?= site_url('logs/view/' . $file['name']) ?>" class="btn btn-sm btn-primary">
|
|
<i class="mdi mdi-eye"></i> View
|
|
</a>
|
|
<a href="<?= site_url('logs/view/' . $file['name'] . '?payment=1') ?>" class="btn btn-sm btn-warning">
|
|
<i class="mdi mdi-credit-card-outline"></i> Payment Logs
|
|
</a>
|
|
<a href="<?= site_url('logs/download/' . $file['name']) ?>" class="btn btn-sm btn-success">
|
|
<i class="mdi mdi-download"></i> Download
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
</div><!-- end card-body -->
|
|
</div><!-- end card -->
|
|
</div><!-- end col -->
|
|
</div>
|
|
<!-- end row -->
|
|
|
|
<style>
|
|
.payment-log-block {
|
|
background: #1e1e2e;
|
|
color: #d4d4d4;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
max-height: 75vh;
|
|
overflow: auto;
|
|
white-space: pre-wrap;
|
|
word-wrap: break-word;
|
|
font-size: 13px;
|
|
margin-bottom: 1rem;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
$(document).ready(function () {
|
|
if ($('#datatable-buttons').length) {
|
|
$('#datatable-buttons').DataTable({
|
|
"order": [[2, 'desc']],
|
|
"dom": '<"row mb-3"<"col-md-6 d-flex align-items-center"f><"col-md-6 d-flex justify-content-end">>rtip',
|
|
columnDefs: [
|
|
{ orderable: false, targets: [3] }
|
|
]
|
|
});
|
|
}
|
|
});
|
|
</script>
|