Geburtstag-Management-Modal mit Reset + Send + Auto-Flag

Neuer Cake-Button neben dem Geburtsdatum in den Stammdaten öffnet ein Modal
mit drei Funktionen:

1. **Gruß-Marker zurücksetzen** (lastBirthdayGreetingYear → null)
   - Für Debugging oder als Fallback, wenn der Kunde den Gruß erneut sehen soll
   - Mit Bestätigungsdialog

2. **Geburtstagsgruß jetzt senden** (Email / WhatsApp / Telegram / Signal)
   - Email: direkt via System-SMTP mit HTML-Template (Du/Sie-abhängig)
   - WhatsApp/Telegram/Signal: öffnet vorbefülltes Fenster mit Gruß-Text
   - Text beachtet Du/Sie-Verhältnis (pronomen, possessiv, etc.)
   - Mit Bestätigungsdialog

3. **Automatisch senden** – neue Einstellung am Customer
   - autoBirthdayGreeting (Boolean) + autoBirthdayChannel (String)
   - Für späteren Cron-basierten Automatik-Versand vorbereitet

Backend:
- birthday.service.ts: resetBirthdayGreeting, buildBirthdayGreetingText, getBirthdayGreetingData
- birthday.controller.ts: resetBirthdayGreeting, sendBirthdayGreeting
- Routes: POST /birthdays/:customerId/reset + /send
- Audit-Log bei beiden Aktionen

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 12:46:03 +02:00
parent 6175421a4c
commit f5a74864a2
9 changed files with 597 additions and 1 deletions
@@ -13,8 +13,9 @@ import Modal from '../../components/ui/Modal';
import Input from '../../components/ui/Input';
import Select from '../../components/ui/Select';
import FileUpload from '../../components/ui/FileUpload';
import { Edit, Plus, Trash2, MapPin, CreditCard, FileText, Gauge, Eye, EyeOff, Download, Globe, UserPlus, X, Search, Mail, Copy, Check, ChevronDown, ChevronRight, Info, Shield, ShieldCheck, ShieldX, ShieldAlert, Lock, ArrowLeft } from 'lucide-react';
import { Edit, Plus, Trash2, MapPin, CreditCard, FileText, Gauge, Eye, EyeOff, Download, Globe, UserPlus, X, Search, Mail, Copy, Check, ChevronDown, ChevronRight, Info, Shield, ShieldCheck, ShieldX, ShieldAlert, Lock, ArrowLeft, Cake } from 'lucide-react';
import CopyButton, { CopyableBlock } from '../../components/ui/CopyButton';
import BirthdayManagementModal from '../../components/BirthdayManagementModal';
import { formatDate } from '../../utils/dateFormat';
import { getContractTypeInfo } from '../../utils/contractInfo';
import type { Address, BankCard, IdentityDocument, Meter, Customer, CustomerRepresentative, CustomerSummary, CustomerConsent, ConsentType, ConsentStatus, RepresentativeAuthorization } from '../../types';
@@ -42,6 +43,7 @@ export default function CustomerDetail({ portalCustomerId }: { portalCustomerId?
const [showDocumentModal, setShowDocumentModal] = useState(false);
const [showMeterModal, setShowMeterModal] = useState(false);
const [showStressfreiEmailModal, setShowStressfreiEmailModal] = useState(false);
const [showBirthdayModal, setShowBirthdayModal] = useState(false);
const [showInactive, setShowInactive] = useState(false);
const [editingBankCard, setEditingBankCard] = useState<BankCard | null>(null);
const [editingDocument, setEditingDocument] = useState<IdentityDocument | null>(null);
@@ -313,6 +315,16 @@ export default function CustomerDetail({ portalCustomerId }: { portalCustomerId?
<dd className="flex items-center gap-1">
{new Date(c.birthDate).toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' })}
<CopyButton value={new Date(c.birthDate).toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' })} />
{!isCustomerPortal && hasPermission('customers:update') && (
<button
type="button"
onClick={() => setShowBirthdayModal(true)}
className="ml-1 p-1 hover:bg-pink-50 rounded transition-colors"
title="Geburtstag verwalten"
>
<Cake className="w-4 h-4 text-pink-500" />
</button>
)}
</dd>
</div>
)}
@@ -451,6 +463,13 @@ export default function CustomerDetail({ portalCustomerId }: { portalCustomerId?
email={editingStressfreiEmail}
customerEmail={customer?.data?.email}
/>
{showBirthdayModal && c && (
<BirthdayManagementModal
customer={c}
onClose={() => setShowBirthdayModal(false)}
/>
)}
</div>
);
}