Skip to content

Commit 8647148

Browse files
“kebean”aimedivin
authored andcommitted
implement attendance
1 parent ea1e1e3 commit 8647148

File tree

12 files changed

+968
-699
lines changed

12 files changed

+968
-699
lines changed

package-lock.json

Lines changed: 12 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"istanbul": "^0.4.5",
7575
"jsonwebtoken": "^9.0.1",
7676
"jwt-decode": "^3.1.2",
77+
"lucide-react": "^0.445.0",
7778
"moment": "^2.29.4",
7879
"pnpm": "^8.6.11",
7980
"react-apexcharts": "^1.4.1",

src/Mutations/Attendance.tsx

Lines changed: 65 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,41 @@
11
import { gql } from '@apollo/client';
22

3-
export const GET_ATTENDANCE = gql`
4-
query ExampleQuery {
5-
getTraineeAttendance {
3+
export const GET_TEAM_ATTENDANCE = gql`
4+
query GetTeamAttendance($team: String!, $orgToken: String) {
5+
getTeamAttendance(team: $team, orgToken: $orgToken) {
66
id
7-
trainees {
8-
traineeId
9-
traineeEmail
10-
status {
11-
days
12-
value
7+
week
8+
phase {
9+
_id
10+
name
11+
}
12+
cohort {
13+
id
14+
name
15+
}
16+
teams {
17+
team {
18+
id
19+
name
20+
}
21+
trainees {
22+
trainee {
23+
id
24+
email
25+
profile {
26+
id
27+
name
28+
}
29+
}
30+
status {
31+
day
32+
score
33+
}
1334
}
1435
}
15-
week
1636
}
1737
}
1838
`;
19-
2039
export const GET_ATTENDANCE_BY_ID = gql`
2140
query GetAttendance($id: ID!) {
2241
getTraineeAttendanceByID(id: $id) {
@@ -33,7 +52,6 @@ export const GET_ATTENDANCE_BY_ID = gql`
3352
}
3453
}
3554
`;
36-
3755
export const GET_WEEKLY_ATTENDANCE = gql`
3856
query GetTraineeAttendanceByID($traineeEmail: String!) {
3957
getTraineeAttendanceByID(traineeEmail: $traineeEmail) {
@@ -46,6 +64,41 @@ export const GET_WEEKLY_ATTENDANCE = gql`
4664
}
4765
`;
4866

67+
export const RECORD_ATTENDANCE = gql`
68+
mutation RecordAttendance(
69+
$week: Int!
70+
$team: String!
71+
$trainees: [TraineeInput!]!
72+
$orgToken: String!
73+
) {
74+
recordAttendance(
75+
week: $week
76+
team: $team
77+
trainees: $trainees
78+
orgToken: $orgToken
79+
) {
80+
team {
81+
id
82+
name
83+
cohort {
84+
name
85+
}
86+
}
87+
trainees {
88+
trainee {
89+
profile {
90+
name
91+
}
92+
}
93+
status {
94+
day
95+
score
96+
}
97+
}
98+
}
99+
}
100+
`;
101+
49102
export const UPDATE_ATTENDANCE = gql`
50103
mutation RecordAttendance(
51104
$week: String!

src/Mutations/manageStudentMutations.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export const GET_TRAINEES_QUERY = gql`
5858
}
5959
team {
6060
name
61+
id
6162
cohort {
6263
id
6364
startDate
@@ -369,6 +370,7 @@ export const ADD_MEMBER_TO_TEAM = gql`
369370
export const GET_TEAM_TRAINEE_QUERY = gql`
370371
query GetTeamTrainees($orgToken: String, $team: String) {
371372
getTeamTrainees(orgToken: $orgToken, team: $team) {
373+
id
372374
profile {
373375
firstName
374376
lastName

src/Mutations/teamMutation.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@ export const GET_TEAMS = gql`
1010
`;
1111
export default GET_TEAMS;
1212

13+
export const GET_ALL_TEAMS = gql`
14+
query Query($orgToken: String) {
15+
getAllTeams(orgToken: $orgToken) {
16+
id
17+
name
18+
cohort {
19+
name
20+
phase {
21+
_id
22+
name
23+
}
24+
coordinator {
25+
id
26+
}
27+
}
28+
}
29+
}
30+
`;
31+
1332
export const ADD_TEAMS = gql`
1433
mutation Mutation(
1534
$name: String!

src/components/CoordinatorCard.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ export const GET_TEAMS_CARDS = gql`
2626
professional_Skills
2727
}
2828
members {
29+
id
2930
profile {
3031
name
32+
lastName
33+
firstName
3134
}
3235
}
3336
active
@@ -164,23 +167,21 @@ function ManagerCard() {
164167
});
165168

166169
return (
167-
<div
168-
className="px-4 md:px-0 pb-20 w-full dark:bg-dark-frame-bg dark:text-black h-full flex overflow-x-auto "
169-
>
170-
{loading ? (
171-
<div className="flex items-center justify-center w-full h-full">
172-
<div className="spinner" />
173-
</div>
174-
) : (
175-
<div className="pl-10 flex">
176-
{teamData &&
170+
<div className="px-4 md:px-0 pb-20 w-full dark:bg-dark-frame-bg dark:text-black h-full flex overflow-x-auto ">
171+
{loading ? (
172+
<div className="flex items-center justify-center w-full h-full">
173+
<div className="spinner" />
174+
</div>
175+
) : (
176+
<div className="pl-10 flex">
177+
{teamData &&
177178
teamData.map((teamProps: any, index: number) => (
178-
<Link key={index} to={`/team/${(teamProps.teamname)}`}>
179+
<Link key={index} to={`/team/${teamProps.teamname}`}>
179180
<Card {...teamProps} />
180181
</Link>
181182
))}
182-
</div>
183-
)}
183+
</div>
184+
)}
184185
</div>
185186
);
186187
}

0 commit comments

Comments
 (0)