From ea6cc03c3093b030d316a6d749183b6223cf12b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9E=C3=B3r=C3=B0ur=20H?= Date: Mon, 7 Oct 2024 11:09:29 +0000 Subject: [PATCH 1/2] feat(service-portal-health): Add extra doctor info to med cert (#16224) * Add extra doctor info to med cert * Fix * Update messages.ts * chore: nx format:write update dirty files --------- Co-authored-by: andes-it --- .../src/components/ExtraDoctors/index.tsx | 27 +++++++++++++++++++ .../service-portal/health/src/lib/messages.ts | 4 +++ .../MedicineCertificate.tsx | 10 +++++++ 3 files changed, 41 insertions(+) create mode 100644 libs/service-portal/health/src/components/ExtraDoctors/index.tsx diff --git a/libs/service-portal/health/src/components/ExtraDoctors/index.tsx b/libs/service-portal/health/src/components/ExtraDoctors/index.tsx new file mode 100644 index 000000000000..46006c7b4f70 --- /dev/null +++ b/libs/service-portal/health/src/components/ExtraDoctors/index.tsx @@ -0,0 +1,27 @@ +import { RightsPortalMethylDoctor } from '@island.is/api/schema' +import { Box, Text } from '@island.is/island-ui/core' +import { isDefined } from '@island.is/shared/utils' + +interface Props { + doctors?: RightsPortalMethylDoctor[] +} + +export const ExtraDoctors = ({ doctors }: Props) => { + const docs = doctors?.map((doctor) => doctor.name).filter(isDefined) + + if (!docs || docs.length === 0) { + return null + } + + return ( + + {docs.map((doc, i) => ( + + + {doc} + + + ))} + + ) +} diff --git a/libs/service-portal/health/src/lib/messages.ts b/libs/service-portal/health/src/lib/messages.ts index 6ea14565057b..5414196153db 100644 --- a/libs/service-portal/health/src/lib/messages.ts +++ b/libs/service-portal/health/src/lib/messages.ts @@ -940,6 +940,10 @@ export const messages = defineMessages({ id: 'sp.health:medicine-name-of-doctor', defaultMessage: 'Heiti læknis', }, + medicineNameOfDocExtra: { + id: 'sp.health:medicine-name-of-doc-extra', + defaultMessage: 'Aukalæknar skráðir á skírteini', + }, medicineCalculatorAddToPurchaseLabel: { id: 'sp.health:medicine-calculator-add-to-purchase-label', defaultMessage: 'Bæta {arg} við lyfjakaupalista', diff --git a/libs/service-portal/health/src/screens/MedicineCertificate/MedicineCertificate.tsx b/libs/service-portal/health/src/screens/MedicineCertificate/MedicineCertificate.tsx index 82d760c68404..2df649e26c8e 100644 --- a/libs/service-portal/health/src/screens/MedicineCertificate/MedicineCertificate.tsx +++ b/libs/service-portal/health/src/screens/MedicineCertificate/MedicineCertificate.tsx @@ -12,6 +12,7 @@ import { messages } from '../../lib/messages' import { useLocale } from '@island.is/localization' import { HealthPaths } from '../../lib/paths' import { Problem } from '@island.is/react-spa/shared' +import { ExtraDoctors } from '../../components/ExtraDoctors' type UseParams = { type: string @@ -101,6 +102,15 @@ export const MedicineCertificate = () => { valueColumnSpan={['6/12']} /> )} + {certificate.methylDoctors && certificate.methylDoctors.length && ( + } + labelColumnSpan={['6/12']} + valueColumnSpan={['6/12']} + /> + )} {certificate.approved !== null && ( Date: Mon, 7 Oct 2024 13:21:38 +0000 Subject: [PATCH 2/2] fix(portals-admin): locklist (#16279) * fix(portals-admin): locklist * tweak * msg id fix * tweak --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../signature-collection/src/lib/messages.ts | 19 ++++- .../List/paperSignees/index.tsx | 1 + .../src/screens-parliamentary/index.tsx | 2 +- .../completeReview/index.tsx | 51 ++++++------ .../completeReview/lockList/index.tsx | 78 +++++++++++++++++++ .../completeReview/lockList/lockList.graphql | 6 ++ 6 files changed, 126 insertions(+), 31 deletions(-) create mode 100644 libs/portals/admin/signature-collection/src/shared-components/completeReview/lockList/index.tsx create mode 100644 libs/portals/admin/signature-collection/src/shared-components/completeReview/lockList/lockList.graphql diff --git a/libs/portals/admin/signature-collection/src/lib/messages.ts b/libs/portals/admin/signature-collection/src/lib/messages.ts index 80f2890f11c3..da266b710980 100644 --- a/libs/portals/admin/signature-collection/src/lib/messages.ts +++ b/libs/portals/admin/signature-collection/src/lib/messages.ts @@ -422,7 +422,7 @@ export const m = defineMessages({ }, confirmListReviewedToggleBack: { id: 'admin-portal.signature-collection:confirmListReviewedToggleBack', - defaultMessage: 'Aflæsa úrvinnslu', + defaultMessage: 'Opna fyrir úrvinnslu', description: '', }, listReviewedModalDescription: { @@ -463,9 +463,24 @@ export const m = defineMessages({ defaultMessage: 'Úrvinnslu lokið', description: '', }, + lockList: { + id: 'admin-portal.signature-collection:lockList', + defaultMessage: 'Læsa söfnun', + description: '', + }, + lockListSuccess: { + id: 'admin-portal.signature-collection:lockListSuccess', + defaultMessage: 'Tókst að læsa söfnun', + description: '', + }, + lockListError: { + id: 'admin-portal.signature-collection:lockListError', + defaultMessage: 'Ekki tókst að læsa söfnun', + description: '', + }, toggleReviewError: { id: 'admin-portal.signature-collection:toggleReviewError', - defaultMessage: 'Ekki tókst loka úrvinnslu', + defaultMessage: 'Ekki tókst að loka úrvinnslu', description: '', }, toggleCollectionProcessSuccess: { 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 083cb10e2b7b..60556c7d06de 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 @@ -44,6 +44,7 @@ export const PaperSignees = ({ listId }: { listId: string }) => { listId, }, }, + skip: !nationalId.isValid(nationalIdInput) || !name, }) useEffect(() => { diff --git a/libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx b/libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx index 9ae00b303039..3a0b0b940abf 100644 --- a/libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx +++ b/libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx @@ -41,7 +41,7 @@ const ParliamentaryRoot = ({ variables: { input: { collectionId: collection?.id, - nationalId: searchTerm, + nationalId: searchTerm.replace(/[^0-9]/g, ''), }, }, skip: searchTerm.replace(/[^0-9]/g, '').length !== 10, 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 a7ad2862538a..96b5b1488381 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 @@ -6,6 +6,7 @@ import { useToggleListReviewMutation } from './toggleListReview.generated' import { useRevalidator } from 'react-router-dom' import { m } from '../../lib/messages' import { ListStatus } from '../../lib/utils' +import LockList from './lockList' const ActionReviewComplete = ({ listId, @@ -15,43 +16,38 @@ const ActionReviewComplete = ({ listStatus: string }) => { const { formatMessage } = useLocale() - const [modalSubmitReviewIsOpen, setModalSubmitReviewIsOpen] = useState(false) - const [toggleListReviewMutation, { loading }] = useToggleListReviewMutation() const { revalidate } = useRevalidator() + + const [modalSubmitReviewIsOpen, setModalSubmitReviewIsOpen] = useState(false) const listReviewed = listStatus && listStatus === ListStatus.Reviewed const modalText = listReviewed ? formatMessage(m.confirmListReviewedToggleBack) : formatMessage(m.confirmListReviewed) - const toggleReview = async () => { - try { - const res = await toggleListReviewMutation({ - variables: { - input: { - listId, - }, - }, - }) - if (res.data?.signatureCollectionAdminToggleListReview.success) { - toast.success(formatMessage(m.toggleReviewSuccess)) - setModalSubmitReviewIsOpen(false) - revalidate() - } else { - toast.error(formatMessage(m.toggleReviewError)) - } - } catch (e) { - toast.error(e.message) - } - } + const [toggleListReview, { loading }] = useToggleListReviewMutation({ + variables: { + input: { + listId, + }, + }, + onCompleted: () => { + setModalSubmitReviewIsOpen(false) + revalidate() + toast.success(formatMessage(m.toggleReviewSuccess)) + }, + onError: () => { + toast.error(formatMessage(m.toggleReviewError)) + }, + }) return ( - + + diff --git a/libs/portals/admin/signature-collection/src/shared-components/completeReview/lockList/index.tsx b/libs/portals/admin/signature-collection/src/shared-components/completeReview/lockList/index.tsx new file mode 100644 index 000000000000..8cf2e5903495 --- /dev/null +++ b/libs/portals/admin/signature-collection/src/shared-components/completeReview/lockList/index.tsx @@ -0,0 +1,78 @@ +import { useLocale } from '@island.is/localization' +import { Box, Button, Text, toast } from '@island.is/island-ui/core' +import { useState } from 'react' +import { Modal } from '@island.is/react/components' +import { useRevalidator } from 'react-router-dom' +import { m } from '../../../lib/messages' +import { ListStatus } from '../../../lib/utils' +import { useSignatureCollectionLockListMutation } from './lockList.generated' + +const ActionLockList = ({ + listId, + listStatus, +}: { + listId: string + listStatus: string +}) => { + const { formatMessage } = useLocale() + const { revalidate } = useRevalidator() + + const [modalLockListIsOpen, setModalLockListIsOpen] = useState(false) + + const [lockList, { loading: loadingLockList }] = + useSignatureCollectionLockListMutation({ + variables: { + input: { + listId, + }, + }, + onCompleted: () => { + setModalLockListIsOpen(false) + revalidate() + toast.success(formatMessage(m.lockListSuccess)) + }, + onError: () => { + toast.error(formatMessage(m.lockListError)) + }, + }) + + return ( + + + setModalLockListIsOpen(false)} + label={''} + closeButtonLabel={''} + > + + {formatMessage(m.lockList)} + + + + + + + ) +} + +export default ActionLockList diff --git a/libs/portals/admin/signature-collection/src/shared-components/completeReview/lockList/lockList.graphql b/libs/portals/admin/signature-collection/src/shared-components/completeReview/lockList/lockList.graphql new file mode 100644 index 000000000000..f67084926da8 --- /dev/null +++ b/libs/portals/admin/signature-collection/src/shared-components/completeReview/lockList/lockList.graphql @@ -0,0 +1,6 @@ +mutation SignatureCollectionLockList($input: SignatureCollectionListIdInput!) { + signatureCollectionLockList(input: $input) { + reasons + success + } +}