refactor: modals refactored
This commit is contained in:
@ -9,14 +9,8 @@ import { useDrawersContext } from "@/drawers/DrawersContext";
|
||||
import { DealSchema } from "@/lib/client";
|
||||
|
||||
const DealsTable: FC = () => {
|
||||
const {
|
||||
deals,
|
||||
paginationInfo,
|
||||
page,
|
||||
setPage,
|
||||
dealsFiltersForm,
|
||||
dealsCrud,
|
||||
} = useDealsContext();
|
||||
const { deals, paginationInfo, page, setPage, sortingForm, dealsCrud } =
|
||||
useDealsContext();
|
||||
const { selectedProject } = useProjectsContext();
|
||||
const { openDrawer } = useDrawersContext();
|
||||
|
||||
@ -40,20 +34,20 @@ const DealsTable: FC = () => {
|
||||
return (
|
||||
<Stack
|
||||
gap={"xs"}
|
||||
h={"calc(100vh - 125px)"}>
|
||||
h={"calc(100vh - var(--mantine-spacing-xl) * 4)"}>
|
||||
<BaseTable
|
||||
records={[...deals]}
|
||||
columns={columns}
|
||||
sortStatus={{
|
||||
columnAccessor: dealsFiltersForm.values.sortingField ?? "",
|
||||
direction: dealsFiltersForm.values.sortingDirection,
|
||||
columnAccessor: sortingForm.values.sortingField ?? "",
|
||||
direction: sortingForm.values.sortingDirection,
|
||||
}}
|
||||
onSortStatusChange={sorting => {
|
||||
dealsFiltersForm.setFieldValue(
|
||||
sortingForm.setFieldValue(
|
||||
"sortingField",
|
||||
sorting.columnAccessor
|
||||
);
|
||||
dealsFiltersForm.setFieldValue(
|
||||
sortingForm.setFieldValue(
|
||||
"sortingDirection",
|
||||
sorting.direction
|
||||
);
|
||||
|
||||
@ -35,7 +35,7 @@ const TopToolPanel: FC<Props> = ({ view, setView }) => {
|
||||
title: "Создание проекта",
|
||||
withCloseButton: true,
|
||||
innerProps: {
|
||||
onComplete: projectsCrud.onCreate,
|
||||
onChange: values => projectsCrud.onCreate(values.name),
|
||||
},
|
||||
});
|
||||
};
|
||||
@ -49,9 +49,15 @@ const TopToolPanel: FC<Props> = ({ view, setView }) => {
|
||||
});
|
||||
};
|
||||
|
||||
const viewFiltersModalMap = {
|
||||
table: "dealsTableFiltersModal",
|
||||
board: "dealsBoardFiltersModal",
|
||||
schedule: "dealsScheduleFiltersModal",
|
||||
};
|
||||
|
||||
const onFiltersClick = () => {
|
||||
modals.openContextModal({
|
||||
modal: "dealsFiltersModal",
|
||||
modal: viewFiltersModalMap[view],
|
||||
title: "Фильтры",
|
||||
withCloseButton: true,
|
||||
innerProps: {
|
||||
|
||||
Reference in New Issue
Block a user