From e13f977c4da2d2d5d41a610f1053f19c3e48ecf4 Mon Sep 17 00:00:00 2001 From: BOHA Date: Sun, 7 Jun 2026 08:43:10 +0200 Subject: [PATCH] refactor(mui): migrate OrderConfirmationModal to kit Modal Replace legacy FormModal with the MUI kit Modal. Map the two-step flow (choose/edit) onto the kit footer: submitText + onSubmit switch per step, submitDisabled gates "Vygenerovat PDF" when there are no items. Re-skin lang/VAT toggles (kit Button variants), item editor (kit TextField + IconButton inside a Box table). All generate/preview logic, props, and Czech text preserved verbatim. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../components/OrderConfirmationModal.tsx | 252 ++++++++---------- 1 file changed, 110 insertions(+), 142 deletions(-) diff --git a/src/admin/components/OrderConfirmationModal.tsx b/src/admin/components/OrderConfirmationModal.tsx index 4dc8047..204c148 100644 --- a/src/admin/components/OrderConfirmationModal.tsx +++ b/src/admin/components/OrderConfirmationModal.tsx @@ -1,5 +1,8 @@ import { useState, useCallback } from "react"; -import FormModal from "./FormModal"; +import Box from "@mui/material/Box"; +import Typography from "@mui/material/Typography"; +import IconButton from "@mui/material/IconButton"; +import { Modal, Button, TextField, Field } from "../ui"; import { useAlert } from "../context/AlertContext"; interface ConfirmationItem { @@ -103,119 +106,111 @@ export default function OrderConfirmationModal({ }, [defaultVatRate]); return ( - {step === "choose" ? ( -
-
- -
- - -
-
+ + + -
- -
- - -
-
+ + + -
- -

+ + Jak chcete připravit potvrzení objednávky? -

- - -
- -
- -
-
- ) : ( -
-
- + Zpět + + + + @@ -230,39 +225,34 @@ export default function OrderConfirmationModal({ {items.map((item, i) => ( ))} -
Popis
- updateItem(i, "description", e.target.value) } - className="admin-form-input" - style={{ minWidth: "200px" }} + sx={{ minWidth: 200 }} /> - updateItem(i, "quantity", Number(e.target.value) || 0) } - className="admin-form-input" - style={{ width: "80px" }} - step="0.001" + sx={{ width: 90 }} + slotProps={{ htmlInput: { step: "0.001" } }} /> - updateItem(i, "unit", e.target.value)} - className="admin-form-input" - style={{ width: "60px" }} + sx={{ width: 70 }} /> - @@ -272,28 +262,28 @@ export default function OrderConfirmationModal({ Number(e.target.value) || 0, ) } - className="admin-form-input" - style={{ width: "100px" }} - step="0.01" + sx={{ width: 110 }} + slotProps={{ htmlInput: { step: "0.01" } }} /> - updateItem(i, "vat_rate", Number(e.target.value) || 0) } - className="admin-form-input" - style={{ width: "70px" }} - step="1" + sx={{ width: 80 }} + slotProps={{ htmlInput: { step: "1" } }} /> - +
-
- - -
- - -
-
+ + Přidat položku + + + )} -
+ ); }