FORM-FIELDS-1: originBreeder + isDeaf in GerbilFormPage
- types.ts: isDeaf?: boolean|null in Gerbil + CreateGerbil (UpdateGerbil erbt via Partial) - de.ts: fields.originBreeder, fields.isDeaf; form.isDeafUnknown/Yes/No - GerbilFormPage: originBreeder Freitext-Input (neben originContactId-Dropdown); isDeaf Tristate-Select (Unbekannt/Ja/Nein); round-trip load→display→save e2e: 2 neue Tests (originBreeder Freitext + isDeaf Tristate round-trip) Gate: vitest 82/82, e2e 146/146, tsc clean Rebase auf Pams CR-2 folgt nach deren Merge.
This commit is contained in:
@@ -54,6 +54,8 @@ export interface Gerbil {
|
||||
* as resident (backend default true).
|
||||
*/
|
||||
isResident?: boolean
|
||||
/** FORM-FIELDS-1: true=gehörlos, false=hörend, null=unbekannt. */
|
||||
isDeaf?: boolean | null
|
||||
}
|
||||
|
||||
/** Payload for POST /gerbils. */
|
||||
@@ -76,6 +78,7 @@ export interface CreateGerbil {
|
||||
characterTraits?: string[] | null
|
||||
characterNote?: string | null
|
||||
isResident?: boolean
|
||||
isDeaf?: boolean | null
|
||||
}
|
||||
|
||||
/** Payload for PUT /gerbils/{id} (all optional / partial update). */
|
||||
|
||||
@@ -21,10 +21,12 @@ interface FormState {
|
||||
enclosureId: string
|
||||
litterId: string
|
||||
originContactId: string
|
||||
originBreeder: string
|
||||
receiverContactId: string
|
||||
genotype: string
|
||||
notes: string
|
||||
isResident: boolean
|
||||
isDeaf: boolean | null
|
||||
}
|
||||
|
||||
const EMPTY: FormState = {
|
||||
@@ -39,10 +41,12 @@ const EMPTY: FormState = {
|
||||
enclosureId: '',
|
||||
litterId: '',
|
||||
originContactId: '',
|
||||
originBreeder: '',
|
||||
receiverContactId: '',
|
||||
genotype: '',
|
||||
notes: '',
|
||||
isResident: true,
|
||||
isDeaf: null,
|
||||
}
|
||||
|
||||
function formFromGerbil(g: {
|
||||
@@ -57,10 +61,12 @@ function formFromGerbil(g: {
|
||||
enclosureId: string | null
|
||||
litterId: string | null
|
||||
originContactId: string | null
|
||||
originBreeder?: string | null
|
||||
receiverContactId: string | null
|
||||
genotype: string | null
|
||||
notes: string | null
|
||||
isResident?: boolean | null
|
||||
isDeaf?: boolean | null
|
||||
}): FormState {
|
||||
return {
|
||||
name: g.name,
|
||||
@@ -74,10 +80,12 @@ function formFromGerbil(g: {
|
||||
enclosureId: g.enclosureId ?? '',
|
||||
litterId: g.litterId ?? '',
|
||||
originContactId: g.originContactId ?? '',
|
||||
originBreeder: g.originBreeder ?? '',
|
||||
receiverContactId: g.receiverContactId ?? '',
|
||||
genotype: g.genotype ?? '',
|
||||
notes: g.notes ?? '',
|
||||
isResident: g.isResident ?? true,
|
||||
isDeaf: g.isDeaf ?? null,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,10 +175,12 @@ export default function GerbilFormPage() {
|
||||
enclosureId: nn(form.enclosureId),
|
||||
litterId: nn(form.litterId),
|
||||
originContactId: nn(form.originContactId),
|
||||
originBreeder: nn(form.originBreeder),
|
||||
receiverContactId: nn(form.receiverContactId),
|
||||
genotype: nn(form.genotype),
|
||||
notes: nn(form.notes),
|
||||
isResident: form.isResident,
|
||||
isDeaf: form.isDeaf,
|
||||
}
|
||||
const result = await mutation.run(body)
|
||||
if (result.ok) navigate(`/rennmaeuse/${result.value.id}`)
|
||||
@@ -326,6 +336,16 @@ export default function GerbilFormPage() {
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label className="field">
|
||||
<span>{t.fields.originBreeder}</span>
|
||||
<input
|
||||
className="input"
|
||||
value={form.originBreeder}
|
||||
placeholder="z. B. Zucht der Kleinen Chaoten"
|
||||
onChange={(e) => set('originBreeder', e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label className="field">
|
||||
<span>{t.fields.receiver}</span>
|
||||
<select
|
||||
@@ -360,6 +380,21 @@ export default function GerbilFormPage() {
|
||||
<textarea value={form.notes} onChange={(e) => set('notes', e.target.value)} />
|
||||
</label>
|
||||
|
||||
<label className="field">
|
||||
<span>{t.fields.isDeaf}</span>
|
||||
<select
|
||||
value={form.isDeaf === null ? '' : String(form.isDeaf)}
|
||||
onChange={(e) => {
|
||||
const v = e.target.value
|
||||
set('isDeaf', v === '' ? null : v === 'true')
|
||||
}}
|
||||
>
|
||||
<option value="">{t.form.isDeafUnknown}</option>
|
||||
<option value="true">{t.form.isDeafYes}</option>
|
||||
<option value="false">{t.form.isDeafNo}</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label className="field field--check" title={t.form.isResidentHint}>
|
||||
<span>{t.form.isResidentLabel}</span>
|
||||
<input
|
||||
|
||||
@@ -80,6 +80,8 @@ export const de = {
|
||||
enclosure: 'Gehege',
|
||||
colorVariety: 'Farbschlag',
|
||||
origin: 'Herkunft',
|
||||
originBreeder: 'Herkunft (Freitext)',
|
||||
isDeaf: 'Gehörlos',
|
||||
receiver: 'Abnehmer',
|
||||
genotype: 'Genotyp',
|
||||
notes: 'Notizen',
|
||||
@@ -114,6 +116,9 @@ export const de = {
|
||||
// BESTAND-FILTER: Zugehörigkeit zum eigenen Bestand (sonst externe Ahne)
|
||||
isResidentLabel: 'Gehört zum eigenen Bestand',
|
||||
isResidentHint: 'Abwählen für externe Ahnen, die nur für den Stammbaum erfasst sind.',
|
||||
isDeafUnknown: 'Unbekannt',
|
||||
isDeafYes: 'Ja',
|
||||
isDeafNo: 'Nein',
|
||||
save: 'Speichern',
|
||||
cancel: 'Abbrechen',
|
||||
saving: 'Speichern …',
|
||||
|
||||
Reference in New Issue
Block a user