fix(penilai): perbaikkan keterangan freeze dan ubah name kjjp ke kjpp, handle key foto memo
This commit is contained in:
@@ -183,7 +183,7 @@
|
||||
return `${data.permohonan.debiture.name}`;
|
||||
},
|
||||
},
|
||||
alasan: {
|
||||
keterangan: {
|
||||
title: 'Alasan',
|
||||
},
|
||||
request: {
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
</div>
|
||||
|
||||
<div class="card-body grid gap-5">
|
||||
{{ $authorization->alasan ?? ''}}
|
||||
{{ $authorization->keterangan ?? ''}}
|
||||
<table class="table table-border">
|
||||
<tbody>
|
||||
<tr>
|
||||
@@ -87,7 +87,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Alasan</td>
|
||||
<td>{{ $authorization->alasan }}</td>
|
||||
<td>{{ $authorization->keterangan }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Tanggal Permohonan</td>
|
||||
@@ -163,21 +163,21 @@
|
||||
@endif
|
||||
|
||||
@if(Auth::user()->hasAnyRole(['administrator','senior-officer']) && $authorization->approve_so==null)
|
||||
<button onclick="otorisatorData({{ $authorization->id }})" 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 }})" type="button" class="btn btn-primary">
|
||||
<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 }})" 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>
|
||||
@@ -188,52 +188,149 @@
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
function otorisatorData(dataId) {
|
||||
const dataHeader = @json($header);
|
||||
Swal.fire({
|
||||
title: 'Apakah Anda yakin?',
|
||||
text: `Untuk melakukan otorisator ${dataHeader}!`,
|
||||
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) => {
|
||||
if (result.isConfirmed) {
|
||||
const userMessage = result.value || ''; // Ambil pesan dari textarea
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
});
|
||||
$.ajax({
|
||||
url: `/otorisator/otorisator/${dataId}/SLA`,
|
||||
type: 'POST',
|
||||
data: {
|
||||
message: userMessage
|
||||
},
|
||||
success: (response) => {
|
||||
Swal.fire('Berhasil!', 'Data berhasil diotorisasi. Menunggu Approval EO dan atau DD', 'success').then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
console.log(response);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
||||
'error');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
<script>
|
||||
const handleRejection = (dataId,dataHeader='') => {
|
||||
Swal.fire({
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
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;
|
||||
}
|
||||
|
||||
return {
|
||||
message,
|
||||
tanggalPaparan
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
message: 'Ya, lanjutkan.'
|
||||
};
|
||||
}
|
||||
},
|
||||
'question'
|
||||
).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
const requestData = isPaparanSO ? {
|
||||
keterangan: result.value.message,
|
||||
tanggalPaparan: result.value.tanggalPaparan
|
||||
} : {
|
||||
keterangan: result.value.message
|
||||
};
|
||||
|
||||
handleAjaxRequest(
|
||||
`/otorisator/otorisator/${dataId}/${dataHeader}`,
|
||||
requestData,
|
||||
'Data berhasil diotorisasi.',
|
||||
'Terjadi kesalahan saat melakukan otorisasi.'
|
||||
);
|
||||
} else if (result.isDenied) {
|
||||
handleRejection(dataId,dataHeader);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user