Update Hero component to dynamically display years since founding; enhance TermineVorschau component with improved date and time formatting, and add Uhrzeit column in the CMS for better event management. Refactor API to handle new fields and improve data handling in CSV exports.

This commit is contained in:
Torsten Schulz (local)
2025-11-05 10:36:58 +01:00
parent 21044c6c34
commit 36400304a4
16 changed files with 913 additions and 292 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -32,7 +32,7 @@ export default defineEventHandler(async (event) => {
}
const query = getQuery(event)
const { datum, titel, beschreibung, kategorie } = query
const { datum, uhrzeit, titel, beschreibung, kategorie } = query
if (!datum || !titel) {
throw createError({
@@ -43,6 +43,7 @@ export default defineEventHandler(async (event) => {
await deleteTermin({
datum,
uhrzeit: uhrzeit || '',
titel,
beschreibung: beschreibung || '',
kategorie: kategorie || 'Sonstiges'

View File

@@ -32,7 +32,7 @@ export default defineEventHandler(async (event) => {
}
const body = await readBody(event)
const { datum, titel, beschreibung, kategorie } = body
const { datum, uhrzeit, titel, beschreibung, kategorie } = body
if (!datum || !titel) {
throw createError({
@@ -43,6 +43,7 @@ export default defineEventHandler(async (event) => {
await saveTermin({
datum,
uhrzeit: uhrzeit || '',
titel,
beschreibung: beschreibung || '',
kategorie: kategorie || 'Sonstiges'

View File

@@ -43,9 +43,10 @@ export default defineEventHandler(async (event) => {
if (values.length >= 4) {
termine.push({
datum: values[0],
titel: values[1],
beschreibung: values[2],
kategorie: values[3]
uhrzeit: values[1] || '',
titel: values[2] || '',
beschreibung: values[3] || '',
kategorie: values[4] || 'Sonstiges'
})
}
}

View File

@@ -98,7 +98,7 @@
"strasse": "Reginastr. 46",
"plz": "60437",
"ort": "Frankfurt",
"telefon": "069 509637",
"telefon": "06101 122",
"email": "j.dichmann@gmx.de"
},
"stellvertreter": {

View File

@@ -110,5 +110,12 @@
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEiLCJlbWFpbCI6ImFkbWluQGhhcmhlaW1lcnRjLmRlIiwicm9sZSI6ImFkbWluIiwiaWF0IjoxNzYxMjI1NDI3LCJleHAiOjE3NjE4MzAyMjd9.MANlBkbOU95y-6yd51m0-hoa941A0uHutVwzl481k9I",
"createdAt": "2025-10-23T13:17:07.206Z",
"expiresAt": "2025-10-30T13:17:07.206Z"
},
{
"id": "1762333423617",
"userId": "1",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEiLCJlbWFpbCI6ImFkbWluQGhhcmhlaW1lcnRjLmRlIiwicm9sZSI6ImFkbWluIiwiaWF0IjoxNzYyMzMzNDIzLCJleHAiOjE3NjI5MzgyMjN9.V-L5ethO0VFSOPT2qbsQF2zQYQZSlese1rL5sIFaHbY",
"createdAt": "2025-11-05T09:03:43.617Z",
"expiresAt": "2025-11-12T09:03:43.617Z"
}
]

View File

@@ -8,6 +8,6 @@
"phone": "",
"active": true,
"created": "2025-10-21T00:00:00.000Z",
"lastLogin": "2025-10-23T13:17:07.206Z"
"lastLogin": "2025-11-05T09:03:43.617Z"
}
]

View File

@@ -50,9 +50,10 @@ export async function readTermine() {
termine.push({
id: randomUUID(), // Generate ID on-the-fly for editing
datum: values[0],
titel: values[1],
beschreibung: values[2],
kategorie: values[3]
uhrzeit: values[1] || '',
titel: values[2] || '',
beschreibung: values[3] || '',
kategorie: values[4] || 'Sonstiges'
})
}
}
@@ -70,21 +71,23 @@ export async function readTermine() {
// Write array of objects to CSV
export async function writeTermine(termine) {
try {
let csv = '"datum","titel","beschreibung","kategorie"\n'
let csv = '"datum","uhrzeit","titel","beschreibung","kategorie"\n'
for (const termin of termine) {
const datum = termin.datum || ''
const uhrzeit = termin.uhrzeit || ''
const titel = termin.titel || ''
const beschreibung = termin.beschreibung || ''
const kategorie = termin.kategorie || ''
// Escape quotes in values
const escapedDatum = datum.replace(/"/g, '""')
const escapedUhrzeit = uhrzeit.replace(/"/g, '""')
const escapedTitel = titel.replace(/"/g, '""')
const escapedBeschreibung = beschreibung.replace(/"/g, '""')
const escapedKategorie = kategorie.replace(/"/g, '""')
csv += `"${escapedDatum}","${escapedTitel}","${escapedBeschreibung}","${escapedKategorie}"\n`
csv += `"${escapedDatum}","${escapedUhrzeit}","${escapedTitel}","${escapedBeschreibung}","${escapedKategorie}"\n`
}
await fs.writeFile(TERMINE_FILE, csv, 'utf-8')
@@ -102,6 +105,7 @@ export async function saveTermin(terminData) {
// Always add as new (CSV doesn't have persistent IDs)
const newTermin = {
datum: terminData.datum,
uhrzeit: terminData.uhrzeit || '',
titel: terminData.titel,
beschreibung: terminData.beschreibung || '',
kategorie: terminData.kategorie || 'Sonstiges'
@@ -122,6 +126,7 @@ export async function deleteTermin(terminData) {
termine = termine.filter(t =>
!(t.datum === terminData.datum &&
(t.uhrzeit || '') === (terminData.uhrzeit || '') &&
t.titel === terminData.titel &&
t.beschreibung === terminData.beschreibung &&
t.kategorie === terminData.kategorie)