Typspezifische Zusatzinfos in Vertragslisten

Jede Vertragszeile zeigt jetzt eine kontextspezifische Zusatzinfo an:
- Strom/Gas: "Lieferadresse: Musterstr. 12, 12345 Berlin"
- DSL/Glasfaser/Kabel: "Anschlussadresse: ..."
- Mobilfunk: "Rufnummer: 0171 1234567" (Hauptkarte bevorzugt)
- KFZ: "Kennzeichen: HB-AB 123"

Sichtbar in:
- Admin-Vertragsliste (/contracts)
- Portal-Vertragsliste (Baumansicht)
- Kunden-Detail → Verträge-Tab

Backend: getAllContracts + getContractTreeForCustomer liefern
mobileDetails (mit simCards), carInsuranceDetails und address mit.

Frontend: Neuer Helper utils/contractInfo.ts mit getContractTypeInfo,
aus dem sowohl Label als auch Wert pro Typ kommt.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 10:19:04 +02:00
parent 50b0e56a84
commit f17adb6095
6 changed files with 165 additions and 81 deletions
+23
View File
@@ -95,6 +95,13 @@ export async function getAllContracts(filters: ContractFilters) {
provider: true,
tariff: true,
contractCategory: true,
mobileDetails: {
select: {
phoneNumber: true,
simCards: { select: { phoneNumber: true, isMain: true } },
},
},
carInsuranceDetails: { select: { licensePlate: true } },
},
}),
prisma.contract.count({ where }),
@@ -845,6 +852,13 @@ export interface ContractTreeNode {
provider?: { id: number; name: string } | null;
tariff?: { id: number; name: string } | null;
contractCategory?: { id: number; name: string } | null;
customer?: { id: number; firstName: string; lastName: string; companyName: string | null; customerNumber: string } | null;
address?: { street: string; houseNumber: string; postalCode: string; city: string } | null;
mobileDetails?: {
phoneNumber: string | null;
simCards: { phoneNumber: string | null; isMain: boolean }[];
} | null;
carInsuranceDetails?: { licensePlate: string | null } | null;
};
predecessors: ContractTreeNode[];
hasHistory: boolean;
@@ -875,6 +889,15 @@ export async function getContractTreeForCustomer(customerId: number): Promise<Co
provider: { select: { id: true, name: true } },
tariff: { select: { id: true, name: true } },
contractCategory: { select: { id: true, name: true } },
customer: { select: { id: true, firstName: true, lastName: true, companyName: true, customerNumber: true } },
address: { select: { street: true, houseNumber: true, postalCode: true, city: true } },
mobileDetails: {
select: {
phoneNumber: true,
simCards: { select: { phoneNumber: true, isMain: true } },
},
},
carInsuranceDetails: { select: { licensePlate: true } },
},
orderBy: [{ startDate: 'desc' }, { createdAt: 'desc' }],
});