@ -1120,27 +1120,54 @@ input.invalid, select.invalid, textarea.invalid {
document.querySelectorAll('.photo-container').forEach(container => {
document.querySelectorAll('.photo-container').forEach(container => {
const input = container.querySelector('input[type="file"]');
const input = container.querySelector('input[type="file"]');
const preview = container.querySelector('.photo-preview');
const preview = container.querySelector('.photo-preview');
const fieldId = preview.id;
const placeholder = container.querySelector('.photo-placeholder');
const fieldId = preview ? preview.id : null;
const maxWidth = parseInt(container.dataset.maxWidth) || 1200;
const maxWidth = parseInt(container.dataset.maxWidth) || 1200;
const maxHeight = parseInt(container.dataset.maxHeight) || 1200;
const maxHeight = parseInt(container.dataset.maxHeight) || 1200;
// Make the placeholder clickable with a label
if (placeholder & & input) {
// Create a unique ID for the input
const inputId = 'photo-input-' + (fieldId || Math.random().toString(36).substr(2, 9));
input.id = inputId;
// Wrap placeholder in a label for better iOS support
const label = document.createElement('label');
label.setAttribute('for', inputId);
label.style.cursor = 'pointer';
label.style.display = 'block';
label.innerHTML = placeholder.innerHTML;
placeholder.innerHTML = '';
placeholder.appendChild(label);
}
// Also handle click on container (for desktop)
container.addEventListener('click', function(e) {
container.addEventListener('click', function(e) {
if (e.target.tagName !== 'BUTTON') {
// Don't trigger if clicking on buttons or if already handled by label
if (e.target.tagName === 'BUTTON' || e.target.tagName === 'LABEL' || e.target.closest('label')) {
return;
}
if (input) {
input.click();
input.click();
}
}
});
});
input.addEventListener('change', function(e) {
if (input) {
const file = e.target.files[0];
input.addEventListener('change', function(e) {
if (!file) return;
const file = e.target.files[0];
if (!file) return;
processImage(file, maxWidth, maxHeight, function(dataUrl) {
processImage(file, maxWidth, maxHeight, function(dataUrl) {
preview.src = dataUrl;
if (preview) {
container.classList.add('has-photo');
preview.src = dataUrl;
hasChanges = true;
preview.style.display = 'block';
saveData();
}
container.classList.add('has-photo');
hasChanges = true;
saveData();
});
});
});
});
}
});
});
}
}
@ -1284,7 +1311,7 @@ input.invalid, select.invalid, textarea.invalid {
body += '\n========================\n';
body += '\n========================\n';
// Add photos section if there are any
// Add photos section only if there are photos
if (photos.length > 0) {
if (photos.length > 0) {
body += '\nFOTO BIJLAGEN (BASE64)\n';
body += '\nFOTO BIJLAGEN (BASE64)\n';
body += '========================\n';
body += '========================\n';
@ -1299,8 +1326,6 @@ input.invalid, select.invalid, textarea.invalid {
body += photo.data + '\n';
body += photo.data + '\n';
body += '< < < EINDE BASE64 < < < \ n \ n ' ;
body += '< < < EINDE BASE64 < < < \ n \ n ' ;
});
});
} else {
body += 'Geen foto\'s toegevoegd aan dit formulier.\n';
}
}
const mailto = 'mailto:' + encodeURIComponent(CONFIG.export.mailto.to) +
const mailto = 'mailto:' + encodeURIComponent(CONFIG.export.mailto.to) +