Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/person lookup #2723

Merged
merged 33 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5fa8ba4
first mvp of person lookup
cammiida Nov 14, 2024
761fc23
removes old validations
cammiida Nov 14, 2024
7d1713c
removes validation error states
cammiida Nov 15, 2024
2652f3d
extracts fetch person queryFn and types the arguments to coordinate w…
cammiida Nov 15, 2024
ad8ef44
removes padlock and readonly state from app components label
cammiida Nov 15, 2024
8f8b668
validates only touched field on blur and moves validation schema to o…
cammiida Nov 15, 2024
1c03c1f
implements first version of actual request
cammiida Nov 15, 2024
83a7949
add missing text resources, en
HauklandJ Nov 18, 2024
0124a08
translate error text resources to nb, nn
HauklandJ Nov 18, 2024
3bc6b21
add controlnumber validation for ssns
HauklandJ Nov 21, 2024
9852e13
add requiredindicator to personLookupComponent
HauklandJ Nov 21, 2024
3ccfa24
rm unused function getFieldName
HauklandJ Nov 22, 2024
7e05462
add component validation
HauklandJ Nov 22, 2024
3adcf20
fix error displays on person lookup component
HauklandJ Nov 25, 2024
071bb91
Add display value test
HauklandJ Nov 25, 2024
60412e7
add text resources for person lookup
HauklandJ Nov 25, 2024
46e1b71
add summary2 for person lookup
HauklandJ Nov 25, 2024
74b2d4f
unimplement unnecessary function
HauklandJ Nov 25, 2024
15bcca6
fix description-connection for label and input fields
HauklandJ Nov 25, 2024
e666d1b
add cypress test for person lookup
HauklandJ Nov 25, 2024
3ad6e56
makes person lookup optional in summary of prev task test
cammiida Nov 26, 2024
25fff73
Merge branch 'main' into feature/person-lookup
HauklandJ Nov 29, 2024
3015212
fix import casing for button
HauklandJ Nov 29, 2024
7b99a87
update error for invalid response from server
HauklandJ Nov 29, 2024
ba1536b
use queryOptions
HauklandJ Nov 29, 2024
608df4b
lastname -> surname
HauklandJ Dec 3, 2024
2299bd5
surname -> lastname
HauklandJ Dec 3, 2024
d3b943e
Merge branch 'main' into feature/person-lookup
HauklandJ Dec 4, 2024
6f7a3e5
add fieldset
HauklandJ Dec 4, 2024
e437776
add shortcuts for cypress on docker
HauklandJ Dec 4, 2024
5980cce
fix copy pasta
HauklandJ Dec 4, 2024
6a7de20
update summary to include title
HauklandJ Dec 4, 2024
5049e49
underscore prefix to denote not used
HauklandJ Dec 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
"test:preview": "jest-preview",
"test:clear-cache": "jest --clearCache",
"cy:open": "cypress open --env environment=tt02",
"cy:open:docker": "cypress open --env environment=docker",
"cy:run": "cypress run --env environment=tt02",
"cy:run:docker": "cypress run --env environment=docker",
"cy:parallel": "cypress-parallel -s cy:run -t 3 -d test/e2e/integration",
"cy:parallel:docker": "cypress-parallel -s cy:run:docker -t 3 -d test/e2e/integration",
"tsc": "yarn gen && tsc && tsc --project test/tsconfig.json",
"tsc:watch": "yarn gen && tsc --watch",
"tsc:watch:cypress": "yarn gen && tsc --watch --project test/tsconfig.json",
Expand Down Expand Up @@ -136,6 +139,7 @@
"@navikt/aksel-icons": "^7.0.0",
"@tanstack/react-query": "^5.25.0",
"ajv": "8.17.1",
"ajv-errors": "^3.0.0",
"ajv-formats": "3.0.1",
"ajv-formats-draft2019": "^1.6.1",
"axios": "1.7.8",
Expand Down
4 changes: 3 additions & 1 deletion src/app-components/Label/Fieldset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { GridSize } from 'src/app-components/Label/types';
export type FieldsetProps = {
id?: string;
legend: string | ReactElement | undefined;
legendSize?: Extract<DesignsystemetLabelProps['size'], 'sm' | 'md' | 'lg' | 'xl'>;
className?: string;
grid?: GridSize;
optionalIndicator?: ReactElement;
Expand All @@ -28,6 +29,7 @@ export function Fieldset({
children,
className,
legend,
legendSize = 'md',
grid,
style,
help,
Expand Down Expand Up @@ -72,7 +74,7 @@ export function Fieldset({
<span className={cn(labelClasses.labelAndHelpWrapper)}>
<DesignsystemetLabel
weight='medium'
size='md'
size={legendSize}
style={style}
asChild
>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "Display value of Person Lookup component",
"expression": [
"displayValue",
"personlookup"
],
"context": {
"component": "personlookup",
"currentLayout": "Page"
},
"expects": "44829800753, Løve",
"layouts": {
"Page": {
"$schema": "https://altinncdn.no/schemas/json/layout/layout.schema.v1.json",
"data": {
"layout": [
{
"id": "personlookup",
"type": "PersonLookup",
"dataModelBindings": {
"person_lookup_ssn": "PersonLookup.Ssn",
"person_lookup_name": "PersonLookup.Name"
}
}
]
}
}
},
"dataModel": {
"PersonLookup": {
"Ssn": "44829800753",
"Name": "Løve"
}
}
}
17 changes: 17 additions & 0 deletions src/language/texts/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ export function en() {
zipCode: 'Zip Code',
no_options_found: 'No matches found',
clear_selection: 'Clear selection',
person_lookup_ssn: 'national ID number/D-number',
person_lookup_name: 'name',
},
navigation: {
main: 'App navigation',
Expand Down Expand Up @@ -315,6 +317,21 @@ export function en() {
vat: 'VAT',
},
},
person_lookup: {
ssn_label: 'National ID number/D-number',
surname_label: 'Surname',
name_label: 'Name',
from_registry_description: 'From the National Population Register',
validation_error_name_too_short: "The name can't be shorter than 2 characters",
validation_error_ssn: 'The national ID number/D-number is invalid.',
validation_error_not_found:
'No person is registered with this combination of national ID number/D-number and name. Please check the fields and try again. \n\nNote: After 5 failed attempts, the search functionality will be temporarily locked.',
validation_error_too_many_requests: 'Too many requests. Please try again later.',
validation_error_forbidden:
'You do not have permission to perform this action. A security level of minimum 2 is required.',
validation_invalid_response_from_server: 'An error occurred. Please try again later.',
unknown_error: 'An unknown error occurred. Please try again later.',
},
helptext: {
button_title: 'Help',
button_title_prefix: 'Helptext for',
Expand Down
17 changes: 17 additions & 0 deletions src/language/texts/nb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ export function nb(): FixedLanguageList {
zipCode: 'Postnr',
no_options_found: 'Fant ingen treff',
clear_selection: 'Fjern alle valgte',
person_lookup_ssn: 'fødselsnummer',
person_lookup_name: 'navn',
},
navigation: {
main: 'Appnavigasjon',
Expand Down Expand Up @@ -316,6 +318,21 @@ export function nb(): FixedLanguageList {
vat: 'MVA',
},
},
person_lookup: {
ssn_label: 'Fødselsnummer',
surname_label: 'Etternavn',
name_label: 'Navn',
from_registry_description: 'Fra folkeregisteret',
validation_error_name_too_short: 'Etternavn må være minst 2 tegn langt',
validation_error_ssn: 'Fødselsnummeret/D-nummeret er ugyldig.',
validation_error_not_found:
'Ingen person er registrert med denne kombinasjonen av fødselsnummer/D-nummer og navn. Vennligst kontroller feltene og prøv igjen. \n\nMerk: Etter 5 feilforsøk blir søkemuligheten midlertidig sperret.',
validation_error_too_many_requests: 'Du har nådd grensen for antall søk. Vennligst prøv igjen senere.',
validation_error_forbidden:
'Du har ikke tilgang til å søke på denne personen. Sikkerhetsnivå 2 eller høyere kreves.',
validation_invalid_response_from_server: 'Det oppstod en feil. Vennligst prøv igjen senere.',
unknown_error: 'Ukjent feil. Vennligst prøv igjen senere.',
},
helptext: {
button_title: 'Hjelp',
button_title_prefix: 'Hjelpetekst for',
Expand Down
17 changes: 17 additions & 0 deletions src/language/texts/nn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ export function nn(): FixedLanguageList {
zipCode: 'Postnr',
no_options_found: 'Fann ingen treff',
clear_selection: 'Fjern alle valde',
person_lookup_ssn: 'fødselsnummer',
person_lookup_name: 'namn',
},
navigation: {
main: 'Appnavigasjon',
Expand Down Expand Up @@ -316,6 +318,21 @@ export function nn(): FixedLanguageList {
vat: 'MVA',
},
},
person_lookup: {
ssn_label: 'Fødselsnummer',
surname_label: 'Etternamn',
name_label: 'Namn',
from_registry_description: 'Frå folkeregisteret',
validation_error_name_too_short: 'Etternamn må vere minst 2 teikn lange.',
validation_error_ssn: 'Fødselsnummeret/D-nummeret er ugyldig.',
validation_error_not_found:
'Ingen person er registrert med denne kombinasjonen av fødselsnummer/D-nummer og namn. Ver venleg og kontroller felta og prøv igjen. \n\nMerk: Etter 5 feilforsøk blir søkemoglegheita mellombels sperra.',
validation_error_too_many_requests: 'Du har gjort for mange søk. Ver venleg, prøv igjen seinare.',
validation_error_forbidden:
'Du har ikkje tilgang til å gjere dette søket. Sikkerheitsnivå 2 eller høgare er påkravd.',
validation_invalid_response_from_server: 'Det oppstod ein feil. Ver venleg, prøv igjen seinare.',
unknown_error: 'Det oppstod ein feil. Ver venleg, prøv igjen seinare.',
},
helptext: {
button_title: 'Hjelp',
button_title_prefix: 'Hjelpetekst for',
Expand Down
47 changes: 47 additions & 0 deletions src/layout/PersonLookup/PersonLookupComponent.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* breakpoints-xs */
@media only screen and (min-width: 0) {
.componentWrapper {
grid-template-areas: 'ssnLabel' 'ssn' 'nameLabel' 'name' 'submit' 'apiError';
gap: var(--fds-spacing-2);
}
}

/* breakpoints-md */
@media only screen and (min-width: 840px) {
.componentWrapper {
grid-template-columns: repeat(2, minmax(250px, 250px)) auto;
grid-template-areas: 'ssnLabel nameLabel .' 'ssn name submit' 'apiError apiError .';
align-items: end;
column-gap: var(--fds-spacing-2);
}
}

.componentWrapper {
display: grid;

.ssnLabel {
grid-area: ssnLabel;
align-self: start;
}

.ssn {
grid-area: ssn;
align-self: start;
}

.nameLabel {
grid-area: nameLabel;
align-self: start;
}

.name {
grid-area: name;
align-self: start;
}

.submit {
grid-area: submit;
align-self: start;
white-space: nowrap;
}
}
Loading
Loading