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 ,
@@ -813,7 +814,9 @@ export const birthForm: ISerializedForm = {
813814 expression :
814815 '!Boolean(draftData?.registration?.registrationNumber)'
815816 }
816- ]
817+ ] . concat (
818+ hideMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet
819+ )
817820 : [
818821 {
819822 action : 'hide' ,
@@ -826,7 +829,9 @@ export const birthForm: ISerializedForm = {
826829 i - 1
827830 } '] || values['detailsMentionExist__${ i - 1 } '] === "false"`
828831 }
829- ] ,
832+ ] . concat (
833+ hideMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet
834+ ) ,
830835 title : {
831836 id : 'mention-view-group-' + i ,
832837 defaultMessage : 'Mention ' + ( i + 1 ) ,
Original file line number Diff line number Diff line change @@ -500,6 +500,39 @@ export const primaryAddressSameAsOtherPrimary: Conditional[] = [
500500 }
501501]
502502
503+ export const hideInPreviewMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet =
504+ [
505+ {
506+ action : 'hideInPreview' ,
507+ expression : `draftData?.history?.some(hist => ['CERTIFIED', 'ISSUED'].includes(hist?.regStatus)) === false`
508+ }
509+ ]
510+
511+ export const hideMarginalNoteIfBirthCertificateIsNoteIssuedNorPrintedYet = [
512+ {
513+ action : 'hide' ,
514+ expression : `draftData?.history?.some(hist => ['CERTIFIED', 'ISSUED'].includes(hist?.regStatus)) === false`
515+ }
516+ ]
517+
518+ export const hideInPreviewAndBlockEditingAnyFieldIfBirthCertificateIsAlreadyissuedOrPrinted =
519+ [
520+ {
521+ action : 'hideInPreview' ,
522+ expression : `draftData?.history?.some(hist => ['CERTIFIED', 'ISSUED'].includes(hist?.regStatus)) === true`
523+ }
524+ ]
525+
526+ export const hideInPreviewDocumentSectionIfBirthCertificateIsAlreadyissuedOrPrinted =
527+ [
528+ {
529+ description :
530+ 'Hide in preview Documents section if birth certificate is already printed or issued' ,
531+ action : 'hideInPreview' ,
532+ expression : `draftData?.history?.some(hist => ['CERTIFIED', 'ISSUED'].includes(hist?.regStatus)) === true`
533+ }
534+ ]
535+
503536export const hideIfDistrictPrimaryAddressNotSelected = (
504537 section : string
505538) : Conditional [ ] => [
You can’t perform that action at this time.
0 commit comments