Merge branch 'afiqhamzah-feat-add-capture-marhun-picture' into 'main'

Afiqhamzah feat add capture marhun picture

See merge request online-sistem1/lelong!326
This commit is contained in:
Muhamad Amir Hassan Hamzan
2022-12-10 12:52:25 +00:00
+66 -9
View File
@@ -62,11 +62,11 @@
</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)
<button type="button" data-toggle="modal" onclick="kesulurahanMarhunData(this)" data-lelongid="{{$lelongbid['lelong_id']}}" data-lelongbidid="{{$lelongbid['id']}}" data-fileid="{{ $lelongbid['filemarhun_id'] }}" data-target="#modaloverallphoto">
<button type="button" data-toggle="modal" onclick="kesulurahanMarhunData(this)" data-lelongid="{{$lelongbid['lelong_id']}}" data-lelongbidid="{{$lelongbid['id']}}" data-lelongbid_status_semak="{{ $lelongbid['status_semak'] }}" data-fileid="{{ $lelongbid['filemarhun_id'] }}" data-target="#modaloverallphoto">
<img src="{{ route('marhun.showphotomarhun', ['norujukan_sag' => $lelongbid['norujukan'], 'filemarhun_id' => $lelongbid['filemarhun_id']]) }}" width="100%">
</button>
@else
@@ -136,6 +136,7 @@
data-fileid="{{ $item->eachmarhun_id }}"
data-filename="{{ $item->eachmarhun_filename }}"
data-marhun="{{ $item->marhun }}" data-marhunid="{{ $item->id }}"
data-lelongbid_status_semak="{{ $lelongbid['status_semak'] }}"
data-target="#modaleachphoto">
<img src="{{ url($item->eachmarhun_filename) }}" alt="Tambah / Padam Gambar"
style="max-width:100px; border: 1px solid #dee2e6" />
@@ -232,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
@@ -431,12 +432,12 @@
@endphp
<a href="{{ $imageLink }}" target="_blank" class="btn m-2 btn-warning">Lihat gambar</a>
<button data-dismiss="modal" onclick="updatePhoto(1)" type="button"
data-target="#modalupdatephoto" data-toggle="modal" class="btn m-2 btn-warning">Muat naik gambar baru</button>
data-target="#modalupdatephoto" data-toggle="modal" class="btn m-2 btn-warning action-invalid-after-semak">Muat naik gambar baru</button>
<button data-dismiss="modal"
onclick="modalOverallPhotoCaptureUpdate.initiateTakeMarhunPhoto()" type="button"
class="btn m-2 btn-warning">Ambil Gambar Baru</button>
class="btn m-2 btn-warning action-invalid-after-semak">Ambil Gambar Baru</button>
<button data-dismiss="modal" onclick="confirmDeletePhoto()"
class="btn m-2 btn-danger">Padam Gambar</button>
class="btn m-2 btn-danger action-invalid-after-semak">Padam Gambar</button>
</div>
@endif
</div>
@@ -480,13 +481,13 @@
<div id="updateDeletePhoto" hidden class="row mt-5 justify-content-center">
<a href="" target="_blank" class="btn m-2 btn-warning viewPhotoEachMarhunLink">Lihat gambar</a>
<button data-dismiss="modal" onclick="updatePhoto(2)" type="button"
data-target="#modalupdatephoto" data-toggle="modal" class="btn m-2 btn-warning">Muat naik gambar baru</button>
data-target="#modalupdatephoto" data-toggle="modal" class="btn m-2 btn-warning action-invalid-after-semak">Muat naik gambar baru</button>
<button data-dismiss="modal"
onclick="modalOverallPhotoCapturePerMarhunUpdate.initiateTakeMarhunPhoto()"
type="button" data-toggle="modal" class="btn m-2 btn-warning">Ambil Gambar
type="button" data-toggle="modal" class="btn m-2 btn-warning action-invalid-after-semak">Ambil Gambar
Baru</button>
<button data-dismiss="modal" onclick="confirmDeletePhoto()"
class="btn m-2 btn-danger">Padam Gambar</button>
class="btn m-2 btn-danger action-invalid-after-semak">Padam Gambar</button>
</div>
</div>
<div class="modal-footer">
@@ -564,6 +565,15 @@
let modalTitle = "Bil:" + loop + ", Id Marhun:" + marhunId + ", Marhun:" + marhun;
lelongBidStatusSemak = $(value).data('lelongbid_status_semak');
isAlreadyStatusSemak = lelongBidStatusSemak === 1;
if(isAlreadyStatusSemak){
const modalOverallPhoto = document.querySelector('#modaleachphoto');
modalOverallPhoto.querySelectorAll('button.action-invalid-after-semak')
.forEach(button => button.style.display = 'none');
}
prepareModalUpdateCaptureEachMarhun(modalTitle, marhunId, fileId);
prepareModalUpdateUploadEachMarhun(modalTitle, marhunId, fileId, fileName);
prepareModalViewPhotoEachMarhun(fileName);
@@ -627,6 +637,15 @@
lelongId = $(value).data('lelongid');
document.getElementById('filemarhun_id').value = fileId;
lelongBidStatusSemak = $(value).data('lelongbid_status_semak');
isAlreadyStatusSemak = lelongBidStatusSemak === 1;
if(isAlreadyStatusSemak){
const modalOverallPhoto = document.querySelector('#modaloverallphoto');
modalOverallPhoto.querySelectorAll('button.action-invalid-after-semak')
.forEach(button => button.style.display = 'none');
}
}
function confirmDeletePhoto() {
@@ -659,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?',