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:
@@ -536,7 +536,7 @@
|
|||||||
$filteredRecords = $query->count();
|
$filteredRecords = $query->count();
|
||||||
|
|
||||||
// Ambil data dengan relasi
|
// Ambil data dengan relasi
|
||||||
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian', 'region.teams.teamsUsers'])->get();
|
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian', 'approveSo'])->get();
|
||||||
|
|
||||||
|
|
||||||
// Hitung jumlah halaman
|
// Hitung jumlah halaman
|
||||||
|
|||||||
@@ -193,4 +193,16 @@
|
|||||||
public function approveBayar(){
|
public function approveBayar(){
|
||||||
return $this->belongsTo(User::class, 'approve_bayar_by', 'id');
|
return $this->belongsTo(User::class, 'approve_bayar_by', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function approveEo(){
|
||||||
|
return $this->belongsTo(User::class, 'approval_eo', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function approveDd(){
|
||||||
|
return $this->belongsTo(User::class, 'approval_dd', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function approveSo(){
|
||||||
|
return $this->belongsTo(User::class, 'approval_so', 'id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||||
<div class="card pb-2.5">
|
<div class="card pb-2.5">
|
||||||
<div class=" card-grid min-w-full" data-datatable="false" data-datatable-page-size="10"
|
<div class=" card-grid min-w-full" data-datatable="false" data-datatable-page-size="10"
|
||||||
data-datatable-state-save="false" id="permohonan-table"
|
data-datatable-state-save="false" id="permohonan-table"
|
||||||
data-api-url="{{ route('otorisator.datatables', ['otorisator' => $header]) }}">
|
data-api-url="{{ route('otorisator.datatables', ['otorisator' => $header]) }}">
|
||||||
<div class="card-header py-5 flex-wrap">
|
<div class="card-header py-5 flex-wrap">
|
||||||
<h3 class="card-title">
|
<h3 class="card-title">
|
||||||
Daftar {{ $header }}
|
Daftar {{ $header }}
|
||||||
@@ -30,46 +30,59 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="scrollable-x-auto">
|
<div class="scrollable-x-auto">
|
||||||
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm"
|
<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>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="w-14">
|
<th class="w-14">
|
||||||
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox" />
|
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox"/>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="nomor_registrasi">
|
<th class="min-w-[150px]" data-datatable-column="nomor_registrasi">
|
||||||
<span class="sort"> <span class="sort-label"> Nomor Registrasi </span>
|
<span class="sort"> <span class="sort-label"> Nomor Registrasi </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="tanggal_permohonan">
|
<th class="min-w-[150px]" data-datatable-column="tanggal_permohonan">
|
||||||
<span class="sort"> <span class="sort-label"> Tanggal Permohonan </span>
|
<span class="sort"> <span class="sort-label"> Tanggal Permohonan </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="user_id">
|
<th class="min-w-[150px]" data-datatable-column="user_id">
|
||||||
<span class="sort"> <span class="sort-label"> User Pemohon </span>
|
<span class="sort"> <span class="sort-label"> User Pemohon </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="branch_id">
|
<th class="min-w-[150px]" data-datatable-column="branch_id">
|
||||||
<span class="sort"> <span class="sort-label"> Cabang Pemohon </span>
|
<span class="sort"> <span class="sort-label"> Cabang Pemohon </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="debitur_id">
|
<th class="min-w-[150px]" data-datatable-column="debitur_id">
|
||||||
<span class="sort"> <span class="sort-label"> Debitur </span>
|
<span class="sort"> <span class="sort-label"> Debitur </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
||||||
<span class="sort"> <span class="sort-label"> Tujuan Penilaian </span>
|
<span class="sort"> <span class="sort-label"> Tujuan Penilaian </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
@if ($header == 'Pembayaran')
|
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
||||||
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
<span class="sort"> <span class="sort-label"> Status Bayar </span>
|
||||||
<span class="sort"> <span class="sort-label"> Status Bayar </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
</th>
|
||||||
</th>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
<th class="min-w-[150px]" data-datatable-column="approval_so">
|
||||||
</tr>
|
<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>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -182,34 +195,80 @@
|
|||||||
return `${data.tujuan_penilaian.name}`;
|
return `${data.tujuan_penilaian.name}`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
...(dataHeader === 'Pembayaran' && {
|
status_bayar: {
|
||||||
status_bayar: {
|
title: 'Status Bayar',
|
||||||
title: 'Status Bayar',
|
render: (item, data) => {
|
||||||
render: (item, data) => {
|
const status = data.status_bayar.replace(/_/g,
|
||||||
const status = data.status_bayar.replace(/_/g,
|
' ');
|
||||||
' ');
|
const statusClass = data.status_bayar === 'belum_bayar' ? 'text-red-600' :
|
||||||
const statusClass = data.status_bayar === 'belum_bayar' ? 'text-red-600' :
|
'text-green-600';
|
||||||
'text-green-600';
|
return `<span class="text-md font-bold ${statusClass} uppercase">
|
||||||
return `<span class="text-md font-bold ${statusClass} uppercase">
|
|
||||||
${status}
|
${status}
|
||||||
</span>`;
|
</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: {
|
actions: {
|
||||||
title: 'Status',
|
title: 'Status',
|
||||||
render: (item, data) => {
|
render: (item, data) => {
|
||||||
return `<div class="flex flex-nowrap justify-center">
|
const userRoles = @json(Auth::user()->getRoleNames());
|
||||||
<a class="btn btn-sm btn-icon btn-clear btn-warning " href="otorisator/show/${data.id}/${dataHeader}">
|
const isAdmin = userRoles.includes('administrator');
|
||||||
<i class="ki-outline ki-eye"></i>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a class="btn btn-sm btn-icon btn-clear btn-primary " onclick="otorisatorData(${data.id})">
|
let buttons = `
|
||||||
<i class="ki-filled ki-double-check"></i>
|
<div class="flex flex-nowrap justify-center">
|
||||||
</a>
|
<a class="btn btn-sm btn-icon btn-clear btn-warning" href="otorisator/show/${data.id}/${dataHeader}">
|
||||||
</div>`;
|
<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);
|
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||||
// Custom search functionality
|
// Custom search functionality
|
||||||
searchInput.addEventListener('input', function() {
|
searchInput.addEventListener('input', function () {
|
||||||
const searchValue = this.value.trim();
|
const searchValue = this.value.trim();
|
||||||
dataTable.search(searchValue, true);
|
dataTable.search(searchValue, true);
|
||||||
|
|
||||||
@@ -265,7 +324,7 @@
|
|||||||
error: (error) => {
|
error: (error) => {
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
||||||
'error');
|
'error');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,16 +14,16 @@
|
|||||||
@include('lpj::component.detail-jaminan', ['backLink' => 'otorisator.'. $dataHeader . '.index'])
|
@include('lpj::component.detail-jaminan', ['backLink' => 'otorisator.'. $dataHeader . '.index'])
|
||||||
|
|
||||||
@if($permohonan->approval_so)
|
@if($permohonan->approval_so)
|
||||||
<div class="card pb-2.5">
|
<div class="card pb-2.5">
|
||||||
<div class="card-header" id="basic_settings">
|
<div class="card-header" id="basic_settings">
|
||||||
<h3 class="card-title">
|
<h3 class="card-title">
|
||||||
Approval
|
Approval
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<table class="table table-border">
|
<table class="table table-border">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Diperiksa Oleh</td>
|
<td>Diperiksa Oleh</td>
|
||||||
<td>{{ getUser($permohonan->approval_so)->name ?? 'N/A' }}</td>
|
<td>{{ getUser($permohonan->approval_so)->name ?? 'N/A' }}</td>
|
||||||
@@ -39,17 +39,33 @@
|
|||||||
<td>{{ getUser($permohonan->approval_dd)->name ?? 'N/A' }}</td>
|
<td>{{ getUser($permohonan->approval_dd)->name ?? 'N/A' }}</td>
|
||||||
<td>{{ $permohonan->approval_dd_at ? formatTanggalIndonesia($permohonan->approval_dd_at,1) : 'N/A' }}</td>
|
<td>{{ $permohonan->approval_dd_at ? formatTanggalIndonesia($permohonan->approval_dd_at,1) : 'N/A' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
@endif
|
@endif
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
|
@if(Auth::user()->hasAnyRole(['administrator','senior-officer']) && $permohonan->approval_so==null)
|
||||||
<i class="ki-filled ki-double-check"></i>
|
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
|
||||||
Otorisator {{ $header ?? '' }}
|
<i class="ki-filled ki-double-check"></i>
|
||||||
</button>
|
Otorisator {{ $header ?? '' }}
|
||||||
|
</button>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(Auth::user()->hasAnyRole(['administrator','EO Appraisal']) && $permohonan->approval_so && $permohonan->approval_eo==null)
|
||||||
|
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
|
||||||
|
<i class="ki-filled ki-double-check"></i>
|
||||||
|
Otorisator {{ $header ?? '' }}
|
||||||
|
</button>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(Auth::user()->hasAnyRole(['administrator','DD Appraisal']) && $permohonan->approval_eo && $permohonan->approval_dd==null)
|
||||||
|
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
|
||||||
|
<i class="ki-filled ki-double-check"></i>
|
||||||
|
Otorisator {{ $header ?? '' }}
|
||||||
|
</button>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -57,7 +73,7 @@
|
|||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script>
|
<script>
|
||||||
function otorisatorData(dataId) {
|
function otorisatorData(dataId) {
|
||||||
const dataHeader = @json($header);
|
const dataHeader = @json($header);
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Apakah Anda yakin?',
|
title: 'Apakah Anda yakin?',
|
||||||
@@ -97,7 +113,7 @@
|
|||||||
error: (error) => {
|
error: (error) => {
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
||||||
'error');
|
'error');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user