@@ -569,16 +592,75 @@ function renderMembersList() {
const photoB64 = ex.photoB64 || ex.offlinePhotoB64 || null;
const div = document.createElement('div');
div.className = 'member-item';
+ div.style.cursor = 'pointer';
+ div.title = 'Foto bearbeiten';
div.innerHTML = `${avatarHtml(m.name, photoB64, m.photoUrl, 40)}
${escHtml(m.name)}
${escHtml(m.company||'')}${m.specialty?' · '+escHtml(m.specialty):''}
-
${photoB64?'✓ Foto':'kein Foto'}`;
+
${photoB64?'✓ Foto':'+ Foto'}`;
+ div.onclick = () => openMemberPhotoModal(m.name, photoB64);
container.appendChild(div);
});
}
+let _memberPhotoB64 = null;
+
+function openMemberPhotoModal(name, currentPhotoB64) {
+ _memberPhotoB64 = currentPhotoB64 || null;
+ document.getElementById('member-photo-name').value = name;
+ document.getElementById('member-photo-modal-title').textContent = name;
+ updateMemberPhotoUI(_memberPhotoB64, name);
+ openAdminModal('modal-member-photo');
+}
+
+function updateMemberPhotoUI(b64, name) {
+ _memberPhotoB64 = b64;
+ const thumb = document.getElementById('member-photo-thumb');
+ const initials = document.getElementById('member-photo-initials');
+ const removeBtn = document.getElementById('member-photo-remove');
+ if (b64) {
+ thumb.src = b64; thumb.style.display = 'block';
+ initials.style.display = 'none';
+ removeBtn.style.display = 'inline-flex';
+ } else {
+ thumb.src = ''; thumb.style.display = 'none';
+ initials.style.display = 'flex';
+ initials.style.background = getColor(name || '');
+ initials.textContent = getInitials(name || '');
+ removeBtn.style.display = 'none';
+ }
+}
+
+function handleMemberPhotoFile(input) {
+ const file = input.files && input.files[0];
+ if (!file) return;
+ const name = document.getElementById('member-photo-name').value;
+ resizePhotoToBase64(file).then(b64 => updateMemberPhotoUI(b64, name)).catch(e => alert(e.message));
+ input.value = '';
+}
+
+function removeMemberPhoto() {
+ updateMemberPhotoUI(null, document.getElementById('member-photo-name').value);
+}
+
+function saveMemberPhoto() {
+ const name = document.getElementById('member-photo-name').value;
+ const extras = loadExtras();
+ const key = extrasKey(name);
+ if (!extras[key]) extras[key] = {};
+ if (_memberPhotoB64) {
+ extras[key].photoB64 = _memberPhotoB64;
+ } else {
+ delete extras[key].photoB64;
+ delete extras[key].offlinePhotoB64;
+ }
+ saveExtras(extras);
+ closeAdminModal('modal-member-photo');
+ renderMembersList();
+}
+
async function fetchMembersAdmin() {
const statusEl = document.getElementById('members-status');
statusEl.textContent = 'Lade vom Server…'; statusEl.style.color = 'var(--muted)';