This commit is contained in:
2024-04-11 14:25:51 +03:00
parent 18157972a1
commit 9815ebbc3b
14 changed files with 254 additions and 14 deletions

View File

@@ -6,6 +6,7 @@ import {DealService, DealServiceSchema} from "../../../../client";
import {notifications} from "../../../../shared/lib/notifications.ts";
import {modals} from "@mantine/modals";
import {BaseTableRef} from "../../../../components/BaseTable/BaseTable.tsx";
import DealProductsTable from "../../components/DealProductsTable/DealProductsTable.tsx";
const useDealServicesTableState = () => {
const {selectedDeal, setSelectedDeal} = useDealPageContext();
@@ -130,7 +131,6 @@ const useDealServicesTableState = () => {
services: selectedDeal?.services || []
}
}
const DealEditDrawerServicesTable = () => {
const {
services,
@@ -150,6 +150,29 @@ const DealEditDrawerServicesTable = () => {
onMultipleDelete={onsServiceMultipleDelete}
/>)
}
const useDealProductTableState = () => {
const {selectedDeal} = useDealPageContext();
return {
clientId: selectedDeal?.clientId || -1,
products: selectedDeal?.products || []
}
}
const DealEditDrawerProductsTable = () => {
const {
products,
clientId
} = useDealProductTableState();
return (
<DealProductsTable
clientId={clientId}
items={products}
/>
)
}
const useDealEditDrawerState = () => {
const {selectedDeal, setSelectedDeal} = useDealPageContext();
return {
@@ -168,6 +191,7 @@ const DealEditDrawer: FC = () => {
onClose={onClose}
opened={isVisible}>
<DealEditDrawerServicesTable/>
<DealEditDrawerProductsTable/>
</Drawer>
);
}