Skip to content

Commit

Permalink
Merge pull request #1184 from opencrvs/merge-cc-to-release
Browse files Browse the repository at this point in the history
Merge cc to release
  • Loading branch information
Zangetsu101 authored Dec 5, 2024
2 parents a2ab7ad + 5f79ccf commit 499dfa5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
- You can now configure the home screen application’s name and icons in your country configuration package as manifest.json and app icon files are moved from core to country config (check `src/client-static` folder)
- Updated `allowedFileFormats` in signature fields to use MIME types (`image/png`, `image/jpg`, `image/jpeg`, `image/svg`) instead of simple file extensions. If you are already using the `allowedFileFormats` field in your implementation, please ensure to update the format accordingly.
- Remove unnecessary UI dividers that add in various sections of the declaration forms(e.g the Death, Birth and Marriage forms) [#244](https://github.com/opencrvs/opencrvs-countryconfig/pull/244)
- The details exists conditionals for the various sections i.e. father, mother, spouse has to use the `values.detailsExist` property instead of accessing it from `draftData.[sectionName].detailsExists`. This is due to the fact that the draftData is not populated until any changes have been made to any of the fields in the current section.

### Bug fixes

Expand Down
19 changes: 8 additions & 11 deletions src/form/addresses/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
*/

import {
FATHER_DETAILS_DONT_EXIST,
MOTHER_DETAILS_DONT_EXIST,
SPOUSE_DETAILS_DONT_EXIST,
detailsDontExist,
expressionToConditional,
hideIfInformantBrideOrGroom,
Expand Down Expand Up @@ -101,11 +98,11 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
{
config: AddressSubsections.PRIMARY_ADDRESS_SUBSECTION,
label: formMessageDescriptors.primaryAddress,
conditionalCase: MOTHER_DETAILS_DONT_EXIST
conditionalCase: detailsDontExist
},
{
config: AddressCases.PRIMARY_ADDRESS,
conditionalCase: MOTHER_DETAILS_DONT_EXIST
conditionalCase: detailsDontExist
} /*,
{
config: AddressSubsections.SECONDARY_ADDRESS_SUBSECTION,
Expand All @@ -128,10 +125,10 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
label: formMessageDescriptors.primaryAddress,
conditionalCase: [
expressionToConditional(
`${FATHER_DETAILS_DONT_EXIST} || ${hideIfMotherAddressNotAvailable[0].expression}`
`${detailsDontExist} || ${hideIfMotherAddressNotAvailable[0].expression}`
),
expressionToConditional(
`${FATHER_DETAILS_DONT_EXIST} || ${hideIfMotherAddressNotAvailable[0].expression} || ${primaryAddressSameAsOtherPrimaryAddress}`,
`${detailsDontExist} || ${hideIfMotherAddressNotAvailable[0].expression} || ${primaryAddressSameAsOtherPrimaryAddress}`,
'hideInPreview'
)
]
Expand All @@ -153,7 +150,7 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
},
{
config: AddressCases.PRIMARY_ADDRESS,
conditionalCase: `((${FATHER_DETAILS_DONT_EXIST} || ${primaryAddressSameAsOtherPrimaryAddress}) && !(${mothersDetailsDontExistOnOtherPage}) || ((${detailsDontExist}) && (${mothersDetailsDontExistOnOtherPage})))`
conditionalCase: `((${detailsDontExist} || ${primaryAddressSameAsOtherPrimaryAddress}) && !(${mothersDetailsDontExistOnOtherPage}) || ((${detailsDontExist}) && (${mothersDetailsDontExistOnOtherPage})))`
} /*,
{
config: AddressSubsections.SECONDARY_ADDRESS_SUBSECTION,
Expand Down Expand Up @@ -282,10 +279,10 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
label: formMessageDescriptors.primaryAddress,
conditionalCase: [
expressionToConditional(
`${SPOUSE_DETAILS_DONT_EXIST} || ${hideIfDeceasedAddressNotAvailable[0].expression}`
`${detailsDontExist} || ${hideIfDeceasedAddressNotAvailable[0].expression}`
),
expressionToConditional(
`${SPOUSE_DETAILS_DONT_EXIST} || ${hideIfDeceasedAddressNotAvailable[0].expression} || ${primaryAddressSameAsOtherPrimaryAddress}`,
`${detailsDontExist} || ${hideIfDeceasedAddressNotAvailable[0].expression} || ${primaryAddressSameAsOtherPrimaryAddress}`,
'hideInPreview'
)
]
Expand All @@ -307,7 +304,7 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
},
{
config: AddressCases.PRIMARY_ADDRESS,
conditionalCase: `((${SPOUSE_DETAILS_DONT_EXIST} || ${primaryAddressSameAsOtherPrimaryAddress}) || (${detailsDontExist}))`
conditionalCase: `(${detailsDontExist} || ${primaryAddressSameAsOtherPrimaryAddress})`
}
]
},
Expand Down
12 changes: 2 additions & 10 deletions src/form/common/default-validation-conditionals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
*
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
*/
import { Conditional } from '../types/types'
import { IntegratingSystemType } from '../types/types'
import { Conditional, IntegratingSystemType } from '../types/types'
import { Validator } from '../types/validators'

/**
Expand Down Expand Up @@ -484,18 +483,11 @@ export const spouseFamilyNameConditionals = [
}
]

export const FATHER_DETAILS_DONT_EXIST =
'(draftData?.father && !draftData?.father.detailsExist) || !values.detailsExist'
export const MOTHER_DETAILS_DONT_EXIST =
'(draftData?.mother && !draftData?.mother.detailsExist) || !values.detailsExist'
export const SPOUSE_DETAILS_DONT_EXIST =
'(draftData?.spouse && !draftData?.spouse.detailsExist) || !values.detailsExist'

// if mothers details do not exist on other page
export const mothersDetailsDontExistOnOtherPage =
'draftData && draftData.mother && !draftData.mother.detailsExist'

// if fathers details do not exist
// if details don't exist for the current section
export const detailsDontExist = '!values.detailsExist'

// primary address same as other primary
Expand Down

0 comments on commit 499dfa5

Please sign in to comment.