{
- navigate(`/organizations/${organizationId}/policies/${policy.id}`);
+ navigate(`/organizations/${organizationId}/documents/${document.id}`);
}}
>
|
- {policy.title}
+ {document.title}
- {policy.description || "No description provided"}
+ {document.description || "No description provided"}
|
- {policy.owner?.fullName || "Unassigned"}
+ {document.owner?.fullName || "Unassigned"}
|
- {format(new Date(policy.updatedAt), "MMM d, yyyy")}
+ {format(new Date(document.updatedAt), "MMM d, yyyy")}
|
@@ -277,7 +277,7 @@ function PolicyTableRow({
View
@@ -291,7 +291,7 @@ function PolicyTableRow({
);
}
-function CreatePolicyModal({
+function CreateDocumentModal({
open,
onOpenChange,
organizationId,
@@ -307,8 +307,8 @@ function CreatePolicyModal({
const [content, setContent] = useState("");
const [ownerId, setOwnerId] = useState(null);
- const [createPolicy, isCreating] =
- useMutation(createPolicyMutation);
+ const [createDocument, isCreating] =
+ useMutation(createDocumentMutation);
// Reset form fields
const resetForm = () => {
@@ -317,11 +317,11 @@ function CreatePolicyModal({
setOwnerId(null);
};
- const handleCreatePolicy = () => {
+ const handleCreateDocument = () => {
if (!title.trim()) {
toast({
title: "Error",
- description: "Please enter a policy title.",
+ description: "Please enter a document title.",
variant: "destructive",
});
return;
@@ -330,7 +330,7 @@ function CreatePolicyModal({
if (!ownerId) {
toast({
title: "Error",
- description: "Please select an owner for the policy.",
+ description: "Please select an owner for the document.",
variant: "destructive",
});
return;
@@ -343,23 +343,23 @@ function CreatePolicyModal({
ownerId,
};
- createPolicy({
+ createDocument({
variables: {
input,
connections: [
ConnectionHandler.getConnectionID(
organizationId,
- "PolicyListView_policies",
+ "DocumentListView_documents",
{ orderBy: { field: "TITLE", direction: "ASC" } },
),
],
},
onCompleted: (response, errors) => {
if (errors) {
- console.error("Error creating policy:", errors);
+ console.error("Error creating document:", errors);
toast({
title: "Error",
- description: "Failed to create policy. Please try again.",
+ description: "Failed to create document. Please try again.",
variant: "destructive",
});
return;
@@ -367,17 +367,17 @@ function CreatePolicyModal({
toast({
title: "Success",
- description: "Policy created successfully!",
+ description: "Document created successfully!",
});
resetForm();
onOpenChange(false);
},
onError: (error) => {
- console.error("Error creating policy:", error);
+ console.error("Error creating document:", error);
toast({
title: "Error",
- description: "Failed to create policy. Please try again.",
+ description: "Failed to create document. Please try again.",
variant: "destructive",
});
},
@@ -394,16 +394,16 @@ function CreatePolicyModal({
return (
|