diff --git a/src/components/CreateStaff/CreateStaff.tsx b/src/components/CreateStaff/CreateStaff.tsx index 35b8ded..a76da6b 100644 --- a/src/components/CreateStaff/CreateStaff.tsx +++ b/src/components/CreateStaff/CreateStaff.tsx @@ -20,12 +20,6 @@ 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 { 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"; interface Field { // subtitle: string; @@ -157,63 +151,61 @@ const CreateStaff: React.FC = ({ Title }) => { id: "staffId", label: t("Staff ID"), type: "text", - value: "", required: true, }, { id: "name", label: t("Staff Name"), type: "text", - value: "", required: true, }, { id: "companyId", label: t("Company"), type: "combo-Obj", - options: companyCombo, + options: companyCombo || [], required: true, }, { id: "teamId", label: t("Team"), type: "combo-Obj", - options: teamCombo, + options: teamCombo || [], required: false, }, { id: "departmentId", label: t("Department"), type: "combo-Obj", - options: departmentCombo, + options: departmentCombo || [], required: true, }, { id: "gradeId", label: t("Grade"), type: "combo-Obj", - options: gradeCombo, + options: gradeCombo || [], required: false, }, { id: "skillSetId", label: t("Skillset"), type: "combo-Obj", - options: skillCombo, + options: skillCombo || [], required: false, }, { id: "currentPositionId", label: t("Current Position"), type: "combo-Obj", - options: positionCombo, + options: positionCombo || [], required: true, }, { id: "salaryId", label: t("Salary Point"), type: "combo-Obj", - options: salaryCombo, + options: salaryCombo || [], required: true, }, // { @@ -223,6 +215,12 @@ const CreateStaff: React.FC = ({ Title }) => { // value: "", // required: false, // }, + { + id: "hourlyRate", + label: t("Hourly Rate"), + type: "numeric-testing", + required: true, + }, { id: "employType", label: t("Employ Type"), @@ -235,7 +233,6 @@ const CreateStaff: React.FC = ({ Title }) => { id: "email", label: t("Email"), type: "text", - value: "", pattern: "^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$", message: t("input matching format"), required: true, @@ -244,8 +241,7 @@ const CreateStaff: React.FC = ({ Title }) => { id: "phone1", label: t("Phone1"), type: "text", - value: "", - // pattern: "^\\d{8}$", + pattern: "^\\d{8}$", message: t("input correct phone no."), required: true, }, @@ -253,8 +249,7 @@ const CreateStaff: React.FC = ({ Title }) => { id: "phone2", label: t("Phone2"), type: "text", - value: "", - // pattern: "^\\d{8}$", + pattern: "^\\d{8}$", message: t("input correct phone no."), required: false, }, @@ -264,15 +259,13 @@ const CreateStaff: React.FC = ({ Title }) => { id: "emergContactName", label: t("Emergency Contact Name"), type: "text", - value: "", required: true, }, { id: "emergContactPhone", label: t("Emergency Contact Phone"), type: "text", - value: "", - // pattern: "^\\d{8}$", + pattern: "^\\d{8}$", message: t("input correct phone no."), required: true, }, @@ -280,33 +273,29 @@ const CreateStaff: React.FC = ({ Title }) => { id: "joinDate", label: t("Join Date"), type: "multiDate", - value: "", required: true, }, { id: "joinPositionId", label: t("Join Position"), type: "combo-Obj", - options: positionCombo, + options: positionCombo || [], required: true, }, { id: "departDate", label: t("Depart Date"), type: "multiDate", - value: "", }, { id: "departReason", label: t("Depart Reason"), type: "text", - value: "", }, { id: "remark", label: t("Remark"), type: "remarks", - value: "", }, ] ];