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

Update Personinformasjon and NavnForm components, add 'Master' in Pdl… #3493

Merged
merged 58 commits into from
Jun 12, 2024

Conversation

krharum
Copy link
Contributor

@krharum krharum commented May 14, 2024

…NavnVisning

#deploy-test-frontend

The code changes conducted primarily involve modifications in several components like "Personinformasjon", "NavnForm", and "PdlNavnVisning". Name attribute is added in "Personinformasjon", and "identMaster" variable is also now included in "NavnForm" and used in its condition checks. In "PdlNavnVisning", 'Master' title value is also being displayed.

krharum added 27 commits May 14, 2024 13:33
…NavnVisning

#deploy-test-frontend

The code changes conducted primarily involve modifications in several components like "Personinformasjon", "NavnForm", and "PdlNavnVisning". Name attribute is added in "Personinformasjon", and "identMaster" variable is also now included in "NavnForm" and used in its condition checks. In "PdlNavnVisning", 'Master' title value is also being displayed.
#deploy-test-frontend

The logic for setting the 'Fødsel' attribute has been modified. The identMaster is now considered in the condition checks for both 'Personinformasjon' and 'Foedsel' components. Additionally, the 'kanVelgeMaster' prop in AvansertForm component has also been updated for improved form handling. A value for 'Master' has been added to the PDL 'Fødsel' visualization component.
Change export method for initialDoedsfall in initialValues.tsx to a function that accepts an optional master argument. Also extended metadata master value presentation in multiple components to include 'Doedsfall', 'PdlPersonInfo', 'Foedsel' and 'Persondetaljer'. In Personinformasjon.tsx, the add method for 'doedsdato' attribute was updated to make use of the new getInitialDoedsfall function.
Added gender attribute to Personinformasjon.tsx and updated the condition message for identifying immigrants with `FNR` instead of `DNR` or `NPID`. Refactored the attribute addition function in gender to consider both `PDL` and `NPID`. Also, in KjoennForm, redefined the prop `kanVelgeMaster` instead of `identtype` to ensure flexibility in master selection.
The code updates improved identification type selection criteria and added a new attribute 'citizenship' to the ordering guidance step in the UI. It also refactors the identification type determination code to include 'PDL' and 'NPID'. Changes have been implemented to display immigrant information and include a master selection option for identity types other than 'PDL' and 'NPID'.
#deploy-test-pdl-forvalter

Adjusted the FullmaktService and ArtifactUpdateService to pass both fullmakt and person data when validating fullmakt details. Added a condition in the validate method to prevent the validation of fullmakt's motpart's personident in case the person is a TestNorge identification. Also, unified validation methods in FullmaktService by eliminating unnecessary overriding methods. Accompanying tests have been updated to match these changes.
Significant refactor of the forms related to person data was carried out. This included changes to the validation rules of "fullmakt" form, with addition of a check for TestNorge identification in the fullmakt's motpart's personident field. Furthermore, streamlined initial form set-up in the "Personinformasjon" form was implemented to reduce redundancies. Changes were also made across multiple other components and accompanying tests to reflect the updates.
#deploy-test-pdl-forvalter

Refactored the RelasjonService to include a check for missing persons before proceeding with operations. The method 'checkAndCreateMissingPersons' was added to ensure that the required person data exists in the repository, and if not, creates a new person. Ensuring data consistency and preventing possible 'person not found' exceptions.
…st-dolly-backend

A log info message has been added after a new person is successfully created in PensjonforvalterConsumer. This should help keep a record of the created persons and facilitate more effective debugging.
#deploy-test-pdl-forvalter

Modified the method in RelasjonService to add a check for missing persons and create them if they don't exist. This update is implemented to enhance data consistency and avoid potential 'person not found' exceptions in the system.
#deploy-test-frontend

Changed the triggering path in the PdlEksisterendePerson component from 'pdldata.person.kontaktinformasjonForDoedsbo' to 'pdldata.person'. This revision should make the component more effective in broad updates rather than just for specific sub-fields.
#deploy-test-frontend
The Personinformasjon component has been updated with attribute categories revised and restructured. Attributes related to age, nationality, and miscellaneous fields, including name, gender, phone number, power of attorney, and security measures, have now been placed into their respective categories for better organization and readability. A new attribute, citizenship (statsborgerskap), has also been added under the nationality category.
#deploy-test-frontend
The access path to the 'ident' attribute in PdlEksisterendePerson component was updated. Instead of reaching the attribute through 'pdlforvalter', 'ident' is now directly under 'pdl'. This change makes the code cleaner and more maintainable, fitting with the overall structure of the data model.
#deploy-test-pdl-forvalter

