Просмотр исходного кода

Remove Staff type and use StaffResult

tags/Baseline_30082024_FRONTEND_UAT
Wayne 1 год назад
Родитель
Сommit
9d61a46092
9 измененных файлов: 6 добавлений и 22 удалений
  1. +0
    -1
      src/app/(main)/staff/create/page.tsx
  2. +1
    -11
      src/app/api/staff/index.ts
  3. +0
    -1
      src/components/CreateCustomer/CreateCustomer.tsx
  4. +0
    -1
      src/components/CreateDepartment/CreateDepartment.tsx
  5. +0
    -1
      src/components/CreateDepartment/DepartmentDetails.tsx
  6. +0
    -1
      src/components/CreatePosition/CreatePosition.tsx
  7. +0
    -1
      src/components/CreatePosition/PositionDetails.tsx
  8. +2
    -2
      src/components/CreateProject/CreateProject.tsx
  9. +3
    -3
      src/components/CreateProject/ProjectClientDetails.tsx

+ 0
- 1
src/app/(main)/staff/create/page.tsx Просмотреть файл

@@ -25,7 +25,6 @@ import {
import { CreateProjectInputs, saveProject } from "@/app/api/projects/actions"; import { CreateProjectInputs, saveProject } from "@/app/api/projects/actions";
import { Error } from "@mui/icons-material"; import { Error } from "@mui/icons-material";
import { ProjectCategory } from "@/app/api/projects"; import { ProjectCategory } from "@/app/api/projects";
import { Staff } from "@/app/api/staff";
import { Grid, Typography } from "@mui/material"; import { Grid, Typography } from "@mui/material";
import CreateStaffForm from "@/components/CreateStaff/CreateStaffForm"; import CreateStaffForm from "@/components/CreateStaff/CreateStaffForm";




+ 1
- 11
src/app/api/staff/index.ts Просмотреть файл

@@ -3,15 +3,6 @@ import { BASE_API_URL } from "@/config/api";
import { cache } from "react"; import { cache } from "react";
import "server-only"; import "server-only";


export interface Staff {
id: number;
name: string;
staffId: string;
team: {
name: string;
code: string;
};
}
export interface StaffResult { export interface StaffResult {
id: number; id: number;
name: string; name: string;
@@ -31,11 +22,10 @@ export interface searchInput {


export const preloadTeamLeads = () => { export const preloadTeamLeads = () => {
fetchTeamLeads(); fetchTeamLeads();
// fetchStaff();
}; };


export const fetchTeamLeads = cache(async () => { export const fetchTeamLeads = cache(async () => {
return serverFetchJson<Staff[]>(`${BASE_API_URL}/staffs/teamLeads`, {
return serverFetchJson<StaffResult[]>(`${BASE_API_URL}/staffs/teamLeads`, {
next: { tags: ["teamLeads"] }, next: { tags: ["teamLeads"] },
}); });
}); });


+ 0
- 1
src/components/CreateCustomer/CreateCustomer.tsx Просмотреть файл

@@ -20,7 +20,6 @@ import {
import { CreateProjectInputs, saveProject } from "@/app/api/projects/actions"; import { CreateProjectInputs, saveProject } from "@/app/api/projects/actions";
import { Error } from "@mui/icons-material"; import { Error } from "@mui/icons-material";
import { ProjectCategory } from "@/app/api/projects"; import { ProjectCategory } from "@/app/api/projects";
import { Staff } from "@/app/api/staff";
import { Typography } from "@mui/material"; import { Typography } from "@mui/material";
import { CustomerFormInputs, saveCustomer } from "@/app/api/customer/actions"; import { CustomerFormInputs, saveCustomer } from "@/app/api/customer/actions";
import CustomerDetails from "./CustomerDetails"; import CustomerDetails from "./CustomerDetails";


+ 0
- 1
src/components/CreateDepartment/CreateDepartment.tsx Просмотреть файл

@@ -20,7 +20,6 @@ import {
import { CreateDepartmentInputs, saveDepartment } from "@/app/api/departments/actions"; import { CreateDepartmentInputs, saveDepartment } from "@/app/api/departments/actions";
import { Error } from "@mui/icons-material"; import { Error } from "@mui/icons-material";
import { ProjectCategory } from "@/app/api/projects"; import { ProjectCategory } from "@/app/api/projects";
import { Staff } from "@/app/api/staff";
import { Typography } from "@mui/material"; import { Typography } from "@mui/material";
import DepartmentDetails from "./DepartmentDetails"; import DepartmentDetails from "./DepartmentDetails";




+ 0
- 1
src/components/CreateDepartment/DepartmentDetails.tsx Просмотреть файл

@@ -17,7 +17,6 @@ import RestartAlt from "@mui/icons-material/RestartAlt";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import { Controller, useFormContext } from "react-hook-form"; import { Controller, useFormContext } from "react-hook-form";
import { CreateDepartmentInputs } from "@/app/api/departments/actions"; import { CreateDepartmentInputs } from "@/app/api/departments/actions";
import { Staff } from "@/app/api/staff";


const DepartmentDetails: React.FC = ({ const DepartmentDetails: React.FC = ({
}) => { }) => {


+ 0
- 1
src/components/CreatePosition/CreatePosition.tsx Просмотреть файл

@@ -20,7 +20,6 @@ import {
import { CreatePositionInputs, savePosition } from "@/app/api/positions/actions"; import { CreatePositionInputs, savePosition } from "@/app/api/positions/actions";
import { Error } from "@mui/icons-material"; import { Error } from "@mui/icons-material";
import { ProjectCategory } from "@/app/api/projects"; import { ProjectCategory } from "@/app/api/projects";
import { Staff } from "@/app/api/staff";
import { Typography } from "@mui/material"; import { Typography } from "@mui/material";
import PositionDetails from "./PositionDetails"; import PositionDetails from "./PositionDetails";




+ 0
- 1
src/components/CreatePosition/PositionDetails.tsx Просмотреть файл

@@ -17,7 +17,6 @@ import RestartAlt from "@mui/icons-material/RestartAlt";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import { Controller, useFormContext } from "react-hook-form"; import { Controller, useFormContext } from "react-hook-form";
import { CreatePositionInputs } from "@/app/api/positions/actions"; import { CreatePositionInputs } from "@/app/api/positions/actions";
import { Staff } from "@/app/api/staff";


const PositionDetails: React.FC = ({ const PositionDetails: React.FC = ({
}) => { }) => {


+ 2
- 2
src/components/CreateProject/CreateProject.tsx Просмотреть файл

@@ -24,14 +24,14 @@ import {
import { CreateProjectInputs, saveProject } from "@/app/api/projects/actions"; import { CreateProjectInputs, saveProject } from "@/app/api/projects/actions";
import { Error } from "@mui/icons-material"; import { Error } from "@mui/icons-material";
import { ProjectCategory } from "@/app/api/projects"; import { ProjectCategory } from "@/app/api/projects";
import { Staff } from "@/app/api/staff";
import { StaffResult } from "@/app/api/staff";
import { Typography } from "@mui/material"; import { Typography } from "@mui/material";


export interface Props { export interface Props {
allTasks: Task[]; allTasks: Task[];
projectCategories: ProjectCategory[]; projectCategories: ProjectCategory[];
taskTemplates: TaskTemplate[]; taskTemplates: TaskTemplate[];
teamLeads: Staff[];
teamLeads: StaffResult[];
} }


const hasErrorsInTab = ( const hasErrorsInTab = (


+ 3
- 3
src/components/CreateProject/ProjectClientDetails.tsx Просмотреть файл

@@ -18,12 +18,12 @@ import Button from "@mui/material/Button";
import { Controller, useFormContext } from "react-hook-form"; import { Controller, useFormContext } from "react-hook-form";
import { CreateProjectInputs } from "@/app/api/projects/actions"; import { CreateProjectInputs } from "@/app/api/projects/actions";
import { ProjectCategory } from "@/app/api/projects"; import { ProjectCategory } from "@/app/api/projects";
import { Staff } from "@/app/api/staff";
import { StaffResult } from "@/app/api/staff";


interface Props { interface Props {
isActive: boolean; isActive: boolean;
projectCategories: ProjectCategory[]; projectCategories: ProjectCategory[];
teamLeads: Staff[];
teamLeads: StaffResult[];
} }


const ProjectClientDetails: React.FC<Props> = ({ const ProjectClientDetails: React.FC<Props> = ({
@@ -99,7 +99,7 @@ const ProjectClientDetails: React.FC<Props> = ({
<Select label={t("Team Lead")} {...field}> <Select label={t("Team Lead")} {...field}>
{teamLeads.map((staff, index) => ( {teamLeads.map((staff, index) => (
<MenuItem key={`${staff.id}-${index}`} value={staff.id}> <MenuItem key={`${staff.id}-${index}`} value={staff.id}>
{`${staff.staffId} - ${staff.name} (${staff.team.code})`}
{`${staff.staffId} - ${staff.name} (${staff.team})`}
</MenuItem> </MenuItem>
))} ))}
</Select> </Select>


Загрузка…
Отмена
Сохранить