Skip to content

Commit

Permalink
Fjern antall stillinger for jobbmesse (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wiklem authored Dec 3, 2024
1 parent e968a41 commit 4ab6b1d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/stilling/stilling/Stilling.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -185,6 +186,7 @@ const Stilling = () => {
) : (
<Edit
erFormidling={erFormidling}
erJobbmesse={erJobbmesse}
innloggetBruker={navIdent}
onPreviewAdClick={onPreviewAdClick}
/>
Expand Down
19 changes: 10 additions & 9 deletions src/stilling/stilling/adValidationReducer.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -400,16 +400,17 @@ function* validateEngagementType(): Generator<unknown, any, any> {
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' });
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/stilling/stilling/edit/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Props = {
resetValidation: () => void;
stilling: Stilling;
erFormidling: boolean;
erJobbmesse: boolean;
};

const Edit = ({
Expand All @@ -34,6 +35,7 @@ const Edit = ({
onPreviewAdClick,
resetValidation,
erFormidling,
erJobbmesse,
}: Props) => {
const stillingenErEkstern = stilling.createdBy !== System.Rekrutteringsbistand;

Expand Down Expand Up @@ -78,7 +80,7 @@ const Edit = ({
</Accordion>
<Accordion className={classNames(css.høyre, css.accordions)}>
<Seksjon spacing tittel="Praktiske opplysninger">
<PraktiskeOpplysninger />
<PraktiskeOpplysninger erJobbmesse={erJobbmesse} />
</Seksjon>
<Seksjon spacing tittel="Kontaktinformasjon">
<Kontaktinformasjon innloggetBruker={innloggetBruker} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type Props = {
setStartTime: (value?: string) => void;
setApplicationDue: (value: string) => void;
validation: Record<ValidertFelt, string | undefined>;
erJobbmesse: boolean;
};

class PraktiskeOpplysninger extends React.Component<Props> {
Expand Down Expand Up @@ -100,7 +101,7 @@ class PraktiskeOpplysninger extends React.Component<Props> {
};

render() {
const { ad, workday, workhours } = this.props;
const { ad, workday, workhours, erJobbmesse } = this.props;

const workdayAsArray: string[] | undefined = workday
? isJson(workday)
Expand Down Expand Up @@ -175,16 +176,18 @@ class PraktiskeOpplysninger extends React.Component<Props> {
<Radio value="Ikke oppgitt">Ikke oppgitt</Radio>
</RadioGroup>
<div className={css.skillelinje} />
<div>
<TextField
label={<Skjemalabel påkrevd>Antall stillinger</Skjemalabel>}
value={ad.properties.positioncount}
onChange={this.onPositioncountChange}
error={this.props.validation.positioncount}
type="number"
min="1"
/>
</div>
{!erJobbmesse && (
<div>
<TextField
label={<Skjemalabel påkrevd>Antall stillinger</Skjemalabel>}
value={ad.properties.positioncount}
onChange={this.onPositioncountChange}
error={this.props.validation.positioncount}
type="number"
min="1"
/>
</div>
)}
<Fieldset
className={css.datepickerOgCheckbox}
legend={<Skjemalabel påkrevd>Søknadsfrist</Skjemalabel>}
Expand Down

0 comments on commit 4ab6b1d

Please sign in to comment.