Skip to content

Commit 5d347a5

Browse files
authored
Merge pull request #327 from digital-gov-mg/develop
Regitsry fix update from develop
2 parents 997de0d + 6ccb0d5 commit 5d347a5

File tree

3 files changed

+73
-53
lines changed

3 files changed

+73
-53
lines changed

public/helpers.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ function eventStatement() {
240240
__spreadArray(
241241
__spreadArray(
242242
[
243-
"--Tamin'ny",
243+
"--Taminny",
244244
customizeDateInCertificateContent(this.eventDate) + ',',
245245
'tamin’ny',
246246
convertTimeToMdgCustomWords(this.birthChildBirthTime)
@@ -329,7 +329,7 @@ function eventStatementSimplified(
329329
__spreadArray(
330330
__spreadArray(
331331
[
332-
"--Tamin'ny",
332+
"--Taminny",
333333
customizeDateInCertificateContent(eventDate) + ',',
334334
'tamin’ny',
335335
convertTimeToMdgCustomWords(birthChildBirthTime)
@@ -865,7 +865,7 @@ function registrationStatementSimplified(registrationStatementContext) {
865865
],
866866
countryPrimaryInformant == 'Madagascar'
867867
? [
868-
"amin'ny",
868+
"aminny",
869869
birthInformantFokontanyCustomAddress
870870
? 'fokontany '.concat(
871871
birthInformantFokontanyCustomAddress,
@@ -970,7 +970,7 @@ function registrationStatement() {
970970
],
971971
this.countryPrimaryInformant == 'Madagascar'
972972
? [
973-
"amin'ny",
973+
"aminny",
974974
this.birthInformantFokontanyCustomAddress
975975
? 'fokontany '.concat(
976976
this.birthInformantFokontanyCustomAddress,
@@ -1681,7 +1681,7 @@ function getRecognitionMentionValues(i) {
16811681
return [
16821682
"Nozanahan'i "
16831683
.concat(this['birthMentionChildFamilyName__' + i] || '-', ' ')
1684-
.concat(this['birthMentionChildFirstName__' + i] || '-', " tamin'ny ")
1684+
.concat(this['birthMentionChildFirstName__' + i] || '-', " taminny ")
16851685
.concat(
16861686
((_f =
16871687
(_e =
@@ -1693,7 +1693,7 @@ function getRecognitionMentionValues(i) {
16931693
: _e.reverse()) === null || _f === void 0
16941694
? void 0
16951695
: _f.join('/')) || '-',
1696-
" tao amin'ny kaominina "
1696+
" tao aminny kaominina "
16971697
)
16981698
.concat(
16991699
this['birthMentionRecognitionPlace__' + i] || '-',

public/main.js

Lines changed: 65 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -484,12 +484,22 @@ const getChildBirthLocation = (eventLocationId, type, id) =>
484484

485485
return {
486486
name: healthFacility?.name,
487-
stateName: healthFacilityCommune?.name,
488-
districtName: healthFacilityDistrict.name
487+
districtName: healthFacilityCommune?.name,
488+
stateName: healthFacilityDistrict?.name,
489489
}
490490
case 'OTHER':
491491
const other = await fetchLocationById(eventLocationId)
492-
return other.address
492+
const otherCommune = await fetchLocationById(
493+
other?.partOf?.reference?.split?.('/')[1]
494+
)
495+
const otherDistrict = await fetchLocationById(
496+
otherCommune?.partOf?.reference?.split?.('/')[1]
497+
)
498+
return {
499+
country: other?.address?.country,
500+
districtName: otherCommune?.name,
501+
stateName: otherDistrict?.name,
502+
}
493503
default:
494504
const home = await fetchOtherBirthLocation(id)
495505
return home.data.fetchBirthRegistration.eventLocation.address
@@ -970,7 +980,7 @@ window.openPrintModal = async function openPrintModal(id) {
970980
q.fieldId ===
971981
'birth.father.father-view-group.fatherHasFormallyRecognisedChild'
972982
) || { value: '' }
973-
).value
983+
).value === 'true' // because the value is string 'false' or 'true'
974984

975985
const title = window.getIsWithAdpotion(
976986
event.mother.maritalStatus,
@@ -1032,8 +1042,8 @@ window.openPrintModal = async function openPrintModal(id) {
10321042
'birth.child.child-view-group.otherPlaceOfBirthAddress'
10331043
)?.value
10341044
: undefined,
1035-
placeOfBirthDistrict: childBirthLocation?.stateName,
1036-
placeOfBirthState: childBirthLocation?.districtName,
1045+
placeOfBirthDistrict: childBirthLocation?.districtName, // in helper.js, it is already used like "District"="Commune" "state"="District" : should not permute it here
1046+
placeOfBirthState: childBirthLocation?.stateName,
10371047
childFamilyName: event.child.name[0].familyName,
10381048
childFirstName: [
10391049
event.child.name[0].middleName,
@@ -1051,6 +1061,10 @@ window.openPrintModal = async function openPrintModal(id) {
10511061
internationalPostalCodePlaceofbirth: childBirthLocation?.postalCode
10521062
}
10531063

1064+
const fatherPrimaryAddress = event.father.address?.find(
1065+
(a) => a.type === 'PRIMARY_ADDRESS'
1066+
)
1067+
10541068
const fatherDetailsContext = {
10551069
motherMaritalStatus: event.mother.maritalStatus,
10561070
fatherReasonNotApplying: event.father.reasonNotApplying,
@@ -1100,13 +1114,8 @@ window.openPrintModal = async function openPrintModal(id) {
11001114
).value == 'true'
11011115
? true
11021116
: false,
1103-
countryPrimaryFather: event.father.address?.find(
1104-
(a) => a.type === 'PRIMARY_ADDRESS'
1105-
)?.country
1106-
? countryData[
1107-
event.father.address?.find((a) => a.type === 'PRIMARY_ADDRESS')
1108-
?.country
1109-
][defaultLang]
1117+
countryPrimaryFather: fatherPrimaryAddress?.country
1118+
? countryData[fatherPrimaryAddress?.country][defaultLang]
11101119
: '',
11111120
birthFatherFokontanyCustomAddress: (
11121121
event?.questionnaire?.find(
@@ -1122,26 +1131,26 @@ window.openPrintModal = async function openPrintModal(id) {
11221131
'birth.mother.mother-view-group.fokontanyCustomAddress'
11231132
) || { value: '' }
11241133
).value,
1125-
fatherPrimaryDistrict: event.father.address?.find(
1126-
(a) => a.type === 'PRIMARY_ADDRESS'
1127-
)?.districtName,
1134+
fatherPrimaryDistrict: fatherPrimaryAddress?.districtName,
11281135
fatherOccupation: event.father.occupation,
11291136
birthFatherFatherHasFormallyRecognisedChild:
11301137
isFatherHasFormallyRecognisedChild,
11311138
motherReasonNotApplying: event.mother.reasonNotApplying,
1132-
internationalStatePrimaryFather: event.father.address?.state,
1133-
internationalDistrictPrimaryFather: event.father.address?.district,
1134-
internationalCityPrimaryFather: event.father.address?.city,
1135-
internationalAddressLine1PrimaryFather: event.father.address?.line?.[6],
1136-
internationalAddressLine2PrimaryFather: event.father.address?.line?.[7],
1137-
internationalAddressLine3PrimaryFather: event.father.address?.line?.[8],
1138-
internationalPostalCodePrimaryFather: event.father.address?.postalCode
1139+
internationalStatePrimaryFather:fatherPrimaryAddress?.state,
1140+
internationalDistrictPrimaryFather:fatherPrimaryAddress?.district,
1141+
internationalCityPrimaryFather:fatherPrimaryAddress?.city,
1142+
internationalAddressLine1PrimaryFather:fatherPrimaryAddress?.line?.[6],
1143+
internationalAddressLine2PrimaryFather:fatherPrimaryAddress?.line?.[7],
1144+
internationalAddressLine3PrimaryFather:fatherPrimaryAddress?.line?.[8],
1145+
internationalPostalCodePrimaryFather:fatherPrimaryAddress?.postalCode
11391146
}
11401147

1148+
const motherPrimaryAddress = event.mother.address?.find(
1149+
(a) => a.type === 'PRIMARY_ADDRESS'
1150+
)
1151+
11411152
const motherDetailsContext = {
1142-
motherPrimaryDistrict: event.mother.address?.find(
1143-
(a) => a.type === 'PRIMARY_ADDRESS'
1144-
)?.districtName,
1153+
motherPrimaryDistrict: motherPrimaryAddress?.districtName,
11451154
motherReasonNotApplying: event.mother.reasonNotApplying,
11461155
motherFamilyName:
11471156
event.mother.name && event.mother.name[0]
@@ -1158,7 +1167,15 @@ window.openPrintModal = async function openPrintModal(id) {
11581167
.join(' ')
11591168
.trim(),
11601169
birthMotherCustomizedExactDateOfBirthUnknown:
1161-
event.mother.exactDateOfBirthUnknown,
1170+
(
1171+
event?.questionnaire?.find(
1172+
(q) =>
1173+
q.fieldId ===
1174+
'birth.mother.mother-view-group.customizedExactDateOfBirthUnknown'
1175+
) || { value: false }
1176+
).value == 'true'
1177+
? true
1178+
: false,
11621179
birthMotherYearOfBirth: (
11631180
event?.questionnaire?.find(
11641181
(q) => q.fieldId === 'birth.mother.mother-view-group.yearOfBirth'
@@ -1179,13 +1196,8 @@ window.openPrintModal = async function openPrintModal(id) {
11791196
).value == 'true'
11801197
? true
11811198
: false,
1182-
countryPrimaryMother: event.mother.address?.find(
1183-
(a) => a.type === 'PRIMARY_ADDRESS'
1184-
)?.country
1185-
? countryData[
1186-
event.mother.address?.find((a) => a.type === 'PRIMARY_ADDRESS')
1187-
?.country
1188-
][defaultLang]
1199+
countryPrimaryMother: motherPrimaryAddress?.country
1200+
? countryData[motherPrimaryAddress?.country][defaultLang]
11891201
: '',
11901202
birthMotherFokontanyCustomAddress: (
11911203
event?.questionnaire?.find(
@@ -1195,15 +1207,24 @@ window.openPrintModal = async function openPrintModal(id) {
11951207
) || { value: '' }
11961208
).value,
11971209
motherOccupation: event.mother.occupation,
1198-
internationalStatePrimaryMother: event.mother.address?.state,
1199-
internationalDistrictPrimaryMother: event.mother.address?.district,
1200-
internationalCityPrimaryMother: event.mother.address?.city,
1201-
internationalAddressLine1PrimaryMother: event.mother.address?.line?.[6],
1202-
internationalAddressLine2PrimaryMother: event.mother.address?.line?.[7],
1203-
internationalAddressLine3PrimaryMother: event.mother.address?.line?.[8],
1204-
internationalPostalCodePrimaryMother: event.mother.address?.postalCode
1210+
internationalStatePrimaryMother: motherPrimaryAddress?.state,
1211+
internationalDistrictPrimaryMother: motherPrimaryAddress?.district,
1212+
internationalCityPrimaryMother: motherPrimaryAddress?.city,
1213+
internationalAddressLine1PrimaryMother: motherPrimaryAddress?.line?.[6],
1214+
internationalAddressLine2PrimaryMother: motherPrimaryAddress?.line?.[7],
1215+
internationalAddressLine3PrimaryMother: motherPrimaryAddress?.line?.[8],
1216+
internationalPostalCodePrimaryMother: motherPrimaryAddress?.postalCode
12051217
}
12061218

1219+
/** @TODO CHANGE This if conditions of registration is changed */
1220+
const registrationItemInHistory = event.history?.find(
1221+
(i) =>
1222+
i.action === null && i.regStatus === "REGISTERED"
1223+
)
1224+
1225+
const registrarRawFirstName = event.registration?.assignment?.firstName
1226+
const registrarFirstName = registrarRawFirstName?.trim().toLowerCase() === 'xyz261' ? '' : ` ${registrarRawFirstName}`
1227+
12071228
const registrationStatementContext = {
12081229
motherMaritalStatus: event.mother.maritalStatus,
12091230
birthFatherFatherHasFormallyRecognisedChild:
@@ -1222,7 +1243,7 @@ window.openPrintModal = async function openPrintModal(id) {
12221243
'birth.child.child-view-group.legacyBirthRegistrationTime'
12231244
) || { value: '' }
12241245
).value,
1225-
registrarDate: event.createdAt,
1246+
registrarDate: registrationItemInHistory?.date,
12261247
timezone: 'Africa/Nairobi',
12271248
informantType: event.informant.relationship,
12281249

@@ -1274,8 +1295,8 @@ window.openPrintModal = async function openPrintModal(id) {
12741295
)?.districtName,
12751296
informantOccupation: event.informant.occupation,
12761297
registrarName: [
1277-
event.registration.assignment.firstName,
1278-
event.registration.assignment.lastName
1298+
event.registration.assignment.lastName,
1299+
registrarFirstName
12791300
]
12801301
.join(' ')
12811302
.trim(),

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ 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 + ','
@@ -283,7 +283,6 @@ function fatherDetails(
283283
this: Record<string, string>,
284284
fatherPrimaryDistrict: string
285285
) {
286-
console.log('===>', canShowFatherDetails(this))
287286
if (!canShowFatherDetails(this)) {
288287
return ''
289288
}

0 commit comments

Comments
 (0)