This commit is contained in:
parent
377b68557c
commit
b694ab91ee
|
@ -90,6 +90,34 @@ class Data_tagihan_siswa extends BaseController
|
||||||
return view('staff_keuangan/layout/wrapper', $data);
|
return view('staff_keuangan/layout/wrapper', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function update_status()
|
||||||
|
{
|
||||||
|
$id = $this->request->getPost('id');
|
||||||
|
$status = $this->request->getPost('status');
|
||||||
|
|
||||||
|
if (!$id || !$status) {
|
||||||
|
return redirect()->back()->with('error', 'Data tidak lengkap untuk memperbarui status tagihan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = ['status' => $status];
|
||||||
|
|
||||||
|
if ($status === 'Lunas') {
|
||||||
|
$data['tanggal_bayar'] = date('Y-m-d H:i:s');
|
||||||
|
} else {
|
||||||
|
$data['tanggal_bayar'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->tagihanModel->update($id, $data);
|
||||||
|
session()->setFlashdata('sukses', 'Status tagihan berhasil diperbarui.');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->logger->error('Gagal update status tagihan: ' . $e->getMessage());
|
||||||
|
session()->setFlashdata('error', 'Terjadi kesalahan saat memperbarui status.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->to(base_url('staff_keuangan/data_tagihan_siswa'));
|
||||||
|
}
|
||||||
|
|
||||||
// Delete tagihan
|
// Delete tagihan
|
||||||
public function delete($id)
|
public function delete($id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,24 @@
|
||||||
<?php $request = service('request'); ?>
|
<?php $request = service('request'); ?>
|
||||||
|
<!-- Wajib untuk Bootstrap Modal bekerja -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
<h4 class="mb-4">Data Tagihan Siswa</h4>
|
<h4 class="mb-4">Data Tagihan Siswa</h4>
|
||||||
|
|
||||||
|
<!-- Notifikasi -->
|
||||||
|
<?php if (session()->getFlashdata('sukses')): ?>
|
||||||
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||||
|
<?= session()->getFlashdata('sukses') ?>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (session()->getFlashdata('error')): ?>
|
||||||
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||||
|
<?= session()->getFlashdata('error') ?>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<!-- Filter Form -->
|
<!-- Filter Form -->
|
||||||
<?= form_open(base_url('staff_keuangan/data_tagihan_siswa'), ['method' => 'get']) ?>
|
<?= form_open(base_url('staff_keuangan/data_tagihan_siswa'), ['method' => 'get']) ?>
|
||||||
<div class="row mb-4">
|
<div class="row mb-4">
|
||||||
|
@ -35,27 +52,23 @@
|
||||||
<?= form_close() ?>
|
<?= form_close() ?>
|
||||||
|
|
||||||
<!-- Table -->
|
<!-- Table -->
|
||||||
<?= form_open(base_url('staff_keuangan/data_tagihan_siswa/proses'), ['id' => 'form-hapus-data']) ?>
|
<?= form_open(base_url('staff_keuangan/data_tagihan_siswa/update_status'), ['id' => 'form-hapus-data']) ?>
|
||||||
<input type="hidden" name="pengalihan" value="<?= current_url() ?>">
|
<input type="hidden" name="pengalihan" value="<?= current_url() ?>">
|
||||||
|
|
||||||
<div class="table-responsive mailbox-messages">
|
<div class="table-responsive mailbox-messages">
|
||||||
<table id="example11" class="display table table-bordered table-sm" cellspacing="0" width="100%">
|
<table class="display table table-bordered table-sm" cellspacing="0" width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="bg-light text-center">
|
<tr class="bg-light text-center">
|
||||||
<th width="5%">
|
<th width="5%"><button type="button" class="btn btn-default btn-sm checkbox-toggle"><i class="far fa-square"></i></button></th>
|
||||||
<div class="mailbox-controls">
|
<th>No</th>
|
||||||
<button type="button" class="btn btn-default btn-sm checkbox-toggle"><i class="far fa-square"></i></button>
|
<th>Nama Siswa</th>
|
||||||
</div>
|
<th>Tagihan Bulan</th>
|
||||||
</th>
|
<th>Nominal</th>
|
||||||
<th width="5%">No</th>
|
<th>Status</th>
|
||||||
<th width="20%">Nama Siswa</th>
|
<th>Tanggal Bayar</th>
|
||||||
<th width="15%">Tagihan Bulan</th>
|
|
||||||
<th width="15%">Nominal</th>
|
|
||||||
<th width="15%">Status</th>
|
|
||||||
<th width="20%">Tanggal Bayar</th>
|
|
||||||
<th>Kelas</th>
|
<th>Kelas</th>
|
||||||
<th>Tahun Ajaran</th>
|
<th>Tahun Ajaran</th>
|
||||||
<th width="10%">Aksi</th>
|
<th>Aksi</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -71,20 +84,53 @@
|
||||||
<td class="text-center"><?= $i++ ?></td>
|
<td class="text-center"><?= $i++ ?></td>
|
||||||
<td><?= esc($row['nama_siswa'] ?? '-') ?></td>
|
<td><?= esc($row['nama_siswa'] ?? '-') ?></td>
|
||||||
<td><?= esc($row['bulan_tagihan']); ?></td>
|
<td><?= esc($row['bulan_tagihan']); ?></td>
|
||||||
<td><?= esc($row['jumlah']); ?></td>
|
<td>Rp<?= number_format($row['jumlah'], 0, ',', '.') ?></td>
|
||||||
<td class="text-center"><?= esc(ucwords($row['status'])) ?></td>
|
<td class="text-center"><?= esc(ucwords($row['status'])) ?></td>
|
||||||
<td class="text-center"><?= $row['tanggal_bayar'] ? date('d-m-Y H:i', strtotime($row['tanggal_bayar'])) : '-' ?></td>
|
<td class="text-center"><?= $row['tanggal_bayar'] ? date('d-m-Y H:i', strtotime($row['tanggal_bayar'])) : '-' ?></td>
|
||||||
<td class="text-center"><?= esc($row['nama_kelas'] ?? '-') ?></td>
|
<td class="text-center"><?= esc($row['nama_kelas'] ?? '-') ?></td>
|
||||||
<td class="text-center"><?= esc($row['tahun_ajaran'] ?? '-') ?></td>
|
<td class="text-center"><?= esc($row['tahun_ajaran'] ?? '-') ?></td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a href="<?= base_url('staff_keuangan/data_tagihan_siswa/edit/' . $row['id']) ?>" class="btn btn-warning btn-sm mb-1" title="Edit"><i class="fa fa-edit"></i></a>
|
|
||||||
<a href="<?= base_url('staff_keuangan/data_tagihan_siswa/delete/' . $row['id']) ?>" class="btn btn-danger btn-sm mb-1 delete-link" title="Hapus"><i class="fa fa-trash"></i></a>
|
<?php if (strtolower($row['status']) === 'telat bayar') : ?>
|
||||||
|
<!-- Tombol Edit Modal -->
|
||||||
|
<button type="button" class="btn btn-warning btn-sm mb-1" data-bs-toggle="modal" data-bs-target="#editStatusModal<?= $row['id'] ?>">
|
||||||
|
<i class="fa fa-edit"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Modal Ubah Status -->
|
||||||
|
<div class="modal fade" id="editStatusModal<?= $row['id'] ?>" tabindex="-1" aria-labelledby="editStatusLabel<?= $row['id'] ?>" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form action="<?= base_url('staff_keuangan/data_tagihan_siswa/update_status') ?>" method="post">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="editStatusLabel<?= $row['id'] ?>">Konfirmasi Pelunasan</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="hidden" name="id" value="<?= $row['id'] ?>">
|
||||||
|
<input type="hidden" name="status" value="Lunas">
|
||||||
|
<p>Yakin ingin menandai tagihan bulan <strong><?= esc($row['bulan_tagihan']) ?></strong> milik <strong><?= esc($row['nama_siswa']) ?></strong> sebagai <span class="badge bg-success">LUNAS</span>?</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="submit" class="btn btn-success">Ya, Tandai Lunas</button>
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<!-- Tombol Hapus -->
|
||||||
|
<a href="<?= base_url('staff_keuangan/data_tagihan_siswa/delete/' . $row['id']) ?>" class="btn btn-danger btn-sm mb-1 delete-link" title="Hapus">
|
||||||
|
<i class="fa fa-trash"></i>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="7" class="text-center">Data tagihan tidak ditemukan.</td>
|
<td colspan="10" class="text-center">Data tagihan tidak ditemukan.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -92,7 +138,5 @@
|
||||||
</div>
|
</div>
|
||||||
<?= form_close(); ?>
|
<?= form_close(); ?>
|
||||||
|
|
||||||
<div class="clearfix">
|
<div class="clearfix"><hr></div>
|
||||||
<hr>
|
|
||||||
</div>
|
|
||||||
<div class="pull-right"><?= $pagination ?? '' ?></div>
|
<div class="pull-right"><?= $pagination ?? '' ?></div>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue