From f1e388e6eb74a5d10524bf0853101a159033b1b4 Mon Sep 17 00:00:00 2001 From: albina Date: Tue, 15 Oct 2024 14:28:16 +0000 Subject: [PATCH 1/4] tweaks --- .../signature-collection/src/lib/messages.ts | 11 ++++++++++ .../screens/Parliamentary/OwnerView/index.tsx | 22 ++++++++++++++----- .../src/screens/Parliamentary/index.tsx | 13 ++++++++++- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/libs/service-portal/signature-collection/src/lib/messages.ts b/libs/service-portal/signature-collection/src/lib/messages.ts index 510616d08ca2..c683b891158a 100644 --- a/libs/service-portal/signature-collection/src/lib/messages.ts +++ b/libs/service-portal/signature-collection/src/lib/messages.ts @@ -354,6 +354,17 @@ export const m = defineMessages({ defaultMessage: 'Umsjónaraðilar', description: '', }, + noSupervisors: { + id: 'sp.signatureCollection:noSupervisors', + defaultMessage: 'Enginn umsjónaraðili skráður', + description: '', + }, + supervisorsTooltip: { + id: 'sp.signatureCollection:supervisorsTooltip', + defaultMessage: + 'Umsjónaraðilar hafa aðgang að öllum upplýsingum safnananna en geta ekki eytt söfnununum.', + description: '', + }, add: { id: 'sp.signatureCollection:add', defaultMessage: 'Bæta við', diff --git a/libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx b/libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx index 23f020c6afc6..5a3b627f072c 100644 --- a/libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx +++ b/libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx @@ -33,8 +33,11 @@ import { formatNationalId } from '@island.is/portals/core' const OwnerView = ({ currentCollection, + // list holder is an individual who owns a list or has a delegation of type Procuration Holder + isListHolder, }: { currentCollection: SignatureCollection + isListHolder: boolean }) => { const navigate = useNavigate() const location = useLocation() @@ -80,7 +83,8 @@ const OwnerView = ({ color="blue400" /> - {!loadingOwnerLists && + {isListHolder && + !loadingOwnerLists && listsForOwner?.length < currentCollection?.areas.length && ( ( @@ -168,10 +172,12 @@ const OwnerView = ({ /> ), } - : { + : !list.active + ? { label: formatMessage(m.listSubmitted), variant: 'blueberry', } + : undefined } /> @@ -187,7 +193,11 @@ const OwnerView = ({ > {formatMessage(m.supervisors) + ' '} - + @@ -207,13 +217,15 @@ const OwnerView = ({ - ) : ( + ) : collectors.length ? ( collectors.map((collector) => ( {collector.name} {formatNationalId(collector.nationalId)} )) + ) : ( + {formatMessage(m.noSupervisors)} )} 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 af20c64d5aad..869a33619124 100644 --- a/libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx +++ b/libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx @@ -9,12 +9,15 @@ import { m } from '../../lib/messages' import OwnerView from './OwnerView' import SigneeView from '../shared/SigneeView' import { useGetCurrentCollection, useIsOwner } from '../../hooks' +import { useUserInfo } from '@island.is/auth/react' +import { AuthDelegationType } from '../../types/schema' const SignatureListsParliamentary = () => { useNamespaces('sp.signatureCollection') const { formatMessage } = useLocale() const { isOwner, loadingIsOwner } = useIsOwner() + const userInfo = useUserInfo() const { currentCollection, loadingCurrentCollection } = useGetCurrentCollection() @@ -30,7 +33,15 @@ const SignatureListsParliamentary = () => { {!currentCollection?.isPresidential ? ( isOwner.success ? ( - + ) : ( ) From 407969b94db6620528cc95892d15082675b380f8 Mon Sep 17 00:00:00 2001 From: albina Date: Tue, 15 Oct 2024 15:51:03 +0000 Subject: [PATCH 2/4] tweak - create list --- .../src/forms/Draft.ts | 157 +----------------- 1 file changed, 8 insertions(+), 149 deletions(-) diff --git a/libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts b/libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts index 1cf3776bd6d1..65ec1afc1985 100644 --- a/libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts +++ b/libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts @@ -9,18 +9,19 @@ import { buildPhoneField, buildSection, buildSubmitField, - buildTableRepeaterField, buildTextField, getValueViaPath, } from '@island.is/application/core' import { DefaultEvents, Form, FormModes } from '@island.is/application/types' -import { Application, UserProfile } from '@island.is/api/schema' +import { + Application, + UserProfile, +} from '@island.is/api/schema' import { format as formatNationalId } from 'kennitala' import Logo from '../../assets/Logo' import { m } from '../lib/messages' import { formatPhone } from '../lib/utils' -import { Manager, Supervisor } from '../lib/constants' import { Collection } from '@island.is/clients/signature-collection' import { Signee } from '@island.is/clients/signature-collection' @@ -175,89 +176,6 @@ export const Draft: Form = buildForm({ }), ], }), - /* Hiding this screen as for now - buildSection({ - id: 'managers', - title: m.managersAndSupervisors, - children: [ - buildMultiField({ - id: 'managers', - title: m.managersAndSupervisorsTitle, - description: '', - children: [ - buildTableRepeaterField({ - id: 'managers', - title: m.managers, - description: m.managersDescription, - addItemButtonText: m.addManager, - marginTop: 0, - fields: { - manager: { - component: 'nationalIdWithName', - }, - constituency: { - component: 'select', - label: m.constituency, - width: 'full', - options: [ - { - value: m.allConstituencies.defaultMessage, - label: m.allConstituencies, - }, - ], - }, - }, - table: { - header: [m.nationalId, m.name, m.constituency], - rows: ['nationalId', 'name', 'constituency'], - format: { - nationalId: (v) => formatNationalId(v), - }, - }, - }), - buildTableRepeaterField({ - id: 'supervisors', - title: m.supervisors, - description: m.supervisorsDescription, - addItemButtonText: m.addSupervisor, - marginTop: 5, - fields: { - supervisor: { - component: 'nationalIdWithName', - }, - constituency: { - component: 'select', - label: m.constituency, - width: 'full', - isMulti: true, - options: (application) => { - return ( - application.externalData.parliamentaryCollection - .data as Collection - )?.areas.map((area) => ({ - value: `${area.id}|${area.name}`, - label: area.name, - })) - }, - }, - }, - table: { - header: [m.nationalId, m.name, m.constituency], - rows: ['nationalId', 'name', 'constituency'], - format: { - nationalId: (v) => formatNationalId(v), - constituency: (v) => { - return (v as unknown as string[]) - .map((e) => e.split('|')[1]) - .join(', ') - }, - }, - }, - }), - ], - }), - ], - }),*/ buildSection({ id: 'overview', title: m.overview, @@ -363,7 +281,10 @@ export const Draft: Form = buildForm({ title: '', items: ({ answers }) => { return (answers.constituency as string[]).map((c: string) => ({ - heading: 'Flokkur 1 - ' + c.split('|')[1], + heading: + getValueViaPath(answers, 'list.name') + + ' - ' + + c.split('|')[1], progressMeter: { currentProgress: 0, maxProgress: 350, @@ -372,68 +293,6 @@ export const Draft: Form = buildForm({ })) }, }), - /*buildDescriptionField({ - id: 'space4', - title: '', - space: 'gutter', - }), - buildDescriptionField({ - id: 'managersHeader', - title: m.managers, - titleVariant: 'h3', - space: 'gutter', - marginBottom: 3, - condition: (answers) => - !!(answers.managers as Array)?.length, - }), - buildKeyValueField({ - label: '', - width: 'full', - value: ({ answers }) => { - return (answers.managers as Array) - .map( - (m: Manager) => - m.manager.name + - ' - ' + - formatNationalId(m.manager.nationalId) + - ' - ' + - m.constituency, - ) - .join('\n') - }, - }), - buildDescriptionField({ - id: 'space5', - title: '', - space: 'gutter', - }), - buildDescriptionField({ - id: 'supervisorsHeader', - title: m.supervisors, - titleVariant: 'h3', - space: 'gutter', - marginBottom: 3, - condition: (answers) => - !!(answers.supervisors as Array)?.length, - }), - buildKeyValueField({ - label: '', - width: 'full', - value: ({ answers }) => { - return (answers.supervisors as Array) - .map( - (s: Supervisor) => - s.supervisor.name + - ' - ' + - formatNationalId(s.supervisor.nationalId) + - ' - ' + - (s.constituency as unknown as string[]) - .map((c) => c.split('|')[1]) - .join(', '), - ) - .join('\n') - }, - }),*/ buildSubmitField({ id: 'submit', placement: 'footer', From 3b65a215937baf63cc4e94f920ebd3f58a84a25c Mon Sep 17 00:00:00 2001 From: albina Date: Tue, 15 Oct 2024 15:59:51 +0000 Subject: [PATCH 3/4] copylink --- .../parliamentary-list-creation/src/fields/CopyLink/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/application/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.tsx b/libs/application/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.tsx index b551805ad303..15d92f497928 100644 --- a/libs/application/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.tsx +++ b/libs/application/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.tsx @@ -7,12 +7,14 @@ import { FC } from 'react' export const CopyLink: FC = ({ application }) => { const { formatMessage } = useLocale() + const { slug } = application.externalData.createLists.data as { slug: string } + return ( {formatMessage(m.shareList)} - + ) } From c9fb816e2fc1ef5c59258d53392fac9598382425 Mon Sep 17 00:00:00 2001 From: andes-it Date: Tue, 15 Oct 2024 16:04:53 +0000 Subject: [PATCH 4/4] chore: nx format:write update dirty files --- .../src/fields/CopyLink/index.tsx | 5 ++++- .../parliamentary-list-creation/src/forms/Draft.ts | 5 +---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/application/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.tsx b/libs/application/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.tsx index 15d92f497928..c47a6bc1ad73 100644 --- a/libs/application/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.tsx +++ b/libs/application/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.tsx @@ -14,7 +14,10 @@ export const CopyLink: FC = ({ application }) => { {formatMessage(m.shareList)} - + ) } diff --git a/libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts b/libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts index 65ec1afc1985..aba2b273173c 100644 --- a/libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts +++ b/libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts @@ -13,10 +13,7 @@ import { getValueViaPath, } from '@island.is/application/core' import { DefaultEvents, Form, FormModes } from '@island.is/application/types' -import { - Application, - UserProfile, -} from '@island.is/api/schema' +import { Application, UserProfile } from '@island.is/api/schema' import { format as formatNationalId } from 'kennitala' import Logo from '../../assets/Logo'