|
@@ -1,17 +1,29 @@ |
|
|
import { projects } from "@/app/api/staff"; |
|
|
import { projects } from "@/app/api/staff"; |
|
|
import { Box, Card, CardContent, Grid, Stack } from "@mui/material"; |
|
|
|
|
|
|
|
|
import { Box, Card, CardContent, Grid, Stack, SxProps } from "@mui/material"; |
|
|
import StyledDataGrid from "../StyledDataGrid"; |
|
|
import StyledDataGrid from "../StyledDataGrid"; |
|
|
import { useMemo } from "react"; |
|
|
import { useMemo } from "react"; |
|
|
import { useTranslation } from "react-i18next"; |
|
|
import { useTranslation } from "react-i18next"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
interface Props { |
|
|
InvolvedProject?: projects[] |
|
|
|
|
|
|
|
|
InvolvedProject: projects[] |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ProjectHistory: React.FC<Props> = async ({ InvolvedProject }) => { |
|
|
const ProjectHistory: React.FC<Props> = async ({ InvolvedProject }) => { |
|
|
const { t } = useTranslation(); |
|
|
const { t } = useTranslation(); |
|
|
|
|
|
console.log(InvolvedProject) |
|
|
|
|
|
const _sx: SxProps = useMemo(() => ( |
|
|
|
|
|
InvolvedProject.length == 0 ? |
|
|
|
|
|
{ |
|
|
|
|
|
height: 300 |
|
|
|
|
|
} |
|
|
|
|
|
: |
|
|
|
|
|
{ |
|
|
|
|
|
height: 500 |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
, []); |
|
|
const projectCols = useMemo( |
|
|
const projectCols = useMemo( |
|
|
() => [ |
|
|
() => [ |
|
|
{ |
|
|
{ |
|
@@ -33,12 +45,14 @@ const ProjectHistory: React.FC<Props> = async ({ InvolvedProject }) => { |
|
|
<Grid container spacing={2} columns={{ xs: 6, sm: 12 }}> |
|
|
<Grid container spacing={2} columns={{ xs: 6, sm: 12 }}> |
|
|
<Grid item xs={6}> |
|
|
<Grid item xs={6}> |
|
|
<StyledDataGrid |
|
|
<StyledDataGrid |
|
|
|
|
|
sx={_sx} |
|
|
rows={InvolvedProject?.filter(item => item.status === "On-going") ?? []} |
|
|
rows={InvolvedProject?.filter(item => item.status === "On-going") ?? []} |
|
|
columns={projectCols} |
|
|
columns={projectCols} |
|
|
/> |
|
|
/> |
|
|
</Grid> |
|
|
</Grid> |
|
|
<Grid item xs={6}> |
|
|
<Grid item xs={6}> |
|
|
<StyledDataGrid |
|
|
<StyledDataGrid |
|
|
|
|
|
sx={_sx} |
|
|
rows={InvolvedProject?.filter(item => item.status === "Completed") ?? []} |
|
|
rows={InvolvedProject?.filter(item => item.status === "Completed") ?? []} |
|
|
columns={projectCols} |
|
|
columns={projectCols} |
|
|
/> |
|
|
/> |
|
|