// src/sections/order/view/order-list-view.tsx import type { IOrderItem } from 'src/types/order'; import { useBoolean, usePopover } from 'minimal-shared/hooks'; import Box from '@mui/material/Box'; import Link from '@mui/material/Link'; import Paper from '@mui/material/Paper'; import Stack from '@mui/material/Stack'; import Button from '@mui/material/Button'; import Avatar from '@mui/material/Avatar'; import MenuList from '@mui/material/MenuList'; import Collapse from '@mui/material/Collapse'; import MenuItem from '@mui/material/MenuItem'; import TableRow from '@mui/material/TableRow'; import Checkbox from '@mui/material/Checkbox'; import TableCell from '@mui/material/TableCell'; import IconButton from '@mui/material/IconButton'; import ListItemText from '@mui/material/ListItemText'; import { RouterLink } from 'src/routes/components'; import { fCurrency } from 'src/utils/format-number'; import { fDate, fTime } from 'src/utils/format-time'; import { Label } from 'src/components/label'; import { Iconify } from 'src/components/iconify'; import { ConfirmDialog } from 'src/components/custom-dialog'; import { CustomPopover } from 'src/components/custom-popover'; import { useTranslation } from 'react-i18next'; // ---------------------------------------------------------------------- type Props = { row: IOrderItem; selected: boolean; detailsHref: string; onSelectRow: () => void; onDeleteRow: () => void; }; export function OrderTableRow({ row, selected, onSelectRow, onDeleteRow, detailsHref }: Props) { const confirmDialog = useBoolean(); const menuActions = usePopover(); const collapseRow = useBoolean(); const { t } = useTranslation(); const renderPrimaryRow = () => ( {row.orderNumber} {row.customer.name} {row.customer.email} {row.totalQuantity} {fCurrency(row.subtotal)} ); const renderSecondaryRow = () => ( {row.items.map((item) => ( ({ display: 'flex', alignItems: 'center', p: theme.spacing(1.5, 2, 1.5, 1.5), '&:not(:last-of-type)': { borderBottom: `solid 2px ${theme.vars.palette.background.neutral}`, }, })} >
x{item.quantity}
{fCurrency(item.price)}
))}
); const renderMenuActions = () => ( { confirmDialog.onTrue(); menuActions.onClose(); }} sx={{ color: 'error.main' }} > {t('Delete')}
  • menuActions.onClose()}> {t('View')}
  • ); const renderConfrimDialog = () => ( Delete } /> ); return ( <> {renderPrimaryRow()} {renderSecondaryRow()} {renderMenuActions()} {renderConfrimDialog()} ); }