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')) {
|
if (!Auth::user()->hasRole('administrator')) {
|
||||||
$query->whereHas('penilaian.userPenilai', function ($q) {
|
$query->whereHas('penilaian.userPenilai', function ($q) {
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ class PenilaianController extends Controller
|
|||||||
|
|
||||||
public function otorisatorUpdate(Request $request, $id, $context)
|
public function otorisatorUpdate(Request $request, $id, $context)
|
||||||
{
|
{
|
||||||
if ($context === 'Freze SLA') {
|
if ($context === 'Freze SLA' || $context === 'Unfreeze SLA') {
|
||||||
$authorization = Authorization::with(['user'])->find($id);
|
$authorization = Authorization::with(['user'])->find($id);
|
||||||
if (!$authorization) {
|
if (!$authorization) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@@ -595,6 +595,14 @@ class PenilaianController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'unfreeze sla':
|
||||||
|
$authorization->update([
|
||||||
|
'request' => 'unfreeze-sla',
|
||||||
|
]);
|
||||||
|
$permohonan->update([
|
||||||
|
'status' => 'unfreeze-sla',
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@@ -891,7 +899,7 @@ class PenilaianController extends Controller
|
|||||||
|
|
||||||
public function revisiLaporan(Request $request, $id)
|
public function revisiLaporan(Request $request, $id)
|
||||||
{
|
{
|
||||||
// dd($request->all());
|
// dd($id);
|
||||||
if($request->dataHeader=='Paparan' || $request->dataHeader=='Freze SLA'){
|
if($request->dataHeader=='Paparan' || $request->dataHeader=='Freze SLA'){
|
||||||
$authorization = Authorization::find($id);
|
$authorization = Authorization::find($id);
|
||||||
$permohonan = Permohonan::find($authorization->permohonan_id);
|
$permohonan = Permohonan::find($authorization->permohonan_id);
|
||||||
@@ -906,7 +914,7 @@ class PenilaianController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$status = 'revisi-paparan';
|
$status = 'revisi-paparan';
|
||||||
}else if($permohonan->status === 'freeze'){
|
}else if($permohonan->status === 'request-freeze'){
|
||||||
if ($authorization) {
|
if ($authorization) {
|
||||||
$authorization->delete();
|
$authorization->delete();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class SLAController extends Controller
|
|||||||
// abort(403, 'Sorry! You are not allowed to view users.');
|
// 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
|
// Pencarian berdasarkan parameter search
|
||||||
if ($request->has('search') && !empty($request->get('search'))) {
|
if ($request->has('search') && !empty($request->get('search'))) {
|
||||||
|
|||||||
@@ -165,13 +165,15 @@
|
|||||||
tujuan_penilaian_id: {
|
tujuan_penilaian_id: {
|
||||||
title: 'Tujuan Penilaian',
|
title: 'Tujuan Penilaian',
|
||||||
render: (item, data) => {
|
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: {
|
jenis_fasilitas_kredit_id: {
|
||||||
title: 'Fasilitas Kredit',
|
title: 'Fasilitas Kredit',
|
||||||
render: (item, data) => {
|
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: {
|
jenis_laporan: {
|
||||||
@@ -183,7 +185,7 @@
|
|||||||
tanggal_survei: {
|
tanggal_survei: {
|
||||||
title: 'Tanggal Survei',
|
title: 'Tanggal Survei',
|
||||||
render: (item, data) => {
|
render: (item, data) => {
|
||||||
if(data.penilaian.waktu_penilaian){
|
if (data.penilaian.waktu_penilaian) {
|
||||||
return `${formatDate(new Date(data.penilaian.waktu_penilaian))}`;
|
return `${formatDate(new Date(data.penilaian.waktu_penilaian))}`;
|
||||||
}
|
}
|
||||||
return `${formatDate(new Date(data.penilaian.created_at))}`;
|
return `${formatDate(new Date(data.penilaian.created_at))}`;
|
||||||
@@ -196,19 +198,19 @@
|
|||||||
const tipe_laporan = data.penilai?.type;
|
const tipe_laporan = data.penilai?.type;
|
||||||
const nilai_plafond = data.penilaian.nilaiPlafond?.name;
|
const nilai_plafond = data.penilaian.nilaiPlafond?.name;
|
||||||
let waktu_penilaian = new Date(data.penilaian.created_at);
|
let waktu_penilaian = new Date(data.penilaian.created_at);
|
||||||
if(data.penilaian.waktu_penilaian){
|
if (data.penilaian.waktu_penilaian) {
|
||||||
waktu_penilaian = new Date(data.penilaian.waktu_penilaian);
|
waktu_penilaian = new Date(data.penilaian.waktu_penilaian);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tujuan_penilaian.name==="RAP"){
|
if (tujuan_penilaian.name === "RAP") {
|
||||||
waktu_penilaian.setDate(waktu_penilaian.getDate() + 3);
|
waktu_penilaian.setDate(waktu_penilaian.getDate() + 3);
|
||||||
} else {
|
} else {
|
||||||
if(tipe_laporan==="sederhana"){
|
if (tipe_laporan === "sederhana") {
|
||||||
waktu_penilaian.setDate(waktu_penilaian.getDate() + 2);
|
waktu_penilaian.setDate(waktu_penilaian.getDate() + 2);
|
||||||
} else if(tipe_laporan==="standar"){
|
} else if (tipe_laporan === "standar") {
|
||||||
if(nilai_plafond==="2 M - 5 M"){
|
if (nilai_plafond === "2 M - 5 M") {
|
||||||
waktu_penilaian.setDate(waktu_penilaian.getDate() + 3);
|
waktu_penilaian.setDate(waktu_penilaian.getDate() + 3);
|
||||||
} else if(nilai_plafond==="< 2M"){
|
} else if (nilai_plafond === "< 2M") {
|
||||||
waktu_penilaian.setDate(waktu_penilaian.getDate() + 3);
|
waktu_penilaian.setDate(waktu_penilaian.getDate() + 3);
|
||||||
} else {
|
} else {
|
||||||
waktu_penilaian.setDate(waktu_penilaian.getDate() + 5);
|
waktu_penilaian.setDate(waktu_penilaian.getDate() + 5);
|
||||||
@@ -232,7 +234,10 @@
|
|||||||
actions: {
|
actions: {
|
||||||
title: 'Action',
|
title: 'Action',
|
||||||
render: (item, data) => {
|
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 `
|
return `
|
||||||
<div class="flex flex-nowrap justify-center gap-1.5">
|
<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">
|
<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>
|
<i class="ki-filled ki-arrow-circle-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>`;
|
</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">
|
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>
|
<i class="ki-filled ki-watch"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>`
|
</div>`
|
||||||
@@ -268,56 +281,56 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function surveyorFreeze(permohonanId, noReg, debitur) {
|
function surveyorFreeze(permohonanId, noReg, debitur) {
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Apakah Anda yakin?',
|
title: 'Apakah Anda yakin?',
|
||||||
text: "Yakin akan Request Freeze dengan " + noReg + " untuk Debitur " + debitur +
|
text: "Yakin akan Request Freeze dengan " + noReg + " untuk Debitur " + debitur +
|
||||||
" ?",
|
" ?",
|
||||||
icon: 'warning',
|
icon: 'warning',
|
||||||
input: 'textarea',
|
input: 'textarea',
|
||||||
inputLabel: 'Keterangan',
|
inputLabel: 'Keterangan',
|
||||||
inputPlaceholder: 'Masukkan keterangan...',
|
inputPlaceholder: 'Masukkan keterangan...',
|
||||||
inputAttributes: {
|
inputAttributes: {
|
||||||
'aria-label': 'Masukkan keterangan'
|
'aria-label': 'Masukkan keterangan'
|
||||||
},
|
},
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: '#3085d6',
|
confirmButtonColor: '#3085d6',
|
||||||
cancelButtonColor: '#d33',
|
cancelButtonColor: '#d33',
|
||||||
confirmButtonText: 'Ya, Lanjutkan!',
|
confirmButtonText: 'Ya, Lanjutkan!',
|
||||||
cancelButtonText: 'Batal',
|
cancelButtonText: 'Batal',
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
const userMessage = result.value || ''; // Ambil pesan dari textarea
|
const userMessage = result.value || ''; // Ambil pesan dari textarea
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
headers: {
|
headers: {
|
||||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: `/surveyor/storeFreeze/${permohonanId}`,
|
url: `/surveyor/storeFreeze/${permohonanId}`,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: {
|
data: {
|
||||||
keterangan: userMessage
|
keterangan: userMessage
|
||||||
},
|
},
|
||||||
success: (response) => {
|
success: (response) => {
|
||||||
Swal.fire('Berhasil!',
|
Swal.fire('Berhasil!',
|
||||||
response.message,
|
response.message,
|
||||||
'success').then(() => {
|
'success').then(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan Freeze.',
|
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan Freeze.',
|
||||||
'error');
|
'error');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showLoadingSwal(message, duration = 5000) {
|
function showLoadingSwal(message, duration = 5000) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
@extends('layouts.main')
|
@extends('layouts.main')
|
||||||
|
|
||||||
@php
|
@php
|
||||||
if($header=="sla"){
|
if ($header == 'sla') {
|
||||||
$header = "Freze SLA";
|
$header = 'Freze SLA';
|
||||||
}
|
}
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@@ -20,55 +20,56 @@
|
|||||||
@include('lpj::component.detail-jaminan', ['backLink' => 'otorisator.' . $dataHeader . '.index'])
|
@include('lpj::component.detail-jaminan', ['backLink' => 'otorisator.' . $dataHeader . '.index'])
|
||||||
|
|
||||||
@foreach ($permohonan->documents as $dokumen)
|
@foreach ($permohonan->documents as $dokumen)
|
||||||
<div class="card border border-agi-100 pb-2.5">
|
<div class="card border border-agi-100 pb-2.5">
|
||||||
<div class="card-header bg-agi-50" id="basic_settings">
|
<div class="card-header bg-agi-50" id="basic_settings">
|
||||||
<h3 class="card-title">
|
<h3 class="card-title">
|
||||||
Team
|
Team
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body grid gap-5">
|
<div class="card-body grid gap-5">
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
@php
|
@php
|
||||||
$surveyor = $permohonan->penilaian->userPenilai->where('role', 'surveyor')->first();
|
$surveyor = $permohonan->penilaian->userPenilai->where('role', 'surveyor')->first();
|
||||||
$penilai = $permohonan->penilaian->userPenilai->where('role', 'penilai')->first();
|
$penilai = $permohonan->penilaian->userPenilai->where('role', 'penilai')->first();
|
||||||
|
|
||||||
@endphp
|
@endphp
|
||||||
<label class="form-label max-w-56">
|
<label class="form-label max-w-56">
|
||||||
Surveyor
|
Surveyor
|
||||||
</label>
|
</label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
|
||||||
<p class="flex w-full text-gray-600 font-medium text-sm">
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
||||||
{{ $surveyor->userPenilaiTeam->name }}
|
{{ $surveyor->userPenilaiTeam->name }}
|
||||||
</p>
|
</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">
|
||||||
</p>
|
{{ checkRegionUserName($surveyor->userPenilaiTeam->id) }}
|
||||||
</div>
|
</p>
|
||||||
<label class="form-label max-w-56">
|
</div>
|
||||||
Penilai
|
<label class="form-label max-w-56">
|
||||||
</label>
|
Penilai
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
|
||||||
<p class="flex w-full text-gray-600 font-medium text-sm">
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
||||||
{{ $penilai->userPenilaiTeam->name }}
|
{{ $penilai->userPenilaiTeam->name }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="flex w-full text-gray-600 font-medium text-sm">
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
||||||
{{ checkRegionUserName($penilai->userPenilaiTeam->id) }}
|
{{ checkRegionUserName($penilai->userPenilaiTeam->id) }}
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@php
|
||||||
|
$inspeksiId = null;
|
||||||
|
foreach ($dokumen->inspeksi as $item) {
|
||||||
|
$inspeksiId = $item->id;
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
</div>
|
</div>
|
||||||
@php
|
@endforeach
|
||||||
$inspeksiId = null;
|
|
||||||
foreach ($dokumen->inspeksi as $item) {
|
|
||||||
$inspeksiId = $item->id;
|
|
||||||
}
|
|
||||||
@endphp
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
<div class="card border border-agi-100 pb-2.5">
|
<div class="card border border-agi-100 pb-2.5">
|
||||||
<div class="card-header bg-agi-50" id="basic_settings">
|
<div class="card-header bg-agi-50" id="basic_settings">
|
||||||
@@ -78,33 +79,33 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body grid gap-5">
|
<div class="card-body grid gap-5">
|
||||||
{{ $authorization->keterangan ?? ''}}
|
{{ $authorization->keterangan ?? '' }}
|
||||||
<table class="table table-border">
|
<table class="table table-border">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Pemohon</td>
|
<td>Pemohon</td>
|
||||||
<td>{{ $authorization->user->name }}</td>
|
<td>{{ $authorization->user->name }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Alasan</td>
|
<td>Alasan</td>
|
||||||
<td>{{ $authorization->keterangan }}</td>
|
<td>{{ $authorization->keterangan }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Tanggal Permohonan</td>
|
<td>Tanggal Permohonan</td>
|
||||||
<td>{{ formatTanggalIndonesia($authorization->created_at,1) }}</td>
|
<td>{{ formatTanggalIndonesia($authorization->created_at, 1) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@php
|
@php
|
||||||
if($header=="SLA"){
|
if ($header == 'SLA') {
|
||||||
$header = "Freze SLA";
|
$header = 'Freze SLA';
|
||||||
}
|
}
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@if($authorization->approve_so)
|
@if ($authorization->approve_so)
|
||||||
<div class="card border border-agi-100 pb-2.5">
|
<div class="card border border-agi-100 pb-2.5">
|
||||||
<div class="card-header bg-agi-50" id="basic_settings">
|
<div class="card-header bg-agi-50" id="basic_settings">
|
||||||
<h3 class="card-title">
|
<h3 class="card-title">
|
||||||
@@ -115,25 +116,28 @@
|
|||||||
<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($authorization->approve_so)->name ?? 'N/A' }}</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' }}
|
||||||
</tr>
|
</td>
|
||||||
@if($authorization->approve_eo!=null)
|
</tr>
|
||||||
<tr>
|
@if ($authorization->approve_eo != null)
|
||||||
<td>Disetujui Oleh (EO)</td>
|
<tr>
|
||||||
<td>{{ getUser($authorization->approve_eo)->name ?? 'N/A' }}</td>
|
<td>Disetujui Oleh (EO)</td>
|
||||||
<td>{{ $authorization->approve_eo_at ? formatTanggalIndonesia($authorization->approve_eo_at,1) : 'N/A' }}</td>
|
<td>{{ getUser($authorization->approve_eo)->name ?? 'N/A' }}</td>
|
||||||
</tr>
|
<td>{{ $authorization->approve_eo_at ? formatTanggalIndonesia($authorization->approve_eo_at, 1) : 'N/A' }}
|
||||||
@endif
|
</td>
|
||||||
@if(in_array($authorization->nilai_eafond_id,[1,4]) && $authorization->approve_dd!=null)
|
</tr>
|
||||||
<tr>
|
@endif
|
||||||
<td>Disetujui Oleh (DD)</td>
|
@if (in_array($authorization->nilai_eafond_id, [1, 4]) && $authorization->approve_dd != null)
|
||||||
<td>{{ getUser($authorization->approve_dd)->name ?? 'N/A' }}</td>
|
<tr>
|
||||||
<td>{{ $authorization->approve_dd_at ? formatTanggalIndonesia($authorization->approve_dd_at,1) : 'N/A' }}</td>
|
<td>Disetujui Oleh (DD)</td>
|
||||||
</tr>
|
<td>{{ getUser($authorization->approve_dd)->name ?? 'N/A' }}</td>
|
||||||
@endif
|
<td>{{ $authorization->approve_dd_at ? formatTanggalIndonesia($authorization->approve_dd_at, 1) : 'N/A' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -141,196 +145,212 @@
|
|||||||
@endif
|
@endif
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<div class="flex gap-2.5">
|
<div class="flex gap-2.5">
|
||||||
@php
|
@php
|
||||||
$inspeksiId = null;
|
$inspeksiId = null;
|
||||||
$documentId = null;
|
$documentId = null;
|
||||||
$jenisJaminanId = null;
|
$jenisJaminanId = null;
|
||||||
foreach ($permohonan->documents as $item) {
|
foreach ($permohonan->documents as $item) {
|
||||||
foreach ($item->inspeksi as $key => $value) {
|
foreach ($item->inspeksi as $key => $value) {
|
||||||
$inspeksiId = $item->id;
|
$inspeksiId = $item->id;
|
||||||
|
}
|
||||||
|
$documentId = $item->id;
|
||||||
|
$jenisJaminanId = $item->jenis_jaminan_id;
|
||||||
}
|
}
|
||||||
$documentId = $item->id;
|
@endphp
|
||||||
$jenisJaminanId = $item->jenis_jaminan_id;
|
|
||||||
}
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if ($dataHeader == 'pelaporan')
|
@if ($dataHeader == 'pelaporan')
|
||||||
<a class="btn btn-success"
|
<a class="btn btn-success"
|
||||||
href="{{ route('otorisator.view-laporan') }}?permohonanId={{ $permohonan->id }}&documentId={{ $documentId }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $jenisJaminanId }}&statusLpj={{true}}">
|
href="{{ route('otorisator.view-laporan') }}?permohonanId={{ $permohonan->id }}&documentId={{ $documentId }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $jenisJaminanId }}&statusLpj={{ true }}">
|
||||||
Lihat Laporan
|
Lihat Laporan
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if(Auth::user()->hasAnyRole(['administrator','senior-officer']) && $authorization->approve_so==null)
|
@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"
|
||||||
<i class="ki-filled ki-double-check"></i>
|
class="btn btn-primary">
|
||||||
Otorisasi {{ $header ?? '' }}
|
<i class="ki-filled ki-double-check"></i>
|
||||||
</button>
|
Otorisasi {{ $header ?? '' }}
|
||||||
@endif
|
</button>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if(Auth::user()->hasAnyRole(['administrator','EO Appraisal']) && $authorization->approve_so && $authorization->approve_eo==null)
|
@if (Auth::user()->hasAnyRole(['administrator', 'EO Appraisal']) &&
|
||||||
<button onclick="otorisatorData({{ $authorization->id }}, 'EO')" type="button" class="btn btn-primary">
|
$authorization->approve_so &&
|
||||||
<i class="ki-filled ki-double-check"></i>
|
$authorization->approve_eo == null)
|
||||||
Otorisasi {{ $header ?? '' }}
|
<button onclick="otorisatorData({{ $authorization->id }}, 'EO')" type="button"
|
||||||
</button>
|
class="btn btn-primary">
|
||||||
@endif
|
<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]))
|
@if (Auth::user()->hasAnyRole(['administrator', 'DD Appraisal']) &&
|
||||||
<button onclick="otorisatorData({{ $authorization->id }}, 'DD')" type="button" class="btn btn-primary">
|
$authorization->approve_eo &&
|
||||||
<i class="ki-filled ki-double-check"></i>
|
$authorization->approve_dd == null &&
|
||||||
Otorisasi {{ $header ?? '' }}
|
in_array($permohonan->nilai_plafond_id, [1, 4]))
|
||||||
</button>
|
<button onclick="otorisatorData({{ $authorization->id }}, 'DD')" type="button"
|
||||||
@endif
|
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>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
@endsection
|
||||||
@endsection
|
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
const handleRejection = (dataId, dataHeader = '') => {
|
||||||
<script>
|
Swal.fire({
|
||||||
const handleRejection = (dataId,dataHeader='') => {
|
title: 'Masukkan alasan penolakan:',
|
||||||
Swal.fire({
|
input: 'textarea',
|
||||||
title: 'Masukkan alasan penolakan:',
|
inputPlaceholder: 'Tuliskan alasan...',
|
||||||
input: 'textarea',
|
showCancelButton: true,
|
||||||
inputPlaceholder: 'Tuliskan alasan...',
|
confirmButtonColor: '#f39c12',
|
||||||
showCancelButton: true,
|
cancelButtonColor: '#d33',
|
||||||
confirmButtonColor: '#f39c12',
|
confirmButtonText: 'Kirim',
|
||||||
cancelButtonColor: '#d33',
|
cancelButtonText: 'Batal',
|
||||||
confirmButtonText: 'Kirim',
|
preConfirm: (alasan) => {
|
||||||
cancelButtonText: 'Batal',
|
if (!alasan) {
|
||||||
preConfirm: (alasan) => {
|
Swal.showValidationMessage('Alasan harus diisi!');
|
||||||
if (!alasan) {
|
return false;
|
||||||
Swal.showValidationMessage('Alasan harus diisi!');
|
}
|
||||||
return false;
|
return alasan;
|
||||||
}
|
|
||||||
return alasan;
|
|
||||||
}
|
|
||||||
}).then((rejectResult) => {
|
|
||||||
if (rejectResult.isConfirmed) {
|
|
||||||
handleAjaxRequest(
|
|
||||||
`/otorisator/revisi-laporan/${dataId}`, {
|
|
||||||
keterangan: rejectResult.value,
|
|
||||||
dataHeader: dataHeader
|
|
||||||
},
|
|
||||||
'Data berhasil ditolak.',
|
|
||||||
'Terjadi kesalahan saat melakukan penolakan.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const showSwalConfirmation = (
|
|
||||||
title, text, html, confirmText, denyText, cancelText, preConfirm, icon = 'question'
|
|
||||||
) => {
|
|
||||||
return Swal.fire({
|
|
||||||
title: title,
|
|
||||||
text: text,
|
|
||||||
html: html,
|
|
||||||
icon: icon,
|
|
||||||
focusConfirm: false,
|
|
||||||
preConfirm: preConfirm,
|
|
||||||
showCancelButton: true,
|
|
||||||
showDenyButton: !!denyText,
|
|
||||||
confirmButtonColor: '#3085d6',
|
|
||||||
cancelButtonColor: '#d33',
|
|
||||||
denyButtonColor: '#f39c12',
|
|
||||||
confirmButtonText: confirmText,
|
|
||||||
denyButtonText: denyText,
|
|
||||||
cancelButtonText: cancelText,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleAjaxRequest = (url, data, successMessage, errorMessage) => {
|
|
||||||
$.ajaxSetup({
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
||||||
},
|
|
||||||
});
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: 'POST',
|
|
||||||
data: data,
|
|
||||||
success: () => {
|
|
||||||
Swal.fire('Berhasil!', successMessage, 'success').then(() => {
|
|
||||||
const dataHeader = @json($header);
|
|
||||||
const redirectUrl = `/otorisator/sla`;
|
|
||||||
window.location.href = redirectUrl;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error: (error) => {
|
|
||||||
console.error('Error:', error);
|
|
||||||
Swal.fire('Gagal!', errorMessage, 'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
function otorisatorData(dataId, role = '') {
|
|
||||||
const dataHeader = @json($header);
|
|
||||||
const isPaparanSO = dataHeader === 'SLA' && role === 'SO';
|
|
||||||
|
|
||||||
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">
|
|
||||||
</div>
|
|
||||||
</div>` : '';
|
|
||||||
|
|
||||||
showSwalConfirmation(
|
|
||||||
'Apakah Anda yakin?',
|
|
||||||
`Untuk melakukan otorisasi ${dataHeader}!`,
|
|
||||||
swalHtml,
|
|
||||||
'Ya, Lanjutkan!',
|
|
||||||
'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!');
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
}).then((rejectResult) => {
|
||||||
|
if (rejectResult.isConfirmed) {
|
||||||
|
handleAjaxRequest(
|
||||||
|
`/otorisator/revisi-laporan/${dataId}`, {
|
||||||
|
keterangan: rejectResult.value,
|
||||||
|
dataHeader: dataHeader
|
||||||
|
},
|
||||||
|
'Data berhasil ditolak.',
|
||||||
|
'Terjadi kesalahan saat melakukan penolakan.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
const showSwalConfirmation = (
|
||||||
message,
|
title, text, html, confirmText, denyText, cancelText, preConfirm, icon = 'question'
|
||||||
tanggalPaparan
|
) => {
|
||||||
};
|
return Swal.fire({
|
||||||
} else {
|
title: title,
|
||||||
return {
|
text: text,
|
||||||
message: 'Ya, lanjutkan.'
|
html: html,
|
||||||
};
|
icon: icon,
|
||||||
|
focusConfirm: false,
|
||||||
|
preConfirm: preConfirm,
|
||||||
|
showCancelButton: true,
|
||||||
|
showDenyButton: !!denyText,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
denyButtonColor: '#f39c12',
|
||||||
|
confirmButtonText: confirmText,
|
||||||
|
denyButtonText: denyText,
|
||||||
|
cancelButtonText: cancelText,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAjaxRequest = (url, data, successMessage, errorMessage) => {
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
|
},
|
||||||
|
});
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: 'POST',
|
||||||
|
data: data,
|
||||||
|
success: () => {
|
||||||
|
Swal.fire('Berhasil!', successMessage, 'success').then(() => {
|
||||||
|
const redirectUrl = `/otorisator/sla`;
|
||||||
|
window.location.href = redirectUrl;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
Swal.fire('Gagal!', errorMessage, 'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function otorisatorData(dataId, role = '') {
|
||||||
|
let dataHeader = @json($header);
|
||||||
|
|
||||||
|
// Update dataHeader if condition matches
|
||||||
|
if (dataHeader === 'Freze SLA' && (role === 'UNFREZE' || role === 'FREZE')) {
|
||||||
|
dataHeader = 'Unfreeze SLA';
|
||||||
}
|
}
|
||||||
},
|
|
||||||
'question'
|
|
||||||
).then((result) => {
|
|
||||||
if (result.isConfirmed) {
|
|
||||||
const requestData = isPaparanSO ? {
|
|
||||||
keterangan: result.value.message,
|
|
||||||
tanggalPaparan: result.value.tanggalPaparan
|
|
||||||
} : {
|
|
||||||
keterangan: result.value.message
|
|
||||||
};
|
|
||||||
|
|
||||||
handleAjaxRequest(
|
const isPaparanSO = dataHeader === 'Unfreeze SLA' && role === 'UNFREZE';
|
||||||
`/otorisator/otorisator/${dataId}/${dataHeader}`,
|
const hideDenyButton = (dataHeader === 'Unfreeze SLA' && (role === 'UNFREZE' || role === 'FREZE'));
|
||||||
requestData,
|
|
||||||
'Data berhasil diotorisasi.',
|
const swalHtml = isPaparanSO ? `
|
||||||
'Terjadi kesalahan saat melakukan otorisasi.'
|
<div class="text-left space-y-4">
|
||||||
);
|
<p class="text-gray-700 text-center">Untuk melakukan otorisasi ${dataHeader}!</p>
|
||||||
} else if (result.isDenied) {
|
<div>
|
||||||
handleRejection(dataId,dataHeader);
|
<textarea id="swal-keterangan" class="textarea" placeholder="Masukkan Keterangan"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>` : '';
|
||||||
|
|
||||||
|
showSwalConfirmation(
|
||||||
|
'Apakah Anda yakin?',
|
||||||
|
`Untuk melakukan otorisasi ${dataHeader}!`,
|
||||||
|
swalHtml,
|
||||||
|
'Ya, Lanjutkan!',
|
||||||
|
hideDenyButton ? null : 'Tolak',
|
||||||
|
'Batal',
|
||||||
|
() => {
|
||||||
|
if (isPaparanSO) {
|
||||||
|
const message = document.getElementById('swal-keterangan')?.value;
|
||||||
|
|
||||||
|
if (!message) {
|
||||||
|
Swal.showValidationMessage('Keterangan harus diisi!');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
message,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
message: 'Ya, lanjutkan.'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'question'
|
||||||
|
).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
const requestData = isPaparanSO ? {
|
||||||
|
keterangan: result.value.message,
|
||||||
|
} : {
|
||||||
|
keterangan: result.value.message
|
||||||
|
};
|
||||||
|
|
||||||
|
handleAjaxRequest(
|
||||||
|
`/otorisator/otorisator/${dataId}/${dataHeader}`,
|
||||||
|
requestData,
|
||||||
|
'Data berhasil diotorisasi.',
|
||||||
|
'Terjadi kesalahan saat melakukan otorisasi.'
|
||||||
|
);
|
||||||
|
} else if (!hideDenyButton && result.isDenied) {
|
||||||
|
handleRejection(dataId, dataHeader);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
</script>
|
||||||
}
|
@endpush
|
||||||
</script>
|
|
||||||
@endpush
|
|
||||||
|
|||||||
Reference in New Issue
Block a user