From 74dd69eb35401d2cf73905c39b3f14713a675e4e Mon Sep 17 00:00:00 2001 From: Cole Thiessen Date: Sun, 16 Jun 2024 16:24:47 -0600 Subject: [PATCH] feat: add button to set amount paid equal to remaining balance --- src/components/common/EditOrder.tsx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/components/common/EditOrder.tsx b/src/components/common/EditOrder.tsx index c5eaa1e..f73802a 100644 --- a/src/components/common/EditOrder.tsx +++ b/src/components/common/EditOrder.tsx @@ -31,12 +31,13 @@ import ButtonGroup from "@mui/material/ButtonGroup"; import FormControl from "@mui/material/FormControl"; import MenuItem from "@mui/material/MenuItem"; import Select from "@mui/material/Select"; -import { styled, Theme, useTheme } from "@mui/material"; +import { styled, Theme, Tooltip, useTheme } from "@mui/material"; import useEditOrder from "../../hooks/useEditOrder"; import useCreateOrder from "../../hooks/useCreateOrder"; import ArrowRightIcon from "@mui/icons-material/ArrowRight"; import ArrowDownIcon from "@mui/icons-material/ArrowDropDown"; import CommentIcon from "@mui/icons-material/Comment"; +import BalanceIcon from "@mui/icons-material/Balance"; function SubsectionTitle({ title, sx, button }: { title: string, sx?: SxProps, button?: React.ReactNode }) { return ({title}{button}); @@ -93,7 +94,7 @@ export default function EditOrder({ open, setOpen, order, setOpenSnackbar, setSn const createOrderMutation = useCreateOrder(); const [isEditing, setIsEditing] = React.useState(isNewOrder); - const [showCustomerDetails, setShowCustomerDetails] = React.useState(false); + const [showCustomerDetails, setShowCustomerDetails] = React.useState(true); const [newOrder, setNewOrder] = React.useState({ ...order }); @@ -368,7 +369,19 @@ export default function EditOrder({ open, setOpen, order, setOpenSnackbar, setSn - Amount Paid + + Amount Paid + + setNewOrder(newOrder => ({ ...newOrder, amountPaid: newOrder.amountPaid + balance }))} + > + + + + - + Picked Up?