Files
lpj/resources/views/otorisasipenawaran/js/editextjs.blade.php
2025-05-06 15:05:09 +07:00

90 lines
3.4 KiB
PHP

<script tipe="module">
function switchProses(id) {
removeErrorCssMsg();
let c = $('#{{ $route[1] }}_check_' + id).val();
if ($('input[name="{{ $route[1] }}_check_' + id + '"]').is(':checked')) {
// checked
// alert('aktif nih');
setActiveElement(id);
} else {
// unchecked
//alert('tdk aktif nih');
setNonActiveElement(id);
}
}
function setActiveElement(id) {
$('#{{ $route[1] }}_biayaPenawaran_' + id).removeAttr('disabled');
$('#{{ $route[1] }}_dokumenPersetujuan_' + id).removeAttr('disabled');
$('#{{ $route[1] }}_icon_update_' + id).removeAttr('disabled');
$('#{{ $route[1] }}_icon_delete_' + id).removeAttr('disabled');
}
function setNonActiveElement(id) {
$('#{{ $route[1] }}_biayaPenawaran_' + id).attr('disabled', 'disabled');
$('#{{ $route[1] }}_dokumenPersetujuan_' + id).attr('disabled', 'disabled');
$('#{{ $route[1] }}_icon_update_' + id).attr('disabled', 'disabled');
$('#{{ $route[1] }}_icon_delete_' + id).attr('disabled', 'disabled');
}
function otorisasiKJPP(penawaran_id, id, kjpp_id, kjppName, biaya_penawaran) {
Swal.fire({
title: ' ',
text: "Yakin akan Otorisasi " + kjppName + "?",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes'
}).then((result) => {
if (result.isConfirmed) {
//define variable
let token = "{{ csrf_token() }}";
let useURL =
"{{ route($route[0] . '.' . $route[1] . '.otorisasiPenawaranKJPP', ['id' => 'PLACEHOLDER']) }}"
.replace('PLACEHOLDER', id);
let noReg = $("#textReg").text();
var input_data = new Object();
input_data._token = token;
input_data.id = id;
input_data.penawaran_id = penawaran_id;
input_data.kjpp_id = kjpp_id;
input_data.kjppName = kjppName;
input_data.biaya_penawaran = biaya_penawaran;
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 Otorisasi!', response.message.message_success[0],
'success').then(() => {
var url = "{{ route('otorisasitender.penawaran.index') }}";
$(location).attr('href', url);
});
} else {
Swal.fire('Error!', response.message.message_error[0], 'error');
}
},
error: function(response, textStatus, errorThrown) {
// var errors = response.responseJSON.errors;
// console.log(errors);
console.log(response);
}
});
}
})
}
</script>