Changed the triggering path in the PdlEksisterendePerson component from 'pdldata.person.kontaktinformasjonForDoedsbo' to 'pdldata.person'. This revision should make the component more effective in broad updates rather than just for specific sub-fields.
…#deploy-test-pdl-forvalter

Updated several services and the associated tests. In SivilstandService, the validate method was refactored to include the person's data. In FullmaktService, updated the method to use StringUtils' isNotBlank function for readability. Added an extra parameter to the the validate function in the test files to match the updates in the SivilstandService.
Revised conditional logics in the Familierelasjoner component for clear and concise code. Added test for 'relatertVedSivilstand' in form validation to check if a partner is required based on the sivilstand type & identMaster and reorganized the placement of components in Steg1Person to improve readability.
#deploy-test-pdl-forvalter
Created a new HendelseIdDTO class and added a method to HendelseIdService for fetching all PDL events associated with a given ID. Modified deletePdlHendelser method to utilize this new functionality. Simplified person identifier retrieval in the PersonService class.
#deploy-test-pdl-forvalter
Enhanced ForelderBarnRelasjonService by incorporating better error handling and data consistency measures. This involved the use of AtomicReference, the introduction of additional person identifiers, and a thorough update of the validation process to cover various conditions.
#deploy-test-pdl-forvalter
Modified ForelderBarnRelasjonService and SivilstandService to include timestamps on updates. Also, improved the validation check in ForelderBarnRelasjonService by changing from isNull to isBlank. This ensures better data consistency and more accurate tracking of modifications.
ForelderBarnRelasjonForm has been refactored, including changes to numerous conditionals and rendering properties throughout the form for improved compatibility and readability. In addition, various display options across several components have been enhanced, ensuring that the right information is displayed to the user at the right time, based on different conditions such as identtype, testnorgePerson, and others. Certain unnecessary properties and component calls were removed for code clean-up.
This update adds multiple console logs to useGruppe.tsx, useSelectOptions.tsx, and PdlEksisterendePerson.tsx for easier debugging. In addition, spelling mistakes in variable names and labels in useSelectOptions.tsx, PdlEksisterendePerson.tsx, and Familierelasjoner.ts
#deploy-test-frontend

This commit eliminates debug logs from multiple files for cleaner code. It significantly simplifies a function in PdlEksisterendePerson.tsx and embeds new validation rules in familierelasjoner.tsx, improving data validity ensuring more robust family relationships.
@krharum krharum marked this pull request as ready for review May 27, 2024 12:55
@krharum krharum requested a review from a team as a code owner May 27, 2024 12:55
#deploy-test-frontend

Modified the logic that evaluates conditions for an existing person in 'pdlPerson' component. A list of valid civil status for partners added and with it, the evaluation for 'PERSON RELATERT TIL' has been improved. Also separated check for 'FULLMEKTIG' from joint condition for cleaner code structure.
The variables in the Personinformasjon and Familierelasjoner files of the bestillingsveileder application have been renamed for clarity, and conditions have been restructured. This helps make the logic of the application easier to follow and understand.
Updated code to ensure that the form elements in multiple components behave according to the number of persons selected and their identity type. Disabled certain form elements when multiple identities or a specific identity type is selected.
…eploy-test-frontend

Implemented dynamic form elements behavior in various components, driven by the number of persons selected and the type of their identity. This prevents certain selection options when dealing with multiple identities or a particular identity type, helping to control form complexity and maintain data consistency in multi-user environments.
#deploy-test-frontend
Updated multiple components to condition form field availability based on selected identities and their types. This fine-tuning enhances data consistency and reduces the complexity in scenarios involving multi-user or multi-identity management.
#deploy-test-pdl-forvalter

The FullmaktService.java file has been updated to include functionality for saving 'motpartsPersonident' if it doesn't exist in the personRepository. An AtomicReference to "DbPerson" has been added to hold the motpartPerson object, and LocalDateTime is used to set the last update time. This ensures that the 'motpartsPersonident' data is always available when required.
A HendelseIdRequest class was introduced, and adjustments were made in PdlTestdataConsumer.java, PersonService.java, and HendelseIdService.java. These changes collectively improved the process of deleting identities from the pool, thereby correcting the previously existing error. A different strategy to generate and handle incidents in the HendelseIdService class was followed for optimization.
'vergemaal',
'fullmakt',
'sikkerhetstiltak',
'tilrettelagtKommunikasjon',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tilrettelagtKommunikasjon skal kanskje også fjernes her, så vi får med denne ved "Velg alle"?

