feat(orders): invoices-style landing — month selector + Vydane-first tabs, content-only tab bodies
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import IconButton from "@mui/material/IconButton";
|
||||
import { useAlert } from "../context/AlertContext";
|
||||
import { useAuth } from "../context/AuthContext";
|
||||
import Forbidden from "../components/Forbidden";
|
||||
import { formatCurrency, formatDate, czechPlural } from "../utils/formatters";
|
||||
import { formatCurrency, formatDate } from "../utils/formatters";
|
||||
import useTableSort from "../hooks/useTableSort";
|
||||
import useDebounce from "../hooks/useDebounce";
|
||||
import { usePaginatedQuery } from "../hooks/usePaginatedQuery";
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
type IssuedOrder,
|
||||
} from "../lib/queries/issued-orders";
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
DataTable,
|
||||
Pagination,
|
||||
@@ -24,8 +23,6 @@ import {
|
||||
TextField,
|
||||
Select,
|
||||
StatusChip,
|
||||
PageHeader,
|
||||
PageEnter,
|
||||
FilterBar,
|
||||
EmptyState,
|
||||
LoadingState,
|
||||
@@ -58,19 +55,6 @@ const STATUS_OPTIONS = [
|
||||
...Object.entries(STATUS_LABELS).map(([value, label]) => ({ value, label })),
|
||||
];
|
||||
|
||||
const PlusIcon = (
|
||||
<svg
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
>
|
||||
<line x1="12" y1="5" x2="12" y2="19" />
|
||||
<line x1="5" y1="12" x2="19" y2="12" />
|
||||
</svg>
|
||||
);
|
||||
const ViewIcon = (
|
||||
<svg
|
||||
width="18"
|
||||
@@ -115,7 +99,12 @@ const DeleteIcon = (
|
||||
</svg>
|
||||
);
|
||||
|
||||
export default function IssuedOrders() {
|
||||
interface IssuedOrdersProps {
|
||||
month: number;
|
||||
year: number;
|
||||
}
|
||||
|
||||
export default function IssuedOrders({ month, year }: IssuedOrdersProps) {
|
||||
const alert = useAlert();
|
||||
const { hasPermission } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
@@ -157,6 +146,8 @@ export default function IssuedOrders() {
|
||||
page,
|
||||
perPage: 20,
|
||||
status: status || undefined,
|
||||
month,
|
||||
year,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -199,14 +190,6 @@ export default function IssuedOrders() {
|
||||
return <LoadingState />;
|
||||
}
|
||||
|
||||
const total = pagination?.total ?? orders.length;
|
||||
const subtitle = `${total} ${czechPlural(
|
||||
total,
|
||||
"objednávka",
|
||||
"objednávky",
|
||||
"objednávek",
|
||||
)}`;
|
||||
|
||||
const columns: DataColumn<IssuedOrder>[] = [
|
||||
{
|
||||
key: "po_number",
|
||||
@@ -305,22 +288,7 @@ export default function IssuedOrders() {
|
||||
];
|
||||
|
||||
return (
|
||||
<PageEnter>
|
||||
<PageHeader
|
||||
title="Objednávky vydané"
|
||||
subtitle={subtitle}
|
||||
actions={
|
||||
hasPermission("orders.create") ? (
|
||||
<Button
|
||||
startIcon={PlusIcon}
|
||||
onClick={() => navigate("/orders/issued/new")}
|
||||
>
|
||||
Vytvořit objednávku vydanou
|
||||
</Button>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
|
||||
<>
|
||||
<FilterBar>
|
||||
<Box sx={{ flex: "1 1 320px" }}>
|
||||
<TextField
|
||||
@@ -386,6 +354,6 @@ export default function IssuedOrders() {
|
||||
confirmVariant="danger"
|
||||
loading={deleteMutation.isPending}
|
||||
/>
|
||||
</PageEnter>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user