feat(helpdesk): add user-select to schema editor field type dropdown

Adds 'user-select' to FIELD_TYPES so it appears in the schema editor
dropdown as 'Benutzerauswahl' / 'User selection'. Preview renders a
placeholder select. Translations added to both i18n files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
aminovfariz
2026-06-08 11:04:25 +02:00
parent 9bc8799b6b
commit 2968d5e386
4 changed files with 10 additions and 1 deletions

View File

@@ -403,6 +403,7 @@
"Date": "Datum", "Date": "Datum",
"Checkbox": "Checkbox", "Checkbox": "Checkbox",
"Select": "Auswahl", "Select": "Auswahl",
"User selection": "Benutzerauswahl",
"Text content": "Textinhalt", "Text content": "Textinhalt",
"Maximum %d fields allowed": "Maximal %d Felder erlaubt", "Maximum %d fields allowed": "Maximal %d Felder erlaubt",
"Field %d: unknown type \"%s\"": "Feld %d: unbekannter Typ \"%s\"", "Field %d: unknown type \"%s\"": "Feld %d: unbekannter Typ \"%s\"",

View File

@@ -403,6 +403,7 @@
"Date": "Date", "Date": "Date",
"Checkbox": "Checkbox", "Checkbox": "Checkbox",
"Select": "Select", "Select": "Select",
"User selection": "User selection",
"Text content": "Text content", "Text content": "Text content",
"Maximum %d fields allowed": "Maximum %d fields allowed", "Maximum %d fields allowed": "Maximum %d fields allowed",
"Field %d: unknown type \"%s\"": "Field %d: unknown type \"%s\"", "Field %d: unknown type \"%s\"": "Field %d: unknown type \"%s\"",

View File

@@ -53,6 +53,7 @@ $handoverSchemaFields = is_array($handoverSchemaFields ?? null) ? $handoverSchem
'type_date' => t('Date'), 'type_date' => t('Date'),
'type_checkbox' => t('Checkbox'), 'type_checkbox' => t('Checkbox'),
'type_select' => t('Select'), 'type_select' => t('Select'),
'type_user-select' => t('User selection'),
'text_content' => t('Text content'), 'text_content' => t('Text content'),
'field' => t('Field'), 'field' => t('Field'),
'preview' => t('Preview'), 'preview' => t('Preview'),

View File

@@ -6,7 +6,7 @@
*/ */
import { resolveHost } from '/js/core/app-dom.js'; import { resolveHost } from '/js/core/app-dom.js';
const FIELD_TYPES = ['heading', 'paragraph', 'text', 'textarea', 'number', 'date', 'checkbox', 'select']; const FIELD_TYPES = ['heading', 'paragraph', 'text', 'textarea', 'number', 'date', 'checkbox', 'select', 'user-select'];
const DISPLAY_ONLY_TYPES = ['heading', 'paragraph']; const DISPLAY_ONLY_TYPES = ['heading', 'paragraph'];
const EMPTY_API = Object.freeze({ destroy: () => {} }); const EMPTY_API = Object.freeze({ destroy: () => {} });
@@ -385,6 +385,12 @@ function init(root) {
option.textContent = opt.label || ''; option.textContent = opt.label || '';
input.appendChild(option); input.appendChild(option);
}); });
} else if (field.type === 'user-select') {
input = document.createElement('select');
const placeholder = document.createElement('option');
placeholder.value = '';
placeholder.textContent = t['type_user-select'] || 'User selection';
input.appendChild(placeholder);
} else { } else {
input = document.createElement('input'); input = document.createElement('input');
input.type = field.type === 'number' ? 'number' : field.type === 'date' ? 'date' : 'text'; input.type = field.type === 'number' ? 'number' : field.type === 'date' ? 'date' : 'text';