feat: filters for profit statistics table
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
import type { ProfitTableGroupBy } from './ProfitTableGroupBy';
|
||||
export type GetProfitTableDataRequest = {
|
||||
dateRange: any[];
|
||||
clientId: number;
|
||||
baseMarketplaceKey: string;
|
||||
dealStatusId: number;
|
||||
groupTableBy: ProfitTableGroupBy;
|
||||
};
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@ export const useProfitTable = () => {
|
||||
initialValues: {
|
||||
dateRange: getDefaultDates(),
|
||||
groupTableBy: GroupStatisticsTable.BY_DATES,
|
||||
client: null,
|
||||
marketplace: null,
|
||||
dealStatus: null,
|
||||
},
|
||||
});
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
@@ -33,6 +36,9 @@ export const useProfitTable = () => {
|
||||
dateToString(dateRange[1]),
|
||||
],
|
||||
groupTableBy: form.values.groupTableBy,
|
||||
clientId: form.values.client?.id ?? -1,
|
||||
baseMarketplaceKey: form.values.marketplace?.key ?? "all",
|
||||
dealStatusId: form.values.dealStatus?.id ?? -1,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -36,6 +36,12 @@ export const ProfitTableFiltersModal = ({ form }: Props) => {
|
||||
value: form.values.groupTableBy.toString(),
|
||||
onChange: (value: string) => form.setFieldValue("groupTableBy", parseInt(value)),
|
||||
}}
|
||||
clientSelectProps={form.getInputProps("client")}
|
||||
onClientClear={() => form.setFieldValue("client", null)}
|
||||
baseMarketplaceSelectProps={form.getInputProps("marketplace")}
|
||||
onBaseMarketplaceClear={() => form.setFieldValue("marketplace", null)}
|
||||
dealStatusSelectProps={form.getInputProps("dealStatus")}
|
||||
onDealStatusClear={() => form.setFieldValue("dealStatus", null)}
|
||||
/>
|
||||
</Modal>
|
||||
</>
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import { GroupStatisticsTable } from "../tabs/ProfitTab/components/ProfitTableSegmentedControl/ProfitTableSegmentedControl.tsx";
|
||||
import {
|
||||
GroupStatisticsTable,
|
||||
} from "../tabs/ProfitTab/components/ProfitTableSegmentedControl/ProfitTableSegmentedControl.tsx";
|
||||
import { BaseMarketplaceSchema, ClientSchema } from "../../../client";
|
||||
import { DealStatusType } from "../../../shared/enums/DealStatus.ts";
|
||||
|
||||
export interface TableFormFilters {
|
||||
dateRange: [Date | null, Date | null];
|
||||
groupTableBy: GroupStatisticsTable;
|
||||
client: ClientSchema | null;
|
||||
marketplace: BaseMarketplaceSchema | null;
|
||||
dealStatus: DealStatusType | null;
|
||||
}
|
||||
Reference in New Issue
Block a user