From 7e3a6166b6db1b163afcc5213c3ddea3318f5185 Mon Sep 17 00:00:00 2001 From: "MSI\\2Fi" Date: Tue, 24 Sep 2024 18:25:48 +0800 Subject: [PATCH] Minor update --- src/components/EditStaff/EditStaff.tsx | 2 +- src/components/EditStaff/EditStaffWrapper.tsx | 10 ++++++++-- src/components/EditStaff/ProjectHistory.tsx | 11 ++++++++++- src/components/ExpenseSearch/CreateExpenseModal.tsx | 4 ++-- src/components/ExpenseSearch/ExpenseSearch.tsx | 2 +- src/components/InvoiceSearch/InvoiceSearchWrapper.tsx | 7 ++++--- 6 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/components/EditStaff/EditStaff.tsx b/src/components/EditStaff/EditStaff.tsx index 740504a..3ef243a 100644 --- a/src/components/EditStaff/EditStaff.tsx +++ b/src/components/EditStaff/EditStaff.tsx @@ -38,7 +38,7 @@ interface formProps { Staff: IndividualStaff combos: comboItem; SalaryEffectiveInfo: SalaryEffectiveInfo[]; - InvolvedProject?: projects[] + InvolvedProject: projects[] InfoHistory: InfoHistory } diff --git a/src/components/EditStaff/EditStaffWrapper.tsx b/src/components/EditStaff/EditStaffWrapper.tsx index fb9fe27..b2d9747 100644 --- a/src/components/EditStaff/EditStaffWrapper.tsx +++ b/src/components/EditStaff/EditStaffWrapper.tsx @@ -54,7 +54,7 @@ const EditStaffWrapper: React.FC & SubComponents = async ({ fetchSkillCombo(), fetchSalaryCombo(), fetchStaffSalaryEffectiveInfo(id), - fetchStaffInvolvedProjects(id), + fetchStaffInvolvedProjects(id)??[], fetchGradesLog(id), fetchPositionLog(id), fetchTeamLog(id), @@ -79,7 +79,13 @@ const EditStaffWrapper: React.FC & SubComponents = async ({ Staff.data.joinDate = Staff.data.joinDate && dateArrayToString(Staff.data.joinDate) as string Staff.data.departDate = Staff.data.departDate && dateArrayToString(Staff.data.departDate) as string - return ; + return ; }; EditStaffWrapper.Loading = EditStaffLoading; diff --git a/src/components/EditStaff/ProjectHistory.tsx b/src/components/EditStaff/ProjectHistory.tsx index 360c5bf..582a294 100644 --- a/src/components/EditStaff/ProjectHistory.tsx +++ b/src/components/EditStaff/ProjectHistory.tsx @@ -1,5 +1,5 @@ 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 { useMemo } from "react"; import { useTranslation } from "react-i18next"; @@ -43,7 +43,12 @@ const ProjectHistory: React.FC = async ({ InvolvedProject }) => { + + + {t("On-going Projects")}: + + item.status === "On-going") ?? []} @@ -51,6 +56,10 @@ const ProjectHistory: React.FC = async ({ InvolvedProject }) => { /> + + {t("Completed Projects")}: + + item.status === "Completed") ?? []} diff --git a/src/components/ExpenseSearch/CreateExpenseModal.tsx b/src/components/ExpenseSearch/CreateExpenseModal.tsx index e864d3a..38f3cee 100644 --- a/src/components/ExpenseSearch/CreateExpenseModal.tsx +++ b/src/components/ExpenseSearch/CreateExpenseModal.tsx @@ -71,14 +71,14 @@ const CreateExpenseModal: React.FC = ({ isOpen, onClose, projects }) => { item.remarks && item.remarks.length > 0 ? item.remarks : undefined, }; }); - console.log(postData); + // console.log(postData); submitDialog(async () => { const response = await saveProjectExpense(postData) console.log(response) if (response) { onClose() successDialog(t("Submit Success"), t).then(() => { - router.replace("/expense"); + window.location.reload() }) } }, t) diff --git a/src/components/ExpenseSearch/ExpenseSearch.tsx b/src/components/ExpenseSearch/ExpenseSearch.tsx index 8191a63..c7807a3 100644 --- a/src/components/ExpenseSearch/ExpenseSearch.tsx +++ b/src/components/ExpenseSearch/ExpenseSearch.tsx @@ -149,7 +149,7 @@ const ExpenseSearch: React.FC = ({ expenses, projects }) => { // setDialogOpen(false); // console.log(selectedRow[0]) selectedRow[0].issueDate = dayjs(selectedRow[0].issuedDate).format(INPUT_DATE_FORMAT) - console.log(selectedRow[0]) + // console.log(selectedRow[0]) await updateProjectExpense(selectedRow[0]) setDialogOpen(false); successDialog(t("Update Success"), t).then(() => { diff --git a/src/components/InvoiceSearch/InvoiceSearchWrapper.tsx b/src/components/InvoiceSearch/InvoiceSearchWrapper.tsx index 5d54100..beda461 100644 --- a/src/components/InvoiceSearch/InvoiceSearchWrapper.tsx +++ b/src/components/InvoiceSearch/InvoiceSearchWrapper.tsx @@ -27,9 +27,10 @@ const InvoiceSearchWrapper: React.FC & SubComponents = async () => { let filteredInvoice = invoices if (teamId) { filteredInvoice = invoices.filter(i => i.teamId === teamId) - } else { - filteredInvoice = [] - } + } + // else { + // filteredInvoice = [] + // } const convertedInvoices = filteredInvoice.map((invoice)=>{ return{