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();
|
||||
|
||||
// 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
|
||||
|
||||
@@ -193,4 +193,16 @@
|
||||
public function approveBayar(){
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,12 +61,25 @@
|
||||
<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="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>
|
||||
@@ -182,7 +195,6 @@
|
||||
return `${data.tujuan_penilaian.name}`;
|
||||
},
|
||||
},
|
||||
...(dataHeader === 'Pembayaran' && {
|
||||
status_bayar: {
|
||||
title: 'Status Bayar',
|
||||
render: (item, data) => {
|
||||
@@ -195,21 +207,68 @@
|
||||
</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">
|
||||
const userRoles = @json(Auth::user()->getRoleNames());
|
||||
const isAdmin = userRoles.includes('administrator');
|
||||
|
||||
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>
|
||||
</div>`;
|
||||
`;
|
||||
} 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;
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
@@ -46,10 +46,26 @@
|
||||
@endif
|
||||
<div>
|
||||
<div>
|
||||
@if(Auth::user()->hasAnyRole(['administrator','senior-officer']) && $permohonan->approval_so==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','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>
|
||||
|
||||
Reference in New Issue
Block a user