diff --git a/src/components/EditTeam/Allocation.tsx b/src/components/EditTeam/Allocation.tsx index 71a7c72..fa2c09d 100644 --- a/src/components/EditTeam/Allocation.tsx +++ b/src/components/EditTeam/Allocation.tsx @@ -62,10 +62,6 @@ const Allocation: React.FC = ({ allStaffs: staff, teamLead }) => { ); const [deletedStaffIds, setDeletedStaffIds] = useState([]); - console.log(getValues("addStaffIds")); - console.log(filteredStaff); - console.log(selectedStaff) - // Adding / Removing staff const addStaff = useCallback((staff: StaffResult) => { setSelectedStaff((s) => [...s, staff]); @@ -88,8 +84,6 @@ const Allocation: React.FC = ({ allStaffs: staff, teamLead }) => { }, getValues("addStaffIds") ); - // console.log(rearrangedList); - // console.log(selectedStaff); const rearrangedStaff = rearrangedList.map((id) => { return selectedStaff.find((staff) => staff.id === id); diff --git a/src/components/EditTeam/EditTeam.tsx b/src/components/EditTeam/EditTeam.tsx index b1a4ca8..79d7ec2 100644 --- a/src/components/EditTeam/EditTeam.tsx +++ b/src/components/EditTeam/EditTeam.tsx @@ -30,8 +30,8 @@ const EditTeam: React.FC = async ({ staff, teamInfo }) => { const formProps = useForm(); const searchParams = useSearchParams(); const idString = searchParams.get("id"); - const [allStaffs, setAllStaffs] = useState(); - const [teamLead, setTeamLead] = useState(); + // const [allStaffs, setAllStaffs] = useState(); + // const [teamLead, setTeamLead] = useState(); const [tabIndex, setTabIndex] = useState(0); const router = useRouter(); @@ -46,34 +46,33 @@ const EditTeam: React.FC = async ({ staff, teamInfo }) => { const [serverError, setServerError] = useState(""); - useEffect(() => { - let idList: number[] = []; - // console.log(desc) - if (idString) { - const filteredTeam = staff.filter((item) => { - return item.teamId === parseInt(idString); - }); - console.log(team.teamLead); - setTeamLead(team.teamLead); - if (filteredTeam.length > 0) { - const filteredIds: number[] = filteredTeam.map((i) => i.id); + // useEffect(() => { + // let idList: number[] = []; + // // console.log(desc) + // if (idString) { + // const filteredTeam = staff.filter((item) => { + // return item.teamId === parseInt(idString); + // }); + // setTeamLead(team.teamLead); + // if (filteredTeam.length > 0) { + // const filteredIds: number[] = filteredTeam.map((i) => i.id); - // const teamLead = tempDesc[0].teamLead - // const index = filteredIds.indexOf(teamLead); + // // const teamLead = tempDesc[0].teamLead + // // const index = filteredIds.indexOf(teamLead); - // if (index !== -1) { - // filteredIds.splice(index, 1); - // filteredIds.unshift(teamLead); - // } + // // if (index !== -1) { + // // filteredIds.splice(index, 1); + // // filteredIds.unshift(teamLead); + // // } - idList = filteredIds; - } - formProps.reset({ description: team.description, addStaffIds: idList }); - } - // console.log(staff) + // idList = filteredIds; + // } + // formProps.reset({ description: team.description, addStaffIds: idList }); + // } + // // console.log(staff) - setAllStaffs(staff); - }, [searchParams]); + // setAllStaffs(staff); + // }, [searchParams]); const hasErrorsInTab = ( tabIndex: number, @@ -136,8 +135,7 @@ const EditTeam: React.FC = async ({ staff, teamInfo }) => { onSubmit={formProps.handleSubmit(onSubmit)} > - {t("Edit Team")} - {/* - {team.name} */} + {t("Edit Team")} - {team.name} = async ({ staff, teamInfo }) => { {tabIndex === 0 && } {tabIndex === 1 && ( - + )}