Add table view and split name into firstName/lastName fields

This commit is contained in:
Torsten Schulz (local)
2025-10-21 14:38:41 +02:00
parent b024bfe884
commit bd677c26ae
29 changed files with 865 additions and 168 deletions

View File

@@ -33,10 +33,12 @@ export default defineEventHandler(async (event) => {
// First, add all manual members
for (const member of manualMembers) {
const normalizedEmail = member.email?.toLowerCase().trim() || ''
const normalizedName = member.name?.toLowerCase().trim() || ''
const fullName = `${member.firstName || ''} ${member.lastName || ''}`.trim()
const normalizedName = fullName.toLowerCase()
mergedMembers.push({
...member,
name: fullName, // Computed for display
source: 'manual',
editable: true,
hasLogin: false

View File

@@ -32,18 +32,19 @@ export default defineEventHandler(async (event) => {
}
const body = await readBody(event)
const { id, name, email, phone, address, notes } = body
const { id, firstName, lastName, email, phone, address, notes } = body
if (!name) {
if (!firstName || !lastName) {
throw createError({
statusCode: 400,
message: 'Name ist erforderlich.'
message: 'Vorname und Nachname sind erforderlich.'
})
}
await saveMember({
id: id || undefined,
name,
firstName,
lastName,
email: email || '',
phone: phone || '',
address: address || '',

View File

@@ -1,7 +1,8 @@
[
{
"id": "m1",
"name": "Max Mustermann",
"firstName": "Max",
"lastName": "Mustermann",
"email": "max@example.com",
"phone": "069 123456",
"address": "Musterstraße 1, 60437 Frankfurt",
@@ -9,7 +10,8 @@
},
{
"id": "m2",
"name": "Anna Schmidt",
"firstName": "Anna",
"lastName": "Schmidt",
"email": "",
"phone": "069 234567",
"address": "Hauptstraße 5, 60437 Frankfurt",