Melengkapi feature Approve Jadwal Kunjungan yang di berikan Surveyor

This commit is contained in:
Andy Chaerudin
2024-12-11 12:07:34 +07:00
committed by putrakuningan
parent dfe1e98d80
commit 614abd01ac
3 changed files with 77 additions and 16 deletions

View File

@@ -186,9 +186,9 @@
let actionHtml = `<div class="flex flex-nowrap justify-center gap-1.5">`;
if (data && data.penilaian && data.penilaian.waktu_penilaian !== null && data.status !==
'done') {
'done' && data.penilaian.authorized_status==null) {
actionHtml += `
<a class="btn btn-sm btn-outline btn-primary" href="surveyor/storeAproved/${data.penilaian.id}">
<a class="btn btn-sm btn-outline btn-primary" href="javascript:void(0)" onclick="surveyorApproveKunjungan(${data.penilaian.id},'${data.nomor_registrasi}')" title="Hapus Proses Penawaran '+kjppName+'">
<i class="ki-filled ki-calendar-edit"></i>
</a>
`;
@@ -225,5 +225,58 @@
});
</script>
<script type="text/javascript">
function surveyorApproveKunjungan(id, noReg) {
Swal.fire({
title: ' ',
text: "Yakin akan Menyetujui Jadwal Kunjungan "+noReg+"?",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes'
}).then((result) => {
if (result.isConfirmed) {
//define variable
// $id ==> penilaian.id
let token = "{{ csrf_token() }}";
let useURL = "{{ URL::to('/surveyor/storeAproved') }}"+"/"+id;
var input_data = new Object();
input_data._token = token;
input_data.id = id;
input_data.noReg =noReg;
$.ajax({
url: useURL,
type: "PUT",
cache: false,
data: input_data,
dataType: "json",
success: function(response) {
console.log(response);
if('success' == response.status)
{
swal.fire('Sukses Menyetujui!', response.message, 'success').then(() => {
location.reload(true);
});
}
else
{
Swal.fire('Error!', response.message, 'error');
}
},
error: function(response, textStatus, errorThrown) {
// var errors = response.responseJSON.errors;
// console.log(errors);
console.log(response);
}
});
}
})
}
</script>
@endpush