260324:2133 Refactor correspondence & rfa
CI / CD Pipeline / build (push) Failing after 17m3s
CI / CD Pipeline / deploy (push) Has been skipped

This commit is contained in:
admin
2026-03-24 21:33:59 +07:00
parent 42fc9fa502
commit aa82b890a5
42 changed files with 2617 additions and 233 deletions
@@ -0,0 +1,53 @@
'use client';
import { CorrespondenceForm } from '@/components/correspondences/form';
import { useCorrespondence } from '@/hooks/use-correspondence';
import { Loader2 } from 'lucide-react';
import { useParams } from 'next/navigation';
export default function EditCorrespondencePage() {
const params = useParams();
const uuid = (params?.uuid as string) ?? '';
const { data: correspondence, isLoading, isError } = useCorrespondence(uuid);
if (!uuid) {
return (
<div className="flex flex-col items-center justify-center min-h-screen">
<h1 className="text-xl font-bold text-red-500">Invalid Correspondence UUID</h1>
</div>
);
}
if (isLoading) {
return (
<div className="flex bg-muted/20 min-h-screen justify-center items-center">
<Loader2 className="h-8 w-8 animate-spin" />
</div>
);
}
if (isError || !correspondence) {
return (
<div className="flex flex-col items-center justify-center min-h-screen">
<h1 className="text-xl font-bold text-red-500">Failed to load correspondence</h1>
<p>Please try again later or verify the UUID.</p>
</div>
);
}
return (
<div className="max-w-4xl mx-auto py-6">
<div className="mb-8">
<h1 className="text-3xl font-bold">Edit Correspondence</h1>
<p className="text-muted-foreground mt-1">
Editing: <span className="font-mono font-semibold">{correspondence.correspondenceNumber}</span>
</p>
</div>
<div className="bg-card border rounded-lg p-6 shadow-sm">
<CorrespondenceForm initialData={correspondence} uuid={uuid} />
</div>
</div>
);
}