This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<!-- app/Views/payment/extra_charges.php -->
|
||||
<?= $this->extend('layout/management_layout') ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php $isSchoolYearReadonly = (bool)($isSchoolYearReadonly ?? false); ?>
|
||||
<div class="container-fluid py-4">
|
||||
|
||||
|
||||
@@ -10,46 +11,23 @@
|
||||
<?php if (session()->get('error')): ?>
|
||||
<div class="alert alert-danger"><?= session()->get('error') ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($isSchoolYearReadonly): ?>
|
||||
<div class="alert alert-warning" role="alert">
|
||||
This school year is read-only. Charges cannot be changed.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Centered School Year filter (match compact design) -->
|
||||
<div class="d-flex justify-content-center mb-3">
|
||||
<form id="chargesYearFilter" class="d-flex align-items-center gap-3" method="get" action="<?= site_url('admin/charges') ?>">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3 gap-3 flex-wrap">
|
||||
<h3 class="mb-0">
|
||||
Add & Deduct Charges
|
||||
<span class="text-muted ms-2">(<?= esc($schoolYear) ?> - <?= esc($semester) ?>)</span>
|
||||
</h3>
|
||||
<div class="d-flex justify-content-between align-items-center mb-3 gap-3 flex-wrap">
|
||||
<h3 class="mb-0">
|
||||
Add & Deduct Charges
|
||||
<span class="text-muted ms-2">(<?= esc($schoolYear) ?> - <?= esc($semester) ?>)</span>
|
||||
</h3>
|
||||
|
||||
<div class="d-flex align-items-center gap-3 flex-wrap">
|
||||
<label for="schoolYear" class="form-label mb-0">School year</label>
|
||||
<select id="schoolYear"
|
||||
name="school_year"
|
||||
class="form-select form-select-sm rounded-pill px-3"
|
||||
style="min-width: 180px; width: auto;">
|
||||
<?php foreach (($schoolYears ?? []) as $sy): ?>
|
||||
<option value="<?= esc($sy) ?>" <?= (string)$schoolYear === (string)$sy ? 'selected' : '' ?>>
|
||||
<?= esc($sy) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="d-flex gap-2 mb-3 justify-content-end"></div>
|
||||
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#chargeModal">
|
||||
<i class="bi bi-plus-circle"></i> Add Charge
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#chargeModal" <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>
|
||||
<i class="bi bi-plus-circle"></i> Add Charge
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
<?php if (!empty($status)): ?>
|
||||
<input type="hidden" name="status" value="<?= esc($status) ?>">
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($parentId)): ?>
|
||||
<input type="hidden" name="parent_id" value="<?= (int)$parentId ?>">
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body table-responsive">
|
||||
<?php $pageTotal = 0.0; if (!empty($rows)) { foreach ($rows as $__r) { $pageTotal += (float)($__r['amount'] ?? 0); } } ?>
|
||||
@@ -192,11 +170,6 @@
|
||||
<?= $this->section('scripts') ?>
|
||||
<script>
|
||||
$(function() {
|
||||
// Auto-apply School Year when selection changes (no Filter button)
|
||||
$('#chargesYearFilter select[name="school_year"]').on('change', function() {
|
||||
this.form.submit();
|
||||
});
|
||||
|
||||
const $parent = $('#parentSelect');
|
||||
const $invId = $('#invoiceIdHidden');
|
||||
const $invNum = $('#invoiceNumberDisplay');
|
||||
@@ -221,8 +194,7 @@
|
||||
if (!pid) return;
|
||||
|
||||
$.getJSON('<?= site_url('admin/charges/invoices') ?>', {
|
||||
parent_id: pid,
|
||||
school_year: '<?= esc($schoolYear) ?>'
|
||||
parent_id: pid
|
||||
}).done(function(data) {
|
||||
const items = (data && Array.isArray(data.results)) ? data.results : [];
|
||||
const chosen = pickDefaultInvoice(items);
|
||||
|
||||
Reference in New Issue
Block a user