Kaynağa Gözat

update staff (allocation) list

tags/Baseline_180220205_Frontend
cyril.tsui 8 ay önce
ebeveyn
işleme
bb472749b5
4 değiştirilmiş dosya ile 29 ekleme ve 7 silme
  1. +1
    -0
      src/app/api/staff/index.ts
  2. +3
    -0
      src/components/CreateProject/StaffAllocation.tsx
  3. +6
    -0
      src/components/SearchResults/SearchResults.tsx
  4. +19
    -7
      src/components/StaffSearch/StaffSearch.tsx

+ 1
- 0
src/app/api/staff/index.ts Dosyayı Görüntüle

@@ -80,6 +80,7 @@ export interface StaffResult {
userId: number;
companyId: number;
data: data;
active: boolean;
}
export interface searchInput {
staffId: string;


+ 3
- 0
src/components/CreateProject/StaffAllocation.tsx Dosyayı Görüntüle

@@ -47,6 +47,7 @@ const staffComparator = (a: StaffResult, b: StaffResult, teamLeads: StaffResult[
return 1;
}
return (
Number(b.active) - Number(a.active) ||
a.team?.localeCompare(b.team) ||
a.grade?.localeCompare(b.grade) ||
a.id - b.id
@@ -113,6 +114,7 @@ const StaffAllocation: React.FC<Props> = ({
{ label: t("Staff ID"), name: "staffId" },
{ label: t("Staff Name"), name: "name" },
{ label: t("Title"), name: "currentPosition" },
{ label: t("Active"), name: "active", type: "checkbox" },
],
[addStaff, t],
);
@@ -130,6 +132,7 @@ const StaffAllocation: React.FC<Props> = ({
{ label: t("Staff ID"), name: "staffId" },
{ label: t("Staff Name"), name: "name" },
{ label: t("Title"), name: "currentPosition" },
{ label: t("Active"), name: "active", type: "checkbox" },
],
[removeStaff, t],
);


+ 6
- 0
src/components/SearchResults/SearchResults.tsx Dosyayı Görüntüle

@@ -15,6 +15,8 @@ import IconButton, { IconButtonOwnProps, IconButtonPropsColorOverrides } from "@
import { t } from "i18next";
import { useTranslation } from "react-i18next";
import { convertDateArrayToString, moneyFormatter } from "@/app/utils/formatUtil";
import DoneIcon from '@mui/icons-material/Done';
import CloseIcon from '@mui/icons-material/Close';

export interface ResultWithId {
id: string | number;
@@ -120,6 +122,10 @@ function SearchResults<T extends ResultWithId>({
) :
column?.type === "money" ? (
<div style={{display: "flex", justifyContent: "flex-end"}}>{moneyFormatter.format(item[columnName] as number)}</div>
) :
column?.type === "checkbox" ? (
Boolean(item[columnName]) ?
<DoneIcon color="primary" /> : <CloseIcon color="error"/>
) :
(
<>{column?.needTranslation ? t(item[columnName] as string) : item[columnName]}</>


+ 19
- 7
src/components/StaffSearch/StaffSearch.tsx Dosyayı Görüntüle

@@ -68,6 +68,12 @@ const StaffSearch: React.FC<Props> = ({ staff, teams, grades, positions, abiliti
type: "select",
options: positionCombo,
},
{
label: t("Active"),
paramName: "active",
type: "select",
options: ["true", "false"],
},
],
[t]
);
@@ -121,14 +127,19 @@ const StaffSearch: React.FC<Props> = ({ staff, teams, grades, positions, abiliti
{ name: "staffId", label: t("Staff ID") },
{ name: "grade", label: t("Grade") },
{ name: "currentPosition", label: t("Current Position") },
{
name: "action",
label: t("Actions"),
onClick: deleteClick,
buttonIcon: <DeleteIcon />,
color: "error",
isHidden: !maintainStaff,
{
name: "active",
label: t("Active"),
type: "checkbox"
},
// {
// name: "action",
// label: t("Actions"),
// onClick: deleteClick,
// buttonIcon: <DeleteIcon />,
// color: "error",
// isHidden: !maintainStaff,
// },
],
[t, onStaffClick, deleteClick]
);
@@ -148,6 +159,7 @@ const StaffSearch: React.FC<Props> = ({ staff, teams, grades, positions, abiliti
&& (query.team === "All" || s.teamId === teams[teamCombo.findIndex(team => team === query.team)].id)
&& (query.grade === "All" || s.grade === query.grade)
&& (query.currentPosition === "All" || s.currentPosition === query.currentPosition)
&& (query.active === "All" || s.active.toString() === query.active)
)
);
}}


Yükleniyor…
İptal
Kaydet