feat: implement AGB History with dynamic CMS fetching

This commit is contained in:
2026-04-27 12:11:11 +02:00
parent 24a19adf19
commit 909bad573b
7 changed files with 181 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
import { Block } from 'payload';
export const AgbHistory: Block = {
slug: 'agbHistory',
labels: {
singular: 'AGB Historie',
plural: 'AGB Historien',
},
fields: [
{
name: 'title',
type: 'text',
label: 'Titel',
localized: true,
defaultValue: 'Vorherige Versionen',
},
],
};

View File

@@ -17,6 +17,7 @@ import { TeamProfile } from './TeamProfile';
import { TechnicalGrid } from './TechnicalGrid';
import { VisualLinkPreview } from './VisualLinkPreview';
import { PDFDownload } from './PDFDownload';
import { AgbHistory } from './AgbHistory';
import { homeBlocksArray } from './HomeBlocks';
export const payloadBlocks = [
@@ -40,4 +41,5 @@ export const payloadBlocks = [
TechnicalGrid,
VisualLinkPreview,
PDFDownload,
AgbHistory,
];

View File

@@ -0,0 +1,49 @@
import { CollectionConfig } from 'payload';
export const Agbs: CollectionConfig = {
slug: 'agbs-collection',
admin: {
useAsTitle: 'title',
defaultColumns: ['title', 'versionDate', 'updatedAt'],
group: 'Rechtliches',
},
access: {
read: () => true,
},
fields: [
{
name: 'title',
type: 'text',
required: true,
localized: true,
label: 'Titel (z.B. AGB April 2026)',
},
{
name: 'versionDate',
type: 'date',
required: true,
label: 'Gültig ab',
admin: {
date: {
pickerAppearance: 'dayOnly',
},
},
},
{
name: 'file',
type: 'upload',
relationTo: 'media',
required: true,
label: 'PDF Datei',
},
{
name: 'isCurrent',
type: 'checkbox',
label: 'Aktuelle Version',
defaultValue: false,
admin: {
position: 'sidebar',
},
},
],
};