Skip to content

Commit

Permalink
paper signees functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
albina committed Sep 19, 2024
1 parent a238e9b commit d002933
Show file tree
Hide file tree
Showing 8 changed files with 290 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,14 @@ export const addConstituency = gql`
}
}
`

export const uploadPaperSignature = gql`
mutation SignatureCollectionUploadPaperSignature(
$input: SignatureCollectionUploadPaperSignatureInput!
) {
signatureCollectionUploadPaperSignature(input: $input) {
success
reasons
}
}
`
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const GetListSignatures = gql`
isDigital
valid
created
pageNumber
}
}
`
Expand Down Expand Up @@ -156,3 +157,9 @@ export const GetCurrentCollection = gql`
}
}
`

export const GetCanSign = gql`
query Query($input: SignatureCollectionCanSignInput!) {
signatureCollectionCanSign(input: $input)
}
`
17 changes: 17 additions & 0 deletions libs/service-portal/signature-collection/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
GetSignedList,
GetListsForOwner,
GetCurrentCollection,
GetCanSign,
} from './graphql/queries'
import {
SignatureCollectionListBase,
Expand Down Expand Up @@ -147,3 +148,19 @@ export const useGetCurrentCollection = () => {
refetchCurrentCollection,
}
}

export const useGetCanSign = (signeeId: string, isValidId: boolean) => {
const { data: getCanSignData, loading: loadingCanSign } = useQuery(
GetCanSign,
{
variables: {
input: {
signeeNationalId: signeeId,
},
},
skip: !signeeId || signeeId.length !== 10 || !isValidId,
},
)
const canSign = getCanSignData?.signatureCollectionCanSign ?? false
return { canSign, loadingCanSign }
}
27 changes: 26 additions & 1 deletion libs/service-portal/signature-collection/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ export const m = defineMessages({
defaultMessage: 'Skrá meðmæli af blaði',
description: '',
},
paperSigneesClearButton: {
id: 'sp.signatureCollection:paperSigneesClearButton',
defaultMessage: 'Hreinsa',
description: '',
},
paperNumber: {
id: 'sp.signatureCollection:paperNumber',
defaultMessage: 'Blaðsíðunúmer',
Expand All @@ -283,7 +288,7 @@ export const m = defineMessages({
},
signPaperSigneeButton: {
id: 'sp.signatureCollection:signPaperSigneeButton',
defaultMessage: 'Skrá meðmæla á lista',
defaultMessage: 'Skrá meðmæli á lista',
description: '',
},
paperSigneeTypoTitle: {
Expand All @@ -296,6 +301,26 @@ export const m = defineMessages({
defaultMessage: 'Vinsamlegast athugið kennitöluna og reynið aftur',
description: '',
},
paperSigneeCantSignTitle: {
id: 'sp.signatureCollection:paperSigneeCantSignTitle',
defaultMessage: 'Ekki er hægt að skrá meðmæli',
description: '',
},
paperSigneeCantSignMessage: {
id: 'sp.signatureCollection:paperSigneeCantSign',
defaultMessage: 'Kennitala uppfyllir ekki skilyrði fyrir að skrá meðmæli',
description: '',
},
paperSigneeSuccess: {
id: 'sp.signatureCollection:paperSigneeSuccess',
defaultMessage: 'Meðmæli skráð',
description: '',
},
paperSigneeError: {
id: 'sp.signatureCollection:paperSigneeError',
defaultMessage: 'Ekki tókst að skrá meðmæli',
description: '',
},

/* Parliamentary */
parliamentaryElectionsTitle: {
Expand Down

This file was deleted.

Loading

0 comments on commit d002933

Please sign in to comment.