Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(portals-admin): Parliamentary collection #16142

Merged
merged 11 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 102 additions & 5 deletions libs/portals/admin/signature-collection/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export const m = defineMessages({
},
signatureListsTitle: {
id: 'admin-portal.signature-collection:signatureLists',
defaultMessage: 'Meðmælasafnanir',
description: '',
},
signatureListsTitlePresidential: {
id: 'admin-portal.signature-collection-parliamentary:signatureLists',
defaultMessage: 'Forsetakosningar',
description: '',
},
Expand Down Expand Up @@ -187,6 +192,38 @@ export const m = defineMessages({
description: '',
},

/* Hætta við söfnun modal */
cancelCollectionButton: {
id: 'dmin-portal.signature-collection:cancelCollectionButton',
defaultMessage: 'Hætta við söfnun meðmæla',
description: '',
},
cancelCollectionModalMessage: {
id: 'dmin-portal.signature-collection:cancelCollectionModalMessage',
defaultMessage: 'Þú ert að fara að hætta við söfnun meðmæla. Ertu viss?',
description: '',
},
cancelCollectionModalConfirmButton: {
id: 'dmin-portal.signature-collection:modalConfirmButton',
defaultMessage: 'Já, hætta við',
description: '',
},
cancelCollectionModalCancelButton: {
id: 'dmin-portal.signature-collection:cancelCollectionModalCancelButton',
defaultMessage: 'Nei, hætta við',
albinagu marked this conversation as resolved.
Show resolved Hide resolved
description: '',
},
cancelCollectionModalToastError: {
id: 'dmin-portal.signature-collection:modalToastError',
defaultMessage: 'Ekki tókst að hætta við söfnun meðmæla',
description: '',
},
cancelCollectionModalToastSuccess: {
id: 'dmin-portal.signature-collection:cancelCollectionModalToastSuccess',
defaultMessage: 'Tókst að hætta við söfnun meðmæla',
description: '',
},

// View list
singleList: {
id: 'admin-portal.signature-collection:singleList',
Expand Down Expand Up @@ -490,14 +527,74 @@ export const m = defineMessages({
defaultMessage: 'Loka lista',
description: '',
},
paperSigneesHeader: {
id: 'admin-portal.signature-collection:paperSigneesHeader',
defaultMessage: 'Skrá meðmæli af blaði',
description: '',
},
paperSigneesClearButton: {
id: 'admin-portal.signature-collection:paperSigneesClearButton',
defaultMessage: 'Hreinsa',
description: '',
},
paperNumber: {
id: 'admin-portal.signature-collection:paperNumber',
defaultMessage: 'Blaðsíðunúmer',
description: '',
},
editPaperNumber: {
id: 'admin-portal.signature-collection:editPaperNumber',
defaultMessage: 'Breyta blaðsíðunúmeri',
description: '',
},
saveEditPaperNumber: {
id: 'admin-portal.signature-collection:saveEditPaperNumber',
defaultMessage: 'Uppfæra blaðsíðunúmer',
description: '',
},
paperSigneeName: {
id: 'admin-portal.signature-collection:paperSigneeName',
defaultMessage: 'Nafn meðmælanda',
description: '',
},
signPaperSigneeButton: {
id: 'admin-portal.signature-collection:signPaperSigneeButton',
defaultMessage: 'Skrá meðmæli á lista',
description: '',
},
paperSigneeTypoTitle: {
id: 'admin-portal.signature-collection:paperSigneeTypoTitle',
defaultMessage: 'Kennitala ekki á réttu formi',
description: '',
},
paperSigneeTypoMessage: {
id: 'admin-portal.signature-collection:paperSigneeTypoMessage',
defaultMessage: 'Vinsamlegast athugið kennitöluna og reynið aftur',
description: '',
},
paperSigneeCantSignTitle: {
id: 'admin-portal.signature-collection:paperSigneeCantSignTitle',
defaultMessage: 'Ekki er hægt að skrá meðmæli',
description: '',
},
paperSigneeCantSignMessage: {
id: 'admin-portal.signature-collection:paperSigneeCantSign',
defaultMessage: 'Kennitala uppfyllir ekki skilyrði fyrir að skrá meðmæli',
description: '',
},
paperSigneeSuccess: {
id: 'admin-portal.signature-collection:paperSigneeSuccess',
defaultMessage: 'Meðmæli skráð',
description: '',
},
paperSigneeError: {
id: 'admin-portal.signature-collection:paperSigneeError',
defaultMessage: 'Ekki tókst að skrá meðmæli',
description: '',
},
})

export const parliamentaryMessages = defineMessages({
listTitle: {
id: 'admin-portal.signature-collection-parliamentary:listTitle',
defaultMessage: 'Alþingiskosningar',
description: '',
},
signatureListsTitle: {
id: 'admin-portal.signature-collection-parliamentary:signatureLists',
defaultMessage: 'Alþingiskosningar',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const signatureCollectionNavigation: PortalNavigationItem = {
path: SignatureCollectionPaths.ParliamentaryRoot,
children: [
{
name: parliamentaryMessages.listTitle,
name: parliamentaryMessages.signatureListsTitle,
path: SignatureCollectionPaths.ParliamentaryRoot,
activeIfExact: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { m, parliamentaryMessages } from '../../lib/messages'
import {
ActionCard,
Box,
Breadcrumbs,
DialogPrompt,
Icon,
Tag,
GridColumn,
GridContainer,
GridRow,
Expand Down Expand Up @@ -44,6 +48,23 @@ export const Constituency = () => {
offset={['0', '0', '0', '1/12']}
span={['12/12', '12/12', '12/12', '8/12']}
>
<Box marginBottom={3}>
<Breadcrumbs
items={[
{
title: formatMessage('Yfirlit'),
albinagu marked this conversation as resolved.
Show resolved Hide resolved
href: `/stjornbord${SignatureCollectionPaths.ParliamentaryRoot}`,
},
{
title: constituencyName,
href: `/stjornbord${SignatureCollectionPaths.ParliamentaryConstituency.replace(
':constituencyName',
constituencyName,
)}`,
},
]}
/>
</Box>
<IntroHeader
title={constituencyName}
intro={
Expand Down Expand Up @@ -75,7 +96,11 @@ export const Constituency = () => {
{constituencyLists.map((list) => (
<ActionCard
key={list.id}
eyebrow={constituencyName}
eyebrow={
formatMessage(m.listEndTime) +
': ' +
new Date(list.endTime).toLocaleDateString()
}
albinagu marked this conversation as resolved.
Show resolved Hide resolved
heading={list.title.split(' - ')[0]}
progressMeter={{
currentProgress: list.numberOfSignatures ?? 0,
Expand All @@ -94,6 +119,47 @@ export const Constituency = () => {
)
},
}}
tag={{
label: 'Cancel collection',
albinagu marked this conversation as resolved.
Show resolved Hide resolved
renderTag: () => (
<DialogPrompt
baseId="cancel_collection_dialog"
albinagu marked this conversation as resolved.
Show resolved Hide resolved
title={
formatMessage(m.cancelCollectionButton) +
' - ' +
list.area?.name
}
albinagu marked this conversation as resolved.
Show resolved Hide resolved
description={formatMessage(
m.cancelCollectionModalMessage,
)}
ariaLabel="delete"
disclosureElement={
<Tag outlined variant="red">
<Box display="flex" alignItems="center">
<Icon
icon="trash"
size="small"
type="outline"
/>
</Box>
</Tag>
}
onConfirm={() => {
//onCancelCollection(list.id)
}}
albinagu marked this conversation as resolved.
Show resolved Hide resolved
buttonTextConfirm={formatMessage(
m.cancelCollectionModalConfirmButton,
)}
buttonPropsConfirm={{
variant: 'primary',
colorScheme: 'destructive',
}}
buttonTextCancel={formatMessage(
m.cancelCollectionModalCancelButton,
)}
/>
),
}}
/>
))}
</Stack>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { GridColumn, GridContainer, GridRow } from '@island.is/island-ui/core'
import {
Box,
Breadcrumbs,
GridColumn,
GridContainer,
GridRow,
} from '@island.is/island-ui/core'
import { useLocale } from '@island.is/localization'
import { IntroHeader, PortalNavigation } from '@island.is/portals/core'
import { signatureCollectionNavigation } from '../../lib/navigation'
import { m, parliamentaryMessages } from '../../lib/messages'
import { useLoaderData } from 'react-router-dom'
import { SignatureCollectionList } from '@island.is/api/schema'
import { PaperSignees } from './paperSignees'
import { SignatureCollectionPaths } from '../../lib/paths'
import ActionExtendDeadline from '../../shared-components/extendDeadline'
import Signees from '../../shared-components/signees'
import ActionReviewComplete from '../../shared-components/completeReview'
Expand Down Expand Up @@ -32,6 +40,24 @@ const List = () => {
offset={['0', '0', '0', '1/12']}
span={['12/12', '12/12', '12/12', '8/12']}
>
<Box marginBottom={3}>
<Breadcrumbs
items={[
{
title: formatMessage('Yfirlit'),
href: `/stjornbord${SignatureCollectionPaths.ParliamentaryRoot}`,
},
{
title: list.area.name,
href: `/stjornbord${SignatureCollectionPaths.ParliamentaryConstituency.replace(
':constituencyName',
list.area.name,
)}`,
},
{ title: formatMessage(m.viewList) },
]}
/>
</Box>
<IntroHeader
title={list?.title}
intro={formatMessage(parliamentaryMessages.signatureListsIntro)}
Expand All @@ -40,6 +66,7 @@ const List = () => {
/>
<ActionExtendDeadline listId={list.id} endTime={list.endTime} />
<Signees numberOfSignatures={list.numberOfSignatures ?? 0} />
<PaperSignees listId={list.id} />
<ActionReviewComplete listId={list.id} />
</GridColumn>
</GridRow>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
query Identity($input: IdentityInput!) {
identity(input: $input) {
nationalId
type
name
}
}

query CanSign($input: SignatureCollectionCanSignFromPaperInput!) {
signatureCollectionCanSignFromPaper(input: $input)
}
Loading
Loading