@@ -592,9 +592,9 @@ export function Control({
|
|||||||
return policies.filter((policy) => {
|
return policies.filter((policy) => {
|
||||||
return (
|
return (
|
||||||
!policySearchQuery ||
|
!policySearchQuery ||
|
||||||
policy.name?.toLowerCase().includes(policySearchQuery.toLowerCase()) ||
|
policy.title?.toLowerCase().includes(policySearchQuery.toLowerCase()) ||
|
||||||
(policy.content &&
|
(policy.description &&
|
||||||
policy.content
|
policy.description
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.includes(policySearchQuery.toLowerCase()))
|
.includes(policySearchQuery.toLowerCase()))
|
||||||
);
|
);
|
||||||
@@ -1092,18 +1092,18 @@ export function Control({
|
|||||||
>
|
>
|
||||||
<td className="py-3 px-4">
|
<td className="py-3 px-4">
|
||||||
<div className="font-medium">
|
<div className="font-medium">
|
||||||
{policy.name}
|
{policy.title}
|
||||||
</div>
|
</div>
|
||||||
{policy.content && (
|
{policy.description && (
|
||||||
<div className="text-xs text-secondary line-clamp-1 mt-0.5">
|
<div className="text-xs text-secondary line-clamp-1 mt-0.5">
|
||||||
{policy.content}
|
{policy.description}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td className="py-3 px-4">
|
<td className="py-3 px-4">
|
||||||
{policy.reviewDate
|
{policy.updatedAt
|
||||||
? new Date(
|
? new Date(
|
||||||
policy.reviewDate
|
policy.updatedAt
|
||||||
).toLocaleDateString()
|
).toLocaleDateString()
|
||||||
: "Not set"}
|
: "Not set"}
|
||||||
</td>
|
</td>
|
||||||
@@ -1202,16 +1202,16 @@ export function Control({
|
|||||||
className="border-b hover:bg-invert-bg"
|
className="border-b hover:bg-invert-bg"
|
||||||
>
|
>
|
||||||
<td className="py-3 px-4">
|
<td className="py-3 px-4">
|
||||||
<div className="font-medium">{policy.name}</div>
|
<div className="font-medium">{policy.title}</div>
|
||||||
{policy.content && (
|
{policy.description && (
|
||||||
<div className="text-xs text-secondary line-clamp-1 mt-0.5">
|
<div className="text-xs text-secondary line-clamp-1 mt-0.5">
|
||||||
{policy.content}
|
{policy.description}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td className="py-3 px-4">
|
<td className="py-3 px-4">
|
||||||
{policy.reviewDate
|
{policy.updatedAt
|
||||||
? new Date(policy.reviewDate).toLocaleDateString()
|
? new Date(policy.updatedAt).toLocaleDateString()
|
||||||
: "Not set"}
|
: "Not set"}
|
||||||
</td>
|
</td>
|
||||||
<td className="py-3 px-4 text-right whitespace-nowrap">
|
<td className="py-3 px-4 text-right whitespace-nowrap">
|
||||||
|
|||||||
@@ -100,21 +100,6 @@ interface SignaturesModalProps {
|
|||||||
} | null;
|
} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define the signature type based on the GraphQL response
|
|
||||||
// interface Signature {
|
|
||||||
// id: string;
|
|
||||||
// state: string;
|
|
||||||
// signedAt?: string | null;
|
|
||||||
// requestedAt: string;
|
|
||||||
// signedBy: {
|
|
||||||
// fullName: string;
|
|
||||||
// id: string;
|
|
||||||
// } | null;
|
|
||||||
// requestedBy: {
|
|
||||||
// fullName: string;
|
|
||||||
// } | null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
export function SignaturesModal({
|
export function SignaturesModal({
|
||||||
isOpen,
|
isOpen,
|
||||||
onClose,
|
onClose,
|
||||||
@@ -126,10 +111,7 @@ export function SignaturesModal({
|
|||||||
policyRef
|
policyRef
|
||||||
);
|
);
|
||||||
|
|
||||||
// Safely access and extract version nodes
|
|
||||||
const versionNodes = (data?.policyVersions?.edges?.map(edge => edge.node) || []);
|
const versionNodes = (data?.policyVersions?.edges?.map(edge => edge.node) || []);
|
||||||
|
|
||||||
// Filter to just published versions and sort by version number
|
|
||||||
const publishedVersions = versionNodes
|
const publishedVersions = versionNodes
|
||||||
.filter(v => v.status === "PUBLISHED")
|
.filter(v => v.status === "PUBLISHED")
|
||||||
.sort((a, b) => b.version - a.version);
|
.sort((a, b) => b.version - a.version);
|
||||||
@@ -147,7 +129,6 @@ export function SignaturesModal({
|
|||||||
|
|
||||||
const [commitRequestSignature] = useMutation<SignaturesModalRequestSignatureMutation>(requestSignatureMutation);
|
const [commitRequestSignature] = useMutation<SignaturesModalRequestSignatureMutation>(requestSignatureMutation);
|
||||||
|
|
||||||
// Load organization data when the modal opens and we have a valid version selected
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpen && organizationId && selectedVersionData?.status === "PUBLISHED") {
|
if (isOpen && organizationId && selectedVersionData?.status === "PUBLISHED") {
|
||||||
loadQuery({ organizationId });
|
loadQuery({ organizationId });
|
||||||
@@ -160,7 +141,6 @@ export function SignaturesModal({
|
|||||||
return format(date, "h:mm a • MMM d, yyyy");
|
return format(date, "h:mm a • MMM d, yyyy");
|
||||||
};
|
};
|
||||||
|
|
||||||
// Safely type signatures as our defined Signature interface
|
|
||||||
const signatures = selectedVersionData?.signatures?.edges?.map(edge => edge.node) || [];
|
const signatures = selectedVersionData?.signatures?.edges?.map(edge => edge.node) || [];
|
||||||
|
|
||||||
const handleRequestSignature = (personId: string) => {
|
const handleRequestSignature = (personId: string) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user