Pārlūkot izejas kodu

update

tags/Baseline_30082024_FRONTEND_UAT
MSI\derek pirms 1 gada
vecāks
revīzija
f3c4ec44bc
2 mainītis faili ar 4 papildinājumiem un 33 dzēšanām
  1. +3
    -1
      src/app/api/team/index.ts
  2. +1
    -32
      src/components/EditTeam/EditTeam.tsx

+ 3
- 1
src/app/api/team/index.ts Parādīt failu

@@ -2,6 +2,7 @@ import { serverFetchJson } from "@/app/utils/fetchUtil";
import { BASE_API_URL } from "@/config/api";
import { cache } from "react";
import "server-only";
import { IndividualStaff } from "../staff";

export interface TeamResult {
action: any;
@@ -27,7 +28,8 @@ export type IndividualTeam = {
description: string;
name: string;
code: string;
teamLead: number;
teamLead: IndividualStaff;
staff: IndividualStaff;
}

export interface comboProp {


+ 1
- 32
src/components/EditTeam/EditTeam.tsx Parādīt failu

@@ -26,13 +26,10 @@ interface Props {

const EditTeam: React.FC<Props> = async ({ staff, teamInfo }) => {
const { team, staffIds } = teamInfo;
// console.log(staffIds)
const { t } = useTranslation();
const formProps = useForm<CreateTeamInputs>();
const searchParams = useSearchParams();
const idString = searchParams.get("id");
// const [allStaffs, setAllStaffs] = useState<StaffResult[]>();
// const [teamLead, setTeamLead] = useState<number>();
const [tabIndex, setTabIndex] = useState(0);
const router = useRouter();

@@ -47,34 +44,6 @@ const EditTeam: React.FC<Props> = 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);
// });
// 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);

// // if (index !== -1) {
// // filteredIds.splice(index, 1);
// // filteredIds.unshift(teamLead);
// // }

// idList = filteredIds;
// }
// formProps.reset({ description: team.description, addStaffIds: idList });
// }
// // console.log(staff)

// setAllStaffs(staff);
// }, [searchParams]);

const hasErrorsInTab = (
tabIndex: number,
errors: FieldErrors<CreateTeamInputs>
@@ -165,7 +134,7 @@ const EditTeam: React.FC<Props> = async ({ staff, teamInfo }) => {
</Stack>
{tabIndex === 0 && <TeamInfo />}
{tabIndex === 1 && (
<Allocation allStaffs={staff} teamLead={team.teamLead} />
<Allocation allStaffs={staff} teamLead={team.teamLead.id} />
)}
<Stack direction="row" justifyContent="flex-end" gap={1}>
<Button


Notiek ielāde…
Atcelt
Saglabāt