contractmodaldetail date format and before contract and next contract question to add

This commit is contained in:
duffyduck 2026-02-04 21:17:13 +01:00
parent 2d052c76d9
commit af2f444a24
5 changed files with 746 additions and 700 deletions

700
frontend/dist/assets/index-BNDhEhH4.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OpenCRM</title> <title>OpenCRM</title>
<script type="module" crossorigin src="/assets/index-DCSrWwxa.js"></script> <script type="module" crossorigin src="/assets/index-BNDhEhH4.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DWDTTlpk.css"> <link rel="stylesheet" crossorigin href="/assets/index-DWDTTlpk.css">
</head> </head>
<body> <body>

View File

@ -115,13 +115,13 @@ export default function ContractDetailModal({ contractId, isOpen, onClose }: Con
{c.startDate && ( {c.startDate && (
<div> <div>
<dt className="text-sm text-gray-500">Vertragsbeginn</dt> <dt className="text-sm text-gray-500">Vertragsbeginn</dt>
<dd>{new Date(c.startDate).toLocaleDateString('de-DE')}</dd> <dd>{new Date(c.startDate).toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' })}</dd>
</div> </div>
)} )}
{c.endDate && ( {c.endDate && (
<div> <div>
<dt className="text-sm text-gray-500">Vertragsende</dt> <dt className="text-sm text-gray-500">Vertragsende</dt>
<dd>{new Date(c.endDate).toLocaleDateString('de-DE')}</dd> <dd>{new Date(c.endDate).toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' })}</dd>
</div> </div>
)} )}
{c.contractDuration && ( {c.contractDuration && (

View File

@ -1066,6 +1066,9 @@ export default function ContractDetail() {
// Modal für Vorgängervertrag // Modal für Vorgängervertrag
const [showPredecessorModal, setShowPredecessorModal] = useState(false); const [showPredecessorModal, setShowPredecessorModal] = useState(false);
// Bestätigungsdialog für Folgevertrag
const [showFollowUpConfirm, setShowFollowUpConfirm] = useState(false);
const { data, isLoading } = useQuery({ const { data, isLoading } = useQuery({
queryKey: ['contract', id], queryKey: ['contract', id],
queryFn: () => contractApi.getById(contractId), queryFn: () => contractApi.getById(contractId),
@ -1275,18 +1278,17 @@ export default function ContractDetail() {
{!isCustomer && ( {!isCustomer && (
<div className="flex gap-2"> <div className="flex gap-2">
{c.previousContract && ( {c.previousContract && (
<Button <Link to={`/contracts/${c.previousContract.id}`}>
variant="secondary" <Button variant="secondary">
onClick={() => setShowPredecessorModal(true)}
>
<ArrowLeft className="w-4 h-4 mr-2" /> <ArrowLeft className="w-4 h-4 mr-2" />
Vorgängervertrag Vorgängervertrag
</Button> </Button>
</Link>
)} )}
{hasPermission('contracts:create') && !c.followUpContract && ( {hasPermission('contracts:create') && !c.followUpContract && (
<Button <Button
variant="secondary" variant="secondary"
onClick={() => followUpMutation.mutate()} onClick={() => setShowFollowUpConfirm(true)}
disabled={followUpMutation.isPending} disabled={followUpMutation.isPending}
> >
<Copy className="w-4 h-4 mr-2" /> <Copy className="w-4 h-4 mr-2" />
@ -2391,6 +2393,39 @@ export default function ContractDetail() {
onClose={() => setShowPredecessorModal(false)} onClose={() => setShowPredecessorModal(false)}
/> />
)} )}
{/* Folgevertrag Bestätigung */}
<Modal
isOpen={showFollowUpConfirm}
onClose={() => setShowFollowUpConfirm(false)}
title="Folgevertrag anlegen"
size="sm"
>
<div className="space-y-4">
<p className="text-gray-700">
Möchten Sie wirklich einen Folgevertrag für diesen Vertrag anlegen?
</p>
<p className="text-sm text-gray-500">
Die Daten des aktuellen Vertrags werden als Vorlage übernommen.
</p>
<div className="flex justify-end gap-3 pt-2">
<Button
variant="secondary"
onClick={() => setShowFollowUpConfirm(false)}
>
Nein
</Button>
<Button
onClick={() => {
setShowFollowUpConfirm(false);
followUpMutation.mutate();
}}
>
Ja, anlegen
</Button>
</div>
</div>
</Modal>
</div> </div>
); );
} }