|
|
@@ -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<Props> = ({ |
|
|
|
) => { |
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars |
|
|
|
const { key, ...rest } = params; |
|
|
|
return ( |
|
|
|
<MenuItem |
|
|
|
{...rest} |
|
|
|
disableRipple |
|
|
|
value={option.value} |
|
|
|
key={`${option.value}--${option.label}`} |
|
|
|
> |
|
|
|
const childKey = `${option.value}--${option.label}`; |
|
|
|
|
|
|
|
const content = ( |
|
|
|
<MenuItem {...rest} disableRipple value={option.value} key={childKey}> |
|
|
|
{multiple && ( |
|
|
|
<Checkbox |
|
|
|
disableRipple |
|
|
@@ -202,6 +201,39 @@ const AutocompleteProjectSelect: React.FC<Props> = ({ |
|
|
|
{option.label} |
|
|
|
</MenuItem> |
|
|
|
); |
|
|
|
|
|
|
|
const associatedProject = allProjects.find( |
|
|
|
(p) => p.id === option.value, |
|
|
|
); |
|
|
|
|
|
|
|
return associatedProject ? ( |
|
|
|
<Tooltip |
|
|
|
key={childKey} |
|
|
|
placement="right" |
|
|
|
title={ |
|
|
|
<Box sx={{ display: "flex", flexDirection: "column", gap: 2 }}> |
|
|
|
<Box> |
|
|
|
<Box>{t("Project Code")}</Box> |
|
|
|
{associatedProject.code} |
|
|
|
</Box> |
|
|
|
<Box> |
|
|
|
<Box>{t("Project Name")}</Box> |
|
|
|
{associatedProject.name} |
|
|
|
</Box> |
|
|
|
{associatedProject.description && ( |
|
|
|
<Box> |
|
|
|
<Box>{t("Project Description")}</Box> |
|
|
|
{associatedProject.description} |
|
|
|
</Box> |
|
|
|
)} |
|
|
|
</Box> |
|
|
|
} |
|
|
|
> |
|
|
|
{content} |
|
|
|
</Tooltip> |
|
|
|
) : ( |
|
|
|
content |
|
|
|
); |
|
|
|
}} |
|
|
|
renderInput={(params) => <TextField {...params} error={error} />} |
|
|
|
/> |
|
|
|