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
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 1m4s
This commit is contained in:
@@ -223,7 +223,7 @@
|
||||
|
||||
<div class="mt-3 bg-blue-50 rounded-lg p-3">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -77,6 +77,25 @@
|
||||
>
|
||||
</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 -->
|
||||
<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>
|
||||
@@ -299,7 +318,8 @@ if (process.client) {
|
||||
const formData = ref({
|
||||
name: '',
|
||||
email: '',
|
||||
phone: ''
|
||||
phone: '',
|
||||
geburtsdatum: ''
|
||||
})
|
||||
|
||||
// Visibility preferences for other logged-in members
|
||||
@@ -326,7 +346,8 @@ const loadProfile = async () => {
|
||||
formData.value = {
|
||||
name: response.user.name,
|
||||
email: response.user.email,
|
||||
phone: response.user.phone || ''
|
||||
phone: response.user.phone || '',
|
||||
geburtsdatum: response.user.geburtsdatum || ''
|
||||
}
|
||||
visibility.value = response.user.visibility || visibility.value
|
||||
} catch {
|
||||
@@ -430,7 +451,8 @@ const handleSave = async () => {
|
||||
name: formData.value.name,
|
||||
email: formData.value.email,
|
||||
phone: formData.value.phone,
|
||||
visibility: visibility.value,
|
||||
geburtsdatum: formData.value.geburtsdatum,
|
||||
visibility: visibility.value,
|
||||
currentPassword: passwordData.value.current || undefined,
|
||||
newPassword: passwordData.value.new || undefined
|
||||
}
|
||||
|
||||
@@ -57,7 +57,15 @@ export default defineEventHandler(async (event) => {
|
||||
const candidates = []
|
||||
|
||||
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
|
||||
const vis = m.visibility || {}
|
||||
const showBirthday = vis.showBirthday === undefined ? true : Boolean(vis.showBirthday)
|
||||
|
||||
@@ -26,6 +26,7 @@ export default defineEventHandler(async (event) => {
|
||||
name: user.name,
|
||||
email: user.email,
|
||||
phone: user.phone || '',
|
||||
geburtsdatum: user.geburtsdatum || '',
|
||||
visibility: Object.assign({ showBirthday: true }, (user.visibility || {}))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
|
||||
const body = await readBody(event)
|
||||
const { name, email, phone, currentPassword, newPassword } = body
|
||||
const { name, email, phone, geburtsdatum, currentPassword, newPassword } = body
|
||||
|
||||
if (!name || !email) {
|
||||
throw createError({
|
||||
@@ -58,6 +58,7 @@ export default defineEventHandler(async (event) => {
|
||||
user.name = name
|
||||
user.email = email
|
||||
user.phone = phone || ''
|
||||
user.geburtsdatum = geburtsdatum || ''
|
||||
|
||||
// Optional visibility preferences (what to show to other logged-in members)
|
||||
// Expected shape: { showEmail: boolean, showPhone: boolean, showAddress: boolean, showBirthday: boolean }
|
||||
@@ -105,6 +106,7 @@ export default defineEventHandler(async (event) => {
|
||||
email: user.email,
|
||||
name: user.name,
|
||||
phone: user.phone,
|
||||
geburtsdatum: user.geburtsdatum || '',
|
||||
visibility: user.visibility || {},
|
||||
roles: roles,
|
||||
role: roles[0] || 'mitglied' // Rückwärtskompatibilität
|
||||
|
||||
Reference in New Issue
Block a user