update,
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// src/sections/order/view/order-list-view.tsx
|
||||
import type { IOrderItem } from 'src/types/order';
|
||||
|
||||
import { useBoolean, usePopover } from 'minimal-shared/hooks';
|
||||
@@ -26,6 +27,7 @@ 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';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -41,6 +43,7 @@ export function OrderTableRow({ row, selected, onSelectRow, onDeleteRow, details
|
||||
const confirmDialog = useBoolean();
|
||||
const menuActions = usePopover();
|
||||
const collapseRow = useBoolean();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const renderPrimaryRow = () => (
|
||||
<TableRow hover selected={selected}>
|
||||
@@ -195,13 +198,13 @@ export function OrderTableRow({ row, selected, onSelectRow, onDeleteRow, details
|
||||
sx={{ color: 'error.main' }}
|
||||
>
|
||||
<Iconify icon="solar:trash-bin-trash-bold" />
|
||||
Delete
|
||||
{t('Delete')}
|
||||
</MenuItem>
|
||||
|
||||
<li>
|
||||
<MenuItem component={RouterLink} href={detailsHref} onClick={() => menuActions.onClose()}>
|
||||
<Iconify icon="solar:eye-bold" />
|
||||
View
|
||||
{t('View')}
|
||||
</MenuItem>
|
||||
</li>
|
||||
</MenuList>
|
||||
|
@@ -16,6 +16,7 @@ import { formHelperTextClasses } from '@mui/material/FormHelperText';
|
||||
|
||||
import { Iconify } from 'src/components/iconify';
|
||||
import { CustomPopover } from 'src/components/custom-popover';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -26,6 +27,7 @@ type Props = {
|
||||
};
|
||||
|
||||
export function OrderTableToolbar({ filters, onResetPage, dateError }: Props) {
|
||||
const { t } = useTranslation();
|
||||
const menuActions = usePopover();
|
||||
|
||||
const { state: currentFilters, setState: updateFilters } = filters;
|
||||
@@ -64,17 +66,17 @@ export function OrderTableToolbar({ filters, onResetPage, dateError }: Props) {
|
||||
<MenuList>
|
||||
<MenuItem onClick={() => menuActions.onClose()}>
|
||||
<Iconify icon="solar:printer-minimalistic-bold" />
|
||||
Print
|
||||
{t('Print')}
|
||||
</MenuItem>
|
||||
|
||||
<MenuItem onClick={() => menuActions.onClose()}>
|
||||
<Iconify icon="solar:import-bold" />
|
||||
Import
|
||||
{t('Import')}
|
||||
</MenuItem>
|
||||
|
||||
<MenuItem onClick={() => menuActions.onClose()}>
|
||||
<Iconify icon="solar:export-bold" />
|
||||
Export
|
||||
{t('Export')}
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</CustomPopover>
|
||||
@@ -93,7 +95,7 @@ export function OrderTableToolbar({ filters, onResetPage, dateError }: Props) {
|
||||
}}
|
||||
>
|
||||
<DatePicker
|
||||
label="Start date"
|
||||
label={t('Start date')}
|
||||
value={currentFilters.startDate}
|
||||
onChange={handleFilterStartDate}
|
||||
slotProps={{ textField: { fullWidth: true } }}
|
||||
@@ -101,7 +103,7 @@ export function OrderTableToolbar({ filters, onResetPage, dateError }: Props) {
|
||||
/>
|
||||
|
||||
<DatePicker
|
||||
label="End date"
|
||||
label={t('End date')}
|
||||
value={currentFilters.endDate}
|
||||
onChange={handleFilterEndDate}
|
||||
slotProps={{
|
||||
@@ -133,7 +135,7 @@ export function OrderTableToolbar({ filters, onResetPage, dateError }: Props) {
|
||||
fullWidth
|
||||
value={currentFilters.name}
|
||||
onChange={handleFilterName}
|
||||
placeholder="Search customer or order number..."
|
||||
placeholder={t('Search customer or order number...')}
|
||||
slotProps={{
|
||||
input: {
|
||||
startAdornment: (
|
||||
|
@@ -1,3 +1,5 @@
|
||||
// src/sections/order/view/order-list-view.tsx
|
||||
|
||||
import type { TableHeadCellProps } from 'src/components/table';
|
||||
import type { IOrderItem, IOrderTableFilters } from 'src/types/order';
|
||||
|
||||
@@ -43,30 +45,33 @@ import {
|
||||
import { OrderTableRow } from '../order-table-row';
|
||||
import { OrderTableToolbar } from '../order-table-toolbar';
|
||||
import { OrderTableFiltersResult } from '../order-table-filters-result';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
const STATUS_OPTIONS = [{ value: 'all', label: 'All' }, ...ORDER_STATUS_OPTIONS];
|
||||
|
||||
const TABLE_HEAD: TableHeadCellProps[] = [
|
||||
{ id: 'orderNumber', label: 'Order', width: 88 },
|
||||
{ id: 'name', label: 'Customer' },
|
||||
{ id: 'createdAt', label: 'Date', width: 140 },
|
||||
{ id: 'totalQuantity', label: 'Items', width: 120, align: 'center' },
|
||||
{ id: 'totalAmount', label: 'Price', width: 140 },
|
||||
{ id: 'status', label: 'Status', width: 110 },
|
||||
{ id: '', width: 88 },
|
||||
];
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export function OrderListView() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const table = useTable({ defaultOrderBy: 'orderNumber' });
|
||||
|
||||
const confirmDialog = useBoolean();
|
||||
|
||||
const [tableData, setTableData] = useState<IOrderItem[]>(_orders);
|
||||
|
||||
const TABLE_HEAD: TableHeadCellProps[] = [
|
||||
{ id: 'orderNumber', label: t('Order'), width: 88 },
|
||||
{ id: 'name', label: t('Customer') },
|
||||
{ id: 'createdAt', label: t('Date'), width: 140 },
|
||||
{ id: 'totalQuantity', label: t('Items'), width: 120, align: 'center' },
|
||||
{ id: 'totalAmount', label: t('Price'), width: 140 },
|
||||
{ id: 'status', label: t('Status'), width: 110 },
|
||||
{ id: '', width: 88 },
|
||||
];
|
||||
|
||||
const filters = useSetState<IOrderTableFilters>({
|
||||
name: '',
|
||||
status: 'all',
|
||||
@@ -143,7 +148,7 @@ export function OrderListView() {
|
||||
confirmDialog.onFalse();
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
{t('Delete')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
@@ -155,9 +160,9 @@ export function OrderListView() {
|
||||
<CustomBreadcrumbs
|
||||
heading="List"
|
||||
links={[
|
||||
{ name: 'Dashboard', href: paths.dashboard.root },
|
||||
{ name: 'Order', href: paths.dashboard.order.root },
|
||||
{ name: 'List' },
|
||||
{ name: t('Dashboard'), href: paths.dashboard.root },
|
||||
{ name: t('Order'), href: paths.dashboard.order.root },
|
||||
{ name: t('List') },
|
||||
]}
|
||||
sx={{ mb: { xs: 3, md: 5 } }}
|
||||
/>
|
||||
@@ -178,7 +183,7 @@ export function OrderListView() {
|
||||
key={tab.value}
|
||||
iconPosition="end"
|
||||
value={tab.value}
|
||||
label={tab.label}
|
||||
label={t(tab.label)}
|
||||
icon={
|
||||
<Label
|
||||
variant={
|
||||
@@ -228,7 +233,7 @@ export function OrderListView() {
|
||||
)
|
||||
}
|
||||
action={
|
||||
<Tooltip title="Delete">
|
||||
<Tooltip title={t('Delete')}>
|
||||
<IconButton color="primary" onClick={confirmDialog.onTrue}>
|
||||
<Iconify icon="solar:trash-bin-trash-bold" />
|
||||
</IconButton>
|
||||
|
Reference in New Issue
Block a user