fix(penilai/so): perbaikkan menu sla unfreeze
This commit is contained in:
@@ -570,7 +570,7 @@ class PenilaiController extends Controller
|
||||
});
|
||||
}
|
||||
|
||||
$query->whereRaw('LOWER(status) IN (?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?)', ['assign', 'survey-completed', 'proses-laporan', 'paparan', 'proses-paparan', 'paparan', 'revisi-laporan', 'revisi-paparan', 'request-freeze', 'freeze', 'reject-freeze']);
|
||||
$query->whereRaw('LOWER(status) IN (?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?)', ['assign', 'survey-completed', 'proses-laporan', 'paparan', 'proses-paparan', 'paparan', 'revisi-laporan', 'revisi-paparan', 'request-freeze', 'freeze', 'reject-freeze','unfreeze-sla']);
|
||||
|
||||
if (!Auth::user()->hasRole('administrator')) {
|
||||
$query->whereHas('penilaian.userPenilai', function ($q) {
|
||||
|
||||
@@ -450,7 +450,7 @@ class PenilaianController extends Controller
|
||||
|
||||
public function otorisatorUpdate(Request $request, $id, $context)
|
||||
{
|
||||
if ($context === 'Freze SLA') {
|
||||
if ($context === 'Freze SLA' || $context === 'Unfreeze SLA') {
|
||||
$authorization = Authorization::with(['user'])->find($id);
|
||||
if (!$authorization) {
|
||||
return response()->json([
|
||||
@@ -595,6 +595,14 @@ class PenilaianController extends Controller
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'unfreeze sla':
|
||||
$authorization->update([
|
||||
'request' => 'unfreeze-sla',
|
||||
]);
|
||||
$permohonan->update([
|
||||
'status' => 'unfreeze-sla',
|
||||
]);
|
||||
break;
|
||||
|
||||
default:
|
||||
return response()->json([
|
||||
@@ -891,7 +899,7 @@ class PenilaianController extends Controller
|
||||
|
||||
public function revisiLaporan(Request $request, $id)
|
||||
{
|
||||
// dd($request->all());
|
||||
// dd($id);
|
||||
if($request->dataHeader=='Paparan' || $request->dataHeader=='Freze SLA'){
|
||||
$authorization = Authorization::find($id);
|
||||
$permohonan = Permohonan::find($authorization->permohonan_id);
|
||||
@@ -906,7 +914,7 @@ class PenilaianController extends Controller
|
||||
}
|
||||
|
||||
$status = 'revisi-paparan';
|
||||
}else if($permohonan->status === 'freeze'){
|
||||
}else if($permohonan->status === 'request-freeze'){
|
||||
if ($authorization) {
|
||||
$authorization->delete();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class SLAController extends Controller
|
||||
// abort(403, 'Sorry! You are not allowed to view users.');
|
||||
}
|
||||
|
||||
$query = Authorization::query()->with('permohonan.debiture','user','approveSo','approveEo','approveDd')->where('jenis','sla');
|
||||
$query = Authorization::query()->with('permohonan.debiture', 'user', 'approveSo', 'approveEo', 'approveDd')->where('jenis', 'sla')->where('request', 'freeze');
|
||||
|
||||
// Pencarian berdasarkan parameter search
|
||||
if ($request->has('search') && !empty($request->get('search'))) {
|
||||
|
||||
@@ -165,13 +165,15 @@
|
||||
tujuan_penilaian_id: {
|
||||
title: 'Tujuan Penilaian',
|
||||
render: (item, data) => {
|
||||
return data.tujuan_penilaian && data.tujuan_penilaian.name ? `${data.tujuan_penilaian.name}` : '-';
|
||||
return data.tujuan_penilaian && data.tujuan_penilaian.name ?
|
||||
`${data.tujuan_penilaian.name}` : '-';
|
||||
},
|
||||
},
|
||||
jenis_fasilitas_kredit_id: {
|
||||
title: 'Fasilitas Kredit',
|
||||
render: (item, data) => {
|
||||
return data.jenisfasilitas_kredit && data.jenisfasilitas_kredit.name ? `${data.jenisfasilitas_kredit.name}` : '-';
|
||||
return data.jenisfasilitas_kredit && data.jenisfasilitas_kredit.name ?
|
||||
`${data.jenisfasilitas_kredit.name}` : '-';
|
||||
},
|
||||
},
|
||||
jenis_laporan: {
|
||||
@@ -232,7 +234,10 @@
|
||||
actions: {
|
||||
title: 'Action',
|
||||
render: (item, data) => {
|
||||
if (data.status === 'survey-completed' || data.status === 'proses-laporan' || data.status === 'paparan' || data.status === 'proses-paparan' || data.status === 'paparan' || data.status == 'revisi-laporan' || data.status === 'done' || data.status === 'revisi-paparan' || data.status === 'reject-freeze' || data.status === 'freeze' || data.status === 'request-freeze') {
|
||||
if (data.status === 'survey-completed' || data.status === 'proses-laporan' || data
|
||||
.status === 'paparan' || data.status === 'proses-paparan' || data.status ===
|
||||
'paparan' || data.status == 'revisi-laporan' || data.status === 'done' || data
|
||||
.status === 'revisi-paparan' || data.status === 'unfreeze-sla') {
|
||||
return `
|
||||
<div class="flex flex-nowrap justify-center gap-1.5">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-info" href="penilai/${data.id}/show">
|
||||
@@ -245,9 +250,17 @@
|
||||
<i class="ki-filled ki-arrow-circle-right"></i>
|
||||
</button>
|
||||
</div>`;
|
||||
} else {
|
||||
} else if (data.status === 'freeze' || data.status === 'request-freeze') {
|
||||
return `
|
||||
<div class="flex flex-nowrap justify-center">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-warning" onclick="showLoadingSwal('Masih dalam proses pengajuan freeze...')">
|
||||
<i class="ki-filled ki-watch"></i>
|
||||
</a>
|
||||
</div>`;
|
||||
} else
|
||||
{
|
||||
return `<div class="flex flex-nowrap justify-center">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-success" onclick="showLoadingSwal('Masih Menunggu proses inspeksi dari surveyor...')">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-success" onclick="showLoadingSwal('Masih Menunggu proses ...')">
|
||||
<i class="ki-filled ki-watch"></i>
|
||||
</a>
|
||||
</div>`
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@php
|
||||
if($header=="sla"){
|
||||
$header = "Freze SLA";
|
||||
if ($header == 'sla') {
|
||||
$header = 'Freze SLA';
|
||||
}
|
||||
@endphp
|
||||
|
||||
@@ -43,7 +43,8 @@
|
||||
{{ $surveyor->userPenilaiTeam->name }}
|
||||
</p>
|
||||
|
||||
<p class="flex w-full text-gray-600 font-medium text-sm">{{ checkRegionUserName($surveyor->userPenilaiTeam->id) }}
|
||||
<p class="flex w-full text-gray-600 font-medium text-sm">
|
||||
{{ checkRegionUserName($surveyor->userPenilaiTeam->id) }}
|
||||
</p>
|
||||
</div>
|
||||
<label class="form-label max-w-56">
|
||||
@@ -99,8 +100,8 @@
|
||||
</div>
|
||||
|
||||
@php
|
||||
if($header=="SLA"){
|
||||
$header = "Freze SLA";
|
||||
if ($header == 'SLA') {
|
||||
$header = 'Freze SLA';
|
||||
}
|
||||
@endphp
|
||||
|
||||
@@ -118,20 +119,23 @@
|
||||
<tr>
|
||||
<td>Diperiksa Oleh</td>
|
||||
<td>{{ getUser($authorization->approve_so)->name ?? 'N/A' }}</td>
|
||||
<td>{{ $authorization->approve_so_at ? formatTanggalIndonesia($authorization->approve_so_at,1) : 'N/A' }}</td>
|
||||
<td>{{ $authorization->approve_so_at ? formatTanggalIndonesia($authorization->approve_so_at, 1) : 'N/A' }}
|
||||
</td>
|
||||
</tr>
|
||||
@if ($authorization->approve_eo != null)
|
||||
<tr>
|
||||
<td>Disetujui Oleh (EO)</td>
|
||||
<td>{{ getUser($authorization->approve_eo)->name ?? 'N/A' }}</td>
|
||||
<td>{{ $authorization->approve_eo_at ? formatTanggalIndonesia($authorization->approve_eo_at,1) : 'N/A' }}</td>
|
||||
<td>{{ $authorization->approve_eo_at ? formatTanggalIndonesia($authorization->approve_eo_at, 1) : 'N/A' }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@if (in_array($authorization->nilai_eafond_id, [1, 4]) && $authorization->approve_dd != null)
|
||||
<tr>
|
||||
<td>Disetujui Oleh (DD)</td>
|
||||
<td>{{ getUser($authorization->approve_dd)->name ?? 'N/A' }}</td>
|
||||
<td>{{ $authorization->approve_dd_at ? formatTanggalIndonesia($authorization->approve_dd_at,1) : 'N/A' }}</td>
|
||||
<td>{{ $authorization->approve_dd_at ? formatTanggalIndonesia($authorization->approve_dd_at, 1) : 'N/A' }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
@@ -163,33 +167,51 @@
|
||||
@endif
|
||||
|
||||
@if (Auth::user()->hasAnyRole(['administrator', 'senior-officer']) && $authorization->approve_so == null)
|
||||
<button onclick="otorisatorData({{ $authorization->id }}, 'SO')" type="button" class="btn btn-primary">
|
||||
<button onclick="otorisatorData({{ $authorization->id }}, 'SO')" type="button"
|
||||
class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
Otorisasi {{ $header ?? '' }}
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@if(Auth::user()->hasAnyRole(['administrator','EO Appraisal']) && $authorization->approve_so && $authorization->approve_eo==null)
|
||||
<button onclick="otorisatorData({{ $authorization->id }}, 'EO')" type="button" class="btn btn-primary">
|
||||
@if (Auth::user()->hasAnyRole(['administrator', 'EO Appraisal']) &&
|
||||
$authorization->approve_so &&
|
||||
$authorization->approve_eo == null)
|
||||
<button onclick="otorisatorData({{ $authorization->id }}, 'EO')" type="button"
|
||||
class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
Otorisasi {{ $header ?? '' }}
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@if(Auth::user()->hasAnyRole(['administrator','DD Appraisal']) && $authorization->approve_eo && $authorization->approve_dd==null && in_array($permohonan->nilai_plafond_id,[1, 4]))
|
||||
<button onclick="otorisatorData({{ $authorization->id }}, 'DD')" type="button" class="btn btn-primary">
|
||||
@if (Auth::user()->hasAnyRole(['administrator', 'DD Appraisal']) &&
|
||||
$authorization->approve_eo &&
|
||||
$authorization->approve_dd == null &&
|
||||
in_array($permohonan->nilai_plafond_id, [1, 4]))
|
||||
<button onclick="otorisatorData({{ $authorization->id }}, 'DD')" type="button"
|
||||
class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
Otorisasi {{ $header ?? '' }}
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@if (
|
||||
(Auth::user()->hasAnyRole(['administrator', 'senior-officer']) &&
|
||||
$authorization->approve_so != null &&
|
||||
$authorization->approve_eo != null) ||
|
||||
$authorization->approve_dd != null)
|
||||
<button onclick="otorisatorData({{ $authorization->id }}, 'UNFREZE')" type="button"
|
||||
class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
Otorisasi Un{{ $header ?? '' }}
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
|
||||
|
||||
<script>
|
||||
const handleRejection = (dataId, dataHeader = '') => {
|
||||
Swal.fire({
|
||||
@@ -255,7 +277,6 @@
|
||||
data: data,
|
||||
success: () => {
|
||||
Swal.fire('Berhasil!', successMessage, 'success').then(() => {
|
||||
const dataHeader = @json($header);
|
||||
const redirectUrl = `/otorisator/sla`;
|
||||
window.location.href = redirectUrl;
|
||||
});
|
||||
@@ -268,19 +289,21 @@
|
||||
};
|
||||
|
||||
function otorisatorData(dataId, role = '') {
|
||||
const dataHeader = @json($header);
|
||||
const isPaparanSO = dataHeader === 'SLA' && role === 'SO';
|
||||
let dataHeader = @json($header);
|
||||
|
||||
// Update dataHeader if condition matches
|
||||
if (dataHeader === 'Freze SLA' && (role === 'UNFREZE' || role === 'FREZE')) {
|
||||
dataHeader = 'Unfreeze SLA';
|
||||
}
|
||||
|
||||
const isPaparanSO = dataHeader === 'Unfreeze SLA' && role === 'UNFREZE';
|
||||
const hideDenyButton = (dataHeader === 'Unfreeze SLA' && (role === 'UNFREZE' || role === 'FREZE'));
|
||||
|
||||
const swalHtml = isPaparanSO ? `
|
||||
<div class="text-left space-y-4">
|
||||
<p class="text-gray-700 text-center">Untuk melakukan otorisasi ${dataHeader}!</p>
|
||||
<div>
|
||||
<label for="swal-keterangan" class="block text-sm font-medium text-gray-700 mb-1">Keterangan</label>
|
||||
<input id="swal-keterangan" class="input" placeholder="Masukkan Keterangan">
|
||||
</div>
|
||||
<div>
|
||||
<label for="swal-tanggal-paparan" class="block text-sm font-medium text-gray-700 mb-1">Tanggal Paparan</label>
|
||||
<input id="swal-tanggal-paparan" class="input" type="date" placeholder="Tanggal paparan">
|
||||
<textarea id="swal-keterangan" class="textarea" placeholder="Masukkan Keterangan"></textarea>
|
||||
</div>
|
||||
</div>` : '';
|
||||
|
||||
@@ -289,21 +312,19 @@
|
||||
`Untuk melakukan otorisasi ${dataHeader}!`,
|
||||
swalHtml,
|
||||
'Ya, Lanjutkan!',
|
||||
'Tolak',
|
||||
hideDenyButton ? null : 'Tolak',
|
||||
'Batal',
|
||||
() => {
|
||||
if (isPaparanSO) {
|
||||
const message = document.getElementById('swal-keterangan')?.value;
|
||||
const tanggalPaparan = document.getElementById('swal-tanggal-paparan').value;
|
||||
|
||||
if (!message || !tanggalPaparan) {
|
||||
Swal.showValidationMessage('Keterangan dan Tanggal Paparan harus diisi!');
|
||||
if (!message) {
|
||||
Swal.showValidationMessage('Keterangan harus diisi!');
|
||||
return false;
|
||||
}
|
||||
|
||||
return {
|
||||
message,
|
||||
tanggalPaparan
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
@@ -316,7 +337,6 @@
|
||||
if (result.isConfirmed) {
|
||||
const requestData = isPaparanSO ? {
|
||||
keterangan: result.value.message,
|
||||
tanggalPaparan: result.value.tanggalPaparan
|
||||
} : {
|
||||
keterangan: result.value.message
|
||||
};
|
||||
@@ -327,7 +347,7 @@
|
||||
'Data berhasil diotorisasi.',
|
||||
'Terjadi kesalahan saat melakukan otorisasi.'
|
||||
);
|
||||
} else if (result.isDenied) {
|
||||
} else if (!hideDenyButton && result.isDenied) {
|
||||
handleRejection(dataId, dataHeader);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user