Merge branch 'staging' into feature/senior-officer

This commit is contained in:
majid
2025-07-03 11:12:56 +07:00
6 changed files with 597 additions and 12 deletions

View File

@@ -19,9 +19,20 @@
* Display a listing of the resource.
*/
public function index()
{
return redirect()->route('noc.pembayaran');
}
public function pembayaran()
{
$persetujuanPenawarans = PersetujuanPenawaran::all();
return view('lpj::noc.index', compact('persetujuanPenawarans'));
return view('lpj::noc.pembayaran', compact('persetujuanPenawarans'));
}
public function penyelesaian()
{
$persetujuanPenawarans = PersetujuanPenawaran::all();
return view('lpj::noc.penyelesaian', compact('persetujuanPenawarans'));
}
/**
@@ -131,6 +142,7 @@
$noc = Noc::updateOrCreate(
[
'permohonan_id' => $validated['permohonan_id'],
'permohonan_id' => $validated['permohonan_id'],
'persetujuan_penawaran_id' => $validated['persetujuan_penawaran_id'],
],
@@ -190,6 +202,12 @@
}
public function dataForDatatables(Request $request)
{
// Redirect to pembayaran datatables by default
return $this->dataForDatatablesPembayaran($request);
}
public function dataForDatatablesPembayaran(Request $request)
{
if (is_null($this->user) || !$this->user->can('noc.view')) {
//abort(403, 'Sorry! You are not allowed to view persetujuan penawaran.');
@@ -198,6 +216,97 @@
// Retrieve data from the database
$query = PersetujuanPenawaran::query();
// Filter for pembayaran (where memo_penyelesaian is null)
$query->whereDoesntHave('noc', function($q) {
$q->whereNotNull('memo_penyelesaian');
});
// Apply search filter if provided
if ($request->has('search') && !empty($request->get('search'))) {
$search = $request->get('search');
$query->where(function ($q) use ($search) {
$q->orWhereRelation('penawaran', 'nomor_registrasi', 'LIKE', '%' . $search . '%');
});
}
// Apply sorting if provided
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
$order = $request->get('sortOrder');
$column = $request->get('sortField');
$query->orderBy($column, $order);
}
// Get the total count of records
$totalRecords = $query->count();
// Apply pagination if provided
if ($request->has('page') && $request->has('size')) {
$page = $request->get('page');
$size = $request->get('size');
$offset = ($page - 1) * $size; // Calculate the offset
$query->skip($offset)->take($size);
}
// Get the filtered count of records
$filteredRecords = $query->count();
// Get the data for the current page
$data = $query->get();
$data = $data->map(function ($persetujuanPenawaran) {
return [
'id' => $persetujuanPenawaran->id,
'nomor_registrasi' => $persetujuanPenawaran->permohonan->nomor_registrasi ?? $persetujuanPenawaran->penawaran->nomor_registrasi,
'nama_debitur' => $persetujuanPenawaran->permohonan->debiture->name ?? $persetujuanPenawaran->penawaran->permohonan->debiture->name,
'cabang' => $persetujuanPenawaran->permohonan->branch->name ?? $persetujuanPenawaran->penawaran->permohonan->branch->name,
'tanggal_pembayaran' => dateFormat(
$persetujuanPenawaran->noc->tanggal_pembayaran ?? $persetujuanPenawaran->noc?->created_at,
true,
),
'nominal_bayar' => currencyFormat($persetujuanPenawaran->nominal_bayar ?? 0,
),
'nominal_diterima' => currencyFormat(
$persetujuanPenawaran->noc->nominal_bayar ?? 0,
),
'bukti_ksl' => $persetujuanPenawaran->noc->bukti_ksl ?? $persetujuanPenawaran->bukti_ksl ?? null,
'bukti_bayar' => $persetujuanPenawaran->bukti_bayar ?? null,
'updated_at' => dateFormat($persetujuanPenawaran->updated_at, true),
];
})->sortBy('updated_at', 1);
// Calculate the page count
$pageCount = ceil($totalRecords / $request->get('size'));
// Calculate the current page number
$currentPage = $request->get('page', 1);
// Return the response data as a JSON object
return response()->json([
'draw' => $request->get('draw'),
'recordsTotal' => $totalRecords,
'recordsFiltered' => $filteredRecords,
'pageCount' => $pageCount,
'page' => $currentPage,
'totalCount' => $totalRecords,
'data' => $data,
]);
}
public function dataForDatatablesPenyelesaian(Request $request)
{
if (is_null($this->user) || !$this->user->can('noc.view')) {
//abort(403, 'Sorry! You are not allowed to view persetujuan penawaran.');
}
// Retrieve data from the database
$query = PersetujuanPenawaran::query();
// Filter for penyelesaian (where memo_penyelesaian is not null)
$query->whereHas('noc', function($q) {
$q->whereNotNull('memo_penyelesaian');
});
// Apply search filter if provided
if ($request->has('search') && !empty($request->get('search'))) {
$search = $request->get('search');

View File

@@ -265,6 +265,18 @@
{
"title": "NOC",
"path": "noc",
"icon": "ki-filled ki-briefcase text-lg text-primary",
"classes": "",
"attributes": [],
"permission": "",
"roles": [
"administrator",
"admin"
],
"sub": [
{
"title": "Pembayaran",
"path": "noc.pembayaran",
"icon": "ki-filled ki-two-credit-cart text-lg text-primary",
"classes": "",
"attributes": [],
@@ -274,6 +286,20 @@
"noc"
]
},
{
"title": "Penyelesaian",
"path": "noc.penyelesaian",
"icon": "ki-filled ki-two-credit-cart text-lg text-primary",
"classes": "",
"attributes": [],
"permission": "",
"roles": [
"administrator",
"noc"
]
}
]
},
{
"title": "Registrasi",
"path": "registrasi",

View File

@@ -0,0 +1,198 @@
@extends('layouts.main')
@section('breadcrumbs')
{{ Breadcrumbs::render('noc.pembayaran') }}
@endsection
@section('content')
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
<div class="card border border-agi-100 card-grid min-w-full" data-datatable="false" data-datatable-page-size="10" data-datatable-state-save="false" id="noc-table" data-api-url="{{ route('noc.datatables.pembayaran') }}">
<div class="card-header bg-agi-50 py-5 flex-wrap">
<h3 class="card-title">
Daftar NOC Pembayaran
</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 NOC Pembayaran" 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 table-auto table-border align-middle text-gray-700 font-medium text-sm" 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="nama_debitur">
<span class="sort"> <span class="sort-label"> Nama Debitur </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="cabang">
<span class="sort"> <span class="sort-label"> Cabang </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="tanggal_setor">
<span class="sort"> <span class="sort-label"> Tanggal KSL </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="nominal_bayar">
<span class="sort"> <span class="sort-label"> Nominal bayar </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="bukti_bayar">
<span class="sort"> <span class="sort-label"> Bukti Bayar </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="nominal_diterima">
<span class="sort"> <span class="sort-label"> Nominal Diterima </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="bukti_ksl">
<span class="sort"> <span class="sort-label"> Bukti KSL </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="tanggal_pembayaran">
<span class="sort"> <span class="sort-label"> Tanggal Pembayaran </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="card-footer justify-center md:justify-between flex-col md:flex-row gap-3 text-gray-600 text-2sm font-medium">
<div class="flex items-center gap-2">
Show
<select class="select select-sm w-16" data-datatable-size="true" name="perpage"> </select> per
page
</div>
<div class="flex items-center gap-4">
<span data-datatable-info="true"> </span>
<div class="pagination" data-datatable-pagination="true">
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
function prosesData(data) {
Swal.fire({
title: 'NOC Pembayaran',
text: "Apakah Anda yakin ingin menyetujui pembayaran ini?",
icon: 'info',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ya',
cancelButtonText: 'Tidak'
}).then((result) => {
if (result.isConfirmed) {
window.location.href = `noc/${data}/edit`;
}
})
}
</script>
<script type="module">
const element = document.querySelector('#noc-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'
},
nama_debitur: {
title: 'Nama Debitur',
},
cabang: {
title: 'Cabang',
},
tanggal_setor: {
title: 'Tanggal Setor',
},
nominal_bayar: {
title: 'Nominal Bayar',
},
bukti_bayar: {
title: 'Bukti KSL',
render: (item, data) => {
if (data.bukti_bayar) {
return `<a href="storage/${data.bukti_bayar}" download="storage/${data.bukti_bayar}" target="_blank" class="badge badge-sm badge-outline">
Download <i class="ki-filled ki-cloud-download"></i>
</a>`;
} else {
return '-';
}
},
},
nominal_diterima: {
title: 'Nominal Diterima',
},
bukti_ksl: {
title: 'Bukti KSL',
render: (item, data) => {
if (data.bukti_ksl) {
return `<a href="storage/${data.bukti_ksl}" download="storage/${data.bukti_ksl}" target="_blank" class="badge badge-sm badge-outline">
Download <i class="ki-filled ki-cloud-download"></i>
</a>`;
} else {
return '-';
}
},
},
tanggal_pembayaran: {
title: 'Tanggal Pembayaran',
},
actions: {
title: 'Action',
render: (item, data) => {
return `<div class="flex flex-nowrap justify-center">
<a class="btn btn-sm btn-outline btn-info" onclick="prosesData(${data.id})">
<i class="ki-filled ki-double-check"></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

View File

@@ -0,0 +1,244 @@
@extends('layouts.main')
@section('breadcrumbs')
{{ Breadcrumbs::render('noc.penyelesaian') }}
@endsection
@section('content')
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
<div class="card border border-agi-100 card-grid min-w-full" data-datatable="false" data-datatable-page-size="10" data-datatable-state-save="false" id="noc-table" data-api-url="{{ route('noc.datatables.penyelesaian') }}">
<div class="card-header bg-agi-50 py-5 flex-wrap">
<h3 class="card-title">
Daftar NOC Penyelesaian
</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 NOC Penyelesaian" 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 table-auto table-border align-middle text-gray-700 font-medium text-sm" 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="nama_debitur">
<span class="sort"> <span class="sort-label"> Nama Debitur </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="cabang">
<span class="sort"> <span class="sort-label"> Cabang </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="tanggal_setor">
<span class="sort"> <span class="sort-label"> Tanggal KSL </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="nominal_bayar">
<span class="sort"> <span class="sort-label"> Nominal bayar </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="bukti_bayar">
<span class="sort"> <span class="sort-label"> Bukti Bayar </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="nominal_diterima">
<span class="sort"> <span class="sort-label"> Nominal Diterima </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="bukti_ksl">
<span class="sort"> <span class="sort-label"> Bukti KSL </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="tanggal_pembayaran">
<span class="sort"> <span class="sort-label"> Tanggal Pembayaran </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="memo_penyelesaian">
<span class="sort"> <span class="sort-label"> Memo Penyelesaian </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="bukti_penyelesaian">
<span class="sort"> <span class="sort-label"> Bukti Penyelesaian </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="nominal_penyelesaian">
<span class="sort"> <span class="sort-label"> Nominal Penyelesaian </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="tanggal_penyelesaian">
<span class="sort"> <span class="sort-label"> Tanggal Penyelesaian </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="card-footer justify-center md:justify-between flex-col md:flex-row gap-3 text-gray-600 text-2sm font-medium">
<div class="flex items-center gap-2">
Show
<select class="select select-sm w-16" data-datatable-size="true" name="perpage"> </select> per
page
</div>
<div class="flex items-center gap-4">
<span data-datatable-info="true"> </span>
<div class="pagination" data-datatable-pagination="true">
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
function prosesData(data) {
Swal.fire({
title: 'NOC Penyelesaian',
text: "Apakah Anda yakin ingin menyetujui penyelesaian ini?",
icon: 'info',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ya',
cancelButtonText: 'Tidak'
}).then((result) => {
if (result.isConfirmed) {
window.location.href = `noc/${data}/edit`;
}
})
}
</script>
<script type="module">
const element = document.querySelector('#noc-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'
},
nama_debitur: {
title: 'Nama Debitur',
},
cabang: {
title: 'Cabang',
},
tanggal_setor: {
title: 'Tanggal Setor',
},
nominal_bayar: {
title: 'Nominal Bayar',
},
bukti_bayar: {
title: 'Bukti KSL',
render: (item, data) => {
if (data.bukti_bayar) {
return `<a href="storage/${data.bukti_bayar}" download="storage/${data.bukti_bayar}" target="_blank" class="badge badge-sm badge-outline">
Download <i class="ki-filled ki-cloud-download"></i>
</a>`;
} else {
return '-';
}
},
},
nominal_diterima: {
title: 'Nominal Diterima',
},
bukti_ksl: {
title: 'Bukti KSL',
render: (item, data) => {
if (data.bukti_ksl) {
return `<a href="storage/${data.bukti_ksl}" download="storage/${data.bukti_ksl}" target="_blank" class="badge badge-sm badge-outline">
Download <i class="ki-filled ki-cloud-download"></i>
</a>`;
} else {
return '-';
}
},
},
tanggal_pembayaran: {
title: 'Tanggal Pembayaran',
},
memo_penyelesaian: {
title: 'Memo Penyelesaian',
render: (item, data) => {
if (data.memo_penyelesaian) {
return `<a href="storage/${data.memo_penyelesaian}" download="storage/${data.memo_penyelesaian}" target="_blank" class="badge badge-sm badge-outline">
Download <i class="ki-filled ki-cloud-download"></i>
</a>`;
} else {
return '-';
}
},
},
bukti_penyelesaian: {
title: 'Bukti Penyelesaian',
render: (item, data) => {
if (data.bukti_penyelesaian) {
return `<a href="storage/${data.bukti_penyelesaian}" download="storage/${data.bukti_penyelesaian}" target="_blank" class="badge badge-sm badge-outline">
Download <i class="ki-filled ki-cloud-download"></i>
</a>`;
} else {
return '-';
}
},
},
nominal_penyelesaian: {
title: 'Nominal Penyelesaian',
},
tanggal_penyelesaian: {
title: 'Tanggal Penyelesaian',
},
actions: {
title: 'Action',
render: (item, data) => {
return `<div class="flex flex-nowrap justify-center">
<a class="btn btn-sm btn-outline btn-info" onclick="prosesData(${data.id})">
<i class="ki-filled ki-double-check"></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

View File

@@ -673,16 +673,19 @@ Breadcrumbs::for('noc', function (BreadcrumbTrail $trail) {
$trail->push('NOC', route('noc.index'));
});
Breadcrumbs::for('noc.pembayaran', function (BreadcrumbTrail $trail) {
$trail->push('NOC Pembayaran', route('noc.pembayaran.index'));
});
Breadcrumbs::for('noc.penyelesaian', function (BreadcrumbTrail $trail) {
$trail->push('NOC Penyelesaian', route('noc.penyelesaian.index'));
});
Breadcrumbs::for('noc.edit', function (BreadcrumbTrail $trail) {
$trail->parent('noc');
$trail->push('Proses NOC');
});
Breadcrumbs::for('noc.penyelesaian', function (BreadcrumbTrail $trail) {
$trail->parent('noc');
$trail->push('Proses Memo Penyelesaian NOC');
});
Breadcrumbs::for('laporan-external', function (BreadcrumbTrail $trail) {
$trail->push('Laporan External', route('laporan-external.index'));
});

View File

@@ -654,9 +654,14 @@ Route::middleware(['auth'])->group(function () {
Route::get('noc/datatables', [NocController::class, 'dataForDatatables'])
->name('noc.datatables');
Route::get('noc/penyelesaian',[NocController::class, 'show'])->name('noc.penyelesaian');
Route::post('noc/penyelesaian',[NocController::class, 'penyelesaian'])->name('noc.store.penyelesaian');
Route::get('noc/datatables/pembayaran', [NocController::class, 'dataForDatatablesPembayaran'])
->name('noc.datatables.pembayaran');
Route::get('noc/datatables/penyelesaian', [NocController::class, 'dataForDatatablesPenyelesaian'])
->name('noc.datatables.penyelesaian');
Route::get('noc/pembayaran', [NocController::class, 'pembayaran'])->name('noc.pembayaran.index');
Route::get('noc/penyelesaian', [NocController::class, 'penyelesaian'])->name('noc.penyelesaian.index');
Route::post('noc/penyelesaian',[NocController::class, 'penyelesaian'])->name('noc.store.penyelesaian');
Route::resource('noc', NocController::class);