From 9d2e0a9071d7ccd2b58b7472501a22aca03198c7 Mon Sep 17 00:00:00 2001 From: Aleksei Poroshin Date: Mon, 6 Jan 2025 15:45:41 +0100 Subject: [PATCH 1/6] Fiks loading av jp --- src/app/containers/JournalpostLoader.tsx | 10 ++++------ src/app/home/Home.tsx | 15 +++++++++------ src/mocks/testHandlers.ts | 5 ++++- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/app/containers/JournalpostLoader.tsx b/src/app/containers/JournalpostLoader.tsx index 4b75629ee..44bb74544 100644 --- a/src/app/containers/JournalpostLoader.tsx +++ b/src/app/containers/JournalpostLoader.tsx @@ -46,10 +46,10 @@ const JournalpostLoader: React.FC = ({ renderOnLoadComplete }: Props) => const [ingenJp, setIngenJp] = useState(false); useEffect(() => { - if (journalpostid) { + if (!journalpost && journalpostid) { getJournalpost(journalpostid); } - }, [journalpostid]); + }, [journalpostid, journalpost]); const handleLukkDebugg = () => { if (journalpostid) { @@ -66,10 +66,8 @@ const JournalpostLoader: React.FC = ({ renderOnLoadComplete }: Props) => if (isJournalpostLoading) { return ( -
-
- -
+
+
); } diff --git a/src/app/home/Home.tsx b/src/app/home/Home.tsx index 785e6f139..6f3bb6660 100644 --- a/src/app/home/Home.tsx +++ b/src/app/home/Home.tsx @@ -37,6 +37,7 @@ export const Home: React.FC = () => { journalpostConflict, journalpostConflictError, journalpostRequestError, + isJournalpostLoading, } = useSelector((state: RootStateType) => state.felles); const lukkOppgaveDone = useSelector((state: RootStateType) => state.fordelingState.lukkOppgaveDone); @@ -83,11 +84,6 @@ export const Home: React.FC = () => { useEffect(() => { if (journalpost?.journalpostId) { - // Her har jeg lagt inn en reset av redux state fordi tidligere ble window.location.href brukt for å navigere til journalposten. - // så hvis man ikke resetter state først skjer det rare ting. - // TODO: fiks dette så vi slipper å kjøre kall for å hente ut journalpost to ganger - dispatch(resetAllStateAction()); - navigate(ROUTES.JOURNALPOST_ROOT.replace(':journalpostid/*', journalpost.journalpostId)); } }, [journalpost]); @@ -110,10 +106,17 @@ export const Home: React.FC = () => { onChange={onChange} label={} onKeyDown={handleKeydown} + disabled={isJournalpostLoading} />
-
diff --git a/src/mocks/testHandlers.ts b/src/mocks/testHandlers.ts index 1e83fb858..b4fe2f9a4 100644 --- a/src/mocks/testHandlers.ts +++ b/src/mocks/testHandlers.ts @@ -26,7 +26,9 @@ import pilsSoknad from '../../cypress/fixtures/pilsSoknad.json'; import jpOMPUT314 from '../../cypress/fixtures/jpOMPUT314.json'; export const testHandlers = { - hentJournalpost: http.get(ApiPath.JOURNALPOST_GET.replace('{journalpostId}', ':id'), ({ params }) => { + hentJournalpost: http.get(ApiPath.JOURNALPOST_GET.replace('{journalpostId}', ':id'), async ({ params }) => { + await delay(500); + if (params.id === '300') { return HttpResponse.json(jpPSB300, { status: 201 }); } @@ -63,6 +65,7 @@ export const testHandlers = { if (params.id === '206') { return HttpResponse.json({ message: 'Forbidden' }, { status: 403 }); } + return HttpResponse.json({ ...journalpost, journalpostId: params.id }); }), opprettePleiepengesoknad: http.post(ApiPath.PSB_SOKNAD_CREATE, () => From 62f79a9eab37f3361b203955bf25068d82d5b4e5 Mon Sep 17 00:00:00 2001 From: Aleksei Poroshin Date: Mon, 6 Jan 2025 17:43:48 +0100 Subject: [PATCH 2/6] fix --- .../pleiepengerSoknadSomKanSendesInn.json | 65 +++++++------------ .../pleiepenger/containers/PSBPunchForm.tsx" | 7 +- src/mocks/testHandlers.ts | 2 +- 3 files changed, 26 insertions(+), 48 deletions(-) diff --git a/cypress/fixtures/pleiepengerSoknadSomKanSendesInn.json b/cypress/fixtures/pleiepengerSoknadSomKanSendesInn.json index 18a520169..cf367a28a 100644 --- a/cypress/fixtures/pleiepengerSoknadSomKanSendesInn.json +++ b/cypress/fixtures/pleiepengerSoknadSomKanSendesInn.json @@ -1,54 +1,37 @@ { - "soeknadId": "0416e1a2-8d80-48b1-a56e-ab4f4b4821fe", - "soekerId": "29099000129", - "journalposter": ["200"], - "mottattDato": "2020-10-12", - "klokkeslett": "12:53", + "arbeidstid": null, "barn": { "norskIdent": "16017725002", "foedselsdato": null }, + "begrunnelseForInnsending": null, + "beredskap": null, + "bosteder": null, + "harInfoSomIkkeKanPunsjes": false, + "harMedisinskeOpplysninger": false, + "journalposter": ["200"], + "k9saksnummer": "10002Fi", + "klokkeslett": "12:53", + "lovbestemtFerie": null, + "lovbestemtFerieSomSkalSlettes": null, + "metadata": null, + "mottattDato": "2024-10-12", + "nattevaak": null, + "omsorg": null, + "opptjeningAktivitet": null, + "soekerId": "29099000129", + "soeknadId": "0416e1a2-8d80-48b1-a56e-ab4f4b4821fe", "soeknadsperiode": [ { "fom": "2021-11-08", "tom": "2021-11-11" } ], - "opptjeningAktivitet": { - "selvstendigNaeringsdrivende": null, - "frilanser": null, - "arbeidstaker": [] - }, - "arbeidstid": { - "arbeidstakerList": [], - "frilanserArbeidstidInfo": null, - "selvstendigNæringsdrivendeArbeidstidInfo": { - "perioder": [] - } - }, - "beredskap": [], - "nattevaak": [], - "tilsynsordning": { - "perioder": [] - }, - "uttak": [], - "omsorg": { - "relasjonTilBarnet": "", - "samtykketOmsorgForBarnet": null, - "beskrivelseAvOmsorgsrollen": "" - }, - "bosteder": [], - "lovbestemtFerie": [], - "lovbestemtFerieSomSkalSlettes": [], - "soknadsinfo": { - "samtidigHjemme": null, - "harMedsoeker": null - }, - "utenlandsopphold": [], - "harInfoSomIkkeKanPunsjes": false, - "harMedisinskeOpplysninger": false, + "soknadsinfo": null, + "tilsynsordning": null, + "trekkKravPerioder": [], - "begrunnelseForInnsending": { - "tekst": "" - } + "utenlandsopphold": null, + "utenlandsoppholdV2": [], + "uttak": null } diff --git "a/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" "b/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" index c8ce1b50c..5644b3c67 100644 --- "a/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" +++ "b/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" @@ -953,7 +953,6 @@ export class PunchFormComponent extends React.Component this.updateSkalHaFerie(e.target.checked)} checked={!!soknad.lovbestemtFerie.length} data-testid="feriepanel-checkbox" @@ -982,7 +981,6 @@ export class PunchFormComponent extends React.Component this.updateIkkeSkalHaFerie(e.target.checked)} checked={!!soknad.lovbestemtFerieSomSkalSlettes.length} /> @@ -1081,9 +1079,8 @@ export class PunchFormComponent extends React.Component this.updateOmsorgstilbud(e.target.checked)} - checked={this.state.iTilsynsordning} + checked={!!this.state.iTilsynsordning} data-testid="omsorgstilbud-checkboks" /> {this.state.iTilsynsordning && ( @@ -1131,7 +1128,6 @@ export class PunchFormComponent extends React.Component this.handleBeredskapNattevåkChange(BeredskapNattevaak.BEREDSKAP, e.target.checked) } @@ -1143,7 +1139,6 @@ export class PunchFormComponent extends React.Component this.handleBeredskapNattevåkChange(BeredskapNattevaak.NATTEVAAK, e.target.checked) } diff --git a/src/mocks/testHandlers.ts b/src/mocks/testHandlers.ts index b4fe2f9a4..31eaf3400 100644 --- a/src/mocks/testHandlers.ts +++ b/src/mocks/testHandlers.ts @@ -91,7 +91,7 @@ export const testHandlers = { eksisterendePleiepengesoknad: http.get( ApiPath.PSB_SOKNAD_GET.replace('{id}', '0416e1a2-8d80-48b1-a56e-ab4f4b4821fe'), - () => HttpResponse.json(journalpost), + () => HttpResponse.json(pleiepengerSoknadSomKanSendesInn), ), eksisterendePilssoknad: http.get( ApiPath.PLS_SOKNAD_GET.replace('{id}', '4e3a9001-f872-4288-829e-08f8e1001b28'), From a58d9e3bf2e83cd5ad246c82fc7e7096f91505ea Mon Sep 17 00:00:00 2001 From: Aleksei Poroshin Date: Wed, 15 Jan 2025 13:48:11 +0100 Subject: [PATCH 3/6] Fiks accordion items defaulty open --- .../Arbeidsforhold/ArbeidsforholdPanel.tsx" | 6 +++++- .../EndringAvS\303\270knadsperioder.tsx" | 2 +- .../pleiepenger/containers/PSBPunchForm.tsx" | 18 ++++++++++++------ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git "a/src/app/s\303\270knader/pleiepenger/containers/Arbeidsforhold/ArbeidsforholdPanel.tsx" "b/src/app/s\303\270knader/pleiepenger/containers/Arbeidsforhold/ArbeidsforholdPanel.tsx" index d87781e4b..ee6259a96 100644 --- "a/src/app/s\303\270knader/pleiepenger/containers/Arbeidsforhold/ArbeidsforholdPanel.tsx" +++ "b/src/app/s\303\270knader/pleiepenger/containers/Arbeidsforhold/ArbeidsforholdPanel.tsx" @@ -823,7 +823,11 @@ const ArbeidsforholdPanel = ({ return ( onPanelClick()} data-testid="accordionItem-arbeidsforholdPanel" > diff --git "a/src/app/s\303\270knader/pleiepenger/containers/EndringAvS\303\270knadsperioder/EndringAvS\303\270knadsperioder.tsx" "b/src/app/s\303\270knader/pleiepenger/containers/EndringAvS\303\270knadsperioder/EndringAvS\303\270knadsperioder.tsx" index 069dc6372..386b1baf4 100644 --- "a/src/app/s\303\270knader/pleiepenger/containers/EndringAvS\303\270knadsperioder/EndringAvS\303\270knadsperioder.tsx" +++ "b/src/app/s\303\270knader/pleiepenger/containers/EndringAvS\303\270knadsperioder/EndringAvS\303\270knadsperioder.tsx" @@ -130,8 +130,8 @@ const EndringAvSøknadsperioder = (props: Props) => { return ( 0} className="endringAvSøknadsperioder" onOpenChange={onClick} data-testid="accordionItem-endringAvSøknadsperioderpanel" diff --git "a/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" "b/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" index 5644b3c67..df4a1cc3f 100644 --- "a/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" +++ "b/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" @@ -882,8 +882,9 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.UTENLANDSOPPHOLD)} data-testid="accordionItem-utenlandsoppholdpanel" > @@ -942,7 +943,8 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.FERIE)} data-testid="accordionItem-feriepanel" > @@ -1030,7 +1032,8 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.OPPLYSINGER_OM_SOKER)} data-testid="accordionItem-opplysningeromsokerpanel" > @@ -1067,7 +1070,8 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.OMSORGSTILBUD)} data-testid="accordionItem-omsorgstilbudpanel" @@ -1117,7 +1121,8 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.BEREDSKAPNATTEVAAK)} data-testid="accordionItem-beredskapnattevaakpanel" > @@ -1152,7 +1157,8 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.MEDLEMSKAP)} data-testid="accordionItem-medlemskappanel" > From 158063fbf092f701265f9a3a8dd175d5671f94cc Mon Sep 17 00:00:00 2001 From: Aleksei Poroshin Date: Wed, 15 Jan 2025 14:25:07 +0100 Subject: [PATCH 4/6] test default open accordion --- .../s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" "b/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" index df4a1cc3f..a36302b12 100644 --- "a/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" +++ "b/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" @@ -942,7 +942,7 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.FERIE)} From 0379550ae58ec8c591084ee94f687795be57afc2 Mon Sep 17 00:00:00 2001 From: Aleksei Poroshin Date: Wed, 15 Jan 2025 14:55:12 +0100 Subject: [PATCH 5/6] test --- .../pleiepenger/containers/PSBPunchForm.tsx" | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git "a/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" "b/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" index a36302b12..44dc4c06b 100644 --- "a/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" +++ "b/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" @@ -835,6 +835,8 @@ export class PunchFormComponent extends React.Component ); + console.log('Test def open utenlandsopphold', this.utenlandsOppholdCheckedValue() === JaNeiIkkeOpplyst.JA); + return (
@@ -882,9 +884,9 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.UTENLANDSOPPHOLD)} data-testid="accordionItem-utenlandsoppholdpanel" > From e95ec073b15208839b5b3e614d07685b64d82425 Mon Sep 17 00:00:00 2001 From: Aleksei Poroshin Date: Thu, 16 Jan 2025 14:50:26 +0100 Subject: [PATCH 6/6] slett default open i paneler PSB form --- .../Arbeidsforhold/ArbeidsforholdPanel.tsx" | 5 ----- .../EndringAvS\303\270knadsperioder.tsx" | 1 - .../pleiepenger/containers/PSBPunchForm.tsx" | 18 ++---------------- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git "a/src/app/s\303\270knader/pleiepenger/containers/Arbeidsforhold/ArbeidsforholdPanel.tsx" "b/src/app/s\303\270knader/pleiepenger/containers/Arbeidsforhold/ArbeidsforholdPanel.tsx" index ee6259a96..64fc38d1c 100644 --- "a/src/app/s\303\270knader/pleiepenger/containers/Arbeidsforhold/ArbeidsforholdPanel.tsx" +++ "b/src/app/s\303\270knader/pleiepenger/containers/Arbeidsforhold/ArbeidsforholdPanel.tsx" @@ -823,11 +823,6 @@ const ArbeidsforholdPanel = ({ return ( onPanelClick()} data-testid="accordionItem-arbeidsforholdPanel" > diff --git "a/src/app/s\303\270knader/pleiepenger/containers/EndringAvS\303\270knadsperioder/EndringAvS\303\270knadsperioder.tsx" "b/src/app/s\303\270knader/pleiepenger/containers/EndringAvS\303\270knadsperioder/EndringAvS\303\270knadsperioder.tsx" index 386b1baf4..a002b6092 100644 --- "a/src/app/s\303\270knader/pleiepenger/containers/EndringAvS\303\270knadsperioder/EndringAvS\303\270knadsperioder.tsx" +++ "b/src/app/s\303\270knader/pleiepenger/containers/EndringAvS\303\270knadsperioder/EndringAvS\303\270knadsperioder.tsx" @@ -131,7 +131,6 @@ const EndringAvSøknadsperioder = (props: Props) => { return ( 0} className="endringAvSøknadsperioder" onOpenChange={onClick} data-testid="accordionItem-endringAvSøknadsperioderpanel" diff --git "a/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" "b/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" index 44dc4c06b..d8b3632c6 100644 --- "a/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" +++ "b/src/app/s\303\270knader/pleiepenger/containers/PSBPunchForm.tsx" @@ -835,8 +835,6 @@ export class PunchFormComponent extends React.Component ); - console.log('Test def open utenlandsopphold', this.utenlandsOppholdCheckedValue() === JaNeiIkkeOpplyst.JA); - return (
@@ -884,9 +882,7 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.UTENLANDSOPPHOLD)} data-testid="accordionItem-utenlandsoppholdpanel" > @@ -944,9 +940,7 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.FERIE)} data-testid="accordionItem-feriepanel" > @@ -1034,8 +1028,6 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.OPPLYSINGER_OM_SOKER)} data-testid="accordionItem-opplysningeromsokerpanel" > @@ -1072,8 +1064,6 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.OMSORGSTILBUD)} data-testid="accordionItem-omsorgstilbudpanel" @@ -1123,8 +1113,6 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.BEREDSKAPNATTEVAAK)} data-testid="accordionItem-beredskapnattevaakpanel" > @@ -1159,8 +1147,6 @@ export class PunchFormComponent extends React.Component this.handlePanelClick(PunchFormPaneler.MEDLEMSKAP)} data-testid="accordionItem-medlemskappanel" >