)}
@@ -140,7 +187,7 @@ export function UserDialog({ open, onOpenChange, user }: UserDialogProps) {
-
+
{errors.email && (
{errors.email.message}
)}
@@ -150,27 +197,33 @@ export function UserDialog({ open, onOpenChange, user }: UserDialogProps) {
- {!user && (
-
-
-
- {errors.password && (
-
- {errors.password.message}
-
- )}
-
- )}
+ {/* Password Section - Show for Create, or Optional for Edit */}
+
+
{user ? "Change Password (Optional)" : "Password Setup"}
+
+
+
+
+
+
+
+
+ {errors.password && (
+
{errors.password.message}
+ )}
+
+
+
+
+
+
+
+
+ {errors.confirmPassword && (
+
{errors.confirmPassword.message}
+ )}
+
+
+
@@ -214,10 +308,10 @@ export function UserDialog({ open, onOpenChange, user }: UserDialogProps) {
onCheckedChange={(checked) => {
const current = selectedRoleIds;
if (checked) {
- setValue("role_ids", [...current, role.roleId]);
+ setValue("roleIds", [...current, role.roleId]);
} else {
setValue(
- "role_ids",
+ "roleIds",
current.filter((id) => id !== role.roleId)
);
}
@@ -243,8 +337,8 @@ export function UserDialog({ open, onOpenChange, user }: UserDialogProps) {
setValue("is_active", chk === true)}
+ checked={watch("isActive")}
+ onCheckedChange={(chk) => setValue("isActive", chk === true)}
/>
+ );
+ }
+
+ if (isError) {
+ return (
+
+ Failed to load correspondences.
+
+ );
+ }
+
+ return (
+ <>
+
+
+ >
+ );
+}
diff --git a/frontend/components/correspondences/detail.tsx b/frontend/components/correspondences/detail.tsx
index 41d03d3..9e794a1 100644
--- a/frontend/components/correspondences/detail.tsx
+++ b/frontend/components/correspondences/detail.tsx
@@ -26,8 +26,8 @@ export function CorrespondenceDetail({ data }: CorrespondenceDetailProps) {
if (confirm("Are you sure you want to submit this correspondence?")) {
// TODO: Implement Template Selection. Hardcoded to 1 for now.
submitMutation.mutate({
- id: data.correspondence_id,
- data: { templateId: 1 }
+ id: data.correspondenceId,
+ data: {}
});
}
};
@@ -37,7 +37,7 @@ export function CorrespondenceDetail({ data }: CorrespondenceDetailProps) {
const action = actionState === "approve" ? "APPROVE" : "REJECT";
processMutation.mutate({
- id: data.correspondence_id,
+ id: data.correspondenceId,
data: {
action,
comments
@@ -61,9 +61,9 @@ export function CorrespondenceDetail({ data }: CorrespondenceDetailProps) {
-
{data.document_number}
+
{data.documentNumber}
- Created on {format(new Date(data.created_at), "dd MMM yyyy HH:mm")}
+ Created on {format(new Date(data.createdAt), "dd MMM yyyy HH:mm")}
@@ -200,14 +200,14 @@ export function CorrespondenceDetail({ data }: CorrespondenceDetailProps) {
From Organization
-
{data.from_organization?.org_name}
-
{data.from_organization?.org_code}
+
{data.fromOrganization?.orgName}
+
{data.fromOrganization?.orgCode}
To Organization
-
{data.to_organization?.org_name}
-
{data.to_organization?.org_code}
+
{data.toOrganization?.orgName}
+
{data.toOrganization?.orgCode}
diff --git a/frontend/components/correspondences/form.tsx b/frontend/components/correspondences/form.tsx
index 8416685..da675ab 100644
--- a/frontend/components/correspondences/form.tsx
+++ b/frontend/components/correspondences/form.tsx
@@ -25,10 +25,10 @@ import { CreateCorrespondenceDto } from "@/types/dto/correspondence/create-corre
const correspondenceSchema = z.object({
subject: z.string().min(5, "Subject must be at least 5 characters"),
description: z.string().optional(),
- document_type_id: z.number().default(1),
- from_organization_id: z.number().min(1, "Please select From Organization"),
- to_organization_id: z.number().min(1, "Please select To Organization"),
- importance: z.enum(["NORMAL", "HIGH", "URGENT"]).default("NORMAL"),
+ documentTypeId: z.number(),
+ fromOrganizationId: z.number().min(1, "Please select From Organization"),
+ toOrganizationId: z.number().min(1, "Please select To Organization"),
+ importance: z.enum(["NORMAL", "HIGH", "URGENT"]),
attachments: z.array(z.instanceof(File)).optional(),
});
@@ -48,7 +48,7 @@ export function CorrespondenceForm() {
resolver: zodResolver(correspondenceSchema),
defaultValues: {
importance: "NORMAL",
- document_type_id: 1,
+ documentTypeId: 1,
} as any, // Cast to any to handle partial defaults for required fields
});
@@ -57,12 +57,12 @@ export function CorrespondenceForm() {
// Note: projectId is hardcoded to 1 for now as per requirements/context
const payload: CreateCorrespondenceDto = {
projectId: 1,
- typeId: data.document_type_id,
+ typeId: data.documentTypeId,
title: data.subject,
description: data.description,
- originatorId: data.from_organization_id, // Mapping From -> Originator (Impersonation)
+ originatorId: data.fromOrganizationId, // Mapping From -> Originator (Impersonation)
details: {
- to_organization_id: data.to_organization_id,
+ to_organization_id: data.toOrganizationId,
importance: data.importance
},
// create-correspondence DTO does not have 'attachments' field at root usually, often handled separate or via multipart
@@ -102,7 +102,7 @@ export function CorrespondenceForm() {
- {errors.from_organization_id && (
-
{errors.from_organization_id.message}
+ {errors.fromOrganizationId && (
+
{errors.fromOrganizationId.message}
)}
- {errors.to_organization_id && (
-
{errors.to_organization_id.message}
+ {errors.toOrganizationId && (
+
{errors.toOrganizationId.message}
)}
diff --git a/frontend/components/correspondences/list.tsx b/frontend/components/correspondences/list.tsx
index ede9465..1c60b8c 100644
--- a/frontend/components/correspondences/list.tsx
+++ b/frontend/components/correspondences/list.tsx
@@ -21,10 +21,10 @@ interface CorrespondenceListProps {
export function CorrespondenceList({ data }: CorrespondenceListProps) {
const columns: ColumnDef