diff --git a/libs/application/templates/signature-collection/parliamentary-list-signing/src/forms/Done.ts b/libs/application/templates/signature-collection/parliamentary-list-signing/src/forms/Done.ts
index 746305678d9c..e65e617c9965 100644
--- a/libs/application/templates/signature-collection/parliamentary-list-signing/src/forms/Done.ts
+++ b/libs/application/templates/signature-collection/parliamentary-list-signing/src/forms/Done.ts
@@ -45,7 +45,7 @@ export const Done: Form = buildForm({
buildMessageWithLinkButtonField({
id: 'done.goToServicePortal',
title: '',
- url: '/minarsidur/min-gogn/listar/medmaelasofnun',
+ url: '/minarsidur/min-gogn/listar/althingis-medmaelasofnun',
buttonTitle: m.linkFieldButtonTitle,
message: m.linkFieldMessage,
}),
diff --git a/libs/service-portal/signature-collection/src/lib/constants.ts b/libs/service-portal/signature-collection/src/lib/constants.ts
index 04eb57fdee3a..0e26bc28bbe6 100644
--- a/libs/service-portal/signature-collection/src/lib/constants.ts
+++ b/libs/service-portal/signature-collection/src/lib/constants.ts
@@ -1,6 +1,6 @@
export const CollectionType = {
Presidential: 'Forsetakosningar',
- Parliamentary: 'Alþingiskosningar',
+ Parliamentary: 'Alþingiskosning NÝTT TEST',
}
// will be fetched later on
diff --git a/libs/service-portal/signature-collection/src/screens/Parliamentary/SignedList/index.tsx b/libs/service-portal/signature-collection/src/screens/Parliamentary/SignedList/index.tsx
new file mode 100644
index 000000000000..dbb10e38bbbe
--- /dev/null
+++ b/libs/service-portal/signature-collection/src/screens/Parliamentary/SignedList/index.tsx
@@ -0,0 +1,146 @@
+import { ActionCard, Box, Button, Text, toast } from '@island.is/island-ui/core'
+import { useLocale } from '@island.is/localization'
+import { m } from '../../../lib/messages'
+import { Modal } from '@island.is/service-portal/core'
+import { useState } from 'react'
+import { useGetSignedList } from '../../../hooks'
+import format from 'date-fns/format'
+import { useMutation } from '@apollo/client'
+import { unSignList } from '../../../hooks/graphql/mutations'
+import {
+ SignatureCollectionSignedList,
+ SignatureCollectionSuccess,
+} from '@island.is/api/schema'
+
+const SignedList = () => {
+ const { formatMessage } = useLocale()
+ const [modalIsOpen, setModalIsOpen] = useState(false)
+
+ // SignedList is typically singular, although it may consist of multiple entries, which in that case will all be invalid
+ const { signedLists, loadingSignedLists, refetchSignedLists } =
+ useGetSignedList()
+
+ const [unSign, { loading }] = useMutation(unSignList, {
+ variables: {
+ input: {
+ listId:
+ signedLists && signedLists?.length === 1
+ ? signedLists[0].id
+ : undefined,
+ },
+ },
+ })
+
+ const onUnSignList = async () => {
+ try {
+ await unSign().then(({ data }) => {
+ if (
+ (
+ data as any as {
+ signatureCollectionUnsign: SignatureCollectionSuccess
+ }
+ ).signatureCollectionUnsign.success
+ ) {
+ toast.success(formatMessage(m.unSignSuccess))
+ setModalIsOpen(false)
+ refetchSignedLists()
+ } else {
+ setModalIsOpen(false)
+ }
+ })
+ } catch (e) {
+ toast.error(formatMessage(m.unSignError))
+ }
+ }
+
+ return (
+
+ {!loadingSignedLists && !!signedLists?.length && (
+
+ {formatMessage(m.mySigneeListsHeader)}
+ {signedLists?.map((list: SignatureCollectionSignedList) => {
+ return (
+
+ setModalIsOpen(true),
+ icon: undefined,
+ }
+ : undefined
+ }
+ tag={
+ list.isValid && !list.active
+ ? {
+ label: formatMessage(m.collectionClosed),
+ variant: 'red',
+ outlined: true,
+ }
+ : list.isValid && !list.isDigital
+ ? {
+ label: formatMessage(m.paperUploadedSignature),
+ variant: 'blue',
+ outlined: true,
+ }
+ : !list.isValid
+ ? {
+ label: formatMessage(m.signatureIsInvalid),
+ variant: 'red',
+ outlined: false,
+ }
+ : undefined
+ }
+ />
+ setModalIsOpen(false)}
+ >
+
+ {formatMessage(m.unSignList)}
+
+
+ {formatMessage(m.unSignModalMessage)}
+
+
+
+
+
+
+ )
+ })}
+
+ )}
+
+ )
+}
+
+export default SignedList
diff --git a/libs/service-portal/signature-collection/src/screens/Parliamentary/SigneeView/index.tsx b/libs/service-portal/signature-collection/src/screens/Parliamentary/SigneeView/index.tsx
index 28937f6eb894..14118b010312 100644
--- a/libs/service-portal/signature-collection/src/screens/Parliamentary/SigneeView/index.tsx
+++ b/libs/service-portal/signature-collection/src/screens/Parliamentary/SigneeView/index.tsx
@@ -1,31 +1,118 @@
-import { ActionCard, Box, Text } from '@island.is/island-ui/core'
+import {
+ ActionCard,
+ AlertMessage,
+ Box,
+ Button,
+ Stack,
+ Text,
+} from '@island.is/island-ui/core'
import { useLocale } from '@island.is/localization'
+import { EmptyState } from '@island.is/service-portal/core'
+import { useGetListsForUser, useGetSignedList } from '../../../hooks'
+import format from 'date-fns/format'
+import { Skeleton } from '../../../skeletons'
+import { useAuth } from '@island.is/auth/react'
+import { sortAlpha } from '@island.is/shared/utils'
import { m } from '../../../lib/messages'
-import { SignatureCollection } from '@island.is/api/schema'
+import SignedList from '../SignedList'
+import { SignatureCollection } from '../../../types/schema'
const SigneeView = ({
currentCollection,
}: {
currentCollection: SignatureCollection
}) => {
+ const { userInfo: user } = useAuth()
+
const { formatMessage } = useLocale()
+ const { signedLists, loadingSignedLists } = useGetSignedList()
+ const { listsForUser, loadingUserLists } = useGetListsForUser(
+ currentCollection?.id,
+ )
return (
-
- {formatMessage(m.mySigneeListsHeader)}
-
-
+ {!user?.profile.actor && !loadingSignedLists && !loadingUserLists ? (
+
+ {listsForUser.length === 0 && signedLists.length === 0 && (
+
+
+
+ )}
+
+ {/* Signed list */}
+
+
+ {/* Other available lists */}
+
+ {listsForUser.length > 0 && (
+
+ {formatMessage(m.mySigneeListsByAreaHeader)}
+
+ )}
+
+
+ {[...listsForUser]?.sort(sortAlpha('title')).map((list) => {
+ return (
+ new Date() && !list.maxReached
+ ? {
+ label: formatMessage(m.signList),
+ variant: 'text',
+ icon: 'arrowForward',
+ disabled: !!signedLists.length,
+ onClick: () => {
+ window.open(
+ `${document.location.origin}${list.slug}`,
+ )
+ },
+ }
+ : undefined
+ }
+ tag={
+ new Date(list.endTime) < new Date()
+ ? {
+ label: formatMessage(m.collectionClosed),
+ variant: 'red',
+ outlined: true,
+ }
+ : list.maxReached
+ ? {
+ label: formatMessage(m.collectionMaxReached),
+ variant: 'red',
+ outlined: true,
+ }
+ : undefined
+ }
+ />
+ )
+ })}
+
+
+
+
+ ) : user?.profile.actor ? (
+
+ ) : (
+
+ )}
)
}
diff --git a/libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx b/libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx
index b93a194ea342..746f36519ea8 100644
--- a/libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx
+++ b/libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx
@@ -1,15 +1,11 @@
import { Box } from '@island.is/island-ui/core'
import { useLocale } from '@island.is/localization'
-import {
- EmptyState,
- IntroHeader,
- THJODSKRA_SLUG,
-} from '@island.is/service-portal/core'
+import { IntroHeader } from '@island.is/service-portal/core'
import { m } from '../../lib/messages'
import OwnerView from './OwnerView'
import SigneeView from './SigneeView'
import { useGetCurrentCollection, useIsOwner } from '../../hooks'
-import { CollectionType } from '../../lib/constants'
+import { Skeleton } from '../../skeletons'
const SignatureListsParliamentary = () => {
const { formatMessage } = useLocale()
@@ -18,18 +14,13 @@ const SignatureListsParliamentary = () => {
const { currentCollection, loadingCurrentCollection } =
useGetCurrentCollection()
- console.log(currentCollection)
- console.log(isOwner)
-
return (
- {currentCollection?.name === CollectionType.Parliamentary &&
- !loadingIsOwner &&
- !loadingCurrentCollection ? (
+ {!loadingIsOwner && !loadingCurrentCollection ? (
{isOwner.success ? (
@@ -38,10 +29,7 @@ const SignatureListsParliamentary = () => {
)}
) : (
-
+
)}
)