diff --git a/src/components/CreateProject/MilestoneSection.tsx b/src/components/CreateProject/MilestoneSection.tsx index a9e65e7..de810b6 100644 --- a/src/components/CreateProject/MilestoneSection.tsx +++ b/src/components/CreateProject/MilestoneSection.tsx @@ -20,6 +20,7 @@ import { GridEventListener, useGridApiRef, GridRowModel, + GridRenderEditCellParams, } from "@mui/x-data-grid"; import { LocalizationProvider, DatePicker } from "@mui/x-date-pickers"; import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs"; @@ -29,7 +30,11 @@ import React, { useCallback, useEffect, useMemo, useState } from "react"; import { Controller, useFormContext } from "react-hook-form"; import { useTranslation } from "react-i18next"; import StyledDataGrid from "../StyledDataGrid"; -import { INPUT_DATE_FORMAT, moneyFormatter } from "@/app/utils/formatUtil"; +import { + INPUT_DATE_FORMAT, + OUTPUT_DATE_FORMAT, + moneyFormatter, +} from "@/app/utils/formatUtil"; import isDate from "lodash/isDate"; interface Props { @@ -179,6 +184,26 @@ const MilestoneSection: React.FC = ({ taskGroupId }) => { width: 200, type: "date", editable: true, + valueFormatter(params) { + return dayjs(params.value).format(OUTPUT_DATE_FORMAT); + }, + renderEditCell(params: GridRenderEditCellParams) { + return ( + + + params.api.setEditCellValue({ + id: params.id, + field: params.field, + value: value?.toDate(), + }) + } + /> + + ); + }, valueGetter(params) { return new Date(params.value); }, @@ -230,14 +255,14 @@ const MilestoneSection: React.FC = ({ taskGroupId }) => { const endDate = getValues("milestones")[taskGroupId]?.endDate; return ( - - - {t("Stage Milestones")} - - + + + + {t("Stage Milestones")} + @@ -298,45 +323,45 @@ const MilestoneSection: React.FC = ({ taskGroupId }) => { - - ({ - marginBlockStart: 1, - marginInline: -3, - borderBottom: `1px solid ${theme.palette.divider}`, - })} - > - { - return params.row._error === params.field ? "hasError" : ""; - }} - slots={{ - footer: FooterToolbar, - noRowsOverlay: NoRowsOverlay, - }} - slotProps={{ - footer: { child: footer }, - }} - /> - - + ({ + marginBlockStart: 1, + marginInline: -3, + borderBottom: `1px solid ${theme.palette.divider}`, + })} + > + { + return params.row._error === params.field ? "hasError" : ""; + }} + slots={{ + footer: FooterToolbar, + noRowsOverlay: NoRowsOverlay, + }} + slotProps={{ + footer: { child: footer }, + }} + /> + + + ); }; diff --git a/src/components/StyledDataGrid/StyledDataGrid.tsx b/src/components/StyledDataGrid/StyledDataGrid.tsx index 3ea0dce..5d6cf5c 100644 --- a/src/components/StyledDataGrid/StyledDataGrid.tsx +++ b/src/components/StyledDataGrid/StyledDataGrid.tsx @@ -32,6 +32,10 @@ const StyledDataGrid = styled(DataGrid)(({ theme }) => ({ borderRadius: 0, maxHeight: 50, }, + "& .MuiFilledInput-root": { + borderRadius: 0, + maxHeight: 50, + }, })); export default StyledDataGrid; diff --git a/src/components/TransferList/TransferList.tsx b/src/components/TransferList/TransferList.tsx index 232c486..d7f5a1a 100644 --- a/src/components/TransferList/TransferList.tsx +++ b/src/components/TransferList/TransferList.tsx @@ -90,6 +90,7 @@ const ItemList: React.FC = ({ component="ul" subheader={ = ({ {label} - {`${checkedItems.length}/${items.length} ${t("selected")}`} + {`${checkedItems.length}/${ + items.length + } ${t("selected")}`}