This commit is contained in:
@@ -81,7 +81,7 @@ $sectionLinks = [
|
||||
<dl class="account-kv">
|
||||
<div><dt>Name</dt><dd><?= htmlspecialchars(trim($profile['first_name'] . ' ' . $profile['last_name']), ENT_QUOTES) ?></dd></div>
|
||||
<div><dt>Anzeigename</dt><dd><?= htmlspecialchars($profile['display_name'], ENT_QUOTES) ?></dd></div>
|
||||
<div><dt>Ort</dt><dd><?= htmlspecialchars(trim($profile['city'] . ' ' . $profile['zip']), ENT_QUOTES) ?></dd></div>
|
||||
<div><dt>Adresse</dt><dd><?= htmlspecialchars(trim(implode(', ', array_filter([(string)($profile['street'] ?? ''), trim((string)$profile['zip'] . ' ' . (string)$profile['city']), (string)($profile['region'] ?? '')]))), ENT_QUOTES) ?></dd></div>
|
||||
<div><dt>E-Mail</dt><dd><?= htmlspecialchars($profile['email'], ENT_QUOTES) ?></dd></div>
|
||||
<div><dt>Telefon</dt><dd><?= htmlspecialchars($profile['contact_phone'], ENT_QUOTES) ?></dd></div>
|
||||
<div><dt>Beruf</dt><dd><?= htmlspecialchars($profile['profession'], ENT_QUOTES) ?></dd></div>
|
||||
@@ -486,6 +486,9 @@ $sectionLinks = [
|
||||
</div>
|
||||
<form method="post" class="stack gap-12">
|
||||
<input type="hidden" name="action" value="profile">
|
||||
<input type="hidden" id="pRegion" name="region" value="<?= htmlspecialchars((string)($profile['region'] ?? ''), ENT_QUOTES) ?>">
|
||||
<input type="hidden" id="pLat" name="lat" value="<?= htmlspecialchars((string)($profile['lat'] ?? ''), ENT_QUOTES) ?>">
|
||||
<input type="hidden" id="pLng" name="lng" value="<?= htmlspecialchars((string)($profile['lng'] ?? ''), ENT_QUOTES) ?>">
|
||||
<div class="form-grid">
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="pName">Anzeigename</label>
|
||||
@@ -498,12 +501,12 @@ $sectionLinks = [
|
||||
</div>
|
||||
<div class="form-grid">
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="pLast">Nachname</label>
|
||||
<input id="pLast" name="last_name" class="input" value="<?= htmlspecialchars($profile['last_name'], ENT_QUOTES) ?>">
|
||||
<label class="label" for="pStreet">Straße / Hausnummer</label>
|
||||
<input id="pStreet" name="street" class="input" value="<?= htmlspecialchars((string)($profile['street'] ?? ''), ENT_QUOTES) ?>" placeholder="z. B. Musterstraße 12">
|
||||
</div>
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="pCity">Ort</label>
|
||||
<input id="pCity" name="city" class="input" value="<?= htmlspecialchars($profile['city'], ENT_QUOTES) ?>">
|
||||
<label class="label" for="pLast">Nachname</label>
|
||||
<input id="pLast" name="last_name" class="input" value="<?= htmlspecialchars($profile['last_name'], ENT_QUOTES) ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-grid">
|
||||
@@ -511,11 +514,25 @@ $sectionLinks = [
|
||||
<label class="label" for="pZip">PLZ</label>
|
||||
<input id="pZip" name="zip" class="input" value="<?= htmlspecialchars($profile['zip'], ENT_QUOTES) ?>">
|
||||
</div>
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="pCity">Ort</label>
|
||||
<input id="pCity" name="city" class="input" value="<?= htmlspecialchars($profile['city'], ENT_QUOTES) ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-grid">
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="pRegionView">Region / Bezirk</label>
|
||||
<input id="pRegionView" class="input" value="<?= htmlspecialchars((string)($profile['region'] ?? ''), ENT_QUOTES) ?>" placeholder="wird bei Lokalisierung ergänzt">
|
||||
</div>
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="pPhone">Telefon (mobil)</label>
|
||||
<input id="pPhone" name="contact_phone" class="input" value="<?= htmlspecialchars($profile['contact_phone'], ENT_QUOTES) ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-12" style="flex-wrap:wrap;">
|
||||
<button class="btn ghost" type="button" id="btnProfileLocate">Adresse lokalisieren</button>
|
||||
<p class="muted small" style="margin:0;">Verwendet dieselben Karten-/Adressdienste wie bei Events und nur nach Einwilligung in externe Dienste.</p>
|
||||
</div>
|
||||
<div class="stack gap-6">
|
||||
<label class="label">Sprachen (Mehrfachauswahl)</label>
|
||||
<div class="chips" style="flex-wrap: wrap;">
|
||||
@@ -728,6 +745,14 @@ $sectionLinks = [
|
||||
const zipInput = document.getElementById('evZip');
|
||||
const cityInput = document.getElementById('evCity');
|
||||
const regionInput = document.getElementById('evRegion');
|
||||
const profileLocateButton = document.getElementById('btnProfileLocate');
|
||||
const profileStreetInput = document.getElementById('pStreet');
|
||||
const profileZipInput = document.getElementById('pZip');
|
||||
const profileCityInput = document.getElementById('pCity');
|
||||
const profileRegionInput = document.getElementById('pRegion');
|
||||
const profileRegionViewInput = document.getElementById('pRegionView');
|
||||
const profileLatInput = document.getElementById('pLat');
|
||||
const profileLngInput = document.getElementById('pLng');
|
||||
let map, marker;
|
||||
|
||||
function ensureLeaflet(callback) {
|
||||
@@ -818,6 +843,28 @@ $sectionLinks = [
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
function geocodeAddressData(query, onSuccess) {
|
||||
if (!window.PKTConsent || !window.PKTConsent.has('external_services')) {
|
||||
alert('Für Karten und Adresssuche bitte zuerst die externen Dienste in den Cookie-Einstellungen erlauben.');
|
||||
window.PKTConsent?.openPreferences?.();
|
||||
return;
|
||||
}
|
||||
fetch('https://nominatim.openstreetmap.org/search?format=jsonv2&limit=1&addressdetails=1&q=' + encodeURIComponent(query), {
|
||||
headers: { 'Accept-Language': 'de', 'User-Agent': 'papa-kind-treff/1.0' },
|
||||
})
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
if (Array.isArray(data) && data[0]) {
|
||||
onSuccess?.(data[0]);
|
||||
return;
|
||||
}
|
||||
alert('Adresse konnte nicht eindeutig lokalisiert werden.');
|
||||
})
|
||||
.catch(() => {
|
||||
alert('Adresssuche aktuell nicht erreichbar.');
|
||||
});
|
||||
}
|
||||
|
||||
function initMap() {
|
||||
if (map) { map.invalidateSize(); return; }
|
||||
map = L.map(mapContainer).setView([51.1657, 10.4515], 6);
|
||||
@@ -863,6 +910,62 @@ $sectionLinks = [
|
||||
geocodeAndPlace(parts.join(', '));
|
||||
});
|
||||
|
||||
(function(){
|
||||
const syncProfileRegionView = () => {
|
||||
if (profileRegionViewInput && profileRegionInput) {
|
||||
profileRegionInput.value = profileRegionViewInput.value.trim();
|
||||
}
|
||||
};
|
||||
|
||||
const clearProfileCoordinates = () => {
|
||||
if (profileLatInput) profileLatInput.value = '';
|
||||
if (profileLngInput) profileLngInput.value = '';
|
||||
};
|
||||
|
||||
[profileStreetInput, profileZipInput, profileCityInput].forEach((input) => {
|
||||
input?.addEventListener('input', clearProfileCoordinates);
|
||||
});
|
||||
|
||||
profileRegionViewInput?.addEventListener('input', () => {
|
||||
syncProfileRegionView();
|
||||
clearProfileCoordinates();
|
||||
});
|
||||
|
||||
profileLocateButton?.addEventListener('click', () => {
|
||||
const parts = [
|
||||
profileStreetInput?.value || '',
|
||||
profileZipInput?.value || '',
|
||||
profileCityInput?.value || '',
|
||||
profileRegionViewInput?.value || '',
|
||||
].map(v => v.trim()).filter(Boolean);
|
||||
|
||||
if (!parts.length) {
|
||||
alert('Bitte zuerst mindestens einen Teil der Adresse eingeben.');
|
||||
return;
|
||||
}
|
||||
|
||||
geocodeAddressData(parts.join(', '), (result) => {
|
||||
const address = result.address || {};
|
||||
const street = [address.road || '', address.house_number || ''].filter(Boolean).join(' ').trim();
|
||||
const region = address.suburb || address.state || address.county || '';
|
||||
const city = address.city || address.town || address.village || '';
|
||||
|
||||
if (profileStreetInput && street) profileStreetInput.value = street;
|
||||
if (profileZipInput && address.postcode) profileZipInput.value = address.postcode;
|
||||
if (profileCityInput && city) profileCityInput.value = city;
|
||||
if (profileRegionViewInput) profileRegionViewInput.value = region;
|
||||
if (profileRegionInput) profileRegionInput.value = region;
|
||||
|
||||
const lat = parseFloat(result.lat);
|
||||
const lng = parseFloat(result.lon);
|
||||
if (profileLatInput) profileLatInput.value = Number.isNaN(lat) ? '' : lat.toFixed(7);
|
||||
if (profileLngInput) profileLngInput.value = Number.isNaN(lng) ? '' : lng.toFixed(7);
|
||||
});
|
||||
});
|
||||
|
||||
syncProfileRegionView();
|
||||
})();
|
||||
|
||||
<?php if ($editing): ?>
|
||||
(function(){
|
||||
const modal = document.getElementById('modalEvent');
|
||||
|
||||
Reference in New Issue
Block a user