feat: deals table
This commit is contained in:
@@ -2,13 +2,15 @@ import {Center, Flex, Image, rem, Stack, Tooltip, UnstyledButton, useMantineColo
|
||||
import {
|
||||
IconBarcode,
|
||||
IconBox,
|
||||
IconCash, IconDashboard,
|
||||
IconCash,
|
||||
IconDashboard,
|
||||
IconFileBarcode,
|
||||
IconHome2,
|
||||
IconLogout,
|
||||
IconMan,
|
||||
IconMoon,
|
||||
IconSun,
|
||||
IconTable,
|
||||
} from '@tabler/icons-react';
|
||||
import classes from './Navbar.module.css';
|
||||
import {useAppDispatch} from "../../redux/store.ts";
|
||||
@@ -40,16 +42,17 @@ function NavbarLink(props: NavbarLinkProps) {
|
||||
}
|
||||
|
||||
const mockdata = [
|
||||
// {
|
||||
// icon: IconHome2,
|
||||
// label: 'Главная',
|
||||
// href: '/'
|
||||
// },
|
||||
|
||||
{
|
||||
icon: IconCash,
|
||||
label: 'Сделки',
|
||||
href: '/leads'
|
||||
},
|
||||
{
|
||||
icon: IconTable,
|
||||
label: 'Таблица сделок',
|
||||
href: '/deals'
|
||||
},
|
||||
{
|
||||
icon: IconMan,
|
||||
label: 'Клиенты',
|
||||
|
||||
@@ -26,10 +26,12 @@ type RestProps<T> = {
|
||||
filterBy?: (item: SelectObjectType<T>) => boolean;
|
||||
};
|
||||
const defaultGetLabelFn = <T extends { name: string }>(item: T): string => {
|
||||
|
||||
return item.name;
|
||||
}
|
||||
|
||||
const defaultGetValueFn = <T extends { id: number }>(item: T): string => {
|
||||
if (!item) return item;
|
||||
return item.id.toString();
|
||||
}
|
||||
export type ObjectSelectProps<T> =
|
||||
@@ -85,6 +87,7 @@ const ObjectSelect = <T, >(props: ObjectSelectProps<T>) => {
|
||||
if (isControlled || !internalValue) return;
|
||||
props.onChange(internalValue);
|
||||
}, [internalValue]);
|
||||
|
||||
const restProps = omit(props, ['filterBy', 'groupBy', 'getValueFn', 'getLabelFn']);
|
||||
return (
|
||||
<Select
|
||||
|
||||
17
src/components/Selects/ClientSelectNew/ClientSelectNew.tsx
Normal file
17
src/components/Selects/ClientSelectNew/ClientSelectNew.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import ObjectSelect, {ObjectSelectProps} from "../../ObjectSelect/ObjectSelect.tsx";
|
||||
import {ClientSchema} from "../../../client";
|
||||
import {FC} from "react";
|
||||
import useClientsList from "../../../pages/ClientsPage/hooks/useClientsList.tsx";
|
||||
|
||||
type Props = Omit<ObjectSelectProps<ClientSchema>, 'data'>
|
||||
|
||||
const ClientSelectNew: FC<Props> = (props) => {
|
||||
const {clients} = useClientsList();
|
||||
return (
|
||||
<ObjectSelect
|
||||
data={clients}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
export default ClientSelectNew;
|
||||
Reference in New Issue
Block a user