Skip to content

Commit

Permalink
Merge branch 'main' into service-portal/subpoena-fixes-2
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Oct 4, 2024
2 parents d0d9a7e + d86d920 commit 34d1ad9
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
.yarn
/infra/helm/
/.nx/cache
/.nx/workspace-data
/.nx/workspace-data
apps/web/public/assets/pdf.worker.min.mjs
23 changes: 23 additions & 0 deletions apps/web/public/assets/pdf.worker.min.mjs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const ChildrenOtherDocumentsSubSection = (index: number) =>
supportingDocuments.labels.otherDocuments.buttonText,
}),
buildHiddenInput({
id: `${Routes.CHILDSUPPORTINGDOCUMENTS}.writtenConsentFromChildRequired`,
id: `${Routes.CHILDSUPPORTINGDOCUMENTS}[${index}].writtenConsentFromChildRequired`,
defaultValue: (application: Application) => {
const age = getSelectedIndividualAge(
application.externalData,
Expand Down Expand Up @@ -110,7 +110,7 @@ export const ChildrenOtherDocumentsSubSection = (index: number) =>
},
}),
buildHiddenInput({
id: `${Routes.CHILDSUPPORTINGDOCUMENTS}.writtenConsentFromOtherParentRequired`,
id: `${Routes.CHILDSUPPORTINGDOCUMENTS}[${index}].writtenConsentFromOtherParentRequired`,
defaultValue: (application: Application) => {
const answers = application.answers as Citizenship
const selectedInCustody = getSelectedCustodyChildren(
Expand Down Expand Up @@ -171,7 +171,7 @@ export const ChildrenOtherDocumentsSubSection = (index: number) =>
},
}),
buildHiddenInput({
id: `${Routes.CHILDSUPPORTINGDOCUMENTS}.custodyDocumentsRequired`,
id: `${Routes.CHILDSUPPORTINGDOCUMENTS}[${index}].custodyDocumentsRequired`,
defaultValue: (application: Application) => {
const answers = application.answers as Citizenship
const selectedInCustody = getSelectedCustodyChildren(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ const SupportingDocumentsSchema = z
},
{
path: ['birthCertificate'],
params: error.fileUploadRequired,
},
)

Expand All @@ -267,12 +266,17 @@ const ChildrenSupportingDocumentsSchema = z
custodyDocumentsRequired: z.string().min(1),
custodyDocuments: z.array(FileDocumentSchema).optional(),
})
.refine(({ writtenConsentFromChildRequired, writtenConsentFromChild }) => {
return (
writtenConsentFromChildRequired === 'false' ||
(writtenConsentFromChild && writtenConsentFromChild.length > 0)
)
})
.refine(
({ writtenConsentFromChildRequired, writtenConsentFromChild }) => {
return (
writtenConsentFromChildRequired === 'false' ||
(writtenConsentFromChild && writtenConsentFromChild.length > 0)
)
},
{
path: ['writtenConsentFromChild'],
},
)
.refine(
({
writtenConsentFromOtherParentRequired,
Expand All @@ -286,7 +290,6 @@ const ChildrenSupportingDocumentsSchema = z
},
{
path: ['writtenConsentFromOtherParent'],
params: error.fileUploadRequired,
},
)
.refine(
Expand All @@ -298,7 +301,6 @@ const ChildrenSupportingDocumentsSchema = z
},
{
path: ['custodyDocuments'],
params: error.fileUploadRequired,
},
)

Expand Down
3 changes: 2 additions & 1 deletion libs/island-ui/core/src/lib/PdfViewer/PdfViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export const PdfViewer: FC<React.PropsWithChildren<PdfViewerProps>> = ({
useEffect(() => {
import('react-pdf')
.then((pdf) => {
pdf.pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdf.pdfjs.version}/pdf.worker.min.mjs`
pdf.pdfjs.GlobalWorkerOptions.workerSrc =
'https://assets.ctfassets.net/8k0h54kbe6bj/8dqL0H07pYWZEkXwLtgBp/1c347f9a4f2bb255f78389b42cf40b97/pdf.worker.min.mjs'
setPdfLib(pdf)
})
.catch((e) => {
Expand Down
42 changes: 41 additions & 1 deletion libs/portals/admin/signature-collection/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,12 @@ export const m = defineMessages({
},
searchNationalIdPlaceholder: {
id: 'admin-portal.signature-collection:searchNationalIdPlaceholder',
defaultMessage: 'Leita eftir kennitölu',
defaultMessage: 'Leita eftir kennitölu meðmælanda',
description: '',
},
noSigneeFoundOverviewText: {
id: 'admin-portal.signature-collection:noSigneeFoundOverviewText',
defaultMessage: 'Enginn meðmælandi fannst',
description: '',
},
sortBy: {
Expand Down Expand Up @@ -355,6 +360,41 @@ export const m = defineMessages({
defaultMessage: 'Kennitala',
description: '',
},
signeeListSigned: {
id: 'admin-portal.signature-collection:signeeListSigned',
defaultMessage: 'Listi',
description: '',
},
signeeListSignedType: {
id: 'admin-portal.signature-collection:signeeListSignedType',
defaultMessage: 'Tegund',
description: '',
},
signeeListSignedStatus: {
id: 'admin-portal.signature-collection:signeeListSignedStatus',
defaultMessage: 'Staða',
description: '',
},
signeeListSignedDigital: {
id: 'admin-portal.signature-collection:signeeListSignedDigital',
defaultMessage: 'Rafrænt',
description: '',
},
signeeListSignedPaper: {
id: 'admin-portal.signature-collection:signeeListSignedPaper',
defaultMessage: 'Af blaði',
description: '',
},
signeeSignatureValid: {
id: 'admin-portal.signature-collection:signeeSigntaureValid',
defaultMessage: 'Gild',
description: '',
},
signeeSignatureInvalid: {
id: 'admin-portal.signature-collection:signeeSigntaureInvalid',
defaultMessage: 'Ógild',
description: '',
},
signeeAddress: {
id: 'admin-portal.signature-collection:signeeAddress',
defaultMessage: 'Heimilisfang',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
query SignatureCollectionSignatureLookup(
$input: SignatureCollectionSignatureLookupInput!
) {
signatureCollectionSignatureLookup(input: $input) {
id
listId
listTitle
created
signee {
nationalId
name
address
}
valid
isDigital
pageNumber
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
Stack,
Box,
Breadcrumbs,
Table as T,
Text,
} from '@island.is/island-ui/core'
import { useLocale } from '@island.is/localization'
import { IntroHeader, PortalNavigation } from '@island.is/portals/core'
Expand All @@ -19,6 +21,9 @@ import { ListsLoaderReturn } from '../loaders/AllLists.loader'
import DownloadReports from './DownloadReports'
import electionsCommitteeLogo from '../../assets/electionsCommittee.svg'
import nationalRegistryLogo from '../../assets/nationalRegistry.svg'
import { useState } from 'react'
import { useSignatureCollectionSignatureLookupQuery } from './findSignature.generated'
import { SkeletonSingleRow } from '../shared-components/compareLists/skeleton'

const ParliamentaryRoot = ({
allowedToProcess,
Expand All @@ -30,6 +35,18 @@ const ParliamentaryRoot = ({
const navigate = useNavigate()
const { collection, allLists } = useLoaderData() as ListsLoaderReturn

const [searchTerm, setSearchTerm] = useState('')

const { data, loading } = useSignatureCollectionSignatureLookupQuery({
variables: {
input: {
collectionId: collection?.id,
nationalId: searchTerm,
},
},
skip: searchTerm.replace(/[^0-9]/g, '').length !== 10,
})

return (
<GridContainer>
<GridRow direction="row">
Expand Down Expand Up @@ -69,15 +86,17 @@ const ParliamentaryRoot = ({
/>
<Box
width="full"
marginBottom={8}
marginBottom={6}
display="flex"
justifyContent="spaceBetween"
>
<Box width="half">
<FilterInput
name="searchSignee"
value={''}
onChange={() => console.log('search')}
value={searchTerm}
onChange={(v) => {
setSearchTerm(v)
}}
placeholder={formatMessage(m.searchNationalIdPlaceholder)}
backgroundColor="blue"
/>
Expand All @@ -87,6 +106,78 @@ const ParliamentaryRoot = ({
collectionId={collection?.id}
/>
</Box>
{loading && (
<Box marginBottom={6}>
<SkeletonSingleRow />
</Box>
)}
{data?.signatureCollectionSignatureLookup &&
(data?.signatureCollectionSignatureLookup.length > 0 ? (
<Box marginBottom={6}>
<T.Table>
<T.Head>
<T.Row>
<T.HeadData>{formatMessage(m.signeeName)}</T.HeadData>
<T.HeadData>
{formatMessage(m.signeeListSigned)}
</T.HeadData>
<T.HeadData>
{formatMessage(m.signeeListSignedType)}
</T.HeadData>
<T.HeadData>
{formatMessage(m.signeeListSignedStatus)}
</T.HeadData>
</T.Row>
</T.Head>
<T.Body>
{data?.signatureCollectionSignatureLookup?.map((s) => (
<T.Row key={s.id}>
<T.Data
span={3}
text={{ variant: 'medium' }}
box={{ background: s.valid ? 'white' : 'red100' }}
>
{s.signee.name}
</T.Data>
<T.Data
span={3}
text={{ variant: 'medium' }}
box={{ background: s.valid ? 'white' : 'red100' }}
>
{s.listTitle}
</T.Data>
<T.Data
span={3}
text={{ variant: 'medium' }}
box={{ background: s.valid ? 'white' : 'red100' }}
>
{formatMessage(
s.isDigital
? m.signeeListSignedDigital
: m.signeeListSignedPaper,
)}
</T.Data>
<T.Data
span={3}
text={{ variant: 'medium' }}
box={{ background: s.valid ? 'white' : 'red100' }}
>
{formatMessage(
s.valid
? m.signeeSignatureValid
: m.signeeSignatureInvalid,
)}
</T.Data>
</T.Row>
))}
</T.Body>
</T.Table>
</Box>
) : (
<Box marginBottom={6}>
<Text>{formatMessage(m.noSigneeFoundOverviewText)}</Text>
</Box>
))}
<Stack space={3}>
{collection?.areas.map((area) => (
<ActionCard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ export const Skeleton = () => {
</T.Row>
)
}

export const SkeletonSingleRow = () => {
return <SkeletonLoader height={90} width="100%" borderRadius="large" />
}

0 comments on commit 34d1ad9

Please sign in to comment.