From 407969b94db6620528cc95892d15082675b380f8 Mon Sep 17 00:00:00 2001 From: albina Date: Tue, 15 Oct 2024 15:51:03 +0000 Subject: [PATCH] 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',