Add display of current image in edit modal

This commit is contained in:
Edwin Noorlander 2025-11-11 18:09:51 +01:00
parent c7f199d61f
commit b1ce2ce3aa
2 changed files with 7 additions and 0 deletions

View File

@ -227,6 +227,12 @@ document.addEventListener('DOMContentLoaded', function() {
document.getElementById('edit_item_name').value = data.name; document.getElementById('edit_item_name').value = data.name;
document.getElementById('edit_item_description').value = data.description || ''; document.getElementById('edit_item_description').value = data.description || '';
document.getElementById('edit_location').value = data.location || ''; document.getElementById('edit_location').value = data.location || '';
const currentImageDiv = document.getElementById('current_image');
if (data.image) {
currentImageDiv.innerHTML = '<p>Huidige afbeelding:</p><img src="' + data.image + '" style="max-width: 100px;">';
} else {
currentImageDiv.innerHTML = '<p>Geen afbeelding</p>';
}
// Populate category select // Populate category select
const categorySelect = document.getElementById('edit_item_category_id'); const categorySelect = document.getElementById('edit_item_category_id');
categorySelect.innerHTML = '<option value="">-- Select Category --</option>'; categorySelect.innerHTML = '<option value="">-- Select Category --</option>';

View File

@ -87,6 +87,7 @@
<div class="mb-3"> <div class="mb-3">
<label for="edit_image" class="form-label">{{ trans('Image') }}</label> <label for="edit_image" class="form-label">{{ trans('Image') }}</label>
<input type="file" class="form-control" id="edit_image" name="image" accept="image/*"> <input type="file" class="form-control" id="edit_image" name="image" accept="image/*">
<div id="current_image" style="margin-top: 10px;"></div>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="edit_location" class="form-label">{{ trans('Location') }}</label> <label for="edit_location" class="form-label">{{ trans('Location') }}</label>