Skip to content

Commit

Permalink
finishups
Browse files Browse the repository at this point in the history
  • Loading branch information
albinagu committed Oct 22, 2024
1 parent 6ac4cfc commit e26b754
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 13 deletions.
21 changes: 21 additions & 0 deletions libs/portals/admin/signature-collection/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,27 @@ export const m = defineMessages({
defaultMessage: 'Opna fyrir úrvinnslu',
description: '',
},
collectionReviewedTitle: {
id: 'admin-portal.signature-collection:collectionReviewedTitle',
defaultMessage: 'Meðmælasöfnun vegna framboðs til Alþingis lokið',
description: '',
},
collectionReviewedMessage: {
id: 'admin-portal.signature-collection:collectionReviewedMessage',
defaultMessage:
'Nú hefur úrvinnslu verið lokið á öllum listum í öllum kjördæmum.',
description: '',
},
collectionProcessedTitle: {
id: 'admin-portal.signature-collection:collectionProcessedTitle',
defaultMessage: 'Úrvinnsla meðmælasöfnunar lokið',
description: '',
},
collectionProcessedMessage: {
id: 'admin-portal.signature-collection:collectionReviewedTitle',
defaultMessage: 'Nú er hægt að framlengja stökum listum.',
description: '',
},
listReviewedModalDescription: {
id: 'admin-portal.signature-collection:listReviewedModalDescription#markdown',
defaultMessage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,12 @@ export const Constituency = ({
': ' +
constituencyLists.length}
</Text>
{constituencyLists?.length > 0 &&
allowedToProcess &&
collectionStatus === CollectionStatus.InInitialReview && (
<CreateCollection
collectionId={collection?.id}
areaId={areaId}
/>
)}
{allowedToProcess && (
<CreateCollection
collectionId={collection?.id}
areaId={areaId}
/>
)}
</Box>
<Stack space={3}>
{constituencyLists.map((list) => (
Expand All @@ -164,7 +162,9 @@ export const Constituency = ({
},
}}
tag={
allowedToProcess && list.active
allowedToProcess &&
list.active &&
collectionStatus === CollectionStatus.InitialActive
? {
label: 'Cancel collection',
renderTag: () => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ const List = ({ allowedToProcess }: { allowedToProcess: boolean }) => {
)}
{allowedToProcess && (
<Box>
{!list.active && <PaperSignees listId={list.id} />}
{!list.active && !list.reviewed && (
<PaperSignees listId={list.id} />
)}
<ActionReviewComplete listId={list.id} listStatus={listStatus} />
</Box>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ import {
useIdentityQuery,
} from './identityAndCanSignLookup.generated'
import { useSignatureCollectionAdminUploadPaperSignatureMutation } from './uploadPaperSignee.generated'
import { useRevalidator } from 'react-router-dom'

export const PaperSignees = ({ listId }: { listId: string }) => {
useNamespaces('sp.signatureCollection')
const { formatMessage } = useLocale()
const { revalidate } = useRevalidator()
const { control, reset } = useForm()

const [nationalIdInput, setNationalIdInput] = useState('')
Expand Down Expand Up @@ -76,6 +78,7 @@ export const PaperSignees = ({ listId }: { listId: string }) => {
toast.error(formatMessage(m.paperSigneeError))
}
reset()
revalidate()
setNationalIdTypo(false)
setName('')
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Breadcrumbs,
Table as T,
Text,
AlertMessage,
} from '@island.is/island-ui/core'
import { useLocale } from '@island.is/localization'
import { IntroHeader, PortalNavigation } from '@island.is/portals/core'
Expand Down Expand Up @@ -220,9 +221,37 @@ const ParliamentaryRoot = ({
)
})}
</Stack>
{allowedToProcess && <CompareLists collectionId={collection?.id} />}
{collectionStatus === CollectionStatus.InInitialReview && (
<ActionCompleteCollectionProcessing collectionId={collection?.id} />
{allowedToProcess && (
<Box>
{collectionStatus !== CollectionStatus.InReview && (
<CompareLists collectionId={collection?.id} />
)}
{(collectionStatus === CollectionStatus.InitialActive ||
collectionStatus === CollectionStatus.InInitialReview) && (
<ActionCompleteCollectionProcessing
collectionId={collection?.id}
canProcess={allLists.every((l) => l.reviewed === true)}
/>
)}
</Box>
)}
{collectionStatus === CollectionStatus.Processed && (
<Box marginTop={8}>
<AlertMessage
type="success"
title={formatMessage(m.collectionProcessedTitle)}
message={formatMessage(m.collectionProcessedMessage)}
/>
</Box>
)}
{collectionStatus === CollectionStatus.InReview && (
<Box marginTop={8}>
<AlertMessage
type="success"
title={formatMessage(m.collectionReviewedTitle)}
message={formatMessage(m.collectionReviewedMessage)}
/>
</Box>
)}
</GridColumn>
</GridRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import { useProcessCollectionMutation } from './finishCollectionProcess.generate

const ActionCompleteCollectionProcessing = ({
collectionId,
canProcess,
}: {
collectionId: string
canProcess?: boolean
}) => {
const { formatMessage } = useLocale()
const [modalSubmitReviewIsOpen, setModalSubmitReviewIsOpen] = useState(false)
Expand Down Expand Up @@ -45,6 +47,7 @@ const ActionCompleteCollectionProcessing = ({
colorScheme="destructive"
variant="text"
onClick={() => setModalSubmitReviewIsOpen(true)}
disabled={!canProcess}
>
{formatMessage(m.completeCollectionProcessing)}
</Button>
Expand Down

0 comments on commit e26b754

Please sign in to comment.