diff --git a/src/admin/components/OrderConfirmationModal.tsx b/src/admin/components/OrderConfirmationModal.tsx index 204c148..92985e8 100644 --- a/src/admin/components/OrderConfirmationModal.tsx +++ b/src/admin/components/OrderConfirmationModal.tsx @@ -2,6 +2,8 @@ import { useState, useCallback } from "react"; import Box from "@mui/material/Box"; import Typography from "@mui/material/Typography"; import IconButton from "@mui/material/IconButton"; +import useMediaQuery from "@mui/material/useMediaQuery"; +import { useTheme } from "@mui/material/styles"; import { Modal, Button, TextField, Field } from "../ui"; import { useAlert } from "../context/AlertContext"; @@ -38,6 +40,8 @@ export default function OrderConfirmationModal({ applyVat, }: OrderConfirmationModalProps) { const alert = useAlert(); + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down("sm")); const [step, setStep] = useState<"choose" | "edit">("choose"); const [lang, setLang] = useState("cs"); const [applyVatState, setApplyVatState] = useState(applyVat); @@ -193,116 +197,221 @@ export default function OrderConfirmationModal({ Zpět - - - - - Popis - Mn. - Jedn. - Cena - %DPH - - - - - {items.map((item, i) => ( - - - - updateItem(i, "description", e.target.value) - } - sx={{ minWidth: 200 }} - /> - - - - updateItem(i, "quantity", Number(e.target.value) || 0) - } - sx={{ width: 90 }} - slotProps={{ htmlInput: { step: "0.001" } }} - /> - - - updateItem(i, "unit", e.target.value)} - sx={{ width: 70 }} - /> - - - - updateItem( - i, - "unit_price", - Number(e.target.value) || 0, - ) - } - sx={{ width: 110 }} - slotProps={{ htmlInput: { step: "0.01" } }} - /> - - - - updateItem(i, "vat_rate", Number(e.target.value) || 0) - } - sx={{ width: 80 }} - slotProps={{ htmlInput: { step: "1" } }} - /> - - - removeItem(i)} - title="Odstranit" - aria-label="Odstranit" + {isMobile ? ( + + {items.map((item, i) => ( + + + + Položka {i + 1} + + + removeItem(i)} + title="Odstranit" + aria-label="Odstranit" + > + - - - - - - - - ))} - + + + + + + + updateItem(i, "description", e.target.value) + } + /> + + + updateItem(i, "quantity", Number(e.target.value) || 0) + } + slotProps={{ htmlInput: { step: "0.001" } }} + /> + updateItem(i, "unit", e.target.value)} + /> + + updateItem(i, "unit_price", Number(e.target.value) || 0) + } + slotProps={{ htmlInput: { step: "0.01" } }} + /> + + updateItem(i, "vat_rate", Number(e.target.value) || 0) + } + slotProps={{ htmlInput: { step: "1" } }} + /> + + + ))} - + ) : ( + + + + + Popis + Mn. + Jedn. + Cena + %DPH + + + + + {items.map((item, i) => ( + + + + updateItem(i, "description", e.target.value) + } + sx={{ minWidth: 200 }} + /> + + + + updateItem( + i, + "quantity", + Number(e.target.value) || 0, + ) + } + sx={{ width: 90 }} + slotProps={{ htmlInput: { step: "0.001" } }} + /> + + + + updateItem(i, "unit", e.target.value) + } + sx={{ width: 70 }} + /> + + + + updateItem( + i, + "unit_price", + Number(e.target.value) || 0, + ) + } + sx={{ width: 110 }} + slotProps={{ htmlInput: { step: "0.01" } }} + /> + + + + updateItem( + i, + "vat_rate", + Number(e.target.value) || 0, + ) + } + sx={{ width: 80 }} + slotProps={{ htmlInput: { step: "1" } }} + /> + + + removeItem(i)} + title="Odstranit" + aria-label="Odstranit" + > + + + + + + + + ))} + + + + )}