const tekstTestNorgeFlere = 'Funksjonen er kun tilgjengelig per individ, ikke for gruppe'
const leggTilPaaGruppe = !!opts?.leggTilPaaGruppe
const tekstLeggTilPaaGruppe =
'Støttes ikke for "legg-til-på-alle" i grupper som inneholder personer fra Test-Norge'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Litt rart med bindestreker i "legg til på alle"? (Gjelder flere steder)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Det var å tydliggjøre at dette er et funksjonsvalg, kan fjerne

Comment on lines 43 to 44
ignoreKeys.push('sivilstand', 'barnForeldre')
ignoreKeys.push('foreldreansvar', 'doedfoedtBarn')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disse kan vel skrives på én linje? Gjelder flere steder ser jeg, hvor det pushes én og én string, men vi kan fint legge alle i samme push 😊

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja ser det er benyttet begge deler, kan endre til en linje

testcontext.parent.type !== 'REGISTRERT_PARTNER' &&
testcontext.parent.type !== 'SEPARERT_PARTNER' &&
testcontext.parent.type !== 'SAMBOER') ||
testcontext.options.context.identMaster !== 'PDL'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Endring av sivilstand direkte på person feiler nå, fordi identMaster er undefined.
testcontext.options.context?.identMaster !== 'PDL' bør gjøre susen.

