Render checkbox Userfields in tables as checkmark (closes #326)

This commit is contained in:
Bernd Bestel 2019-08-15 14:05:33 +02:00
parent be4b5c81b2
commit 257dd644aa
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 10 additions and 1 deletions

View File

@ -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)

View File

@ -4,7 +4,15 @@
@if($userfield->show_as_column_in_tables == 1)
@php $userfieldObject = FindObjectInArrayByPropertyValue($userfieldValues, 'name', $userfield->name) @endphp
<td>@if($userfieldObject !== null){{ $userfieldObject->value }}@endif</td>
<td>
@if($userfieldObject !== null)
@if($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_CHECKBOX)
@if($userfieldObject->value == 1)<i class="fas fa-check"></i>@endif
@else
{{ $userfieldObject->value }}
@endif
@endif
</td>
@endif
@endforeach