contractmodaldetail date format and before contract and next contract question to add
This commit is contained in:
@@ -115,13 +115,13 @@ export default function ContractDetailModal({ contractId, isOpen, onClose }: Con
|
||||
{c.startDate && (
|
||||
<div>
|
||||
<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>
|
||||
)}
|
||||
{c.endDate && (
|
||||
<div>
|
||||
<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>
|
||||
)}
|
||||
{c.contractDuration && (
|
||||
|
||||
@@ -1066,6 +1066,9 @@ export default function ContractDetail() {
|
||||
// Modal für Vorgängervertrag
|
||||
const [showPredecessorModal, setShowPredecessorModal] = useState(false);
|
||||
|
||||
// Bestätigungsdialog für Folgevertrag
|
||||
const [showFollowUpConfirm, setShowFollowUpConfirm] = useState(false);
|
||||
|
||||
const { data, isLoading } = useQuery({
|
||||
queryKey: ['contract', id],
|
||||
queryFn: () => contractApi.getById(contractId),
|
||||
@@ -1275,18 +1278,17 @@ export default function ContractDetail() {
|
||||
{!isCustomer && (
|
||||
<div className="flex gap-2">
|
||||
{c.previousContract && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => setShowPredecessorModal(true)}
|
||||
>
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Vorgängervertrag
|
||||
</Button>
|
||||
<Link to={`/contracts/${c.previousContract.id}`}>
|
||||
<Button variant="secondary">
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Vorgängervertrag
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
{hasPermission('contracts:create') && !c.followUpContract && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => followUpMutation.mutate()}
|
||||
onClick={() => setShowFollowUpConfirm(true)}
|
||||
disabled={followUpMutation.isPending}
|
||||
>
|
||||
<Copy className="w-4 h-4 mr-2" />
|
||||
@@ -2391,6 +2393,39 @@ export default function ContractDetail() {
|
||||
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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user