File tree Expand file tree Collapse file tree 3 files changed +55
-5
lines changed
Expand file tree Collapse file tree 3 files changed +55
-5
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ import { getNUI } from '../common/common-custom-fields'
1111import { REGULAR_TEXT_MAX_LENGTH } from '@countryconfig/constants'
1212import { tribunalOfFirstInstanceActOptions } from '../common/select-options'
1313import { conditionals } from './custom-conditionals'
14+ import {
15+ hideInPreviewMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet ,
16+ hideMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet
17+ } from '../common/default-validation-conditionals'
1418
1519export function getTimeOfBirth ( ) : SerializedFormField {
1620 const fieldName : string = 'birthTime'
@@ -856,7 +860,9 @@ export const getDetailsMentionExist = (index: number) => {
856860 action : 'hideInPreview' ,
857861 expression : `${ index } !== 0 || values['detailsMentionExist__${ index } '] === "true"`
858862 }
859- ]
863+ ] . concat (
864+ hideInPreviewMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet
865+ )
860866 : [
861867 {
862868 action : 'hideInPreview' ,
@@ -866,7 +872,13 @@ export const getDetailsMentionExist = (index: number) => {
866872 action : 'hide' ,
867873 expression : `!values['detailsMentionExist__${ index - 1 } ']`
868874 }
869- ] ,
875+ ]
876+ . concat (
877+ hideInPreviewMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet
878+ )
879+ . concat (
880+ hideMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet
881+ ) ,
870882 mapping : getCustomFieldMapping ( fieldId ) ,
871883 ignoreBottomMargin : false
872884 } satisfies SerializedFormField
Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ import {
5757 hideIfDistrictPrimaryAddressNotSelected ,
5858 hideIfFatherPrimaryAddressConditionsDontMeet ,
5959 hideIfNotDefaultCountry ,
60- fathersHasFormallyRecognisedChildConditionnals
60+ fathersHasFormallyRecognisedChildConditionnals ,
61+ hideMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet
6162} from '../common/default-validation-conditionals'
6263import {
6364 getNationalIDValidators ,
@@ -810,7 +811,9 @@ export const birthForm: ISerializedForm = {
810811 expression :
811812 '!Boolean(draftData?.registration?.registrationNumber)'
812813 }
813- ]
814+ ] . concat (
815+ hideMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet
816+ )
814817 : [
815818 {
816819 action : 'hide' ,
@@ -823,7 +826,9 @@ export const birthForm: ISerializedForm = {
823826 i - 1
824827 } '] || values['detailsMentionExist__${ i - 1 } '] === "false"`
825828 }
826- ] ,
829+ ] . concat (
830+ hideMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet
831+ ) ,
827832 title : {
828833 id : 'mention-view-group-' + i ,
829834 defaultMessage : 'Mention ' + ( i + 1 ) ,
Original file line number Diff line number Diff line change @@ -494,6 +494,39 @@ export const primaryAddressSameAsOtherPrimary: Conditional[] = [
494494 }
495495]
496496
497+ export const hideInPreviewMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet =
498+ [
499+ {
500+ action : 'hideInPreview' ,
501+ expression : `draftData?.history?.some(hist => ['CERTIFIED', 'ISSUED'].includes(hist?.regStatus)) === false`
502+ }
503+ ]
504+
505+ export const hideMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet = [
506+ {
507+ action : 'hide' ,
508+ expression : `draftData?.history?.some(hist => ['CERTIFIED', 'ISSUED'].includes(hist?.regStatus)) === false`
509+ }
510+ ]
511+
512+ export const hideInPreviewAndBlockEditingAnyFieldIfBirthCertificateIsAlreadyissuedOrPrinted =
513+ [
514+ {
515+ action : 'hideInPreview' ,
516+ expression : `draftData?.history?.some(hist => ['CERTIFIED', 'ISSUED'].includes(hist?.regStatus)) === true`
517+ }
518+ ]
519+
520+ export const hideInPreviewDocumentSectionIfBirthCertificateIsAlreadyissuedOrPrinted =
521+ [
522+ {
523+ description :
524+ 'Hide in preview Documents section if birth certificate is already printed or issued' ,
525+ action : 'hideInPreview' ,
526+ expression : `draftData?.history?.some(hist => ['CERTIFIED', 'ISSUED'].includes(hist?.regStatus)) === true`
527+ }
528+ ]
529+
497530export const hideIfDistrictPrimaryAddressNotSelected = (
498531 section : string
499532) : Conditional [ ] => [
You can’t perform that action at this time.
0 commit comments