From 4ab6b1dcccf88bb6e138d3cfaa7beeb2172b2dec Mon Sep 17 00:00:00 2001 From: Wiklem Date: Tue, 3 Dec 2024 09:23:31 +0100 Subject: [PATCH] Fjern antall stillinger for jobbmesse (#261) --- .github/workflows/deploy.yml | 2 +- src/stilling/stilling/Stilling.tsx | 2 ++ src/stilling/stilling/adValidationReducer.ts | 19 +++++++------- src/stilling/stilling/edit/Edit.tsx | 4 ++- .../PraktiskeOpplysninger.tsx | 25 +++++++++++-------- 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index eb57f71b..7b52cf6b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -45,7 +45,7 @@ jobs: deploy-til-dev: name: Deploy til dev-gcp needs: bygg-og-push-docker-image - if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/legger-til-ferdigstilt-hendelse-varsling' + if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/jobbmesse-antall' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/src/stilling/stilling/Stilling.tsx b/src/stilling/stilling/Stilling.tsx index f01e6b93..9704bb9e 100644 --- a/src/stilling/stilling/Stilling.tsx +++ b/src/stilling/stilling/Stilling.tsx @@ -56,6 +56,7 @@ const Stilling = () => { const stillingsinfo = useSelector((state: State) => state.stillingsinfoData); const erFormidling = stillingsinfo.stillingskategori === Stillingskategori.Formidling; + const erJobbmesse = stillingsinfo.stillingskategori === Stillingskategori.Jobbmesse; const { kandidatlisteId, mutate } = useKandidatlisteId(uuid); @@ -185,6 +186,7 @@ const Stilling = () => { ) : ( diff --git a/src/stilling/stilling/adValidationReducer.ts b/src/stilling/stilling/adValidationReducer.ts index 3e1563a3..d75c99d8 100644 --- a/src/stilling/stilling/adValidationReducer.ts +++ b/src/stilling/stilling/adValidationReducer.ts @@ -1,4 +1,4 @@ -import { Privacy } from 'felles/domene/stilling/Stilling'; +import { Privacy, Stillingskategori } from 'felles/domene/stilling/Stilling'; import moment from 'moment'; import { put, select, takeLatest } from 'redux-saga/effects'; import { State } from '../redux/store'; @@ -400,16 +400,17 @@ function* validateEngagementType(): Generator { function* validatePositionCount() { const state: State = yield select(); const positioncount = state.adData?.properties.positioncount; - const error = positioncount && !positioncount.match(/^[1-9]\d*$/); - if (valueIsNotSet(positioncount) || error) { - yield addValidationError({ - field: 'positioncount', - message: 'Antall stillinger mangler', - }); - } else { - yield removeValidationError({ field: 'positioncount' }); + if (state.stillingsinfoData.stillingskategori !== Stillingskategori.Jobbmesse) { + if (valueIsNotSet(positioncount) || error) { + yield addValidationError({ + field: 'positioncount', + message: 'Antall stillinger mangler', + }); + } else { + yield removeValidationError({ field: 'positioncount' }); + } } } diff --git a/src/stilling/stilling/edit/Edit.tsx b/src/stilling/stilling/edit/Edit.tsx index ed61113b..b2541f73 100644 --- a/src/stilling/stilling/edit/Edit.tsx +++ b/src/stilling/stilling/edit/Edit.tsx @@ -26,6 +26,7 @@ type Props = { resetValidation: () => void; stilling: Stilling; erFormidling: boolean; + erJobbmesse: boolean; }; const Edit = ({ @@ -34,6 +35,7 @@ const Edit = ({ onPreviewAdClick, resetValidation, erFormidling, + erJobbmesse, }: Props) => { const stillingenErEkstern = stilling.createdBy !== System.Rekrutteringsbistand; @@ -78,7 +80,7 @@ const Edit = ({ - + diff --git a/src/stilling/stilling/edit/praktiske-opplysninger/PraktiskeOpplysninger.tsx b/src/stilling/stilling/edit/praktiske-opplysninger/PraktiskeOpplysninger.tsx index 52404c59..077bab45 100644 --- a/src/stilling/stilling/edit/praktiske-opplysninger/PraktiskeOpplysninger.tsx +++ b/src/stilling/stilling/edit/praktiske-opplysninger/PraktiskeOpplysninger.tsx @@ -39,6 +39,7 @@ type Props = { setStartTime: (value?: string) => void; setApplicationDue: (value: string) => void; validation: Record; + erJobbmesse: boolean; }; class PraktiskeOpplysninger extends React.Component { @@ -100,7 +101,7 @@ class PraktiskeOpplysninger extends React.Component { }; render() { - const { ad, workday, workhours } = this.props; + const { ad, workday, workhours, erJobbmesse } = this.props; const workdayAsArray: string[] | undefined = workday ? isJson(workday) @@ -175,16 +176,18 @@ class PraktiskeOpplysninger extends React.Component { Ikke oppgitt
-
- Antall stillinger} - value={ad.properties.positioncount} - onChange={this.onPositioncountChange} - error={this.props.validation.positioncount} - type="number" - min="1" - /> -
+ {!erJobbmesse && ( +
+ Antall stillinger} + value={ad.properties.positioncount} + onChange={this.onPositioncountChange} + error={this.props.validation.positioncount} + type="number" + min="1" + /> +
+ )}
Søknadsfrist}