diff --git a/libs/portals/admin/signature-collection/src/screens-parliamentary/List/paperSignees/identityAndCanSignLookup.graphql b/libs/portals/admin/signature-collection/src/screens-parliamentary/List/paperSignees/identityAndCanSignLookup.graphql index 373c3e542c71..d92220e6f5ed 100644 --- a/libs/portals/admin/signature-collection/src/screens-parliamentary/List/paperSignees/identityAndCanSignLookup.graphql +++ b/libs/portals/admin/signature-collection/src/screens-parliamentary/List/paperSignees/identityAndCanSignLookup.graphql @@ -6,6 +6,11 @@ query Identity($input: IdentityInput!) { } } -query CanSign($input: SignatureCollectionCanSignFromPaperInput!) { - signatureCollectionCanSignFromPaper(input: $input) +query SignatureCollectionAdminCanSignInfo( + $input: SignatureCollectionCanSignFromPaperInput! +) { + signatureCollectionAdminCanSignInfo(input: $input) { + reasons + success + } } diff --git a/libs/portals/admin/signature-collection/src/screens-parliamentary/List/paperSignees/index.tsx b/libs/portals/admin/signature-collection/src/screens-parliamentary/List/paperSignees/index.tsx index 60556c7d06de..e7dad47c52cf 100644 --- a/libs/portals/admin/signature-collection/src/screens-parliamentary/List/paperSignees/index.tsx +++ b/libs/portals/admin/signature-collection/src/screens-parliamentary/List/paperSignees/index.tsx @@ -16,7 +16,7 @@ import { useForm } from 'react-hook-form' import { toast } from 'react-toastify' import { m } from '../../../lib/messages' import { - useCanSignQuery, + useSignatureCollectionAdminCanSignInfoQuery, useIdentityQuery, } from './identityAndCanSignLookup.generated' import { useSignatureCollectionUploadPaperSignatureMutation } from './uploadPaperSignee.generated' @@ -37,15 +37,16 @@ export const PaperSignees = ({ listId }: { listId: string }) => { onCompleted: (data) => setName(data.identity?.name || ''), }) - const { data: canSign, loading: loadingCanSign } = useCanSignQuery({ - variables: { - input: { - signeeNationalId: nationalIdInput, - listId, + const { data: canSign, loading: loadingCanSign } = + useSignatureCollectionAdminCanSignInfoQuery({ + variables: { + input: { + signeeNationalId: nationalIdInput, + listId, + }, }, - }, - skip: !nationalId.isValid(nationalIdInput) || !name, - }) + skip: !nationalId.isValid(nationalIdInput) || !name, + }) useEffect(() => { if (nationalIdInput.length === 10) { @@ -126,7 +127,11 @@ export const PaperSignees = ({ listId }: { listId: string }) => { }} error={nationalIdTypo ? ' ' : undefined} loading={loading || loadingCanSign} - icon={name && canSign ? 'checkmark' : undefined} + icon={ + name && canSign?.signatureCollectionAdminCanSignInfo?.success + ? 'checkmark' + : undefined + } /> @@ -157,7 +162,9 @@ export const PaperSignees = ({ listId }: { listId: string }) => {