diff --git a/frontend/src/tools/bestellungen.jsx b/frontend/src/tools/bestellungen.jsx index 8abaab6..b32ee8e 100644 --- a/frontend/src/tools/bestellungen.jsx +++ b/frontend/src/tools/bestellungen.jsx @@ -1,3 +1,4 @@ +import { useConfirm } from '../confirm.jsx'; import { useState, useEffect, useMemo } from 'react'; import { api, S } from '../lib.js'; import { SearchIcon, PlusIcon, XIcon, EditIcon, TrashIcon, ChevronIcon } from '../icons.jsx'; @@ -30,6 +31,7 @@ function StatusBadge({ status, onClick, small }) { // ── Bestellung Detail ───────────────────────────────────────────────────────── function BestellungDetail({ id, toast, onBack }) { + const { confirm, ConfirmDialog } = useConfirm(); const [order, setOrder] = useState(null); const [loading, setLoading] = useState(true); const [archiv, setArchiv] = useState([]); @@ -85,6 +87,7 @@ function BestellungDetail({ id, toast, onBack }) { }; const removeItem = async itemId => { + if (!await confirm('Position wirklich entfernen?')) return; try { const u = await api(`/tools/bestellungen/${id}/items/${itemId}`,{method:'DELETE'}); setOrder(u); toast('Entfernt'); } catch(e) { toast(e.message,'error'); } }; @@ -108,6 +111,7 @@ function BestellungDetail({ id, toast, onBack }) { return (
+ {/* Header */}
)} - {order && !editMode && ( + {order && !editMode && !order.bezahlt && ( @@ -138,7 +149,7 @@ function BestellungDetail({ id, toast, onBack }) {
{/* Formular */} - {(editMode || !id) && ( + {(editMode || !id) && !order?.bezahlt && (
@@ -190,10 +201,12 @@ function BestellungDetail({ id, toast, onBack }) {
POSITIONEN
- + {!order.bezahlt && ( + + )}
{order.items.length===0 && ( @@ -386,6 +399,7 @@ function BestellungDetail({ id, toast, onBack }) { // ── Übersicht ───────────────────────────────────────────────────────────────── export default function Bestellungen({ toast, mobile }) { + const { confirm, ConfirmDialog } = useConfirm(); const [orders, setOrders] = useState([]); const [loading, setLoading] = useState(true); const [search, setSearch] = useState(''); @@ -401,6 +415,7 @@ export default function Bestellungen({ toast, mobile }) { useEffect(()=>{ load(); },[]); const del = async id => { + if (!await confirm('Bestellung wirklich löschen?')) return; try { await api(`/tools/bestellungen/${id}`,{method:'DELETE'}); setOrders(p=>p.filter(o=>o.id!==id)); toast('Gelöscht'); } catch(e) { toast(e.message,'error'); } finally { setDelId(null); } }; @@ -427,6 +442,7 @@ export default function Bestellungen({ toast, mobile }) { return (
+

Bestellungen

- {delId===order.id?( -
- - -
- ):( - - )} +
); diff --git a/frontend/src/tools/kalkulator3d.jsx b/frontend/src/tools/kalkulator3d.jsx index df6fbd6..65e64ae 100644 --- a/frontend/src/tools/kalkulator3d.jsx +++ b/frontend/src/tools/kalkulator3d.jsx @@ -1,3 +1,4 @@ +import { useConfirm } from '../confirm.jsx'; import { useState, useMemo, useEffect, useRef } from 'react'; import { api, S } from '../lib.js'; @@ -289,6 +290,7 @@ export default function Kalkulator3D({ toast, editData, onEditDone, mobile }) { // ── Archiv ────────────────────────────────────────────────────────────── export function SavedList({ toast, mobile }) { + const { confirm, ConfirmDialog } = useConfirm(); const [items, setItems] = useState([]); const [loading, setLoading] = useState(true); const [delId, setDelId] = useState(null); @@ -407,18 +409,10 @@ export function SavedList({ toast, mobile }) {
{/* Aktionen */} - {delId === item.id ? ( -
- Wirklich löschen? - - -
- ) : ( -
- - -
- )} +
+ + +
))}