feat: search deal by id and deal id column
This commit is contained in:
@@ -6,6 +6,11 @@ import { ActionIcon, Image } from "@mantine/core";
|
||||
const useDealsTableColumns = () => {
|
||||
return useMemo<MRT_ColumnDef<DealSummary>[]>(
|
||||
() => [
|
||||
{
|
||||
accessorKey: "id",
|
||||
header: "Номер",
|
||||
size: 20,
|
||||
},
|
||||
{
|
||||
header: "Маркетплейс",
|
||||
size: 10,
|
||||
|
||||
@@ -5,6 +5,7 @@ import { BaseMarketplaceSchema, ClientSchema } from "../../../client";
|
||||
import { DealStatusType } from "../../../shared/enums/DealStatus.ts";
|
||||
|
||||
type State = {
|
||||
id: number | null;
|
||||
marketplace: BaseMarketplaceSchema | null;
|
||||
dealStatus: DealStatusType | null;
|
||||
client: ClientSchema | null;
|
||||
@@ -13,6 +14,7 @@ const useDealsPageState = () => {
|
||||
const { objects } = useDealSummariesFull();
|
||||
const form = useForm<State>({
|
||||
initialValues: {
|
||||
id: null,
|
||||
marketplace: null,
|
||||
dealStatus: null,
|
||||
client: null,
|
||||
@@ -21,6 +23,11 @@ const useDealsPageState = () => {
|
||||
const [data, setData] = useState(objects);
|
||||
const applyFilters = () => {
|
||||
let result = objects;
|
||||
if (form.values.id) {
|
||||
result = result.filter(
|
||||
obj => obj.id === form.values.id
|
||||
)
|
||||
}
|
||||
if (form.values.marketplace) {
|
||||
result = result.filter(
|
||||
obj => obj.baseMarketplace?.key === form.values.marketplace?.key
|
||||
|
||||
@@ -12,7 +12,7 @@ import DealEditDrawer from "../drawers/DealEditDrawer/DealEditDrawer.tsx";
|
||||
import { DealPageContextProvider } from "../contexts/DealPageContext.tsx";
|
||||
import { modals } from "@mantine/modals";
|
||||
import { DealService, DealSummaryReorderRequest } from "../../../client";
|
||||
import { ActionIcon, Flex, rem, Text } from "@mantine/core";
|
||||
import { ActionIcon, Flex, NumberInput, rem, Text } from "@mantine/core";
|
||||
import classNames from "classnames";
|
||||
import { notifications } from "../../../shared/lib/notifications.ts";
|
||||
import { IconMenu2, IconMenuDeep } from "@tabler/icons-react";
|
||||
@@ -345,6 +345,12 @@ export const LeadsPage: FC = () => {
|
||||
? "flex"
|
||||
: "none",
|
||||
}}>
|
||||
<NumberInput
|
||||
min={1}
|
||||
step={1}
|
||||
placeholder={"Введите номер"}
|
||||
{...form.getInputProps("id")}
|
||||
/>
|
||||
<DealStatusSelect
|
||||
onClear={() =>
|
||||
form.setFieldValue("dealStatus", null)
|
||||
|
||||
Reference in New Issue
Block a user