Implement birthdate input in member profile management. Update API to handle birthdate data for user profiles and enhance visibility settings for birthday display in member lists.
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 1m4s

This commit is contained in:
Torsten Schulz (local)
2026-04-01 11:19:23 +02:00
parent 0fb58af194
commit daabeec33c
5 changed files with 39 additions and 6 deletions

View File

@@ -223,7 +223,7 @@
<div class="mt-3 bg-blue-50 rounded-lg p-3"> <div class="mt-3 bg-blue-50 rounded-lg p-3">
<p class="text-xs text-blue-800"> <p class="text-xs text-blue-800">
<strong>Hinweis:</strong> Ohne <code>id</code> wird ein neues Mitglied erstellt. Mit <code>id</code> wird ein bestehendes Mitglied aktualisiert. <code>geburtsdatum</code> ist Pflichtfeld zur Duplikatsprüfung (Format: YYYY-MM-DD). <strong>Hinweis:</strong> Ohne <code>id</code> wird ein neues Mitglied erstellt. Mit <code>id</code> wird ein bestehendes Mitglied aktualisiert. Bei neuen Mitgliedern ist <code>geburtsdatum</code> zur Duplikatsprüfung Pflicht (Format: YYYY-MM-DD). Altdaten ohne Geburtsdatum koennen weiter bearbeitet werden.
</p> </p>
</div> </div>
</div> </div>

View File

@@ -77,6 +77,25 @@
> >
</div> </div>
<div>
<label
for="geburtsdatum"
class="block text-sm font-medium text-gray-700 mb-2"
>
Geburtsdatum
</label>
<input
id="geburtsdatum"
v-model="formData.geburtsdatum"
type="date"
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
:disabled="isSaving"
>
<p class="mt-1 text-xs text-gray-500">
Sichtbar ist in der Mitgliederliste nur der Geburtstag, wenn Sie ihn unten freigeben.
</p>
</div>
<!-- Sichtbarkeits-Einstellungen --> <!-- Sichtbarkeits-Einstellungen -->
<div class="mt-4 border-t border-gray-100 pt-4"> <div class="mt-4 border-t border-gray-100 pt-4">
<h3 class="text-sm font-medium text-gray-900 mb-2">Sichtbarkeit für andere Mitglieder</h3> <h3 class="text-sm font-medium text-gray-900 mb-2">Sichtbarkeit für andere Mitglieder</h3>
@@ -299,7 +318,8 @@ if (process.client) {
const formData = ref({ const formData = ref({
name: '', name: '',
email: '', email: '',
phone: '' phone: '',
geburtsdatum: ''
}) })
// Visibility preferences for other logged-in members // Visibility preferences for other logged-in members
@@ -326,7 +346,8 @@ const loadProfile = async () => {
formData.value = { formData.value = {
name: response.user.name, name: response.user.name,
email: response.user.email, email: response.user.email,
phone: response.user.phone || '' phone: response.user.phone || '',
geburtsdatum: response.user.geburtsdatum || ''
} }
visibility.value = response.user.visibility || visibility.value visibility.value = response.user.visibility || visibility.value
} catch { } catch {
@@ -430,7 +451,8 @@ const handleSave = async () => {
name: formData.value.name, name: formData.value.name,
email: formData.value.email, email: formData.value.email,
phone: formData.value.phone, phone: formData.value.phone,
visibility: visibility.value, geburtsdatum: formData.value.geburtsdatum,
visibility: visibility.value,
currentPassword: passwordData.value.current || undefined, currentPassword: passwordData.value.current || undefined,
newPassword: passwordData.value.new || undefined newPassword: passwordData.value.new || undefined
} }

View File

@@ -57,7 +57,15 @@ export default defineEventHandler(async (event) => {
const candidates = [] const candidates = []
for (const m of manualMembers) { for (const m of manualMembers) {
const isAccepted = m.active === true || (m.status && String(m.status).toLowerCase() === 'accepted') || m.accepted === true const normalizedStatus = m.status ? String(m.status).toLowerCase() : ''
const hasExplicitAcceptanceFlag = m.active !== undefined || m.accepted !== undefined || normalizedStatus !== ''
const isAccepted = hasExplicitAcceptanceFlag
? (
m.active === true ||
m.accepted === true ||
normalizedStatus === 'accepted'
)
: true
if (!isAccepted) continue if (!isAccepted) continue
const vis = m.visibility || {} const vis = m.visibility || {}
const showBirthday = vis.showBirthday === undefined ? true : Boolean(vis.showBirthday) const showBirthday = vis.showBirthday === undefined ? true : Boolean(vis.showBirthday)

View File

@@ -26,6 +26,7 @@ export default defineEventHandler(async (event) => {
name: user.name, name: user.name,
email: user.email, email: user.email,
phone: user.phone || '', phone: user.phone || '',
geburtsdatum: user.geburtsdatum || '',
visibility: Object.assign({ showBirthday: true }, (user.visibility || {})) visibility: Object.assign({ showBirthday: true }, (user.visibility || {}))
} }
} }

View File

@@ -22,7 +22,7 @@ export default defineEventHandler(async (event) => {
} }
const body = await readBody(event) const body = await readBody(event)
const { name, email, phone, currentPassword, newPassword } = body const { name, email, phone, geburtsdatum, currentPassword, newPassword } = body
if (!name || !email) { if (!name || !email) {
throw createError({ throw createError({
@@ -58,6 +58,7 @@ export default defineEventHandler(async (event) => {
user.name = name user.name = name
user.email = email user.email = email
user.phone = phone || '' user.phone = phone || ''
user.geburtsdatum = geburtsdatum || ''
// Optional visibility preferences (what to show to other logged-in members) // Optional visibility preferences (what to show to other logged-in members)
// Expected shape: { showEmail: boolean, showPhone: boolean, showAddress: boolean, showBirthday: boolean } // Expected shape: { showEmail: boolean, showPhone: boolean, showAddress: boolean, showBirthday: boolean }
@@ -105,6 +106,7 @@ export default defineEventHandler(async (event) => {
email: user.email, email: user.email,
name: user.name, name: user.name,
phone: user.phone, phone: user.phone,
geburtsdatum: user.geburtsdatum || '',
visibility: user.visibility || {}, visibility: user.visibility || {},
roles: roles, roles: roles,
role: roles[0] || 'mitglied' // Rückwärtskompatibilität role: roles[0] || 'mitglied' // Rückwärtskompatibilität