Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Ikke defaultSelected dato for datepickere i endre situasjon
Browse files Browse the repository at this point in the history
  • Loading branch information
jstnhlj committed Aug 2, 2023
1 parent be2368f commit bd517e6
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions src/komponenter/endre-situasjon/steg2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,12 @@ const TILBAKE_TIL_JOBB = (props: Steg2Props) => {
selectedDay: forsteArbeidsdagDato,
} = useDatepicker({
fromDate: new Date('Jan 01 2022'),
defaultSelected: new Date(),
});

const [stillingsProsent, settStillingsProsent] = useState<string>();

const { feil, loading, handleLagreEndringer } = useLagreEndringer(props);

const disabled = !stillingsProsent || loading;
const disabled = !stillingsProsent || !forsteArbeidsdagDato || loading;

const tilleggsData = {
forsteArbeidsdagDato,
Expand Down Expand Up @@ -322,7 +320,6 @@ const OPPSIGELSE = (props: Steg2Props) => {
selectedDay: oppsigelseDato,
} = useDatepicker({
fromDate: new Date('Jan 01 2022'),
defaultSelected: new Date(),
});

const {
Expand All @@ -331,13 +328,12 @@ const OPPSIGELSE = (props: Steg2Props) => {
selectedDay: sisteArbeidsdagDato,
} = useDatepicker({
fromDate: new Date('Jan 01 2022'),
defaultSelected: new Date(),
});

const [harNyJobb, settHarNyJobb] = useState<string>();

const { feil, loading, handleLagreEndringer } = useLagreEndringer(props);
const disabled = !harNyJobb || loading;
const disabled = !harNyJobb || !oppsigelseDato || !sisteArbeidsdagDato || loading;

const tilleggsData = {
oppsigelseDato,
Expand Down Expand Up @@ -414,13 +410,12 @@ const ENDRET_PERMITTERINGSPROSENT = (props: Steg2Props) => {
selectedDay: gjelderFraDato,
} = useDatepicker({
fromDate: new Date('Jan 01 2022'),
defaultSelected: new Date(),
});
const [permitteringsProsent, settPermitteringsProsent] = useState<string>();
const [permitteringForlenget, settPermitteringForlenget] = useState<string>();

const { feil, loading, handleLagreEndringer } = useLagreEndringer(props);
const disabled = !permitteringsProsent || !permitteringForlenget || loading;
const disabled = !permitteringsProsent || !permitteringForlenget || !gjelderFraDato || loading;

const tilleggsData = {
permitteringsProsent,
Expand Down Expand Up @@ -495,14 +490,13 @@ const NY_JOBB = (props: Steg2Props) => {
selectedDay: forsteArbeidsdagDato,
} = useDatepicker({
fromDate: new Date('Jan 01 2022'),
defaultSelected: new Date(),
});

const [stillingsProsent, settStillingsProsent] = useState<string>();

const { feil, loading, handleLagreEndringer } = useLagreEndringer(props);

const disabled = !stillingsProsent || loading;
const disabled = !stillingsProsent || !forsteArbeidsdagDato || loading;

const tilleggsData = {
forsteArbeidsdagDato,
Expand Down Expand Up @@ -557,14 +551,13 @@ const MIDLERTIDIG_JOBB = (props: Steg2Props) => {
selectedDay: forsteArbeidsdagDato,
} = useDatepicker({
fromDate: new Date('Jan 01 2022'),
defaultSelected: new Date(),
});

const [stillingsProsent, settStillingsProsent] = useState<string>();

const { feil, loading, handleLagreEndringer } = useLagreEndringer(props);

const disabled = !stillingsProsent || loading;
const disabled = !stillingsProsent || !forsteArbeidsdagDato || loading;

const tilleggsData = {
forsteArbeidsdagDato,
Expand Down Expand Up @@ -619,13 +612,12 @@ const KONKURS = (props: Steg2Props) => {
selectedDay: sisteArbeidsdagDato,
} = useDatepicker({
fromDate: new Date('Jan 01 2022'),
defaultSelected: new Date(),
});

const [harNyJobb, settHarNyJobb] = useState<string>();

const { feil, loading, handleLagreEndringer } = useLagreEndringer(props);
const disabled = !harNyJobb || loading;
const disabled = !harNyJobb || !sisteArbeidsdagDato || loading;

const tilleggsData = {
sisteArbeidsdagDato,
Expand Down Expand Up @@ -679,7 +671,6 @@ const SAGT_OPP = (props: Steg2Props) => {
selectedDay: oppsigelseDato,
} = useDatepicker({
fromDate: new Date('Jan 01 2022'),
defaultSelected: new Date(),
});

const {
Expand All @@ -688,13 +679,12 @@ const SAGT_OPP = (props: Steg2Props) => {
selectedDay: sisteArbeidsdagDato,
} = useDatepicker({
fromDate: new Date('Jan 01 2022'),
defaultSelected: new Date(),
});

const [harNyJobb, settHarNyJobb] = useState<string>();

const { feil, loading, handleLagreEndringer } = useLagreEndringer(props);
const disabled = !harNyJobb || loading;
const disabled = !harNyJobb || !oppsigelseDato || !sisteArbeidsdagDato || loading;

const tilleggsData = {
oppsigelseDato,
Expand Down Expand Up @@ -762,7 +752,6 @@ const ANNET = (props: Steg2Props) => {
selectedDay: gjelderFraDato,
} = useDatepicker({
fromDate: new Date('Jan 01 2022'),
defaultSelected: new Date(),
});

const { feil, loading, handleLagreEndringer } = useLagreEndringer(props);
Expand All @@ -771,6 +760,8 @@ const ANNET = (props: Steg2Props) => {
gjelderFraDato,
};

const disabled = !gjelderFraDato || loading;

return (
<Steg2Wrapper valgtSituasjon={props.valgtSituasjon}>
<>
Expand All @@ -790,7 +781,7 @@ const ANNET = (props: Steg2Props) => {
handleLagreEndringer(props.valgtSituasjon, props.opprinneligSituasjon, tilleggsData)
}
loading={loading}
disabled={loading}
disabled={disabled}
>
Lagre endring i situasjon
</Button>
Expand Down

0 comments on commit bd517e6

Please sign in to comment.