diff --git a/src/components/EditStaff/EditStaff.tsx b/src/components/EditStaff/EditStaff.tsx index f5a061b..356a6c5 100644 --- a/src/components/EditStaff/EditStaff.tsx +++ b/src/components/EditStaff/EditStaff.tsx @@ -10,24 +10,15 @@ import { SubmitHandler, useForm, } from "react-hook-form"; -import { CreateStaffInputs, saveStaff, testing } from "@/app/api/staff/actions"; +import { CreateStaffInputs, saveStaff } from "@/app/api/staff/actions"; import { Button, Stack, Typography } from "@mui/material"; // import CreateStaffForm from "../CreateStaffForm"; -import { comboProp, fetchCompanyCombo } from "@/app/api/companys/actions"; -import { fetchTeamCombo } from "@/app/api/team/actions"; -import { fetchDepartmentCombo } from "@/app/api/departments/actions"; -import { fetchPositionCombo } from "@/app/api/positions/actions"; -import { fetchGradeCombo } from "@/app/api/grades/actions"; -import { fetchSkillCombo } from "@/app/api/skill/actions"; -import { fetchSalaryCombo } from "@/app/api/salarys/actions"; +import { comboProp } from "@/app/api/companys/actions"; // import StaffInfo from "./StaffInfo"; import { Check, Close, RestartAlt } from "@mui/icons-material"; -import { ServerFetchError } from "@/app/utils/fetchUtil"; import StaffInfo from "./StaffInfo"; import { IndividualStaff, SalaryEffectiveInfo } from "@/app/api/staff"; import dayjs from "dayjs"; -import { INPUT_DATE_FORMAT } from "@/app/utils/formatUtil"; -import { List, differenceBy } from "lodash"; // import { useGridApiContext } from '@mui/x-data-grid'; export interface comboItem { @@ -144,10 +135,10 @@ const EditStaff: React.FC = ({ Staff, combos, SalaryEffectiveInfo }) haveError = true formProps.setError("salaryId", { message: t("Please Enter Salary."), type: "required" }) } - if (data.joinDate && data.departDate && new Date(data.departDate) <= new Date(data.joinDate)) { - haveError = true - formProps.setError("departDate", { message: t("Depart Date cannot be earlier than Join Date."), type: "required" }) - } + // if (data.joinDate && data.departDate && new Date(data.departDate) <= new Date(data.joinDate)) { + // haveError = true + // formProps.setError("departDate", { message: t("Depart Date cannot be earlier than Join Date."), type: "required" }) + // } if (haveError) { return } @@ -256,7 +247,7 @@ const EditStaff: React.FC = ({ Staff, combos, SalaryEffectiveInfo }) // date: dayjs(item.date).toDate(), // })}) // ) - // }, []); + // }, [formProps]); // useEffect(() => { // resetStaff() diff --git a/src/components/EditStaff/SalaryEffectiveModel.tsx b/src/components/EditStaff/SalaryEffectiveModel.tsx index 0899a21..354c15a 100644 --- a/src/components/EditStaff/SalaryEffectiveModel.tsx +++ b/src/components/EditStaff/SalaryEffectiveModel.tsx @@ -152,7 +152,6 @@ const SalaryEffectiveModel: React.FC = ({ open, onClo ...prevRowModesModel, [id]: { mode: GridRowModes.Edit } })); - }, [setRowModesModel] ); diff --git a/src/components/EditStaff/StaffInfo.tsx b/src/components/EditStaff/StaffInfo.tsx index c432555..7e915b8 100644 --- a/src/components/EditStaff/StaffInfo.tsx +++ b/src/components/EditStaff/StaffInfo.tsx @@ -330,7 +330,7 @@ const StaffInfo: React.FC = ({ combos }) => { ))} )} @@ -466,7 +466,7 @@ const StaffInfo: React.FC = ({ combos }) => { textField: { // required: true, error: - joinDate === "Invalid Date" || !joinDate, + !joinDate ?? false, // value: errors.joinDate?.message, }, }} diff --git a/src/i18n/zh/staff.json b/src/i18n/zh/staff.json index 296ecc4..199418d 100644 --- a/src/i18n/zh/staff.json +++ b/src/i18n/zh/staff.json @@ -28,5 +28,6 @@ "Reset": "重設", "Confirm": "確認", "Cancel": "取消", - "Save": "儲存" + "Save": "儲存", + "Edit Salary": "編輯薪金點" } \ No newline at end of file