feat: warehouse places accounting

This commit is contained in:
2025-05-07 09:53:02 +04:00
parent d347c09199
commit e4f8e90ae6
41 changed files with 1305 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
import { DataTable } from "mantine-datatable";
import { IconChevronRight, IconSpace } from "@tabler/icons-react";
import clsx from "clsx";
import classes from "../../../OrganizationalStructureTab/components/DepartmentsTree/DepartmentsTree.module.css";
import { useState } from "react";
import { PlaceSchema } from "../../../../../../client";
import PlaceActions from "./PlaceActions.tsx";
type Props = {
place: PlaceSchema;
}
const Place = ({ place }: Props) => {
const [placeTypeIds, setPlaceTypeIds] = useState<number[]>([]);
return (
<DataTable
noHeader
columns={[
{
accessor: "name",
title: "Место",
noWrap: true,
render: ({ id, number, placeType }) => (
<>
<IconChevronRight
className={clsx(classes.icon, classes.expandIcon, {
[classes.expandIconRotated]: placeTypeIds?.includes(id),
})}
/>
<IconSpace className={classes.icon} />
<span>{placeType.name} {number}</span>
</>
),
},
{
accessor: "actions",
title: "",
width: "0%",
render: (place) => (
<PlaceActions place={place} />
),
},
]}
records={place.children?.sort((a, b) => a.id - b.id)}
rowExpansion={{
allowMultiple: true,
expanded: { recordIds: placeTypeIds, onRecordIdsChange: setPlaceTypeIds },
content: ({ record }) => (
<Place place={record} />
),
}}
/>
);
};
export default Place;