Skip to content

Commit

Permalink
Map locationList og fjern Location fra stilling
Browse files Browse the repository at this point in the history
  • Loading branch information
Wiklem committed Oct 25, 2024
1 parent 0f99652 commit 6fcd722
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 102 deletions.
2 changes: 1 addition & 1 deletion src/Stilling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export type Stilling = {
properties: Properties;

// Arbeidssted
location: Location;
locationList: Location[];

// Fra Altinn
employer: Employer;
Expand Down
161 changes: 75 additions & 86 deletions src/mock/eksempler/stilling.json
Original file line number Diff line number Diff line change
@@ -1,133 +1,122 @@
{
"id": 593547,
"uuid": "3446abca-2b01-4409-b2fb-0af0f668d204",
"created": "2020-03-16T14:55:21.314124",
"createdBy": "pam-rekrutteringsbistand",
"updated": "2020-03-16T15:02:53.140067",
"updatedBy": "pam-rekrutteringsbistand",
"mediaList": [],
"activationOnPublishingDate": false,
"administration": {
"comments": null,
"id": 1424451,
"navIdent": "A123456",
"remarks": [],
"reportee": "Mossby, Joare Mangstuen",
"status": "DONE"
},
"businessName": "MOSSBY TAXI AS",
"categoryList": [
{
"categoryType": "STYRK08NAV",
"code": "8322.02",
"description": null,
"id": 5396,
"name": "Drosjesjåfør",
"parentId": 5394
}
],
"contactList": [
{
"name": "Joare Mangstuen Mossby",
"email": "[email protected]",
"name": "Joare Mangstuen Mossby",
"phone": "48173919",
"role": null,
"title": "KAM"
}
],
"title": "Jobbservice Mossby taxi søker to sjåfører. Kurs og opplæring gis. ",
"status": "ACTIVE",
"privacy": "INTERNAL_NOT_SHOWN",
"source": "DIR",
"medium": "DIR",
"reference": "d328d737-1965-487b-a1bb-9f3872e1c1e7",
"published": "2020-03-16T14:59:46.259214",
"expires": "2020-03-28T02:00:00",
"created": "2020-03-16T14:55:21.314124",
"createdBy": "pam-rekrutteringsbistand",
"deactivatedByExpiry": false,
"employer": {
"id": 441854,
"uuid": "9983a5ef-e573-4ee8-b73c-7e617a1d896a",
"contactList": [],
"created": "2019-09-06T14:16:56.237362",
"createdBy": "pam-ad",
"updated": "2020-03-16T14:59:46.255943",
"updatedBy": "pam-ad",
"mediaList": [],
"contactList": [],
"deactivated": null,
"employees": 0,
"id": 441854,
"location": {
"address": "Testgaten 1",
"postalCode": "0001",
"county": "VIKEN",
"municipal": "DRAMMEN",
"municipalCode": "3005",
"city": "DRAMMEN",
"country": "NORGE",
"county": "VIKEN",
"latitude": "59.6",
"longitude": "10.1"
"longitude": "10.1",
"municipal": "DRAMMEN",
"municipalCode": "3005",
"postalCode": "0001"
},
"locationList": [
{
"address": "Testgaten 1",
"postalCode": "3041",
"county": "VIKEN",
"municipal": "DRAMMEN",
"municipalCode": "3005",
"city": "DRAMMEN",
"country": "NORGE",
"county": "VIKEN",
"latitude": "59.6",
"longitude": "10.1"
"longitude": "10.1",
"municipal": "DRAMMEN",
"municipalCode": "3005",
"postalCode": "3041"
}
],
"properties": {
"nace2": "[{\"code\":\"52.214\",\"name\":\"Drift av taxisentraler og annen formidling av persontransport\"}]"
},
"mediaList": [],
"name": "MOSSBY TAXI AS",
"orgform": "BEDR",
"orgnr": "000000000",
"status": "ACTIVE",
"parentOrgnr": "000000000",
"properties": {
"nace2": "[{\"code\":\"52.214\",\"name\":\"Drift av taxisentraler og annen formidling av persontransport\"}]"
},
"publicName": "MOSSBY TAXI AS",
"deactivated": null,
"orgform": "BEDR",
"employees": 0
},
"administration": {
"id": 1424451,
"status": "DONE",
"comments": null,
"reportee": "Mossby, Joare Mangstuen",
"remarks": [],
"navIdent": "A123456"
},
"location": {
"address": null,
"postalCode": null,
"county": "VIKEN",
"municipal": "DRAMMEN",
"municipalCode": "3005",
"city": null,
"country": "NORGE",
"latitude": null,
"longitude": null
"status": "ACTIVE",
"updated": "2020-03-16T14:59:46.255943",
"updatedBy": "pam-ad",
"uuid": "9983a5ef-e573-4ee8-b73c-7e617a1d896a"
},
"expires": "2020-03-28T02:00:00",
"firstPublished": true,
"id": 593547,
"locationList": [
{
"address": null,
"postalCode": null,
"county": "VIKEN",
"municipal": "DRAMMEN",
"municipalCode": "3005",
"city": null,
"country": "NORGE",
"county": "VIKEN",
"latitude": null,
"longitude": null
}
],
"categoryList": [
{
"id": 5396,
"code": "8322.02",
"categoryType": "STYRK08NAV",
"name": "Drosjesjåfør",
"description": null,
"parentId": 5394
"longitude": null,
"municipal": "DRAMMEN",
"municipalCode": "3005",
"postalCode": null
}
],
"mediaList": [],
"medium": "DIR",
"privacy": "INTERNAL_NOT_SHOWN",
"properties": {
"extent": "Heltid",
"workhours": "[\"Dagtid\",\"Kveld\",\"Natt\"]",
"adtext": "<p>Mossby Taxi trenger to sjåfører på en bil. Arbeidstider er både skolekjøring fra morgenen, dagkjøring og oppdrag kveld/helg. Kandidatene må ikke erfaring som taxisjåfør siden full opplæring og kur gis. Men man ønsker kandidater som har interesse og ønske å jobbe som taxisjåfør. Kjøring i Drammensdistriktet. </p><p>Oppstart: Snarest</p>",
"applicationdue": "Snarest",
"workday": "[\"Lørdag\",\"Ukedager\"]",
"searchtags": "[{\"label\":\"Taxisjåfør\",\"score\":1.0},{\"label\":\"Bussjåfør\",\"score\":0.15123688},{\"label\":\"Taxi guide\",\"score\":0.15123688}]",
"classification_input_source": "categoryName",
"engagementtype": "Fast",
"extent": "Heltid",
"jobtitle": "Drosjesjåfør",
"positioncount": "2",
"engagementtype": "Fast",
"starttime": "Etter avtale",
"classification_input_source": "categoryName",
"searchtags": "[{\"label\":\"Taxisjåfør\",\"score\":1.0},{\"label\":\"Bussjåfør\",\"score\":0.15123688},{\"label\":\"Taxi guide\",\"score\":0.15123688}]",
"sector": "Privat",
"adtext": "<p>Mossby Taxi trenger to sjåfører på en bil. Arbeidstider er både skolekjøring fra morgenen, dagkjøring og oppdrag kveld/helg. Kandidatene må ikke erfaring som taxisjåfør siden full opplæring og kur gis. Men man ønsker kandidater som har interesse og ønske å jobbe som taxisjåfør. Kjøring i Drammensdistriktet. </p><p>Oppstart: Snarest</p>"
"starttime": "Etter avtale",
"workday": "[\"Lørdag\",\"Ukedager\"]",
"workhours": "[\"Dagtid\",\"Kveld\",\"Natt\"]"
},
"published": "2020-03-16T14:59:46.259214",
"publishedByAdmin": "2020-03-16T14:59:46.259214",
"businessName": "MOSSBY TAXI AS",
"firstPublished": true,
"deactivatedByExpiry": false,
"activationOnPublishingDate": false,
"rekruttering": null
"reference": "d328d737-1965-487b-a1bb-9f3872e1c1e7",
"rekruttering": null,
"source": "DIR",
"status": "ACTIVE",
"title": "Jobbservice Mossby taxi søker to sjåfører. Kurs og opplæring gis. ",
"updated": "2020-03-16T15:02:53.140067",
"updatedBy": "pam-rekrutteringsbistand",
"uuid": "3446abca-2b01-4409-b2fb-0af0f668d204"
}
2 changes: 1 addition & 1 deletion src/visning/SosialeMedier.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Link } from '@navikt/ds-react';
import React, { FunctionComponent, Fragment } from 'react';
import { Fragment, FunctionComponent } from 'react';
import { Properties } from '../Stilling';

