@@ -38,7 +38,7 @@ interface formProps { | |||||
Staff: IndividualStaff | Staff: IndividualStaff | ||||
combos: comboItem; | combos: comboItem; | ||||
SalaryEffectiveInfo: SalaryEffectiveInfo[]; | SalaryEffectiveInfo: SalaryEffectiveInfo[]; | ||||
InvolvedProject?: projects[] | |||||
InvolvedProject: projects[] | |||||
InfoHistory: InfoHistory | InfoHistory: InfoHistory | ||||
} | } | ||||
@@ -54,7 +54,7 @@ const EditStaffWrapper: React.FC<Props> & SubComponents = async ({ | |||||
fetchSkillCombo(), | fetchSkillCombo(), | ||||
fetchSalaryCombo(), | fetchSalaryCombo(), | ||||
fetchStaffSalaryEffectiveInfo(id), | fetchStaffSalaryEffectiveInfo(id), | ||||
fetchStaffInvolvedProjects(id), | |||||
fetchStaffInvolvedProjects(id)??[], | |||||
fetchGradesLog(id), | fetchGradesLog(id), | ||||
fetchPositionLog(id), | fetchPositionLog(id), | ||||
fetchTeamLog(id), | fetchTeamLog(id), | ||||
@@ -79,7 +79,13 @@ const EditStaffWrapper: React.FC<Props> & SubComponents = async ({ | |||||
Staff.data.joinDate = Staff.data.joinDate && dateArrayToString(Staff.data.joinDate) as string | Staff.data.joinDate = Staff.data.joinDate && dateArrayToString(Staff.data.joinDate) as string | ||||
Staff.data.departDate = Staff.data.departDate && dateArrayToString(Staff.data.departDate) as string | Staff.data.departDate = Staff.data.departDate && dateArrayToString(Staff.data.departDate) as string | ||||
return <EditStaff Staff={Staff.data} combos={combos} SalaryEffectiveInfo={SalaryEffectiveInfo} InvolvedProject={InvolvedProject} InfoHistory={InfoHistory}/>; | |||||
return <EditStaff | |||||
Staff={Staff.data} | |||||
combos={combos} | |||||
SalaryEffectiveInfo={SalaryEffectiveInfo} | |||||
InvolvedProject={InvolvedProject} | |||||
InfoHistory={InfoHistory} | |||||
/>; | |||||
}; | }; | ||||
EditStaffWrapper.Loading = EditStaffLoading; | EditStaffWrapper.Loading = EditStaffLoading; | ||||
@@ -1,5 +1,5 @@ | |||||
import { projects } from "@/app/api/staff"; | import { projects } from "@/app/api/staff"; | ||||
import { Box, Card, CardContent, Grid, Stack, SxProps } from "@mui/material"; | |||||
import { Box, Card, CardContent, Divider, Grid, Stack, SxProps, Typography } 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"; | ||||
@@ -43,7 +43,12 @@ const ProjectHistory: React.FC<Props> = async ({ InvolvedProject }) => { | |||||
<CardContent component={Stack} spacing={4}> | <CardContent component={Stack} spacing={4}> | ||||
<Box> | <Box> | ||||
<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}> | ||||
<Typography variant="h5"> | |||||
{t("On-going Projects")}: | |||||
</Typography> | |||||
<Divider sx={{ paddingBlockStart: 2 }}/> | |||||
<StyledDataGrid | <StyledDataGrid | ||||
sx={_sx} | sx={_sx} | ||||
rows={InvolvedProject?.filter(item => item.status === "On-going") ?? []} | rows={InvolvedProject?.filter(item => item.status === "On-going") ?? []} | ||||
@@ -51,6 +56,10 @@ const ProjectHistory: React.FC<Props> = async ({ InvolvedProject }) => { | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={6}> | <Grid item xs={6}> | ||||
<Typography variant="h5"> | |||||
{t("Completed Projects")}: | |||||
</Typography> | |||||
<Divider sx={{ paddingBlockStart: 2 }}/> | |||||
<StyledDataGrid | <StyledDataGrid | ||||
sx={_sx} | sx={_sx} | ||||
rows={InvolvedProject?.filter(item => item.status === "Completed") ?? []} | rows={InvolvedProject?.filter(item => item.status === "Completed") ?? []} | ||||
@@ -71,14 +71,14 @@ const CreateExpenseModal: React.FC<Props> = ({ isOpen, onClose, projects }) => { | |||||
item.remarks && item.remarks.length > 0 ? item.remarks : undefined, | item.remarks && item.remarks.length > 0 ? item.remarks : undefined, | ||||
}; | }; | ||||
}); | }); | ||||
console.log(postData); | |||||
// console.log(postData); | |||||
submitDialog(async () => { | submitDialog(async () => { | ||||
const response = await saveProjectExpense(postData) | const response = await saveProjectExpense(postData) | ||||
console.log(response) | console.log(response) | ||||
if (response) { | if (response) { | ||||
onClose() | onClose() | ||||
successDialog(t("Submit Success"), t).then(() => { | successDialog(t("Submit Success"), t).then(() => { | ||||
router.replace("/expense"); | |||||
window.location.reload() | |||||
}) | }) | ||||
} | } | ||||
}, t) | }, t) | ||||
@@ -149,7 +149,7 @@ const ExpenseSearch: React.FC<Props> = ({ expenses, projects }) => { | |||||
// setDialogOpen(false); | // setDialogOpen(false); | ||||
// console.log(selectedRow[0]) | // console.log(selectedRow[0]) | ||||
selectedRow[0].issueDate = dayjs(selectedRow[0].issuedDate).format(INPUT_DATE_FORMAT) | selectedRow[0].issueDate = dayjs(selectedRow[0].issuedDate).format(INPUT_DATE_FORMAT) | ||||
console.log(selectedRow[0]) | |||||
// console.log(selectedRow[0]) | |||||
await updateProjectExpense(selectedRow[0]) | await updateProjectExpense(selectedRow[0]) | ||||
setDialogOpen(false); | setDialogOpen(false); | ||||
successDialog(t("Update Success"), t).then(() => { | successDialog(t("Update Success"), t).then(() => { | ||||
@@ -27,9 +27,10 @@ const InvoiceSearchWrapper: React.FC & SubComponents = async () => { | |||||
let filteredInvoice = invoices | let filteredInvoice = invoices | ||||
if (teamId) { | if (teamId) { | ||||
filteredInvoice = invoices.filter(i => i.teamId === teamId) | filteredInvoice = invoices.filter(i => i.teamId === teamId) | ||||
} else { | |||||
filteredInvoice = [] | |||||
} | |||||
} | |||||
// else { | |||||
// filteredInvoice = [] | |||||
// } | |||||
const convertedInvoices = filteredInvoice.map((invoice)=>{ | const convertedInvoices = filteredInvoice.map((invoice)=>{ | ||||
return{ | return{ | ||||