Tambahkan fitur persetujuan pada otorisator
- Ditambahkan relasi baru di model Permohonan untuk persetujuan SO, EO, dan DD. - Modifikasi PenilaianController untuk menyertakan data relasi persetujuan. - Perbaikan dan penyesuaian tampilan tabel dengan kolom persetujuan. - Tambahkan logika tombol otorisator berdasarkan peran pengguna dan status persetujuan. - Update tampilan detail permohonan dengan informasi persetujuan.
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
<div class="card pb-2.5">
|
||||
<div class=" card-grid min-w-full" data-datatable="false" data-datatable-page-size="10"
|
||||
data-datatable-state-save="false" id="permohonan-table"
|
||||
data-api-url="{{ route('otorisator.datatables', ['otorisator' => $header]) }}">
|
||||
data-datatable-state-save="false" id="permohonan-table"
|
||||
data-api-url="{{ route('otorisator.datatables', ['otorisator' => $header]) }}">
|
||||
<div class="card-header py-5 flex-wrap">
|
||||
<h3 class="card-title">
|
||||
Daftar {{ $header }}
|
||||
@@ -30,46 +30,59 @@
|
||||
<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">
|
||||
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="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]" data-datatable-column="tujuan_penilaian_id">
|
||||
<span class="sort"> <span class="sort-label"> Tujuan Penilaian </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<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="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]" data-datatable-column="tujuan_penilaian_id">
|
||||
<span class="sort"> <span class="sort-label"> Tujuan Penilaian </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
|
||||
@if ($header == 'Pembayaran')
|
||||
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
||||
<span class="sort"> <span class="sort-label"> Status Bayar </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
@endif
|
||||
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
||||
<span class="sort"> <span class="sort-label"> Status Bayar </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
|
||||
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
||||
</tr>
|
||||
<th class="min-w-[150px]" data-datatable-column="approval_so">
|
||||
<span class="sort"> <span class="sort-label"> Approval SO </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
|
||||
<th class="min-w-[150px]" data-datatable-column="approval_eo">
|
||||
<span class="sort"> <span class="sort-label"> Approval EO </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
|
||||
<th class="min-w-[150px]" data-datatable-column="approval_dd">
|
||||
<span class="sort"> <span class="sort-label"> Approval DD </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>
|
||||
@@ -182,34 +195,80 @@
|
||||
return `${data.tujuan_penilaian.name}`;
|
||||
},
|
||||
},
|
||||
...(dataHeader === 'Pembayaran' && {
|
||||
status_bayar: {
|
||||
title: 'Status Bayar',
|
||||
render: (item, data) => {
|
||||
const status = data.status_bayar.replace(/_/g,
|
||||
' ');
|
||||
const statusClass = data.status_bayar === 'belum_bayar' ? 'text-red-600' :
|
||||
'text-green-600';
|
||||
return `<span class="text-md font-bold ${statusClass} uppercase">
|
||||
status_bayar: {
|
||||
title: 'Status Bayar',
|
||||
render: (item, data) => {
|
||||
const status = data.status_bayar.replace(/_/g,
|
||||
' ');
|
||||
const statusClass = data.status_bayar === 'belum_bayar' ? 'text-red-600' :
|
||||
'text-green-600';
|
||||
return `<span class="text-md font-bold ${statusClass} uppercase">
|
||||
${status}
|
||||
</span>`;
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
},
|
||||
approval_so: {
|
||||
title: 'Approval SO',
|
||||
render: (item, data) => {
|
||||
if(data.approve_so) {
|
||||
return `${data.approve_so.name} | ${window.formatTanggalIndonesia(data.approval_so_at)}`;
|
||||
}
|
||||
return '';
|
||||
},
|
||||
},
|
||||
approval_eo: {
|
||||
title: 'Approval EO',
|
||||
render: (item, data) => {
|
||||
if(data.approve_eo) {
|
||||
return `${data.approve_eo.name} | ${window.formatTanggalIndonesia(data.approval_eo_at)}`;
|
||||
}
|
||||
return '';
|
||||
},
|
||||
},
|
||||
approval_dd: {
|
||||
title: 'Approval DD',
|
||||
render: (item, data) => {
|
||||
if(data.approve_dd) {
|
||||
return `${data.approve_dd.name} | ${window.formatTanggalIndonesia(data.approval_dd_at)}`;
|
||||
}
|
||||
return '';
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
title: 'Status',
|
||||
render: (item, data) => {
|
||||
return `<div class="flex flex-nowrap justify-center">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-warning " href="otorisator/show/${data.id}/${dataHeader}">
|
||||
<i class="ki-outline ki-eye"></i>
|
||||
</a>
|
||||
const userRoles = @json(Auth::user()->getRoleNames());
|
||||
const isAdmin = userRoles.includes('administrator');
|
||||
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-primary " onclick="otorisatorData(${data.id})">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
</a>
|
||||
</div>`;
|
||||
let buttons = `
|
||||
<div class="flex flex-nowrap justify-center">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-warning" href="otorisator/show/${data.id}/${dataHeader}">
|
||||
<i class="ki-outline ki-eye"></i>
|
||||
</a>
|
||||
`;
|
||||
|
||||
if ((isAdmin || userRoles.includes('senior-officer')) && !data.approval_so) {
|
||||
buttons += `
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-primary" onclick="otorisatorData(${data.id})">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
</a>
|
||||
`;
|
||||
} else if ((isAdmin || userRoles.includes('EO Appraisal')) && data.approval_so && !data.approval_eo) {
|
||||
buttons += `
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-primary" onclick="otorisatorData(${data.id})">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
</a>
|
||||
`;
|
||||
} else if ((isAdmin || userRoles.includes('DD Appraisal')) && data.approval_eo && !data.approval_dd) {
|
||||
buttons += `
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-primary" onclick="otorisatorData(${data.id})">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
|
||||
buttons += `</div>`;
|
||||
return buttons;
|
||||
},
|
||||
}
|
||||
},
|
||||
@@ -217,7 +276,7 @@
|
||||
|
||||
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||
// Custom search functionality
|
||||
searchInput.addEventListener('input', function() {
|
||||
searchInput.addEventListener('input', function () {
|
||||
const searchValue = this.value.trim();
|
||||
dataTable.search(searchValue, true);
|
||||
|
||||
@@ -265,7 +324,7 @@
|
||||
error: (error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
||||
'error');
|
||||
'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user