Skip to content

Commit f35a960

Browse files
authored
Merge pull request #311 from digital-gov-mg/develop
update from develop improve birth certificate contents set limit of birthDeclaration to 365 temporary Merge pull request #299 from digital-gov-mg/develop - qa env deploy config
2 parents 3d08857 + 6297cd9 commit f35a960

File tree

5 files changed

+94
-30
lines changed

5 files changed

+94
-30
lines changed

public/helpers.js

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,20 @@ function eventStatement() {
254254
this.birthChildFokontanyCustomAddress
255255
? 'fokontany ' + this.birthChildFokontanyCustomAddress + ','
256256
: '',
257-
'kaominina',
258-
(definitionOffice(replaceByUppercase(placeOfBirthDistrict)) ||
259-
'-') + ',',
260-
'district',
261-
definitionDistrict(placeOfBirthState) || '-'
257+
258+
this.birthChildFokontanyCustomAddress
259+
.toLowerCase()
260+
.includes('toamasina')
261+
? ''
262+
: 'kaominina' +
263+
' ' +
264+
(definitionOffice(
265+
replaceByUppercase(placeOfBirthDistrict)
266+
) || '-') +
267+
',' +
268+
'district' +
269+
' ' +
270+
definitionDistrict(placeOfBirthState) || '-'
262271
]
263272
: [
264273
'no teraka tao',
@@ -406,10 +415,15 @@ function fatherDetails(fatherPrimaryDistrict) {
406415
(this.birthFatherFokontanyCustomAddress ||
407416
this.birthMotherFokontanyCustomAddress ||
408417
'-') + ',',
409-
'kaominina',
410-
(definitionOffice(
411-
replaceByUppercase(fatherPrimaryDistrict)
412-
) || '- ') + ','
418+
fatherPrimaryDistrict?.toLowerCase().includes('cu toamasina')
419+
? // && (this.birthFatherFokontanyCustomAddress?.toLowerCase().includes('toamasina') || this.birthMotherFokontanyCustomAddress?.toLowerCase().includes('toamasina'))
420+
''
421+
: 'kaominina' +
422+
' ' +
423+
(definitionOffice(
424+
replaceByUppercase(fatherPrimaryDistrict)
425+
) || '- ') +
426+
','
413427
]
414428
: [
415429
([
@@ -653,9 +667,16 @@ function motherDetails(motherPrimaryDistrict) {
653667
? [
654668
'amin’ny fokontany',
655669
(this.birthMotherFokontanyCustomAddress || '-') + ',',
656-
'kaominina',
657-
(definitionOffice(replaceByUppercase(motherPrimaryDistrict)) ||
658-
'-') + ','
670+
671+
motherPrimaryDistrict?.toLowerCase().includes('cu toamasina')
672+
? // && this.birthMotherFokontanyCustomAddress.toLowerCase().includes('toamasina')
673+
''
674+
: 'kaominina' +
675+
' ' +
676+
(definitionOffice(
677+
replaceByUppercase(motherPrimaryDistrict)
678+
) || '-') +
679+
','
659680
]
660681
: [
661682
([
@@ -1075,7 +1096,7 @@ var DOZENS_MDG_WORDS = [
10751096
'roapolo ',
10761097
'telopolo ',
10771098
'efapolo ',
1078-
'dimapolo ',
1099+
'dimampolo ',
10791100
'enipolo ',
10801101
'fitopolo ',
10811102
'valopolo ',
@@ -1480,6 +1501,13 @@ function isToamasina() {
14801501
return name.toLowerCase().includes('cu toamasina')
14811502
}
14821503
}
1504+
1505+
function isToamasinaSubUrbaine() {
1506+
return function (name) {
1507+
return name.toLowerCase().includes('toamasina suburbaine')
1508+
}
1509+
}
1510+
14831511
/**
14841512
* @TODO To optimize
14851513
* !! THIS marital status translation list is HARDCODED here because :

src/api/certificates/source/Madagascar-birth-certificate.svg

Lines changed: 7 additions & 1 deletion
Loading

src/form/common/certificate/handlebars/helpers.ts

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -224,19 +224,31 @@ export function eventStatement(): Handlebars.HelperDelegate {
224224
? [
225225
'no teraka tao amin’ny',
226226
this.placeOfBirthFacility
227-
? replaceAbbreviations(this.placeOfBirthFacility) + ','
227+
? replaceAbbreviations(this.placeOfBirthFacility)
228228
: '',
229229
this.birthChildOtherPlaceOfBirthAddress
230-
? this.birthChildOtherPlaceOfBirthAddress + ','
230+
? this.birthChildOtherPlaceOfBirthAddress + ''
231231
: '',
232232
this.birthChildFokontanyCustomAddress
233233
? 'fokontany ' + this.birthChildFokontanyCustomAddress + ','
234234
: '',
235-
'kaominina',
236-
(definitionOffice(replaceByUppercase(placeOfBirthDistrict)) ||
237-
'-') + ',',
238-
'district',
239-
definitionDistrict(placeOfBirthState) || '-'
235+
236+
this.birthChildFokontanyCustomAddress
237+
?.toLowerCase()
238+
.includes('toamasina') ||
239+
this.placeOfBirthFacility?.toLowerCase().includes('toamasina') ||
240+
this.birthChildFokontanyCustomAddress
241+
?.toLowerCase()
242+
.includes('toamasina')
243+
? ''
244+
: 'kaominina' +
245+
' ' +
246+
(definitionOffice(replaceByUppercase(placeOfBirthDistrict)) ||
247+
'-') +
248+
', ' +
249+
'district' +
250+
' ' +
251+
definitionDistrict(placeOfBirthState) || '-'
240252
]
241253
: [
242254
'no teraka tao',
@@ -305,9 +317,15 @@ function fatherDetails(
305317
(this.birthFatherFokontanyCustomAddress ||
306318
this.birthMotherFokontanyCustomAddress ||
307319
'-') + ',',
308-
'kaominina',
309-
(definitionOffice(replaceByUppercase(fatherPrimaryDistrict)) ||
310-
'- ') + ','
320+
fatherPrimaryDistrict?.toLowerCase().includes('cu toamasina')
321+
? // && (this.birthFatherFokontanyCustomAddress?.toLowerCase().includes('toamasina') || this.birthMotherFokontanyCustomAddress?.toLowerCase().includes('toamasina'))
322+
''
323+
: 'kaominina' +
324+
' ' +
325+
(definitionOffice(
326+
replaceByUppercase(fatherPrimaryDistrict)
327+
) || '- ') +
328+
','
311329
]
312330
: [
313331
([
@@ -355,9 +373,15 @@ function motherDetails(
355373
? [
356374
'amin’ny fokontany',
357375
(this.birthMotherFokontanyCustomAddress || '-') + ',',
358-
'kaominina',
359-
(definitionOffice(replaceByUppercase(motherPrimaryDistrict)) || '-') +
360-
','
376+
377+
motherPrimaryDistrict?.toLowerCase().includes('cu toamasina')
378+
? // && this.birthMotherFokontanyCustomAddress?.toLowerCase().includes('toamasina')
379+
''
380+
: 'kaominina' +
381+
' ' +
382+
(definitionOffice(replaceByUppercase(motherPrimaryDistrict)) ||
383+
'-') +
384+
','
361385
]
362386
: [
363387
([
@@ -567,7 +591,7 @@ const DOZENS_MDG_WORDS: string[] = [
567591
'roapolo ',
568592
'telopolo ',
569593
'efapolo ',
570-
'dimapolo ',
594+
'dimampolo ',
571595
'enipolo ',
572596
'fitopolo ',
573597
'valopolo ',
@@ -946,6 +970,12 @@ export function isToamasina(): Handlebars.HelperDelegate {
946970
}
947971
}
948972

973+
export function isToamasinaSubUrbaine(): Handlebars.HelperDelegate {
974+
return function (this: any, name: string) {
975+
return name.toLowerCase().includes('toamasina suburbaine')
976+
}
977+
}
978+
949979
/**
950980
* @TODO To optimize
951981
* !! THIS marital status translation list is HARDCODED here because :

src/form/common/custom-validation-conditionals/custom-validators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export function isDateNotOlderThanDays(limit: number) {
136136
description:
137137
'The error message appears when the given date is older than the limit days'
138138
},
139-
props: { limit: 30 }
139+
props: { limit: 365 } // 30 days by default
140140
} satisfies ValidationResult
141141
}
142142

src/form/common/default-validation-conditionals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const isValidChildBirthDate = [
3232
},
3333
{
3434
operation: 'isDateNotOlderThanDays',
35-
parameters: [30]
35+
parameters: [365] // 30 days by default
3636
}
3737
] satisfies Validator[]
3838

0 commit comments

Comments
 (0)