update semua form inspeksi
This commit is contained in:
@@ -139,16 +139,18 @@
|
||||
<span class="form-label">Upload Denah</span>
|
||||
</label>
|
||||
<div class="w-full grid gap-5">
|
||||
<img id="foto_denah"
|
||||
<img id="foto_denah-preview"
|
||||
src="{{ isset($formFoto['foto_denah']) ? asset('storage/' . old('foto_denah', $formFoto['foto_denah'])) : '#' }}"
|
||||
alt="Gambar foto_denah" style="width: 30rem;">
|
||||
alt="Gambar foto_denah" style="{{ isset($formFoto['foto_denah']) ? 'width: 30rem;' : 'display: none;' }}">
|
||||
|
||||
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<input type="file"
|
||||
value="{{ old('foto_denah', isset($formDenah['foto_denah']) ? $formDenah['foto_denah'] : '') }}"
|
||||
name="foto_denah" class="file-input file-input-bordered w-full "
|
||||
accept="image/*">
|
||||
accept="image/*"
|
||||
onchange="previewImage(this, 'foto_denah-preview')"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -196,6 +198,18 @@
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
function previewImage(input, previewId) {
|
||||
if (input.files && input.files[0]) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
$('#' + previewId).attr('src', e.target.result).show();
|
||||
}
|
||||
reader.readAsDataURL(input.files[0]);
|
||||
} else {
|
||||
$('#' + previewId).hide();
|
||||
}
|
||||
}
|
||||
|
||||
function submitDenah() {
|
||||
|
||||
const formElement = $('#formDenah')[0];
|
||||
|
||||
Reference in New Issue
Block a user