|
|
@@ -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<formProps> = ({ 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<formProps> = ({ Staff, combos, SalaryEffectiveInfo }) |
|
|
|
// date: dayjs(item.date).toDate(), |
|
|
|
// })}) |
|
|
|
// ) |
|
|
|
// }, []); |
|
|
|
// }, [formProps]); |
|
|
|
|
|
|
|
// useEffect(() => { |
|
|
|
// resetStaff() |
|
|
|