Validate overall marhun photo uploaded first before sah auction marhuns

This commit is contained in:
afiq.hamzah
2022-12-10 17:09:57 +08:00
parent 315f5b8cdf
commit 711aa2eb6b
+40 -2
View File
@@ -62,7 +62,7 @@
</h4> --}}
<div class="row justify-content-center">
<div class="col-6">
<div class="card">
<div class="card card-overall-marhun">
<div class="card-header">Keseluruhan Marhun</div>
<div class="card-body" style="align-self: center; justify-content: center;">
@if ($lelongbid['filemarhun_filename'] != null)
@@ -233,7 +233,7 @@
@elseif($status['status'] == 1)
<button style="width:7%;" class="btn btn-info" >Telah Sah</button>
@else
<button style="width:7%;" class="btn btn-success" onclick="confirm()">Semak/button>
<button style="width:7%;" class="btn btn-success button-confirm-marhun" onclick="confirm()" data-is_overall_marhun_photo_uploaded="{{ $lelongbid['filemarhun_filename'] != null }}">Semak/button>
@endif
@else
@@ -678,7 +678,45 @@
document.getElementById('photo_type').value = type;
}
function validateOverallMarhunPhotoTook(){
const button_confirm = document.querySelector('button.button-confirm-marhun');
const is_overall_marhun_photo_uploaded = button_confirm.dataset.is_overall_marhun_photo_uploaded;
if(! is_overall_marhun_photo_uploaded){
return false;
}
return true;
}
function showOverallMarhunPhotoErrorAlert(){
$.alert({
title: 'Perhatian!',
content: 'Sila pastikan gambar keseluruhan marhun lengkap',
type: 'red',
buttons: {
OK: {
btnClass: 'btn-default',
action: function() {
setTimeout(() => {
button_take_marhun_photo = document.querySelector('div.card-overall-marhun');
button_take_marhun_photo.scrollIntoView({ behavior: 'smooth', block: 'start'});
}, 500);
}
},
}
});
}
function confirm() {
const is_pass_validation = validateOverallMarhunPhotoTook();
if (! is_pass_validation) {
showOverallMarhunPhotoErrorAlert();
return;
}
$.confirm({
title: 'Perhatian!',
content: 'Anda pasti telah membuat semakan untuk kesemua marhun?',