feat: deal product services

This commit is contained in:
2024-05-13 07:46:24 +03:00
parent 0ebb1d5e08
commit 6acb34271d
19 changed files with 401 additions and 30 deletions

View File

@@ -0,0 +1,25 @@
import {FC} from "react";
import ObjectSelect, {ObjectSelectProps} from "../../ObjectSelect/ObjectSelect.tsx";
import {ServiceSchema} from "../../../client";
import useServicesList from "../../../pages/ServicesPage/hooks/useServicesList.tsx";
import {omit} from "lodash";
import {ServiceType} from "../../../shared/enums/ServiceType.ts";
type RestProps = {
filterType?: ServiceType;
}
type Props = Omit<ObjectSelectProps<ServiceSchema>, 'data'> & RestProps;
const ServiceSelectNew: FC<Props> = (props: Props) => {
const {services} = useServicesList();
const data = props.filterType ? services.filter(service => service.serviceType === props.filterType) : services;
const restProps = omit(props, ['filterType']);
return (
<ObjectSelect
{...restProps}
data={data}
/>
)
}
export default ServiceSelectNew;