✨ feat(pembayaran): implementasi pembayaran kurang & lebih bayar dengan role management
- Tambah method kurang() & lebih() di PembayaranController untuk halaman khusus - Implementasi dataForDatatablesKurang() & dataForDatatablesLebih() untuk listing data - Optimasi query dengan filter status + mapping nominal ke format rupiah - Cleanup code: hapus import & komentar tidak dipakai, rapikan indentasi - Update module.json: ubah akses menu pembayaran ke "pemohon-ao", tambahkan role "admin" untuk menu NOC - Tambah route pembayaran/datatables-kurang & pembayaran/datatables-lebih di routes/registrasi.php - Filtering & sorting data konsisten dengan pagination DataTables - Format tampilan data finansial distandarisasi (rupiah 2 desimal)
This commit is contained in:
@@ -9,16 +9,9 @@ use Illuminate\Http\JsonResponse;
|
|||||||
use Modules\Lpj\Models\Permohonan;
|
use Modules\Lpj\Models\Permohonan;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
|
||||||
use Modules\Lpj\Models\PenawaranTender;
|
use Modules\Lpj\Models\PenawaranTender;
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Modules\Lpj\Models\PersetujuanPenawaran;
|
use Modules\Lpj\Models\PersetujuanPenawaran;
|
||||||
use Modules\Lpj\Http\Requests\PersetujuanPenawaranRequest;
|
use Modules\Lpj\Http\Requests\PersetujuanPenawaranRequest;
|
||||||
|
|
||||||
// use Modules\Lpj\Models\JenisPenilaian;
|
|
||||||
|
|
||||||
// use Modules\Lpj\Models\Regions;
|
|
||||||
|
|
||||||
class PembayaranController extends Controller
|
class PembayaranController extends Controller
|
||||||
{
|
{
|
||||||
public $user;
|
public $user;
|
||||||
@@ -28,6 +21,14 @@ class PembayaranController extends Controller
|
|||||||
return view('lpj::pembayaran.index');
|
return view('lpj::pembayaran.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function kurang(){
|
||||||
|
return view('lpj::pembayaran.kurang');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function lebih(){
|
||||||
|
return view('lpj::pembayaran.lebih');
|
||||||
|
}
|
||||||
|
|
||||||
public function approval()
|
public function approval()
|
||||||
{
|
{
|
||||||
return view('lpj::pembayaran.approval');
|
return view('lpj::pembayaran.approval');
|
||||||
@@ -321,6 +322,142 @@ class PembayaranController extends Controller
|
|||||||
$data = $query->with(['user', 'debiture', 'branch', 'jenisPenilaian'])->get();
|
$data = $query->with(['user', 'debiture', 'branch', 'jenisPenilaian'])->get();
|
||||||
|
|
||||||
|
|
||||||
|
// Hitung jumlah halaman
|
||||||
|
$pageCount = ceil($totalRecords / $size);
|
||||||
|
|
||||||
|
// Ambil current page
|
||||||
|
$currentPage = max(1, $request->get('page', 1));
|
||||||
|
|
||||||
|
// Return JSON response
|
||||||
|
return response()->json([
|
||||||
|
'draw' => $request->get('draw'),
|
||||||
|
'recordsTotal' => $totalRecords,
|
||||||
|
'recordsFiltered' => $filteredRecords,
|
||||||
|
'pageCount' => $pageCount,
|
||||||
|
'page' => $currentPage,
|
||||||
|
'totalCount' => $totalRecords,
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function dataForDatatablesKurang(Request $request)
|
||||||
|
{
|
||||||
|
if (is_null($this->user) || !$this->user->can('debitur.view')) {
|
||||||
|
// abort(403, 'Sorry! You are not allowed to view users.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = Noc::query()->where(function ($query) {
|
||||||
|
$query->where(['status_kurang_bayar' => '1']);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sorting berdasarkan sortField dan sortOrder
|
||||||
|
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||||
|
$order = $request->get('sortOrder');
|
||||||
|
$column = $request->get('sortField');
|
||||||
|
$query->orderBy($column, $order);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hitung total records
|
||||||
|
$totalRecords = $query->count();
|
||||||
|
|
||||||
|
// Pagination (default page size 10)
|
||||||
|
$size = $request->get('size', 10);
|
||||||
|
if ($size == 0) {
|
||||||
|
$size = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->has('page') && $request->has('size')) {
|
||||||
|
$page = $request->get('page', 1);
|
||||||
|
$offset = ($page - 1) * $size;
|
||||||
|
|
||||||
|
$query->skip($offset)->take($size);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filtered records
|
||||||
|
$filteredRecords = $query->count();
|
||||||
|
|
||||||
|
// Ambil data dengan relasi
|
||||||
|
$data = $query->get();
|
||||||
|
|
||||||
|
$data = $data->map(function ($item) {
|
||||||
|
return [
|
||||||
|
'id' => $item->id,
|
||||||
|
'permohonan' => $item->permohonan,
|
||||||
|
'pemohon' => $item->permohonan->user,
|
||||||
|
'branch' => $item->permohonan->branch,
|
||||||
|
'debiture' => $item->permohonan->debiture,
|
||||||
|
'nominal_kurang_bayar' => formatRupiah($item->nominal_kurang_bayar,2)
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
// Hitung jumlah halaman
|
||||||
|
$pageCount = ceil($totalRecords / $size);
|
||||||
|
|
||||||
|
// Ambil current page
|
||||||
|
$currentPage = max(1, $request->get('page', 1));
|
||||||
|
|
||||||
|
// Return JSON response
|
||||||
|
return response()->json([
|
||||||
|
'draw' => $request->get('draw'),
|
||||||
|
'recordsTotal' => $totalRecords,
|
||||||
|
'recordsFiltered' => $filteredRecords,
|
||||||
|
'pageCount' => $pageCount,
|
||||||
|
'page' => $currentPage,
|
||||||
|
'totalCount' => $totalRecords,
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function dataForDatatablesLebih(Request $request)
|
||||||
|
{
|
||||||
|
if (is_null($this->user) || !$this->user->can('debitur.view')) {
|
||||||
|
// abort(403, 'Sorry! You are not allowed to view users.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = Noc::query()->where(function ($query) {
|
||||||
|
$query->where(['status_lebih_bayar' => '1']);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sorting berdasarkan sortField dan sortOrder
|
||||||
|
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||||
|
$order = $request->get('sortOrder');
|
||||||
|
$column = $request->get('sortField');
|
||||||
|
$query->orderBy($column, $order);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hitung total records
|
||||||
|
$totalRecords = $query->count();
|
||||||
|
|
||||||
|
// Pagination (default page size 10)
|
||||||
|
$size = $request->get('size', 10);
|
||||||
|
if ($size == 0) {
|
||||||
|
$size = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->has('page') && $request->has('size')) {
|
||||||
|
$page = $request->get('page', 1);
|
||||||
|
$offset = ($page - 1) * $size;
|
||||||
|
|
||||||
|
$query->skip($offset)->take($size);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filtered records
|
||||||
|
$filteredRecords = $query->count();
|
||||||
|
|
||||||
|
// Ambil data dengan relasi
|
||||||
|
$data = $query->get();
|
||||||
|
|
||||||
|
$data = $data->map(function ($item) {
|
||||||
|
return [
|
||||||
|
'id' => $item->id,
|
||||||
|
'permohonan' => $item->permohonan,
|
||||||
|
'pemohon' => $item->permohonan->user,
|
||||||
|
'branch' => $item->permohonan->branch,
|
||||||
|
'debiture' => $item->permohonan->debiture,
|
||||||
|
'nominal_lebih_bayar' => formatRupiah($item->nominal_lebih_bayar,2)
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
// Hitung jumlah halaman
|
// Hitung jumlah halaman
|
||||||
$pageCount = ceil($totalRecords / $size);
|
$pageCount = ceil($totalRecords / $size);
|
||||||
|
|
||||||
|
|||||||
@@ -398,7 +398,7 @@
|
|||||||
"permission": "",
|
"permission": "",
|
||||||
"roles": [
|
"roles": [
|
||||||
"administrator",
|
"administrator",
|
||||||
"admin"
|
"pemohon-ao"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -409,7 +409,7 @@
|
|||||||
"permission": "",
|
"permission": "",
|
||||||
"roles": [
|
"roles": [
|
||||||
"administrator",
|
"administrator",
|
||||||
"admin"
|
"pemohon-ao"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -420,7 +420,7 @@
|
|||||||
"permission": "",
|
"permission": "",
|
||||||
"roles": [
|
"roles": [
|
||||||
"administrator",
|
"administrator",
|
||||||
"admin"
|
"pemohon-ao"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -459,6 +459,7 @@
|
|||||||
"permission": "",
|
"permission": "",
|
||||||
"roles": [
|
"roles": [
|
||||||
"administrator",
|
"administrator",
|
||||||
|
"admin",
|
||||||
"noc"
|
"noc"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -471,6 +472,7 @@
|
|||||||
"permission": "",
|
"permission": "",
|
||||||
"roles": [
|
"roles": [
|
||||||
"administrator",
|
"administrator",
|
||||||
|
"admin",
|
||||||
"noc"
|
"noc"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
242
resources/views/pembayaran/kurang.blade.php
Normal file
242
resources/views/pembayaran/kurang.blade.php
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
|
||||||
|
@section('breadcrumbs')
|
||||||
|
{{ Breadcrumbs::render('pembayaran') }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="grid">
|
||||||
|
<div class="min-w-full border card border-agi-100 card-grid" data-datatable="false" data-datatable-page-size="10"
|
||||||
|
data-datatable-state-save="false" id="pembayaran-table" data-api-url="{{ route('pembayaran.kurang.datatables') }}">
|
||||||
|
<div class="flex-wrap py-5 card-header bg-agi-50">
|
||||||
|
<h3 class="card-title">
|
||||||
|
Daftar Pembayaran Kurang Bayar
|
||||||
|
</h3>
|
||||||
|
<div class="flex flex-wrap gap-2 lg:gap-5">
|
||||||
|
<div class="flex">
|
||||||
|
<label class="input input-sm"> <i class="ki-filled ki-magnifier"> </i>
|
||||||
|
<input placeholder="Search Kurang Bayar" id="search" type="text" value="">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-wrap gap-2.5">
|
||||||
|
<div class="h-[24px] border border-r-gray-200"></div>
|
||||||
|
<a class="btn btn-sm btn-light" href="#"> Export to Excel </a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="scrollable-x-auto">
|
||||||
|
<table class="table text-sm font-medium text-gray-700 align-middle table-auto table-border"
|
||||||
|
data-datatable-table="true">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="w-14">
|
||||||
|
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox" />
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="nomor_registrasi">
|
||||||
|
<span class="sort"> <span class="sort-label"> Nomor Registrasi </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="nomor_tiket">
|
||||||
|
<span class="sort"> <span class="sort-label"> Nomor Tiket </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="tanggal_permohonan">
|
||||||
|
<span class="sort"> <span class="sort-label"> Tanggal Permohonan </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="user_id">
|
||||||
|
<span class="sort"> <span class="sort-label"> User Pemohon </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="branch_id">
|
||||||
|
<span class="sort"> <span class="sort-label"> Cabang Pemohon </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="debitur_id">
|
||||||
|
<span class="sort"> <span class="sort-label"> Debitur </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px] text-center" data-datatable-column="status_bayar">
|
||||||
|
<span class="sort"> <span class="sort-label"> Status Bayar </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px] text-center" data-datatable-column="nominal_kurang_bayar">
|
||||||
|
<span class="sort"> <span class="sort-label"> Nominal </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="flex-col gap-3 justify-center font-medium text-gray-600 card-footer md:justify-between md:flex-row text-2sm">
|
||||||
|
<div class="flex gap-2 items-center">
|
||||||
|
Show
|
||||||
|
<select class="w-16 select select-sm" data-datatable-size="true" name="perpage"> </select> per
|
||||||
|
page
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-4 items-center">
|
||||||
|
<span data-datatable-info="true"> </span>
|
||||||
|
<div class="pagination" data-datatable-pagination="true">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script type="text/javascript">
|
||||||
|
function pembayaranOtorisator(id) {
|
||||||
|
// alert('hai id = ' + id);
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Apakah Anda yakin?',
|
||||||
|
text: `Untuk melakukan approve Pembayaran!`,
|
||||||
|
icon: 'warning',
|
||||||
|
input: 'textarea', // Menambahkan input textarea
|
||||||
|
inputLabel: 'Keterangan',
|
||||||
|
inputPlaceholder: 'Masukkan keterangan...',
|
||||||
|
inputAttributes: {
|
||||||
|
'aria-label': 'Masukkan keterangan'
|
||||||
|
},
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Ya, Lanjutkan!',
|
||||||
|
cancelButtonText: 'Lain kali',
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
|
||||||
|
let useURL = "{{ URL::to('pembayaran') }}" + "/" + id;
|
||||||
|
const keterangan = result.value || ''; // Ambil pesan dari textarea
|
||||||
|
|
||||||
|
var input_data = new Object();
|
||||||
|
input_data._method = 'PUT';
|
||||||
|
input_data.id = id;
|
||||||
|
input_data.keterangan = keterangan;
|
||||||
|
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
|
},
|
||||||
|
});
|
||||||
|
$.ajax({
|
||||||
|
url: useURL,
|
||||||
|
type: 'PUT',
|
||||||
|
data: input_data,
|
||||||
|
dataType: "json",
|
||||||
|
success: (response) => {
|
||||||
|
if ('success' == response.status) {
|
||||||
|
Swal.fire('Berhasil!', response.message, 'success').then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
} else if ('error' == response.status) {
|
||||||
|
Swal.fire('Error!', response.message, 'error').then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(response);
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
||||||
|
'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<script type="module">
|
||||||
|
const element = document.querySelector('#pembayaran-table');
|
||||||
|
const searchInput = document.getElementById('search');
|
||||||
|
|
||||||
|
const apiUrl = element.getAttribute('data-api-url');
|
||||||
|
const dataTableOptions = {
|
||||||
|
apiEndpoint: apiUrl,
|
||||||
|
pageSize: 5,
|
||||||
|
columns: {
|
||||||
|
select: {
|
||||||
|
render: (item, data, context) => {
|
||||||
|
const checkbox = document.createElement('input');
|
||||||
|
checkbox.className = 'checkbox checkbox-sm';
|
||||||
|
checkbox.type = 'checkbox';
|
||||||
|
checkbox.value = data.id.toString();
|
||||||
|
checkbox.setAttribute('data-datatable-row-check', 'true');
|
||||||
|
return checkbox.outerHTML.trim();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nomor_registrasi: {
|
||||||
|
title: 'Nomor Registrasi',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.permohonan?.nomor_registrasi}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nomor_tiket: {
|
||||||
|
title: 'Nomor Tiket',
|
||||||
|
},
|
||||||
|
tanggal_permohonan: {
|
||||||
|
title: 'Tanggal Permohonan',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.permohonan?.tanggal_permohonan}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user_id: {
|
||||||
|
title: 'User Pemohon',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.pemohon?.name}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
branch_id: {
|
||||||
|
title: 'Cabang Pemohon',
|
||||||
|
render: (item, data) => {
|
||||||
|
if (data.branch) {
|
||||||
|
return `${data.branch.code} - ${data.branch.name}`;
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
debitur_id: {
|
||||||
|
title: 'Debitur',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.debiture?.name}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
status_bayar: {
|
||||||
|
title: 'Status Bayar',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `<span class="font-bold text-red-600 uppercase text-md">
|
||||||
|
Kurang Bayar
|
||||||
|
</span>`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nominal_kurang_bayar: {
|
||||||
|
title: 'Kurang Bayar'
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
title: 'Status',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `<div class="flex gap-2 justify-center">
|
||||||
|
<a class="btn btn-icon btn-clear btn-warning" href="pembayaran/${data.id}/edit" title="Lakukan Pembayaran">
|
||||||
|
<i class="ki-outline ki-credit-cart"></i>
|
||||||
|
</a>
|
||||||
|
</div>`;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||||
|
// Custom search functionality
|
||||||
|
searchInput.addEventListener('input', function() {
|
||||||
|
const searchValue = this.value.trim();
|
||||||
|
dataTable.search(searchValue, true);
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
242
resources/views/pembayaran/lebih.blade.php
Normal file
242
resources/views/pembayaran/lebih.blade.php
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
|
||||||
|
@section('breadcrumbs')
|
||||||
|
{{ Breadcrumbs::render('pembayaran') }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="grid">
|
||||||
|
<div class="min-w-full border card border-agi-100 card-grid" data-datatable="false" data-datatable-page-size="10"
|
||||||
|
data-datatable-state-save="false" id="pembayaran-table" data-api-url="{{ route('pembayaran.lebih.datatables') }}">
|
||||||
|
<div class="flex-wrap py-5 card-header bg-agi-50">
|
||||||
|
<h3 class="card-title">
|
||||||
|
Daftar Pembayaran Lebih Bayar
|
||||||
|
</h3>
|
||||||
|
<div class="flex flex-wrap gap-2 lg:gap-5">
|
||||||
|
<div class="flex">
|
||||||
|
<label class="input input-sm"> <i class="ki-filled ki-magnifier"> </i>
|
||||||
|
<input placeholder="Search Lebih Bayar" id="search" type="text" value="">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-wrap gap-2.5">
|
||||||
|
<div class="h-[24px] border border-r-gray-200"></div>
|
||||||
|
<a class="btn btn-sm btn-light" href="#"> Export to Excel </a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="scrollable-x-auto">
|
||||||
|
<table class="table text-sm font-medium text-gray-700 align-middle table-auto table-border"
|
||||||
|
data-datatable-table="true">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="w-14">
|
||||||
|
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox" />
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="nomor_registrasi">
|
||||||
|
<span class="sort"> <span class="sort-label"> Nomor Registrasi </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="nomor_tiket">
|
||||||
|
<span class="sort"> <span class="sort-label"> Nomor Tiket </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="tanggal_permohonan">
|
||||||
|
<span class="sort"> <span class="sort-label"> Tanggal Permohonan </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="user_id">
|
||||||
|
<span class="sort"> <span class="sort-label"> User Pemohon </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="branch_id">
|
||||||
|
<span class="sort"> <span class="sort-label"> Cabang Pemohon </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="debitur_id">
|
||||||
|
<span class="sort"> <span class="sort-label"> Debitur </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px] text-center" data-datatable-column="status_bayar">
|
||||||
|
<span class="sort"> <span class="sort-label"> Status Bayar </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px] text-center" data-datatable-column="nominal_lebih_bayar">
|
||||||
|
<span class="sort"> <span class="sort-label"> Nominal </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="flex-col gap-3 justify-center font-medium text-gray-600 card-footer md:justify-between md:flex-row text-2sm">
|
||||||
|
<div class="flex gap-2 items-center">
|
||||||
|
Show
|
||||||
|
<select class="w-16 select select-sm" data-datatable-size="true" name="perpage"> </select> per
|
||||||
|
page
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-4 items-center">
|
||||||
|
<span data-datatable-info="true"> </span>
|
||||||
|
<div class="pagination" data-datatable-pagination="true">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script type="text/javascript">
|
||||||
|
function pembayaranOtorisator(id) {
|
||||||
|
// alert('hai id = ' + id);
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Apakah Anda yakin?',
|
||||||
|
text: `Untuk melakukan approve Pembayaran!`,
|
||||||
|
icon: 'warning',
|
||||||
|
input: 'textarea', // Menambahkan input textarea
|
||||||
|
inputLabel: 'Keterangan',
|
||||||
|
inputPlaceholder: 'Masukkan keterangan...',
|
||||||
|
inputAttributes: {
|
||||||
|
'aria-label': 'Masukkan keterangan'
|
||||||
|
},
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Ya, Lanjutkan!',
|
||||||
|
cancelButtonText: 'Lain kali',
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
|
||||||
|
let useURL = "{{ URL::to('pembayaran') }}" + "/" + id;
|
||||||
|
const keterangan = result.value || ''; // Ambil pesan dari textarea
|
||||||
|
|
||||||
|
var input_data = new Object();
|
||||||
|
input_data._method = 'PUT';
|
||||||
|
input_data.id = id;
|
||||||
|
input_data.keterangan = keterangan;
|
||||||
|
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
|
},
|
||||||
|
});
|
||||||
|
$.ajax({
|
||||||
|
url: useURL,
|
||||||
|
type: 'PUT',
|
||||||
|
data: input_data,
|
||||||
|
dataType: "json",
|
||||||
|
success: (response) => {
|
||||||
|
if ('success' == response.status) {
|
||||||
|
Swal.fire('Berhasil!', response.message, 'success').then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
} else if ('error' == response.status) {
|
||||||
|
Swal.fire('Error!', response.message, 'error').then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(response);
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
||||||
|
'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<script type="module">
|
||||||
|
const element = document.querySelector('#pembayaran-table');
|
||||||
|
const searchInput = document.getElementById('search');
|
||||||
|
|
||||||
|
const apiUrl = element.getAttribute('data-api-url');
|
||||||
|
const dataTableOptions = {
|
||||||
|
apiEndpoint: apiUrl,
|
||||||
|
pageSize: 5,
|
||||||
|
columns: {
|
||||||
|
select: {
|
||||||
|
render: (item, data, context) => {
|
||||||
|
const checkbox = document.createElement('input');
|
||||||
|
checkbox.className = 'checkbox checkbox-sm';
|
||||||
|
checkbox.type = 'checkbox';
|
||||||
|
checkbox.value = data.id.toString();
|
||||||
|
checkbox.setAttribute('data-datatable-row-check', 'true');
|
||||||
|
return checkbox.outerHTML.trim();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nomor_registrasi: {
|
||||||
|
title: 'Nomor Registrasi',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.permohonan?.nomor_registrasi}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nomor_tiket: {
|
||||||
|
title: 'Nomor Tiket',
|
||||||
|
},
|
||||||
|
tanggal_permohonan: {
|
||||||
|
title: 'Tanggal Permohonan',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.permohonan?.tanggal_permohonan}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user_id: {
|
||||||
|
title: 'User Pemohon',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.pemohon?.name}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
branch_id: {
|
||||||
|
title: 'Cabang Pemohon',
|
||||||
|
render: (item, data) => {
|
||||||
|
if (data.branch) {
|
||||||
|
return `${data.branch.code} - ${data.branch.name}`;
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
debitur_id: {
|
||||||
|
title: 'Debitur',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.debiture?.name}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
status_bayar: {
|
||||||
|
title: 'Status Bayar',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `<span class="font-bold text-green-600 uppercase text-md">
|
||||||
|
Lebih Bayar
|
||||||
|
</span>`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nominal_lebih_bayar: {
|
||||||
|
title: 'Lebih Bayar'
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
title: 'Status',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `<div class="flex gap-2 justify-center">
|
||||||
|
<a class="btn btn-icon btn-clear btn-warning" href="pembayaran/${data.id}/edit" title="Lakukan Pembayaran">
|
||||||
|
<i class="ki-outline ki-credit-cart"></i>
|
||||||
|
</a>
|
||||||
|
</div>`;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||||
|
// Custom search functionality
|
||||||
|
searchInput.addEventListener('input', function() {
|
||||||
|
const searchValue = this.value.trim();
|
||||||
|
dataTable.search(searchValue, true);
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
@@ -136,6 +136,8 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
Route::get('/pembayaran/{pembayaran}/edit', 'edit')->name('pembayaran.edit');
|
Route::get('/pembayaran/{pembayaran}/edit', 'edit')->name('pembayaran.edit');
|
||||||
Route::post('pembayaran','store')->name('pembayaran.store');
|
Route::post('pembayaran','store')->name('pembayaran.store');
|
||||||
Route::get('/pembayaran/datatables', 'dataForDatatables')->name('pembayaran.datatables');
|
Route::get('/pembayaran/datatables', 'dataForDatatables')->name('pembayaran.datatables');
|
||||||
|
Route::get('/pembayaran/datatables-kurang','dataForDatatablesKurang')->name('pembayaran.kurang.datatables');
|
||||||
|
Route::get('/pembayaran/datatables-lebih','dataForDatatablesLebih')->name('pembayaran.lebih.datatables');
|
||||||
|
|
||||||
Route::put('/pembayaran/{pembayaran}', 'update')->name('pembayaran.update');
|
Route::put('/pembayaran/{pembayaran}', 'update')->name('pembayaran.update');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user