-
Notifications
You must be signed in to change notification settings - Fork 11
Update StaffDashboard columns to show Name, Role, Location, Phone, Status, Actions #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: kc-pit-2026-test
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,17 +9,17 @@ import { | |||||
| Stack, | ||||||
| TableCell, | ||||||
| TableRow, | ||||||
| Tooltip, | ||||||
| Typography | ||||||
| Tooltip | ||||||
| } from '@mui/material'; | ||||||
|
|
||||||
| import { UserDocument } from '@/types/User'; | ||||||
|
|
||||||
| interface StaffMember { | ||||||
| id: string; | ||||||
| employeeId: string; | ||||||
| name: string; | ||||||
| position: string; | ||||||
| locationObjectId: string; | ||||||
|
||||||
| locationObjectId: string; | |
| locationName: string; |
Copilot
AI
Jan 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field reference should be member.locationName instead of member.locationObjectId to match the corrected field name and maintain consistency with the codebase convention (see client/src/types/Survey.ts).
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -12,9 +12,10 @@ import StaffDashboardRow from './StaffDashboardRow'; | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| interface StaffMember { | ||||||||||||||||||||||
| id: string; | ||||||||||||||||||||||
| employeeId: string; | ||||||||||||||||||||||
| name: string; | ||||||||||||||||||||||
| position: string; | ||||||||||||||||||||||
| locationObjectId: string; | ||||||||||||||||||||||
|
||||||||||||||||||||||
| locationObjectId: string; | |
| /** | |
| * Human-readable location name (hubName), following app-wide convention. | |
| */ | |
| locationName: string; | |
| /** | |
| * @deprecated This field name is misleading; use `locationName` instead. | |
| * Kept optional for backward compatibility with older code. | |
| */ | |
| locationObjectId?: string; |
Copilot
AI
Jan 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sort key should be locationName instead of locationObjectId to match the corrected field name and maintain consistency with the codebase convention (see client/src/types/Survey.ts).
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,10 @@ import { UserDocument } from '@/types/User'; | |
|
|
||
| interface StaffMember { | ||
| id: string; | ||
| employeeId: string; | ||
| name: string; | ||
| position: string; | ||
| locationObjectId: string; | ||
|
||
| phone: string; | ||
| approvalStatus: string; | ||
| } | ||
|
|
||
|
|
@@ -84,15 +85,17 @@ export const paginateStaff = ( | |
| * Transform users data to staff members format | ||
| */ | ||
| export const transformUsersToStaff = ( | ||
| users: UserDocument[] | undefined | ||
| users: UserDocument[] | undefined, | ||
| locationMap: Map<string, string> | ||
| ): StaffMember[] => { | ||
| if (!users) return []; | ||
|
|
||
| return users.map((user: UserDocument) => ({ | ||
| id: user._id, | ||
| employeeId: user._id ?? 'N/A', | ||
| name: `${user.firstName} ${user.lastName}`, | ||
| position: user.role, | ||
| locationObjectId: locationMap.get(user.locationObjectId?.toString() ?? '') ?? 'N/A', | ||
|
||
| phone: user.phone ?? 'N/A', | ||
| approvalStatus: user.approvalStatus ?? 'PENDING' | ||
| })); | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field name
locationObjectIdis misleading because it stores the location name (hubName) rather than the ObjectId. According to the codebase convention established inclient/src/types/Survey.tsandclient/src/hooks/useApi.tsx(line 339), this should be renamed tolocationNamefor consistency.