From a4e9ed0a1b9a4cfd357d8072fddecd5d5cd50d1e Mon Sep 17 00:00:00 2001 From: albina Date: Wed, 23 Oct 2024 14:17:02 +0000 Subject: [PATCH 1/2] fix(admin): already signed message & create collection available --- .../admin/signature-collection/src/lib/messages.ts | 10 ++++++++++ .../screens-parliamentary/Constituency/index.tsx | 13 ++++++------- .../List/paperSignees/index.tsx | 8 +++++++- .../src/shared-components/completeReview/index.tsx | 6 +++++- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/libs/portals/admin/signature-collection/src/lib/messages.ts b/libs/portals/admin/signature-collection/src/lib/messages.ts index 04147e17217e..f0e2a7744eb6 100644 --- a/libs/portals/admin/signature-collection/src/lib/messages.ts +++ b/libs/portals/admin/signature-collection/src/lib/messages.ts @@ -501,6 +501,11 @@ export const m = defineMessages({ defaultMessage: 'Úrvinnslu lokið', description: '', }, + toggleReviewSuccessToggleBack: { + id: 'admin-portal.signature-collection:toggleReviewSuccessToggleBack', + defaultMessage: 'Tókst að opna fyrir úrvinnslu', + description: '', + }, lockList: { id: 'admin-portal.signature-collection:lockList', defaultMessage: 'Læsa söfnun', @@ -754,6 +759,11 @@ export const m = defineMessages({ defaultMessage: 'Ekki tókst að skrá meðmæli', description: '', }, + paperSigneeErrorAlreadySigned: { + id: 'admin-portal.signature-collection:paperSigneeErrorAlreadySigned', + defaultMessage: 'Kennitala er þegar á lista', + description: '', + }, }) export const createCollectionErrorMessages = defineMessages({ diff --git a/libs/portals/admin/signature-collection/src/screens-parliamentary/Constituency/index.tsx b/libs/portals/admin/signature-collection/src/screens-parliamentary/Constituency/index.tsx index 239ecbc8a5e1..c0ddcfdf8772 100644 --- a/libs/portals/admin/signature-collection/src/screens-parliamentary/Constituency/index.tsx +++ b/libs/portals/admin/signature-collection/src/screens-parliamentary/Constituency/index.tsx @@ -131,13 +131,12 @@ export const Constituency = ({ ': ' + constituencyLists.length} - {allowedToProcess && - collectionStatus === CollectionStatus.InInitialReview && ( - - )} + {allowedToProcess && ( + + )} {constituencyLists.map((list) => ( 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 38d624aeec34..e8d3b39e0392 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 @@ -75,7 +75,13 @@ export const PaperSignees = ({ listId }: { listId: string }) => { if (res.signatureCollectionAdminUploadPaperSignature?.success) { toast.success(formatMessage(m.paperSigneeSuccess)) } else { - toast.error(formatMessage(m.paperSigneeError)) + if ( + res.signatureCollectionAdminUploadPaperSignature?.reasons?.includes( + 'alreadySigned', + ) + ) { + toast.error(formatMessage(m.paperSigneeErrorAlreadySigned)) + } } reset() revalidate() diff --git a/libs/portals/admin/signature-collection/src/shared-components/completeReview/index.tsx b/libs/portals/admin/signature-collection/src/shared-components/completeReview/index.tsx index 7da91a5a0a37..bf67334a38fe 100644 --- a/libs/portals/admin/signature-collection/src/shared-components/completeReview/index.tsx +++ b/libs/portals/admin/signature-collection/src/shared-components/completeReview/index.tsx @@ -35,7 +35,11 @@ const ActionReviewComplete = ({ onCompleted: () => { setModalSubmitReviewIsOpen(false) revalidate() - toast.success(formatMessage(m.toggleReviewSuccess)) + toast.success( + listReviewed + ? formatMessage(m.toggleReviewSuccessToggleBack) + : formatMessage(m.toggleReviewSuccess), + ) }, onError: () => { toast.error(formatMessage(m.toggleReviewError)) From b01e92f18d88b646bc3ba26238e3d40b9412312a Mon Sep 17 00:00:00 2001 From: albina Date: Wed, 23 Oct 2024 16:12:18 +0000 Subject: [PATCH 2/2] tweak allowedToProcess --- .../src/screens-parliamentary/Constituency/index.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/portals/admin/signature-collection/src/screens-parliamentary/Constituency/index.tsx b/libs/portals/admin/signature-collection/src/screens-parliamentary/Constituency/index.tsx index c0ddcfdf8772..419a9c6bd199 100644 --- a/libs/portals/admin/signature-collection/src/screens-parliamentary/Constituency/index.tsx +++ b/libs/portals/admin/signature-collection/src/screens-parliamentary/Constituency/index.tsx @@ -131,12 +131,10 @@ export const Constituency = ({ ': ' + constituencyLists.length} - {allowedToProcess && ( - - )} + {constituencyLists.map((list) => (