Skip to content

Commit

Permalink
feat(web): Journeyman list - display national id field (#15645)
Browse files Browse the repository at this point in the history
* Add national id field to journeyman table view

* Display publication date

* Allow for national id search

* Add field to gql model

* Change table header display name

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and oskarjs committed Aug 20, 2024
1 parent 927cde3 commit 609194d
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ import { GET_JOURNEYMAN_LICENCES_QUERY } from './queries'

const DEFAULT_PAGE_SIZE = 20
const DEFAULT_TABLE_MIN_HEIGHT = '800px'
const SEARCH_KEYS: (keyof JourneymanLicence)[] = ['name', 'dateOfPublication']
const SEARCH_KEYS: (keyof JourneymanLicence)[] = [
'name',
'dateOfPublication',
'nationalId',
]

interface JourneymanListProps {
slice: ConnectedComponent
Expand Down Expand Up @@ -113,6 +117,7 @@ const JourneymanList = ({ slice }: JourneymanListProps) => {
n('csvHeaderName', 'Nafn') as string,
n('csvHeaderProfession', 'Iðngrein') as string,
n('csvHeaderDateOfPublication', 'Útgáfuár') as string,
n('csvHeaderNationalId', 'Kennitala') as string,
]
const dataRows = []
for (const licence of licences) {
Expand All @@ -122,6 +127,7 @@ const JourneymanList = ({ slice }: JourneymanListProps) => {
licence.dateOfPublication // Útgáfuár
? format(new Date(licence.dateOfPublication), 'yyyy')
: '',
licence.nationalId ?? '',
])
}
return resolve(prepareCsvString(headerRow, dataRows))
Expand Down Expand Up @@ -262,8 +268,9 @@ const JourneymanList = ({ slice }: JourneymanListProps) => {
<T.Row>
<T.HeadData>{n('name', 'Nafn')}</T.HeadData>
<T.HeadData>{n('profession', 'Iðngrein')}</T.HeadData>
<T.HeadData>{n('dateOfPublication', 'Útgáfuár')}</T.HeadData>
<T.HeadData align="right">
{n('dateOfPublication', 'Útgáfuár')}
{n('nationalId', 'Kennitala')}
</T.HeadData>
</T.Row>
</T.Head>
Expand All @@ -287,7 +294,7 @@ const JourneymanList = ({ slice }: JourneymanListProps) => {
<T.Data>
{licences.dateOfPublication && (
<Box>
<Text textAlign="right" variant="small">
<Text variant="small">
{format(
new Date(licences.dateOfPublication),
'yyyy',
Expand All @@ -296,6 +303,13 @@ const JourneymanList = ({ slice }: JourneymanListProps) => {
</Box>
)}
</T.Data>
<T.Data>
<Box>
<Text textAlign="right" variant="small">
{licences.nationalId}
</Text>
</Box>
</T.Data>
</T.Row>
)
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const GET_JOURNEYMAN_LICENCES_QUERY = gql`
name
dateOfPublication
profession
nationalId
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class JourneymanLicence {

@Field({ nullable: true })
profession?: string

@Field({ nullable: true })
nationalId?: string
}

@ObjectType()
Expand Down
10 changes: 10 additions & 0 deletions libs/clients/syslumenn/src/clientConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3210,6 +3210,9 @@
"nafn": {
"type": "string"
},
"kennitala": {
"type": "string"
},
"idngrein": {
"type": "string"
},
Expand Down Expand Up @@ -3432,6 +3435,9 @@
"nafn": {
"type": "string"
},
"kennitala": {
"type": "string"
},
"starfsrettindi": {
"type": "string"
}
Expand Down Expand Up @@ -4626,6 +4632,10 @@
},
"malsvari": {
"$ref": "#/definitions/Malsvari"
},
"arfshlutfall": {
"type": "number",
"format": "decimal"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions libs/clients/syslumenn/src/lib/syslumennClient.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ export interface JourneymanLicence {
name?: string
dateOfPublication?: Date
profession?: string
nationalId?: string
}

export interface ProfessionRight {
Expand Down
1 change: 1 addition & 0 deletions libs/clients/syslumenn/src/lib/syslumennClient.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ export const mapJourneymanLicence = (
name: licence.nafn,
dateOfPublication: licence.gildirFra,
profession: licence.idngrein,
nationalId: licence.kennitala,
}
}

Expand Down

0 comments on commit 609194d

Please sign in to comment.