feat: module dependencies

This commit is contained in:
2025-09-18 17:53:26 +04:00
parent a95d05e28b
commit 0805a86335
17 changed files with 153 additions and 119 deletions

View File

@ -11,36 +11,6 @@ const DealServicesTable: FC = () => {
// const isLocked = isDealLocked(deal); // TODO bills
// const [currentService, setCurrentService] = useState<
// DealServiceSchema | undefined
// >();
// const [employeesModalVisible, setEmployeesModalVisible] = useState(false);
// const onEmployeeClick = (item: CardServiceSchema) => {
// if (!onChange) return;
// setCurrentService(item);
// setEmployeesModalVisible(true);
// };
// const onEmployeeModalClose = () => {
// setEmployeesModalVisible(false);
// setCurrentService(undefined);
// };
// const getCurrentEmployees = (): UserSchema[] => {
// if (!currentService) return [];
// const item = items.find(
// i => i.service.id === currentService.service.id
// );
// if (!item) return [];
// return item.employees;
// };
// const onEmployeesChange = (items: UserSchema[]) => {
// if (!currentService || !onChange) return;
// debouncedOnChange({
// ...currentService,
// employees: items,
// });
// };
return (
<Flex
direction={"column"}

View File

@ -49,11 +49,6 @@ const DealServiceRow: FC<Props> = ({ value, onChange, onDelete }) => {
tipLabel={"Удалить услугу"}>
<IconTrash />
</ActionIconWithTip>
{/*<Tooltip label="Сотрудники">*/}
{/*<ActionIcon onClick={() => onEmployeeClick(service)}>*/}
{/* <IconUsersGroup />*/}
{/*</ActionIcon>*/}
{/*</Tooltip>*/}
<NumberInput
flex={1}
suffix={" шт."}

View File

@ -57,11 +57,6 @@ const ProductServicesTable: FC<Props> = ({
onChange,
});
// const [currentService, setCurrentService] = useState<
// ProductServiceSchema | undefined
// >();
// const [employeesModalVisible, setEmployeesModalVisible] = useState(false);
const onCreateClick = () => {
const excludeServiceIds = dealProduct.productServices.map(
productService => productService.service.id
@ -80,31 +75,6 @@ const ProductServicesTable: FC<Props> = ({
});
};
// const onEmployeeClick = (item: CardProductServiceSchema) => {
// if (!onChange) return;
// setCurrentService(item);
// setEmployeesModalVisible(true);
// };
// const onEmployeeModalClose = () => {
// setEmployeesModalVisible(false);
// setCurrentService(undefined);
// };
// const getCurrentEmployees = (): UserSchema[] => {
// if (!currentService) return [];
// const item = items.find(
// i => i.service.id === currentService.service.id
// );
// if (!item) return [];
// return item.employees;
// };
// const onEmployeesChange = (items: UserSchema[]) => {
// if (!currentService || !onChange) return;
// onChange({
// ...currentService,
// employees: items,
// });
// };
const isEmptyTable = dealProduct.productServices.length === 0;
return (

View File

@ -46,15 +46,6 @@ const useProductServicesTableColumns = ({
onClick={() => onChange(dealProductService)}>
<IconEdit />
</ActionIconWithTip>
{/*<Tooltip label="Сотрудники">*/}
{/* <ActionIcon*/}
{/* onClick={() =>*/}
{/* onEmployeeClick(row.original)*/}
{/* }*/}
{/* variant={"default"}>*/}
{/* <IconUsersGroup />*/}
{/* </ActionIcon>*/}
{/*</Tooltip>*/}
</Flex>
),
},

View File

@ -38,7 +38,6 @@ const ProductServiceEditorModal = ({
service: undefined,
serviceId: undefined,
price: undefined,
// employees: [],
isFixedPrice: false,
};

View File

@ -15,13 +15,6 @@ const modules: ModulesType = {
key: "fulfillment_base",
icon: <IconBox />,
},
modelData: {
id: 1,
key: "fulfillment_base",
label: "Фулфиллмент",
iconName: "IconBox",
description: "Создание товаров и услуг, их привязка к сделкам",
},
},
};

View File

@ -20,13 +20,6 @@ const modules: ModulesType = {
key: "{{this.key}}",
icon: {{#if this.iconName}}<{{this.iconName}} />{{else}}None{{/if}},
},
modelData: {
id: {{this.id}},
key: "{{this.key}}",
label: "{{this.label}}",
iconName: "{{this.iconName}}",
description: "{{this.description}}",
},
},
{{/each}}
};

View File

@ -1,5 +1,4 @@
import { ReactNode } from "react";
import { BuiltInModuleSchema } from "@/lib/client";
export type Module = {
renderInfo: {
@ -7,7 +6,6 @@ export type Module = {
key: string;
icon: ReactNode;
};
modelData: BuiltInModuleSchema;
getTab?: (props: any) => ReactNode;
};