-
Hello, I came across the documentation about configuring a certificate and wanted something which is a bit more complicated. Is it possible to somehow use Javascript in the macros (eg. {{eventDate}}) to do all kind of adjustments (like, put default value, use magic worlds like "yesterday" instead of the date of yesterday ...) ? I already have the JS functions and/or endpoint to do it but I'm looking for a proper way to do it (without modifying opencrvs-core). Thank you for your help |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hey Manitra! Unfortunately, currently, it is not possible to run completely arbitrary javascript on the certificate values. We have a few built-in Handlebars Helpers for internationalisation, if conditions, date formatting and fetching location details by id. However, these might not be sufficient for your use case. We acknowledge that custom formatting logic is a very common use case and are planning to support this in future releases. Modifying core is never a good idea, but if you have no choice, I recommend you write your own Handlebars helper. We haven't yet designed how we could allow countries to add custom formatting to their certificates, but my hunch is that it would involve allowing countries to define their own helpers for Handlebars. Transitioning your custom helpers to this format in later versions shouldn't be too difficult. I hope this helps! |
Beta Was this translation helpful? Give feedback.
-
@rikukissa @manitra I just submitted this PR which allows you to build configurable handlebar helpers. |
Beta Was this translation helpful? Give feedback.
Hey Manitra! Unfortunately, currently, it is not possible to run completely arbitrary javascript on the certificate values. We have a few built-in Handlebars Helpers for internationalisation, if conditions, date formatting and fetching location details by id. However, these might not be sufficient for your use case. We acknowledge that custom formatting logic is a very common use case and are planning to support this in future releases.
Modifying core is never a good idea, but if you have no choice, I recommend you write your own Handlebars helper. We haven't yet designed how we could allow countries to add custom formatting to their certificates, but my hunch is that it would involve all…