-
Notifications
You must be signed in to change notification settings - Fork 69
Update birth certificate SVG to use streetLevelDetails fields and correct informant relation handling #1052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:
|
| {{#ifCond (lookup $declaration 'informant.relation') '===' 'Mother' }} | ||
| <tspan x="307" y="518.104">{{$lookup $declaration 'mother.name.fullname'}}</tspan> | ||
| {{ else }} | ||
| {{#ifCond (lookup $declaration 'informant.relation') '===' 'FATHER'}} | ||
| {{#ifCond (lookup $declaration 'informant.relation') '===' 'Father'}} | ||
| <tspan x="307" y="518.104">{{$lookup $declaration 'father.name.fullname'}}</tspan> | ||
| {{ else }} | ||
| <tspan x="307" y="518.104">{{$lookup $declaration 'informant.name.fullname'}}</tspan> | ||
| {{/ifCond}} | ||
| {{/ifCond}} | ||
| <tspan x="307" y="528.104">{{$intl 'v2.constants.informant' (lookup $declaration 'informant.relation')}}{{#ifCond (lookup $declaration 'informant.relation') '===' 'OTHER'}} ({{lookup $declaration 'informant.other.relation'}}) {{/ifCond}}</tspan> | ||
| <tspan x="307" y="528.104">{{lookup $declaration 'informant.relation'}}{{#ifCond (lookup $declaration 'informant.relation') '===' 'OTHER'}} ({{lookup $declaration 'informant.other.relation'}}) {{/ifCond}}</tspan> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be kind enough to figure out why the values aren't consistent? i.e. OTHER, Mother, Father instead of OTHER, MOTHER, FATHER
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Zangetsu101 , @Nil20 , @jamil314
In v2-events/../pdfUtils.ts, we have the following code:
const resolvedDeclaration = stringifyDeclaration(fieldConfigs, $declaration)
const data = {
$declaration: resolvedDeclaration,
$metadata,
$review: review,
$references: {
locations,
users
}
}
const output = template(data)
return outputThe $declaration object contains all fields with their references resolved into human-readable values.
For example, the field informant.relation is a Select field. Its internal values are uppercase codes like FATHER, MOTHER, while the display labels are Father, Mother, etc.
After resolution, $declaration['informant.relation'] contains the labels (e.g., Father) instead of the raw values (e.g., FATHER).
Hence, when we bind these variables to the template, we use these resolved labels in the final output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean we also need to think about french version of mother/father?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jamil314 , I have taken care of your concern in this PR and opencrvs/opencrvs-core#10599 here
5d5ac47 to
6551e2f
Compare
makelicious
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the issue only in certified certificate or in all of them?
| <!-- NOTE: Since we are using intl-lookup, we need to use informant.relation as actual value | ||
| rather than as stringified one. Hence we opt for native lookup over $lookup --> | ||
| {{#ifCond (lookup $declaration 'informant.relation') '===' 'MOTHER' }} | ||
| {{#ifCond (lookup $originalDeclaration 'informant.relation') '===' 'MOTHER' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any way to to do this without original declaration? Previously we used native lookup not $lookup, since it provided the raw value. Any guesses what has changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In packages/client/src/v2-events/features/events/actions/print-certificate/pdfUtils.ts
...
const stringifyDeclaration = getFormDataStringifier(
intl,
locations,
adminLevels
)
const fieldConfigs = config.declaration.pages.flatMap((x) => x.fields)
const resolvedDeclaration = stringifyDeclaration(fieldConfigs, $declaration)
...
const data = {
$declaration: resolvedDeclaration,
$metadata,
$review: review,
$references: {
locations,
users
}
}
As you can see, we first resolve all the properties of the $declaration object, then we send it to svg template. Hence, we dont have any more reference values in $declaration rather always the resolved value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have reverted the change in the core, so now, we dont use resolved value for comparison anymore.
…rect informant relation handling
issue: opencrvs/opencrvs-core#10584
core pr: opencrvs/opencrvs-core#10599
Checklist