fix: made statistic dates PATRIOTIC

This commit is contained in:
2024-11-21 21:11:26 +04:00
parent 9c56ef180f
commit 0758d14a9a
3 changed files with 13 additions and 1 deletions

View File

@@ -60,6 +60,7 @@ export const Filters = (props: FiltersProps) => {
type="range"
placeholder="Выберите даты"
maxDate={new Date()}
valueFormat={"DD.MM.YYYY"}
/>
}
{dealStatusSelectProps &&

View File

@@ -6,6 +6,7 @@ import { Skeleton, Stack } from "@mantine/core";
import { ProfitChartFiltersModal } from "../../modals/ProfitChartFiltersModal.tsx";
import { Total } from "../Total/Total.tsx";
import styles from "../../../../ui/StatisticsPage.module.css";
import { formatDate } from "../../../../../../types/utils.ts";
export const ProfitChart = () => {
@@ -15,6 +16,12 @@ export const ProfitChart = () => {
isLoading,
} = useProfitChart();
const formattedProfitData = profitData.map(
value => {
return { ...value, date: formatDate(value.date) };
},
);
const getChartsSeries = [
[
{ name: "profit", label: "Прибыль", color: "indigo.6" },
@@ -42,7 +49,7 @@ export const ProfitChart = () => {
my={"sm"}
w={"98%"}
h={"34vh"}
data={profitData}
data={formattedProfitData}
dataKey="date"
unit={units[idx]}
tooltipAnimationDuration={200}

View File

@@ -3,6 +3,7 @@ import { MRT_ColumnDef } from "mantine-react-table";
import { ProfitTableDataItem } from "../../../../../../../client";
import { GroupStatisticsTable } from "../../ProfitTableSegmentedControl/ProfitTableSegmentedControl.tsx";
import { DealStatus, DealStatusDictionary } from "../../../../../../../shared/enums/DealStatus.ts";
import { formatDate } from "../../../../../../../types/utils.ts";
type Props = {
groupTableBy: GroupStatisticsTable;
@@ -29,6 +30,9 @@ export const useProfitTableColumns = ({ groupTableBy }: Props) => {
const statusIndex = row.original.groupedValue as DealStatus;
return DealStatusDictionary[statusIndex];
}
if (groupTableBy == GroupStatisticsTable.BY_DATES) {
return formatDate(row.original.groupedValue as string);
}
return row.original.groupedValue;
},
size: 60,