fix: made statistic dates PATRIOTIC
This commit is contained in:
@@ -60,6 +60,7 @@ export const Filters = (props: FiltersProps) => {
|
|||||||
type="range"
|
type="range"
|
||||||
placeholder="Выберите даты"
|
placeholder="Выберите даты"
|
||||||
maxDate={new Date()}
|
maxDate={new Date()}
|
||||||
|
valueFormat={"DD.MM.YYYY"}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
{dealStatusSelectProps &&
|
{dealStatusSelectProps &&
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { Skeleton, Stack } from "@mantine/core";
|
|||||||
import { ProfitChartFiltersModal } from "../../modals/ProfitChartFiltersModal.tsx";
|
import { ProfitChartFiltersModal } from "../../modals/ProfitChartFiltersModal.tsx";
|
||||||
import { Total } from "../Total/Total.tsx";
|
import { Total } from "../Total/Total.tsx";
|
||||||
import styles from "../../../../ui/StatisticsPage.module.css";
|
import styles from "../../../../ui/StatisticsPage.module.css";
|
||||||
|
import { formatDate } from "../../../../../../types/utils.ts";
|
||||||
|
|
||||||
|
|
||||||
export const ProfitChart = () => {
|
export const ProfitChart = () => {
|
||||||
@@ -15,6 +16,12 @@ export const ProfitChart = () => {
|
|||||||
isLoading,
|
isLoading,
|
||||||
} = useProfitChart();
|
} = useProfitChart();
|
||||||
|
|
||||||
|
const formattedProfitData = profitData.map(
|
||||||
|
value => {
|
||||||
|
return { ...value, date: formatDate(value.date) };
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const getChartsSeries = [
|
const getChartsSeries = [
|
||||||
[
|
[
|
||||||
{ name: "profit", label: "Прибыль", color: "indigo.6" },
|
{ name: "profit", label: "Прибыль", color: "indigo.6" },
|
||||||
@@ -42,7 +49,7 @@ export const ProfitChart = () => {
|
|||||||
my={"sm"}
|
my={"sm"}
|
||||||
w={"98%"}
|
w={"98%"}
|
||||||
h={"34vh"}
|
h={"34vh"}
|
||||||
data={profitData}
|
data={formattedProfitData}
|
||||||
dataKey="date"
|
dataKey="date"
|
||||||
unit={units[idx]}
|
unit={units[idx]}
|
||||||
tooltipAnimationDuration={200}
|
tooltipAnimationDuration={200}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { MRT_ColumnDef } from "mantine-react-table";
|
|||||||
import { ProfitTableDataItem } from "../../../../../../../client";
|
import { ProfitTableDataItem } from "../../../../../../../client";
|
||||||
import { GroupStatisticsTable } from "../../ProfitTableSegmentedControl/ProfitTableSegmentedControl.tsx";
|
import { GroupStatisticsTable } from "../../ProfitTableSegmentedControl/ProfitTableSegmentedControl.tsx";
|
||||||
import { DealStatus, DealStatusDictionary } from "../../../../../../../shared/enums/DealStatus.ts";
|
import { DealStatus, DealStatusDictionary } from "../../../../../../../shared/enums/DealStatus.ts";
|
||||||
|
import { formatDate } from "../../../../../../../types/utils.ts";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
groupTableBy: GroupStatisticsTable;
|
groupTableBy: GroupStatisticsTable;
|
||||||
@@ -29,6 +30,9 @@ export const useProfitTableColumns = ({ groupTableBy }: Props) => {
|
|||||||
const statusIndex = row.original.groupedValue as DealStatus;
|
const statusIndex = row.original.groupedValue as DealStatus;
|
||||||
return DealStatusDictionary[statusIndex];
|
return DealStatusDictionary[statusIndex];
|
||||||
}
|
}
|
||||||
|
if (groupTableBy == GroupStatisticsTable.BY_DATES) {
|
||||||
|
return formatDate(row.original.groupedValue as string);
|
||||||
|
}
|
||||||
return row.original.groupedValue;
|
return row.original.groupedValue;
|
||||||
},
|
},
|
||||||
size: 60,
|
size: 60,
|
||||||
|
|||||||
Reference in New Issue
Block a user