Vertragsauswahl: Kundennr./Zählernr./Telefonnr. in allen Pickern

Zentraler Helper contractLabel.ts liefert je nach Vertragstyp die
sinnvollen Zusatzinfos (nur wenn Daten vorhanden):
- Kdnr. <customer.customerNumber> (immer)
- Anbieter-Vtr. <contractNumberAtProvider>
- Zähler <meterNumber> (Strom/Gas)
- Mobil <main-SIM-Nummer> (Mobilfunk)
- Festnetz <main-phone> (Internet)

Backend contractApi.getAll include um energyDetails.meter und
internetDetails.phoneNumbers erweitert – vorher fehlten die im
Response.

Angewendet auf 5 Call-Sites:
- AssignToContractModal (Email-zu-Vertrag zuordnen)
- TaskList (Mitarbeiter- und Kundenportal-"Neue Aufgabe/Anfrage")
- Dashboard (Support-Anfrage-Modal)
- PdfTemplates (Test-Vorlage-Kontext-Auswahl)
- ContractForm (Vorgänger-Vertrag-Select)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-07-06 00:26:42 +02:00
co-authored by Claude Opus 4.7
parent 0b78323c7b
commit d14db3de2f
7 changed files with 187 additions and 11 deletions
+18 -7
View File
@@ -3,6 +3,7 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom';
import { pdfTemplateApi, contractApi, authApi } from '../../services/api';
import type { PdfTemplate, CrmField, Contract } from '../../types';
import { buildContractLabelParts } from '../../utils/contractLabel';
import Card from '../../components/ui/Card';
import Button from '../../components/ui/Button';
import Input from '../../components/ui/Input';
@@ -475,13 +476,23 @@ function TestPreviewModal({ template, onClose }: { template: PdfTemplate; onClos
selectedContractId === c.id ? 'bg-blue-50 border-blue-200' : ''
}`}
>
<div>
<span className="font-mono font-medium">{c.contractNumber}</span>
{c.customer && (
<span className="text-gray-500 ml-2">
{c.customer.companyName || `${c.customer.firstName} ${c.customer.lastName}`}
</span>
)}
<div className="flex-1 min-w-0">
<div>
<span className="font-mono font-medium">{c.contractNumber}</span>
{c.customer && (
<span className="text-gray-500 ml-2">
{c.customer.companyName || `${c.customer.firstName} ${c.customer.lastName}`}
</span>
)}
</div>
{(() => {
const parts = buildContractLabelParts(c);
return parts.extras.length > 0 ? (
<div className="text-xs text-gray-400 truncate">
{parts.extras.join(' · ')}
</div>
) : null;
})()}
</div>
<Badge variant="default">{c.type}</Badge>
</button>