relatertPerson: Yup.string().nullable(),
relatertPerson: Yup.string()
.test('er-testnorge-paakrevd', 'Person fra Testnorge er påkrevd', (value, testcontext) => {
return testcontext.options.context.identMaster !== 'PDL' || value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Denne feiler også, samme grunn som ovenfor.

const tekstLeggTilPaaGruppe =
'Støttes ikke for "legg-til-på-alle" i grupper som inneholder personer fra Test-Norge'

const getIgnoreKeys = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Når man importerer person fra Tenor og sier "Velg alle" på identifikasjon-panelet blir både falsk ID og ny ID valgt selv om checkboxene er skjult. Regner med at du må ha en sjekk for erTestnorgePerson i denne funksjonen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bra observert, vil fikse! 😄

const getIgnoreKeys = () => {
if (opts?.identtype === 'NPID') {
return ['foreldreansvar', 'doedfoedtBarn']
var ignoreKeys = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bruk let istedenfor var (gjelder flere steder).

@@ -133,12 +167,20 @@ export const PersoninformasjonPanel = ({ stateModifier, testnorgeIdent }) => {
<Attributt attr={sm.attrs.telefonnummer} />
<Attributt
attr={sm.attrs.vergemaal}
disabled={opts?.identtype === 'NPID'}
disabled={npidPerson || (harTestnorgeIdenter && leggTilPaaGruppe)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Synes fortsatt ikke vi trenger å disable fullmakt og vergemål ved legg til på gruppe, så du kan gjerne åpne opp for det igjen om du ikke er veldig uenig 😉

Copy link
Contributor Author

@krharum krharum Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jeg tenker at dette er innenfor, nå behandles eksisterende person likt og gjenkjennelig uansett opplysningstype, og det kan også være logisk for bruker. 😄

Comment on lines 128 to 133
} else if (label === 'BARN') {
// eksisterende person er forelder
return eksisterendePerson?.alder - person.alder > 17 && getAntallForeldre(person.foreldre) < 3
} else if (label === 'FORELDER') {
// eksisterende person er barn
return person.alder - eksisterendePerson?.alder > 17 && checkForeldre(person)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nå vil man ikke kunne velge eksisterende person dersom man ikke setter alder på person i bestillingen - stemmer det? I så fall bør bruker få en form for varsel om dette, for det er ikke så lett å finne ut av på egen hånd.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja det er med hensikt at det ikke skal være mulig å velge person som ikke har riktig alder. Vil legge på hint for dette.
👍

)
.map(() => (isOK = false))
if (!isOK) {
feilmelding = 'Ansvarlig person må velges'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nå havner denne feilmeldingen under feltet ansvar, men den hører til feltet ansvarlig. Så her må det skrives om litt så feilmeldingen henger sammen med rett felt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Har refaktorert

: ''
(!harFnr &&
'Personer med identtype DNR eller NPID kan ikke innvandre fordi de ikke har norsk statsborgerskap') ||
(harTestnorgeIdenter && leggTilPaaGruppe && tekstLeggTilPaaGruppe)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Denne sjekken gir i mange tilfeller false, men title må være en string eller null, og derfor får vi en warning i consolen (derfor har vi tidligere sendt med en tom string dersom vi ikke skal vise title). Fint om du kan fikse det her, i tillegg til på utvandretTilLand, vergemaal og fullmakt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visste jeg ikke, vil oppdatere

motpartsPersonident: Yup.string().nullable(),
motpartsPersonident: Yup.string()
.test('feltet-mangler', 'Fullmektig er påkrevd', (value, testcontext) => {
return value || testcontext.options.context.identMaster !== 'PDL'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Endring av fullmakt direkte på person feiler fordi identMaster er undefined.

@@ -142,7 +166,7 @@ export const PdlEksisterendePerson = ({
name={eksisterendePersonPath}
onChange={(person) => {
formMethods.setValue(eksisterendePersonPath, person?.value || null)
formMethods.trigger('pdldata.person.kontaktinformasjonForDoedsbo')
formMethods.trigger('pdldata.person')
}}
label={label}
options={filteredOptions}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nå som options har fått så mye ekstra info, hadde det kanskje vært fint med et bredere felt, så vi kan lese alt? size={'xxlarge'} f.eks.?

@betsytraran
Copy link
Contributor

For øyeblikket får jeg ikke til å legge til barn/forelder og sivilstand på Tenor-person, får feilmelding på bestillingen: Feil: error:ForelderBarnRelasjon: Relatert person 05918796705 finnes ikke, samt et spørsmålstegn istedenfor ident. Mulig jeg ikke er på siste versjon av koden eller at det er noe hikke, men om du vil se nærmere på det kan du ta en titt på best. 11581 og 11582.

Copy link
Contributor

@betsytraran betsytraran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Da tenker jeg at jeg sier meg ferdig 😅 Godkjent når du har gått igjennom alle kommenarene 👍

#delploy-test-frontend

The commit involves several changes related to the "ForelderBarnRelasjon" form component. Firstly, an alert was introduced when age difference of existing person is not adequately set. Secondly, updates were made to the "ForelderBarnRelasjonForm" component to include the "ident" property. Also, relevant validation rules were added to fields in various form components. Text strings were simplified by grouping similar field names together. For instance, in "KontaktDoedsbo", "Identifikasjon" and others. Lastly, a required 'ansvarlig' test was added to handle the condition when 'ansvarlig' field is 'ANDRE'.
#delploy-test-frontend

This update ensures that tooltips in multiple form components have a fallback empty string. This change impacts several components including "KontaktDoedsbo", "Identifikasjon", "Personinformasjon", "Familierelasjoner", and "PdlPersonForm". When certain conditions are not met, an empty tooltip will now be displayed instead of leaving it undefined.
@krharum
Copy link
Contributor Author

krharum commented Jun 11, 2024

For øyeblikket får jeg ikke til å legge til barn/forelder og sivilstand på Tenor-person, får feilmelding på bestillingen: Feil: error:ForelderBarnRelasjon: Relatert person 05918796705 finnes ikke, samt et spørsmålstegn istedenfor ident. Mulig jeg ikke er på siste versjon av koden eller at det er noe hikke, men om du vil se nærmere på det kan du ta en titt på best. 11581 og 11582.

@krharum krharum closed this Jun 11, 2024
…ontend #deploy-test-frontend

Made amendments across several areas of the codebase, including changes to the validation of familial relationships and "ForelderBarnRelasjon" forms. These changes provide better handling of familial relationship data, including using antall as a const variable, passing in the 'ident' parameter to several components, and adjusting conditions for master identification. Also debugged issues in the "Familierelasjoner" validation method and adjusted size parameter in the "PdlEksisterendePerson" component.
Updated PdlEksisterendePerson and familierelasjoner components by removing redundant conditions and console logs. The validation now has simpler checks for related persons in family relationships, ensuring accuracy while maintaining cleaner and more efficient code.
The commit has two main actions. It introduces changes to streamline how familial relationships are handled in the 'HendelseIdService' class. This includes using streams to access 'relasjoner' and reducing code redundancy. This improves the performance of operations dealing with familial relationships. Secondly, it adds '@UpdateTimestamp' annotation to 'sist_oppdatert' field in 'DbPerson', 'DbAlias', and 'DbRelasjon' model classes to track the last update time automatically.
@krharum
Copy link
Contributor Author

krharum commented Jun 12, 2024

Lukket ved feiltagelse

@krharum krharum reopened this Jun 12, 2024
@krharum krharum merged commit 6894b86 into master Jun 12, 2024
8 checks passed
@krharum krharum deleted the feature/testnorge-nye-pdl-artifakter branch June 12, 2024 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants