diff --git a/src/pages/dashboard/Content/PromocodeManagement/usePromocodeGridColDef.tsx b/src/pages/dashboard/Content/PromocodeManagement/usePromocodeGridColDef.tsx index 2bd6da9..707e7f2 100644 --- a/src/pages/dashboard/Content/PromocodeManagement/usePromocodeGridColDef.tsx +++ b/src/pages/dashboard/Content/PromocodeManagement/usePromocodeGridColDef.tsx @@ -4,14 +4,20 @@ import { Promocode } from "@root/model/promocodes"; import { useMemo, useState } from "react"; import { BarChart, Delete } from "@mui/icons-material"; -import {promocodeApi} from "@root/api/promocode/requests"; +import { promocodeApi } from "@root/api/promocode/requests"; export function usePromocodeGridColDef( setStatistics: (id: string) => void, deletePromocode: (id: string) => void ) { - const validity = (value:string|number) => {if(value===0){return "неоганичен"}else {return new Date(value).toLocaleString()}} - return useMemo[]>( + const validity = (value: string | number) => { + if (value === 0) { + return "неоганичен"; + } else { + return new Date(value).toLocaleString(); + } + }; + return useMemo[]>( () => [ { field: "id", @@ -50,6 +56,14 @@ export function usePromocodeGridColDef( valueGetter: ({ row }) => row.dueTo * 1000, valueFormatter: ({ value }) => `${validity(value)}`, }, + { + field: "description", + headerName: "Описание", + minWidth: 200, + flex: 1, + sortable: false, + valueGetter: ({ row }) => row.description, + }, { field: "settings", headerName: "", @@ -57,10 +71,12 @@ export function usePromocodeGridColDef( sortable: false, renderCell: (params) => { return ( - { - setStatistics(params.row.id,) - promocodeApi.getPromocodeStatistics(params.row.id, 0, 0) - }}> + { + setStatistics(params.row.id); + promocodeApi.getPromocodeStatistics(params.row.id, 0, 0); + }} + > );