type Props = { properties: Properties };
Expand Down
21 changes: 11 additions & 10 deletions src/visning/Stillingsinfo.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import React, { FunctionComponent } from 'react';
import { Dialog } from '@navikt/ds-icons';
import { Link } from '@navikt/ds-react';
import { FunctionComponent } from 'react';

import { logEvent } from '../amplitude/amplitude';
import { Stilling } from '../Stilling';
import Infopanel from './Infopanel';
import Lenkeknapp from './Lenkeknapp';
import SosialeMedier from './SosialeMedier';
import {
hentSøknadsfrist,
hentAdresse,
formaterDato,
lagInnerHtml,
hentAdresse,
hentAdresser,
hentBedriftensVisningsnavn,
hentSøknadsfrist,
lagInnerHtml,
} from './stillingUtils';
import { Stilling } from '../Stilling';
import Infopanel from './Infopanel';
import Tabell, { Rad } from './tabell/Tabell';
import Lenkeknapp from './Lenkeknapp';
import SosialeMedier from './SosialeMedier';
import { logEvent } from '../amplitude/amplitude';
import css from './Visning.module.css';

interface Props {
Expand Down Expand Up @@ -81,7 +82,7 @@ const Stillingsinfo: FunctionComponent<Props> = ({ stilling }) => {
<Infopanel tittel="Om stillingen">
<Tabell>
<Rad label="Stillingstittel">{properties.jobtitle}</Rad>
<Rad label="Arbeidssted">{hentAdresse(stilling.location)}</Rad>
<Rad label="Arbeidssted">{hentAdresser(stilling.locationList)}</Rad>
<Rad label="Ansettelsesform">{properties.engagementtype}</Rad>
<Rad label="Arbeidstidsordning">{properties.jobarrangement}</Rad>
<Rad label="Omfang">{properties.extent}</Rad>
Expand Down
8 changes: 4 additions & 4 deletions src/visning/Visning.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { FunctionComponent } from 'react';
import { Alert, Heading, Link } from '@navikt/ds-react';
import { FunctionComponent } from 'react';

import { hentKommuneOgEllerBy, lagInnerHtml, hentBedriftensVisningsnavn } from './stillingUtils';
import { Stilling } from '../Stilling';
import NaturligLinjeskift from './NaturligLinjeskift';
import Stillingsinfo from './Stillingsinfo';
import { hentAdresser, hentBedriftensVisningsnavn, lagInnerHtml } from './stillingUtils';
import css from './Visning.module.css';

interface Props {
Expand All @@ -14,8 +14,8 @@ interface Props {
const Visning: FunctionComponent<Props> = ({ stilling }) => {
const annonsetekst = lagInnerHtml(stilling.properties.adtext);
const stillingPåArbeidsplassen = `https://arbeidsplassen.nav.no/stillinger/stilling/${stilling.uuid}`;
const hvemOgHvor = `${hentBedriftensVisningsnavn(stilling)}, ${hentKommuneOgEllerBy(
stilling.location
const hvemOgHvor = `${hentBedriftensVisningsnavn(stilling)}, ${hentAdresser(
stilling.locationList
)}`;

return (
Expand Down
8 changes: 8 additions & 0 deletions src/visning/stillingUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ export const hentAdresse = (location: Location) => {
} else return hentKommuneOgEllerBy(location);
};

export const hentAdresser = (locationList: Location[]) => {
if (locationList && locationList.length) {
return locationList.map((location) => hentAdresse(location));
}

return '';
};

// Hentet fra 'is-uuid': https://github.com/afram/is-uuid/blob/master/lib/is-uuid.js
export const erUuid = (kanskjeUuid: string) => {
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
Expand Down

0 comments on commit 6fcd722

Please sign in to comment.