I’m trying to customize my healthcare provider cards so that they will display if the professional is accepting new patients. I’ve gotten so far as the following:
My code for the card’s component file looks like:
details: 'Accepting New Patients: '+ profile.acceptingNewPatients,
Is there a formatter I can apply so that the card displays “Yes” instead of “true?” I tried playing around with the “prettyprintobject” formatter but kept running into errors.
Hey @Sarah_Dougherty! Really cool use-case here that you’re setting up for your brand’s experience. In order to “transform” the boolean field, I recommend using custom (yet simple) JS formatter in your formatters.js file. In order to add this formatter, you’ll want to go to Jambo Commands → Override Theme → static > js > formatters.js.
Here, you can add the following code within the file:
static acceptingStatus(profile) {
if (profile.acceptingNewPatients) {
return 'Accepting New Patients';
}
return '';
}
This formatter is essentially translating the “True” boolean value to “Accepting New Patients”. From here, you’ll want to update the details mapping within your card’s compnent.js file. Please update it such that it transforms the data using your JS formatter:
details: Formatter.acceptingStatus(profile),
See below for final result:
You can also target the details to make the Accepting New Patients stand out a bit more. Let me know if you have any follow up questions when implementing this!
2 Likes