- Added a new API endpoint for reordering reference value types based on user-defined order. - Updated the AdminReferenceValueTypesPage to allow users to reorder types using up/down buttons. - Introduced a consistent confidence level sorting mechanism across the application. - Refactored related components to remove unused sort order fields and improve user experience.
60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
/** Labels für Referenzwert-Metadaten (Erfassung). */
|
||
|
||
export const REF_SOURCE_LABELS = {
|
||
manual_user: 'Manuell (Nutzer)',
|
||
manual_admin: 'Manuell (Admin)',
|
||
import_device: 'Import Gerät',
|
||
import_app: 'Import App',
|
||
derived_system: 'Abgeleitet (System)',
|
||
estimated_system: 'Geschätzt (System)',
|
||
test_entry: 'Testeintrag',
|
||
}
|
||
|
||
export const REF_METHOD_LABELS = {
|
||
direct_measurement: 'Direkte Messung',
|
||
lab_test: 'Labortest',
|
||
field_test: 'Feldtest',
|
||
questionnaire: 'Fragebogen',
|
||
formula_estimation: 'Formel-Schätzung',
|
||
trend_analysis: 'Trendanalyse',
|
||
device_algorithm: 'Geräte-Algorithmus',
|
||
manual_assessment: 'Manuelle Einschätzung',
|
||
imported_external: 'Extern importiert',
|
||
unknown: 'Unbekannt',
|
||
}
|
||
|
||
export const REF_CONFIDENCE_LABELS = {
|
||
high: 'Hoch',
|
||
medium: 'Mittel',
|
||
low: 'Niedrig',
|
||
unknown: 'Unbekannt',
|
||
}
|
||
|
||
/** Reihenfolge für Dropdowns (nicht alphabetisch) */
|
||
export const REF_CONFIDENCE_ORDER = ['high', 'medium', 'low', 'unknown']
|
||
|
||
export function sortConfidenceKeys(keys) {
|
||
if (!Array.isArray(keys)) return []
|
||
const known = REF_CONFIDENCE_ORDER.filter((k) => keys.includes(k))
|
||
const rest = [...keys].filter((k) => !REF_CONFIDENCE_ORDER.includes(k)).sort()
|
||
return [...known, ...rest]
|
||
}
|
||
|
||
export function labelSource(k) {
|
||
return REF_SOURCE_LABELS[k] || k || '–'
|
||
}
|
||
export function labelMethod(k) {
|
||
return REF_METHOD_LABELS[k] || k || '–'
|
||
}
|
||
export function labelConfidence(k) {
|
||
return REF_CONFIDENCE_LABELS[k] || k || '–'
|
||
}
|
||
|
||
export const VALUE_DATA_TYPE_LABELS = {
|
||
integer: 'Ganzzahl',
|
||
decimal: 'Dezimalzahl',
|
||
percentage: 'Prozent',
|
||
text: 'Text',
|
||
enum: 'Auswahl (ENUM)',
|
||
}
|