Implemented new Userfield type "Select list" (closes #325)

This commit is contained in:
Bernd Bestel
2019-09-17 19:11:06 +02:00
parent bbd5ce1dc4
commit 0c27157db6
11 changed files with 44 additions and 13 deletions

View File

@@ -7,9 +7,11 @@
<td>
@if($userfieldObject !== null)
@if($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_CHECKBOX)
@if($userfieldObject->value == 1)<i class="fas fa-check"></i>@endif
@if($userfieldObject->value == 1)<i class="fas fa-check"></i>@endif
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_PRESET_CHECKLIST)
{!! str_replace(',', '<br>', $userfieldObject->value) !!}
@else
{{ $userfieldObject->value }}
{{ $userfieldObject->value }}
@endif
@endif
</td>

View File

@@ -84,6 +84,15 @@
@endforeach
</select>
</div>
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_PRESET_CHECKLIST)
<div class="form-group">
<label for="{{ $userfield->name }}">{{ $userfield->caption }}</label>
<select multiple class="form-control userfield-input selectpicker" data-userfield-name="{{ $userfield->name }}" data-actions-Box="true" data-live-search="true">
@foreach(preg_split('/\r\n|\r|\n/', $userfield->config) as $option)
<option value="{{ $option }}">{{ $option }}</option>
@endforeach
</select>
</div>
@endif
@endforeach