mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-07 16:19:01 +00:00
fix(vendors): align list header, Total Jobs, and Filters with design (SH-219)
This commit is contained in:
parent
a0214cc01f
commit
0a3cfe2d6a
1 changed files with 40 additions and 52 deletions
92
src/app/(protected)/vendors/index.tsx
vendored
92
src/app/(protected)/vendors/index.tsx
vendored
|
|
@ -1,7 +1,6 @@
|
|||
import { useMemo, useState, type KeyboardEvent, type MouseEvent } from "react";
|
||||
import DeleteOutlineIcon from "@mui/icons-material/DeleteOutlined";
|
||||
import EditOutlinedIcon from "@mui/icons-material/EditOutlined";
|
||||
import FilterListIcon from "@mui/icons-material/FilterList";
|
||||
import VisibilityOutlinedIcon from "@mui/icons-material/VisibilityOutlined";
|
||||
import {
|
||||
Alert,
|
||||
|
|
@ -34,10 +33,13 @@ import {
|
|||
Tooltip,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
import { SlidersHorizontal } from "lucide-react";
|
||||
import { VendorCreateModal } from "./_components/vendor-create-modal";
|
||||
import { VendorDetailDrawer } from "./_components/vendor-detail-drawer";
|
||||
import { VendorFiltersDrawer } from "./_components/vendor-filters-drawer";
|
||||
import { emptyVendorFilters, type VendorFilters } from "./_components/vendor-filters";
|
||||
import { PageHeader } from "@/components/ui/page-header";
|
||||
import { ToolbarButton } from "@/components/ui/toolbar-button";
|
||||
import type { VendorListItem } from "@/domain/vendors/types/vendor";
|
||||
import { useDeleteVendor } from "@/domain/vendors/use-cases/use-delete-vendor";
|
||||
import { useVendorDeactivationImpact } from "@/domain/vendors/use-cases/use-vendor-deactivation-impact";
|
||||
|
|
@ -218,55 +220,37 @@ export default function VendorsListPage() {
|
|||
|
||||
return (
|
||||
<Box className="flex flex-col gap-4 p-4">
|
||||
<Stack
|
||||
direction={{ xs: "column", md: "row" }}
|
||||
spacing={2}
|
||||
sx={{
|
||||
alignItems: { xs: "stretch", md: "center" },
|
||||
justifyContent: "space-between",
|
||||
}}
|
||||
>
|
||||
<Stack direction="row" spacing={2} sx={{ alignItems: "baseline" }}>
|
||||
<Typography variant="h5" component="h1">
|
||||
Vendors / Technicians
|
||||
</Typography>
|
||||
<Typography variant="body2" sx={{ color: "text.secondary" }}>
|
||||
{globalCount} technicians · {activeCount} active
|
||||
</Typography>
|
||||
{isFetching && !isLoading && <CircularProgress size={16} />}
|
||||
</Stack>
|
||||
|
||||
<Stack
|
||||
direction={{ xs: "column", sm: "row" }}
|
||||
spacing={2}
|
||||
sx={{ alignItems: { xs: "stretch", sm: "center" } }}
|
||||
>
|
||||
<TextField
|
||||
size="small"
|
||||
value={search}
|
||||
onChange={(e) => {
|
||||
setSearch(e.target.value);
|
||||
setPage(0);
|
||||
}}
|
||||
placeholder="Search name, company, trade..."
|
||||
className="min-w-[260px]"
|
||||
/>
|
||||
<Button
|
||||
variant="outlined"
|
||||
onClick={() => setFiltersOpen(true)}
|
||||
startIcon={<FilterListIcon />}
|
||||
aria-label="Open vendor filters"
|
||||
>
|
||||
Filters
|
||||
{appliedChips.length > 0 && (
|
||||
<Chip size="small" color="primary" label={appliedChips.length} sx={{ ml: 1 }} />
|
||||
)}
|
||||
</Button>
|
||||
<Button variant="contained" onClick={() => setCreateOpen(true)}>
|
||||
+ Add Vendor
|
||||
</Button>
|
||||
</Stack>
|
||||
</Stack>
|
||||
<PageHeader
|
||||
title="Vendors / Technicians"
|
||||
subtitle={`${globalCount} technicians · ${activeCount} active`}
|
||||
actions={
|
||||
<>
|
||||
<TextField
|
||||
size="small"
|
||||
value={search}
|
||||
onChange={(e) => {
|
||||
setSearch(e.target.value);
|
||||
setPage(0);
|
||||
}}
|
||||
placeholder="Search name, company, trade..."
|
||||
className="min-w-[260px]"
|
||||
/>
|
||||
<ToolbarButton
|
||||
variant="outline"
|
||||
icon={<SlidersHorizontal size={13} />}
|
||||
onClick={() => setFiltersOpen(true)}
|
||||
aria-label="Open vendor filters"
|
||||
badge={appliedChips.length}
|
||||
>
|
||||
Filters
|
||||
</ToolbarButton>
|
||||
<Button variant="contained" onClick={() => setCreateOpen(true)}>
|
||||
+ Add Vendor
|
||||
</Button>
|
||||
{Boolean(isFetching && !isLoading) && <CircularProgress size={16} />}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
<Tabs
|
||||
value={isActive ? "active" : "inactive"}
|
||||
|
|
@ -313,7 +297,11 @@ export default function VendorsListPage() {
|
|||
{TABLE_COLUMNS.map((column) => (
|
||||
<TableCell
|
||||
key={column}
|
||||
align={column === "View" || column === "Edit" ? "center" : "left"}
|
||||
align={
|
||||
column === "View" || column === "Edit" || column === "Total Jobs"
|
||||
? "center"
|
||||
: "left"
|
||||
}
|
||||
className="font-semibold"
|
||||
>
|
||||
{column}
|
||||
|
|
@ -408,7 +396,7 @@ export default function VendorsListPage() {
|
|||
"—"
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell>{row.totalJobs ?? 0}</TableCell>
|
||||
<TableCell align="center">{row.totalJobs ?? 0}</TableCell>
|
||||
<TableCell>
|
||||
<Chip
|
||||
size="small"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue