fix(so/penilai) : perbaikkan paparan dan resume
This commit is contained in:
@@ -95,7 +95,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@if (in_array($permohonan->nilai_plafond_id, [1,2, 4]) && $permohonan->approval_dd != null)
|
||||
@if (in_array($permohonan->nilai_plafond_id, [1, 2, 4]) && $permohonan->approval_dd != null)
|
||||
<tr>
|
||||
<td>Disetujui Oleh (DD)</td>
|
||||
<td>{{ getUser($permohonan->approval_dd)->name ?? 'N/A' }}</td>
|
||||
@@ -157,38 +157,46 @@
|
||||
Otorisator {{ $header ?? '' }}
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@elseif($dataHeader == 'paparan')
|
||||
@if($permohonan->penilai->file_paparan)
|
||||
@if ($permohonan->penilai->file_paparan)
|
||||
<span class="btn btn-success btn-outline"
|
||||
onclick="viewPDF('{{ Storage::url($permohonan->penilai->file_paparan) }}')"><i
|
||||
onclick="viewPDF('{{ Storage::url($permohonan->penilai->file_paparan) }}')"><i
|
||||
class="ki-filled ki-eye mr-2"></i>Lihat Data Paparan</span>
|
||||
@endif
|
||||
|
||||
@if($permohonan->penilai->kertas_kerja)
|
||||
@if ($permohonan->penilai->kertas_kerja)
|
||||
<span class="btn btn-warning btn-outline"
|
||||
onclick="viewPDF('{{ Storage::url($permohonan->penilai->kertas_kerja) }}')"><i
|
||||
onclick="viewPDF('{{ Storage::url($permohonan->penilai->kertas_kerja) }}')"><i
|
||||
class="ki-filled ki-eye mr-2"></i>Lihat Kertas Kerja</span>
|
||||
@endif
|
||||
|
||||
|
||||
<a class="btn btn-success"
|
||||
href="{{ route('otorisator.view-laporan') }}?permohonanId={{ $permohonan->id }}&documentId={{ $documentId }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $jenisJaminanId }}&statusLpj={{ true }}">
|
||||
Lihat Laporan
|
||||
Lihat resume
|
||||
</a>
|
||||
|
||||
|
||||
@if(Auth::user()->hasAnyRole(['administrator','senior-officer']) && $authorization->approve_so==null)
|
||||
<button onclick="otorisatorData({{ $authorization->id }},'SO')" type="button" class="btn btn-primary">
|
||||
@if (Auth::user()->hasAnyRole(['administrator', 'senior-officer']) && $authorization->approve_so == null)
|
||||
<button onclick="otorisatorData({{ $authorization->id }},'SO')" 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']) &&
|
||||
$authorization->approve_so &&
|
||||
$authorization->approve_dd == null)
|
||||
<button onclick="otorisatorData({{ $authorization->id }},'DD')" type="button" class="btn btn-primary">
|
||||
@if (Auth::user()->hasAnyRole(['administrator', 'EO Appraisal']) &&
|
||||
$authorization->approve_eo == null)
|
||||
<button onclick="otorisatorData({{ $authorization->id }},'EO')" 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']) && $authorization->approve_dd == null)
|
||||
<button onclick="otorisatorData({{ $authorization->id }},'DD')" type="button"
|
||||
class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
Otorisator {{ $header ?? '' }}
|
||||
</button>
|
||||
@@ -201,116 +209,192 @@
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
function otorisatorData(dataId, role='') {
|
||||
function otorisatorData(dataId, role = '') {
|
||||
const dataHeader = @json($header);
|
||||
if(dataHeader == 'Paparan'){
|
||||
if(role == 'SO'){
|
||||
if (dataHeader == 'Paparan') {
|
||||
const showSwalConfirmation = (title, text, html, confirmText, denyText, cancelText, preConfirm) => {
|
||||
return Swal.fire({
|
||||
title: title,
|
||||
text: text,
|
||||
html: html,
|
||||
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: (response) => {
|
||||
Swal.fire('Berhasil!', successMessage, 'success').then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
console.log(response);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Gagal!', errorMessage, 'error');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleRejection = (dataId) => {
|
||||
Swal.fire({
|
||||
title: 'Apakah Anda yakin?',
|
||||
text: `Untuk melakukan otorisator ${dataHeader}!`,
|
||||
icon: 'warning',
|
||||
html: `
|
||||
<input id="swal-keterangan" class="swal2-input input" placeholder="Keterangan">
|
||||
<input id="swal-tanggal-paparan" class="swal2-input input" type="date" placeholder="Tanggal paparan">
|
||||
`,
|
||||
focusConfirm: false,
|
||||
preConfirm: () => {
|
||||
title: 'Masukkan alasan penolakan:',
|
||||
input: 'textarea',
|
||||
inputPlaceholder: 'Tuliskan alasan...',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#f39c12',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Kirim',
|
||||
cancelButtonText: 'Batal',
|
||||
preConfirm: (alasan) => {
|
||||
if (!alasan) {
|
||||
Swal.showValidationMessage('Alasan harus diisi!');
|
||||
return false;
|
||||
}
|
||||
return alasan;
|
||||
}
|
||||
}).then((rejectResult) => {
|
||||
if (rejectResult.isConfirmed) {
|
||||
handleAjaxRequest(
|
||||
`/otorisator/revisi/${dataId}`, {
|
||||
message: rejectResult.value
|
||||
},
|
||||
'Data berhasil ditolak.',
|
||||
'Terjadi kesalahan saat melakukan penolakan.'
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Main logic based on role
|
||||
if (role === 'SO') {
|
||||
showSwalConfirmation(
|
||||
'Apakah Anda yakin?',
|
||||
`Untuk melakukan otorisator ${dataHeader}!`,
|
||||
`
|
||||
<div class="text-left space-y-4">
|
||||
<p class="text-gray-700 text-center">Untuk melakukan otorisator ${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>
|
||||
`,
|
||||
'Ya, Lanjutkan!', 'Rejected', 'Batal',
|
||||
() => {
|
||||
const keterangan = document.getElementById('swal-keterangan').value;
|
||||
const tanggalPaparan = document.getElementById('swal-tanggal-paparan').value;
|
||||
|
||||
if (!keterangan || !tanggalPaparan) {
|
||||
Swal.showValidationMessage('Keterangan atau Tanggal Paparan Harus diisi!');
|
||||
return false;
|
||||
}
|
||||
|
||||
return { keterangan, tanggalPaparan };
|
||||
},
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Ya, Lanjutkan!',
|
||||
cancelButtonText: 'Batal',
|
||||
}).then((result) => {
|
||||
return {
|
||||
keterangan,
|
||||
tanggalPaparan
|
||||
};
|
||||
}
|
||||
).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
const keterangan = result.value.keterangan || '';
|
||||
const tanggalPaparan = result.value.tanggalPaparan || '';
|
||||
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
handleAjaxRequest(
|
||||
`/otorisator/otorisator/${dataId}/${dataHeader}`, {
|
||||
message: result.value.keterangan,
|
||||
tanggalPaparan: result.value.tanggalPaparan
|
||||
},
|
||||
});
|
||||
$.ajax({
|
||||
url: `/otorisator/otorisator/${dataId}/${dataHeader}`,
|
||||
type: 'POST',
|
||||
data: {
|
||||
message: keterangan,
|
||||
tanggalPaparan: tanggalPaparan
|
||||
},
|
||||
success: (response) => {
|
||||
Swal.fire('Berhasil!',
|
||||
'Data berhasil diotorisasi.',
|
||||
'success').then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
console.log(response);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
||||
'error');
|
||||
}
|
||||
});
|
||||
'Data berhasil diotorisasi.',
|
||||
'Terjadi kesalahan saat melakukan otorisator.'
|
||||
);
|
||||
} else if (result.isDenied) {
|
||||
handleRejection(dataId);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
Swal.fire({
|
||||
title: 'Apakah Yakin?',
|
||||
text: `Pastikan bahwa paparan sudah dilakukan!`,
|
||||
icon: 'warning',
|
||||
input: 'textarea',
|
||||
inputLabel: 'Keterangan',
|
||||
inputPlaceholder: 'Masukkan keterangan...',
|
||||
inputAttributes: {
|
||||
'aria-label': 'Masukkan keterangan'
|
||||
},
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Ya, Lanjutkan!',
|
||||
cancelButtonText: 'Batal',
|
||||
}).then((result) => {
|
||||
} else if (role === 'EO') {
|
||||
showSwalConfirmation(
|
||||
'Apakah Yakin?',
|
||||
'Anda akan menyetujui data ini?',
|
||||
`
|
||||
<p class="text-gray-700 text-center">Anda akan menyetujui data ini?</p>
|
||||
<textarea id="swal-keterangan" class="block w-full px-4 py-2 border border-gray-300 rounded-lg shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm" placeholder="Masukkan keterangan..."></textarea>
|
||||
`,
|
||||
'Ya, Lanjutkan!', 'Rejected', 'Batal',
|
||||
() => {
|
||||
const keterangan = document.getElementById('swal-keterangan').value;
|
||||
if (!keterangan) {
|
||||
Swal.showValidationMessage('Keterangan harus diisi!');
|
||||
return false;
|
||||
}
|
||||
return {
|
||||
keterangan
|
||||
};
|
||||
}
|
||||
).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
const userMessage = result.value || ''; // Ambil pesan dari textarea
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
handleAjaxRequest(
|
||||
`/otorisator/otorisator/${dataId}/${dataHeader}`, {
|
||||
message: result.value.keterangan
|
||||
},
|
||||
});
|
||||
$.ajax({
|
||||
url: `/otorisator/otorisator/${dataId}/${dataHeader}`,
|
||||
type: 'POST',
|
||||
data: {
|
||||
message: userMessage
|
||||
'Data berhasil diotorisasi.',
|
||||
'Terjadi kesalahan saat melakukan otorisator.'
|
||||
);
|
||||
} else if (result.isDenied) {
|
||||
handleRejection(dataId);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showSwalConfirmation(
|
||||
'Apakah Yakin?',
|
||||
'Pastikan bahwa paparan sudah dilakukan!',
|
||||
`
|
||||
<p class="text-gray-700 text-center">Pastikan bahwa paparan sudah dilakukan!</p>
|
||||
<textarea id="swal-keterangan" class="block w-full px-4 py-2 border border-gray-300 rounded-lg shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm" placeholder="Masukkan keterangan..."></textarea>
|
||||
`,
|
||||
'Ya, Lanjutkan!', 'Rejected', 'Batal',
|
||||
() => {
|
||||
const keterangan = document.getElementById('swal-keterangan').value;
|
||||
if (!keterangan) {
|
||||
Swal.showValidationMessage('Keterangan harus diisi!');
|
||||
return false;
|
||||
}
|
||||
return {
|
||||
keterangan
|
||||
};
|
||||
}
|
||||
).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
handleAjaxRequest(
|
||||
`/otorisator/otorisator/${dataId}/${dataHeader}`, {
|
||||
message: result.value.keterangan
|
||||
},
|
||||
success: (response) => {
|
||||
Swal.fire('Berhasil!',
|
||||
'Data berhasil diotorisasi',
|
||||
'success').then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
console.log(response);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
||||
'error');
|
||||
}
|
||||
});
|
||||
'Data berhasil diotorisasi.',
|
||||
'Terjadi kesalahan saat melakukan otorisator.'
|
||||
);
|
||||
} else if (result.isDenied) {
|
||||
handleRejection(dataId);
|
||||
}
|
||||
});
|
||||
}
|
||||
}else{
|
||||
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Apakah Anda yakin?',
|
||||
text: `Untuk melakukan otorisator ${dataHeader}!`,
|
||||
@@ -393,10 +477,10 @@
|
||||
},
|
||||
success: (response) => {
|
||||
Swal.fire('Berhasil!', 'Data berhasil Revisi Laporan', 'success').then(
|
||||
() => {
|
||||
window.location.href =
|
||||
'{{ route('otorisator.pelaporan.index') }}';
|
||||
});
|
||||
() => {
|
||||
window.location.href =
|
||||
'{{ route('otorisator.pelaporan.index') }}';
|
||||
});
|
||||
console.log(response);
|
||||
},
|
||||
error: (error) => {
|
||||
|
||||
@@ -82,6 +82,10 @@
|
||||
<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>
|
||||
@@ -251,6 +255,15 @@
|
||||
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) => {
|
||||
|
||||
Reference in New Issue
Block a user