feat(persons): add type selector + title + conditional fields to edit form

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-25 21:45:09 +02:00
committed by marcel
parent 110416d68b
commit 7699a4e7e2
2 changed files with 118 additions and 56 deletions

View File

@@ -6,7 +6,11 @@ import { m } from '$lib/paraglide/messages.js';
const TYPES = ['PERSON', 'INSTITUTION', 'GROUP', 'UNKNOWN'] as const;
type PersonType = (typeof TYPES)[number];
let { value = 'PERSON', name = 'personType' }: { value?: string; name?: string } = $props();
let {
value = 'PERSON',
name = 'personType',
onchange
}: { value?: string; name?: string; onchange?: (type: PersonType) => void } = $props();
let selected = $state<PersonType>(
untrack(() => (TYPES.includes(value as PersonType) ? (value as PersonType) : 'PERSON'))
@@ -21,6 +25,7 @@ const labels: Record<PersonType, () => string> = {
function select(type: PersonType) {
selected = type;
onchange?.(type);
}
</script>