From 257dd644aa23649efd1b9a34f50dfa9d281e6bb1 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Thu, 15 Aug 2019 14:05:33 +0200 Subject: [PATCH] Render checkbox Userfields in tables as checkmark (closes #326) --- changelog/52_UNRELEASED_2019-xx-xx.md | 1 + views/components/userfields_tbody.blade.php | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/changelog/52_UNRELEASED_2019-xx-xx.md b/changelog/52_UNRELEASED_2019-xx-xx.md index 10c3717b..d87edbcb 100644 --- a/changelog/52_UNRELEASED_2019-xx-xx.md +++ b/changelog/52_UNRELEASED_2019-xx-xx.md @@ -7,6 +7,7 @@ - General improvements/fixes - Improved the handling which entry page to use with disabled feature flags (thanks @nielstholenaar) - Fixed that the Userfield type "Preset list" had always the caption "Product group" instead of the configured one (thanks @oncleben31) + - Userfields of type "checkbox" are rendered as a checkmark in tables when checked (instead of "1" as till now) - API improvements - New endpoint `/stock/shoppinglist/remove-product` to remove a product from a shopping list (thanks @Forceu) - When adding a product (through `stock/product/{productId}/add` or `stock/product/{productId}/inventory`) with omitted best before date and if the given product has "Default best before days" set, the best before date is calculated based on that (so far always today was used which is still the case when no date is supplied and also the product has no "Default best before days set) (thanks @Forceu) diff --git a/views/components/userfields_tbody.blade.php b/views/components/userfields_tbody.blade.php index 8e9d6429..8ec2c728 100644 --- a/views/components/userfields_tbody.blade.php +++ b/views/components/userfields_tbody.blade.php @@ -4,7 +4,15 @@ @if($userfield->show_as_column_in_tables == 1) @php $userfieldObject = FindObjectInArrayByPropertyValue($userfieldValues, 'name', $userfield->name) @endphp - @if($userfieldObject !== null){{ $userfieldObject->value }}@endif + + @if($userfieldObject !== null) + @if($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_CHECKBOX) + @if($userfieldObject->value == 1)@endif + @else + {{ $userfieldObject->value }} + @endif + @endif + @endif @endforeach