From 568911967db4054a512d503c970ec0f50cad7bcf Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 6 Oct 2026 12:06:23 +0000 Subject: [PATCH] Design P6: Angebots-Formular als Dialog (Esc, Sperre beim Speichern, Vorschlagsliste geprueft) Co-Authored-By: Claude Sonnet 5.5 --- src/components/offers/OfferForm.jsx | 99 ++++++++++++++++------------- 1 file changed, 54 insertions(+), 45 deletions(-) diff --git a/src/components/offers/OfferForm.jsx b/src/components/offers/OfferForm.jsx index d50de33..b9c4855 100644 --- a/src/components/offers/OfferForm.jsx +++ b/src/components/offers/OfferForm.jsx @@ -1,11 +1,10 @@ -import { useEffect, useMemo, useState } from 'react' -import { FaSpinner } from 'react-icons/fa6' -import { Card, Button, AutocompleteInput } from '../ui' +import { useEffect, useMemo, useRef, useState } from 'react' +import { Dialog, Field, Button, AutocompleteInput } from '../ui' import { useCustomers } from '../../hooks/useCustomers' +import { useScrollIntoView } from '../../hooks/useScrollIntoView' import { createOffer, getOfferContext } from '../../lib/teamApi' import { customerPickLabel, findCustomerByLabel } from '../../lib/chatFormat' import { createdMessage, evaluateOfferForm, offerConfirm } from '../../lib/offerFormat' -import '../../styles/admin-areas.css' const MONTHS = Array.from({ length: 12 }, (_, i) => i + 1) @@ -29,6 +28,8 @@ export default function OfferForm({ fixedCustomerId, fixedCustomerName, onCreate const [ctx, setCtx] = useState(null) // { customerId, data } | { customerId, error } const [busy, setBusy] = useState(false) const [error, setError] = useState('') + const errorRef = useRef(null) + useScrollIntoView(errorRef, error) useEffect(() => { setCtx(null) @@ -83,62 +84,70 @@ export default function OfferForm({ fixedCustomerId, fixedCustomerName, onCreate } let previewBox - if (!customerId) previewBox =
Bitte einen Kunden aus der Liste wählen.
- else if (ctx?.error && ctx.customerId === customerId) previewBox =
{ctx.error}
- else if (!ready) previewBox =
Lade Kunde…
+ if (!customerId) previewBox =

Bitte einen Kunden aus der Liste wählen.

+ else if (ctx?.error && ctx.customerId === customerId) previewBox =

{ctx.error}

+ else if (!ready) previewBox =

Lade Kunde…

else { previewBox = ( <> - {evaluation.errors.map((l) =>
{l}
)} - {evaluation.previewLines.map((l) =>
{l}
)} + {evaluation.errors.map((l) =>

{l}

)} + {evaluation.previewLines.map((l) =>

{l}

)} ) } return ( - -

Neues Angebot

-
- - - -
+
+ + - - + + + setValidUntil(e.target.value)} /> +
- - -
+
{previewBox}
+ {error &&

{error}

} + ) }