diff --git a/src/app/api/projects/index.ts b/src/app/api/projects/index.ts index 788ba56..d208d0e 100644 --- a/src/app/api/projects/index.ts +++ b/src/app/api/projects/index.ts @@ -79,6 +79,7 @@ export interface ProjectWithTasks { id: number; code: string; status?: string; + description?: string; name: string; tasks: Task[]; milestones: { diff --git a/src/components/TimeLeaveModal/TimeLeaveInputTable.tsx b/src/components/TimeLeaveModal/TimeLeaveInputTable.tsx index 980dccc..c7e0734 100644 --- a/src/components/TimeLeaveModal/TimeLeaveInputTable.tsx +++ b/src/components/TimeLeaveModal/TimeLeaveInputTable.tsx @@ -194,7 +194,7 @@ const TimeLeaveInputTable: React.FC = ({ ...model, [id]: { mode: GridRowModes.View, ignoreModifications: true }, })); - const editedRow = entries.find((entry) => entry.id === id); + const editedRow = entries.find((entry) => getRowId(entry) === id); if (editedRow?._isNew) { setEntries((es) => es.filter((e) => getRowId(e) !== id)); } else { diff --git a/src/components/TimesheetTable/ProjectSelect.tsx b/src/components/TimesheetTable/ProjectSelect.tsx index e824265..8a318a0 100644 --- a/src/components/TimesheetTable/ProjectSelect.tsx +++ b/src/components/TimesheetTable/ProjectSelect.tsx @@ -1,11 +1,13 @@ import React, { useCallback, useMemo } from "react"; import { Autocomplete, + Box, Checkbox, Chip, ListSubheader, MenuItem, TextField, + Tooltip, } from "@mui/material"; import { AssignedProject, ProjectWithTasks } from "@/app/api/projects"; import { useTranslation } from "react-i18next"; @@ -184,13 +186,10 @@ const AutocompleteProjectSelect: React.FC = ({ ) => { // eslint-disable-next-line @typescript-eslint/no-unused-vars const { key, ...rest } = params; - return ( - + const childKey = `${option.value}--${option.label}`; + + const content = ( + {multiple && ( = ({ {option.label} ); + + const associatedProject = allProjects.find( + (p) => p.id === option.value, + ); + + return associatedProject ? ( + + + {t("Project Code")} + {associatedProject.code} + + + {t("Project Name")} + {associatedProject.name} + + {associatedProject.description && ( + + {t("Project Description")} + {associatedProject.description} + + )} + + } + > + {content} + + ) : ( + content + ); }} renderInput={(params) => } />