fix: Standort-Formulare zweispaltig, Felder in voller Breite

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jonny 2026-11-08 15:13:40 +01:00
parent 679dd869c4
commit 30b18c367c
3 changed files with 124 additions and 83 deletions

View File

@ -19,7 +19,7 @@ export function AdressFelder({
}) {
const id = (feld: string) => `${idPrefix}-${feld}`;
return (
<div className="mb-4 flex flex-col gap-3 md:col-span-2">
<div className="mb-4 flex flex-col gap-3">
<div>
<label htmlFor={id("name")} className={LABEL}>
Name
@ -52,7 +52,12 @@ export function AdressFelder({
<label htmlFor={id("hausnummer")} className={LABEL}>
Nr.
</label>
<input id={id("hausnummer")} name="hausnummer" defaultValue={werte.hausnummer ?? ""} className={FIELD_CLASSES} />
<input
id={id("hausnummer")}
name="hausnummer"
defaultValue={werte.hausnummer ?? ""}
className={FIELD_CLASSES}
/>
</div>
</div>
<div className="flex gap-3">

View File

@ -48,43 +48,60 @@ export function NeuerStandort() {
<Card role="row" className="md:rounded-none md:border-0 md:border-b">
<form
onSubmit={handleSubmit}
className="flex flex-col gap-3 md:grid md:grid-cols-[1fr_1fr_1fr_1fr_1fr_auto_auto] md:items-end md:gap-4"
className="flex flex-col gap-3 md:grid md:grid-cols-2 md:items-start md:gap-x-8"
>
{fehler && (
<div className="md:col-span-7">
<div className="md:col-span-2">
<Alert>{fehler}</Alert>
</div>
)}
<AdressFelder idPrefix="neu-standort" />
<FormField label="Ansprechpartner" htmlFor="neu-standort-ansprechpartner">
<input
id="neu-standort-ansprechpartner"
name="ansprechpartner"
type="text"
required
className={FIELD_CLASSES}
/>
</FormField>
<FormField label="Telefon (optional)" htmlFor="neu-standort-telefon">
<input id="neu-standort-telefon" name="telefon" type="tel" className={FIELD_CLASSES} />
</FormField>
<FormField label="E-Mail (optional)" htmlFor="neu-standort-email">
<input id="neu-standort-email" name="email" type="email" className={FIELD_CLASSES} />
</FormField>
<Button type="submit" fullWidth={false} disabled={isPending}>
Anlegen
</Button>
<Button
type="button"
variant="secondary"
fullWidth={false}
onClick={() => {
setOffen(false);
setFehler(null);
}}
>
Abbrechen
</Button>
<div>
<FormField
label="Ansprechpartner"
htmlFor="neu-standort-ansprechpartner"
>
<input
id="neu-standort-ansprechpartner"
name="ansprechpartner"
type="text"
required
className={FIELD_CLASSES}
/>
</FormField>
<FormField label="Telefon (optional)" htmlFor="neu-standort-telefon">
<input
id="neu-standort-telefon"
name="telefon"
type="tel"
className={FIELD_CLASSES}
/>
</FormField>
<FormField label="E-Mail (optional)" htmlFor="neu-standort-email">
<input
id="neu-standort-email"
name="email"
type="email"
className={FIELD_CLASSES}
/>
</FormField>
</div>
<div className="flex gap-3 md:col-span-2 md:justify-end">
<Button type="submit" fullWidth={false} disabled={isPending}>
Anlegen
</Button>
<Button
type="button"
variant="secondary"
fullWidth={false}
onClick={() => {
setOffen(false);
setFehler(null);
}}
>
Abbrechen
</Button>
</div>
</form>
</Card>
);

View File

@ -38,20 +38,32 @@ export function StandortZeile({ ort }: { ort: Ort }) {
className="md:grid md:grid-cols-[1fr_1fr_auto] md:items-center md:gap-4 md:rounded-none md:border-0 md:border-b md:p-0 md:px-4 md:py-3 md:shadow-none"
>
<div role="cell">
<span className="text-xs font-medium text-asphalt-grey md:hidden">Adresse</span>
<span className="text-xs font-medium text-asphalt-grey md:hidden">
Adresse
</span>
<p className="text-asphalt-grey">{ort.adresse}</p>
{!ort.name && (
<p className="mt-1 text-xs font-medium text-status-warning">Name fehlt – bitte nachtragen</p>
<p className="mt-1 text-xs font-medium text-status-warning">
Name fehlt – bitte nachtragen
</p>
)}
{(!ort.plz || !ort.ort) && (
<p className="mt-1 text-xs font-medium text-status-warning">PLZ/Ort fehlt – bitte nachtragen</p>
<p className="mt-1 text-xs font-medium text-status-warning">
PLZ/Ort fehlt – bitte nachtragen
</p>
)}
</div>
<div role="cell" className="mt-2 md:mt-0">
<span className="text-xs font-medium text-asphalt-grey md:hidden">Ansprechpartner</span>
<span className="text-xs font-medium text-asphalt-grey md:hidden">
Ansprechpartner
</span>
<p className="text-asphalt-grey">{ort.ansprechpartner}</p>
{ort.telefon && <p className="text-xs text-asphalt-grey/70">{ort.telefon}</p>}
{ort.email && <p className="text-xs text-asphalt-grey/70">{ort.email}</p>}
{ort.telefon && (
<p className="text-xs text-asphalt-grey/70">{ort.telefon}</p>
)}
{ort.email && (
<p className="text-xs text-asphalt-grey/70">{ort.email}</p>
)}
</div>
<div role="cell" className="mt-3 md:mt-0">
<button
@ -70,56 +82,63 @@ export function StandortZeile({ ort }: { ort: Ort }) {
<Card role="row" className="md:rounded-none md:border-0 md:border-b">
<form
onSubmit={handleSubmit}
className="flex flex-col gap-3 md:grid md:grid-cols-[1fr_1fr_1fr_1fr_1fr_auto_auto] md:items-end md:gap-4"
className="flex flex-col gap-3 md:grid md:grid-cols-2 md:items-start md:gap-x-8"
>
{fehler && (
<div className="md:col-span-7">
<div className="md:col-span-2">
<Alert>{fehler}</Alert>
</div>
)}
<AdressFelder idPrefix={`ort-${ort.id}`} werte={ort} />
<FormField label="Ansprechpartner" htmlFor={`ansprechpartner-${ort.id}`}>
<input
id={`ansprechpartner-${ort.id}`}
name="ansprechpartner"
type="text"
required
defaultValue={ort.ansprechpartner}
className={FIELD_CLASSES}
/>
</FormField>
<FormField label="Telefon (optional)" htmlFor={`telefon-${ort.id}`}>
<input
id={`telefon-${ort.id}`}
name="telefon"
type="tel"
defaultValue={ort.telefon ?? ""}
className={FIELD_CLASSES}
/>
</FormField>
<FormField label="E-Mail (optional)" htmlFor={`email-${ort.id}`}>
<input
id={`email-${ort.id}`}
name="email"
type="email"
defaultValue={ort.email ?? ""}
className={FIELD_CLASSES}
/>
</FormField>
<Button type="submit" fullWidth={false} disabled={isPending}>
Speichern
</Button>
<Button
type="button"
variant="secondary"
fullWidth={false}
onClick={() => {
setBearbeiten(false);
setFehler(null);
}}
>
Abbrechen
</Button>
<div>
<FormField
label="Ansprechpartner"
htmlFor={`ansprechpartner-${ort.id}`}
>
<input
id={`ansprechpartner-${ort.id}`}
name="ansprechpartner"
type="text"
required
defaultValue={ort.ansprechpartner}
className={FIELD_CLASSES}
/>
</FormField>
<FormField label="Telefon (optional)" htmlFor={`telefon-${ort.id}`}>
<input
id={`telefon-${ort.id}`}
name="telefon"
type="tel"
defaultValue={ort.telefon ?? ""}
className={FIELD_CLASSES}
/>
</FormField>
<FormField label="E-Mail (optional)" htmlFor={`email-${ort.id}`}>
<input
id={`email-${ort.id}`}
name="email"
type="email"
defaultValue={ort.email ?? ""}
className={FIELD_CLASSES}
/>
</FormField>
</div>
<div className="flex gap-3 md:col-span-2 md:justify-end">
<Button type="submit" fullWidth={false} disabled={isPending}>
Speichern
</Button>
<Button
type="button"
variant="secondary"
fullWidth={false}
onClick={() => {
setBearbeiten(false);
setFehler(null);
}}
>
Abbrechen
</Button>
</div>
</form>
</Card>
);