From c2368bd824f89aa14be11bac412c02a9b20614ce Mon Sep 17 00:00:00 2001 From: Alessio Pintus Date: Mon, 2 Oct 2023 17:43:07 +0200 Subject: [PATCH] ENG-4141 Fix checkbox display in case of true value --- .../components/entity-field-table/EntityFieldTable.js.ejs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/generators/entity-microfrontend/templates/ui/widgets/entity/detailsWidget/src/components/entity-field-table/EntityFieldTable.js.ejs b/generators/entity-microfrontend/templates/ui/widgets/entity/detailsWidget/src/components/entity-field-table/EntityFieldTable.js.ejs index 598c65d7..aef7ac21 100644 --- a/generators/entity-microfrontend/templates/ui/widgets/entity/detailsWidget/src/components/entity-field-table/EntityFieldTable.js.ejs +++ b/generators/entity-microfrontend/templates/ui/widgets/entity/detailsWidget/src/components/entity-field-table/EntityFieldTable.js.ejs @@ -4,7 +4,7 @@ const fieldType = getJHipsterType(field); switch (fieldType) { case 'Boolean': - return ``; + return ``; case 'LocalDate': return `{${entityInstance}.${field.fieldName} && new Date(${entityInstance}.${field.fieldName}).toLocaleDateString(language)}`; case 'ZonedDateTime': @@ -33,6 +33,10 @@ import Checkbox from '@material-ui/core/Checkbox'; import <%= entityInstance %>Type from 'components/__types__/<%= entityInstance %>'; +<%_ if (fields.find(field => field.fieldType === 'Boolean')) { _%> +const isChecked = booleanField => typeof booleanField !== 'undefined' ? booleanField.valueOf() : false; +<%_ } _%> + const <%= entityClass %>FieldTable = ({ t, <% if (fieldsContainDate) { _%>i18n: { language }, <% } _%><%= entityInstance %> }) => (