mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Make Userfields reorderable (closes #1134)
This commit is contained in:
parent
887526c727
commit
6270f39688
@ -119,6 +119,7 @@
|
||||
### Userfield improvements/fixes
|
||||
- New Userfield type "File" to attach any file, will be rendered as a link to the file in tables (if enabled) (thanks @fipwmaqzufheoxq92ebc)
|
||||
- New Userfield type "Picture" to attach a picture, the picture will be rendered (small) in tables (if enabled) (thanks @fipwmaqzufheoxq92ebc)
|
||||
- Userfields can now be reordered on the input form (new field "Sort number" per Userfield, fields will be ordered by that number, if any)
|
||||
|
||||
### General & other improvements/fixes
|
||||
- UI refresh / style improvements (thanks @zsarnett for the idea and initial work on this)
|
||||
|
@ -1975,3 +1975,18 @@ msgstr ""
|
||||
|
||||
msgid "Automatically do the booking using the last price and the amount of the shopping list item, if the product has \"Default due days\" set"
|
||||
msgstr ""
|
||||
|
||||
msgid "When moving products from/to a freezer location, the products due date is automatically adjusted according to the product settings"
|
||||
msgstr ""
|
||||
|
||||
msgid "This is the internal field name, e. g. for the API"
|
||||
msgstr ""
|
||||
|
||||
msgid "This is used to display the field on the frontend"
|
||||
msgstr ""
|
||||
|
||||
msgid "Multiple Userfields will be ordered by that number on the input form"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sort number"
|
||||
msgstr ""
|
||||
|
2
migrations/0119.sql
Normal file
2
migrations/0119.sql
Normal file
@ -0,0 +1,2 @@
|
||||
ALTER TABLE userfields
|
||||
ADD sort_number INTEGER;
|
@ -65,7 +65,7 @@ class UserfieldsService extends BaseService
|
||||
throw new \Exception('Entity does not exist or is not exposed');
|
||||
}
|
||||
|
||||
return $this->getDatabase()->userfields()->where('entity', $entity)->orderBy('name', 'COLLATE NOCASE')->fetchAll();
|
||||
return $this->getDatabase()->userfields()->where('entity', $entity)->orderBy('sort_number')->orderBy('name', 'COLLATE NOCASE')->fetchAll();
|
||||
}
|
||||
|
||||
public function GetValues($entity, $objectId)
|
||||
|
@ -49,7 +49,12 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">{{ $__t('Name') }}</label>
|
||||
<label for="name">
|
||||
{{ $__t('Name') }}
|
||||
<i class="fas fa-question-circle text-muted"
|
||||
data-toggle="tooltip"
|
||||
title="{{ $__t('This is the internal field name, e. g. for the API') }}"></i>
|
||||
</label>
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
required
|
||||
@ -61,7 +66,12 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">{{ $__t('Caption') }}</label>
|
||||
<label for="name">
|
||||
{{ $__t('Caption') }}
|
||||
<i class="fas fa-question-circle text-muted"
|
||||
data-toggle="tooltip"
|
||||
title="{{ $__t('This is used to display the field on the frontend') }}"></i>
|
||||
</label>
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
required
|
||||
@ -71,6 +81,15 @@
|
||||
<div class="invalid-feedback">{{ $__t('A caption is required') }}</div>
|
||||
</div>
|
||||
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'sort_number',
|
||||
'label' => 'Sort number',
|
||||
'min' => 0,
|
||||
'value' => $userfield->sort_number,
|
||||
'isRequired' => false,
|
||||
'hint' => $__t('Multiple Userfields will be ordered by that number on the input form')
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="type">{{ $__t('Type') }}</label>
|
||||
<select required
|
||||
|
@ -92,6 +92,7 @@
|
||||
<th>{{ $__t('Name') }}</th>
|
||||
<th>{{ $__t('Caption') }}</th>
|
||||
<th>{{ $__t('Type') }}</th>
|
||||
<th>{{ $__t('Sort number') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="d-none">
|
||||
@ -125,6 +126,9 @@
|
||||
<td>
|
||||
{{ $__t($userfield->type) }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $userfield->sort_number }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
Loading…
x
Reference in New Issue
Block a user