@@ -49,14 +49,17 @@ const RecruiterApplicantsPage = () => {
4949
5050 const fetchJobs = async ( ) => {
5151 try {
52- const response = await fetch ( "https://chapi.techstartucalgary.com/jobs/me" , {
53- method : "GET" ,
54- mode : "cors" ,
55- headers : {
56- "Content-Type" : "application/json" ,
57- Authorization : `Bearer ${ localStorage . getItem ( "access_token" ) } ` ,
52+ const response = await fetch (
53+ "https://chapi.techstartucalgary.com/jobs/me" ,
54+ {
55+ method : "GET" ,
56+ mode : "cors" ,
57+ headers : {
58+ "Content-Type" : "application/json" ,
59+ Authorization : `Bearer ${ localStorage . getItem ( "access_token" ) } ` ,
60+ } ,
5861 } ,
59- } ) ;
62+ ) ;
6063
6164 if ( response . ok ) {
6265 const data = await response . json ( ) ;
@@ -69,12 +72,12 @@ const RecruiterApplicantsPage = () => {
6972 console . error ( error ) ;
7073 }
7174 } ;
72-
75+
7376 const fetchApplicants = async ( jobId ) => {
7477 try {
7578 const idsToFetch = jobId ? [ jobId ] : jobIds ;
7679 let allApplicants = [ ] ;
77-
80+
7881 for ( const id of idsToFetch ) {
7982 const response = await fetch (
8083 `https://chapi.techstartucalgary.com/applications/${ id } ` ,
@@ -85,10 +88,9 @@ const RecruiterApplicantsPage = () => {
8588 "Content-Type" : "application/json" ,
8689 Authorization : `Bearer ${ localStorage . getItem ( "access_token" ) } ` ,
8790 } ,
88- }
91+ } ,
8992 ) ;
9093
91-
9294 if ( response . status === 404 ) {
9395 setApplicants ( [ ] ) ;
9496 } else {
@@ -102,17 +104,17 @@ const RecruiterApplicantsPage = () => {
102104 }
103105 }
104106 }
105-
107+
106108 setApplicants ( allApplicants ) ;
107109 } catch ( error ) {
108110 console . error ( error ) ;
109111 }
110112 } ;
111-
113+
112114 const downloadResume = ( resume , filename ) => {
113115 const element = document . createElement ( "a" ) ;
114116 element . href = URL . createObjectURL (
115- new Blob ( [ resume ] , { type : "application/pdf" } )
117+ new Blob ( [ resume ] , { type : "application/pdf" } ) ,
116118 ) ;
117119 element . download = filename ;
118120 document . body . appendChild ( element ) ;
@@ -127,7 +129,7 @@ const RecruiterApplicantsPage = () => {
127129 const filteredApplicants = applicants . filter ( ( applicant ) =>
128130 `${ applicant . applicant . first_name } ${ applicant . applicant . last_name } `
129131 . toLowerCase ( )
130- . includes ( filterName . toLowerCase ( ) )
132+ . includes ( filterName . toLowerCase ( ) ) ,
131133 ) ;
132134
133135 const handleDialogOpen = ( row ) => {
@@ -154,11 +156,11 @@ const RecruiterApplicantsPage = () => {
154156 new_status : dialogData . application_status . status ,
155157 rejection_feedback : dialogData . application_status . feedback ,
156158 } ) ,
157- }
159+ } ,
158160 ) ;
159-
161+
160162 if ( response . ok ) {
161- fetchApplicants ( ) ;
163+ fetchApplicants ( ) ;
162164 handleDialogClose ( ) ;
163165 } else {
164166 console . error ( "Failed to update the status" ) ;
@@ -167,23 +169,20 @@ const RecruiterApplicantsPage = () => {
167169 console . error ( error ) ;
168170 }
169171 } ;
170-
171172
172173 return (
173174 < Container maxWidth = "lg" >
174-
175- < Box
176- sx = { {
177- pb : 5 ,
178- minHeight : "100px" ,
179- borderRadius : "10px" , // Testing - For now added inline styling
180- boxShadow : 1 ,
181- bgcolor : "background.page" ,
182- marginTop : "30px" ,
183-
184- } }
185- >
186- < UserListToolbar
175+ < Box
176+ sx = { {
177+ pb : 5 ,
178+ minHeight : "100px" ,
179+ borderRadius : "10px" , // Testing - For now added inline styling
180+ boxShadow : 1 ,
181+ bgcolor : "background.page" ,
182+ marginTop : "30px" ,
183+ } }
184+ >
185+ < UserListToolbar
187186 filterName = { filterName }
188187 onFilterName = { handleFilterByName }
189188 />
@@ -195,7 +194,6 @@ const RecruiterApplicantsPage = () => {
195194 order = "asc"
196195 orderBy = "name"
197196 headLabel = { [
198-
199197 { id : "name" , label : "Name" , alignRight : false } ,
200198 { id : "role" , label : "Role" , alignRight : false } ,
201199 { id : "status" , label : "Status" , alignRight : false } ,
@@ -207,8 +205,8 @@ const RecruiterApplicantsPage = () => {
207205 />
208206 < TableBody >
209207 { filteredApplicants . map ( ( row ) => (
210- < TableRow key = { row . user_profile_id } tabIndex = { - 1 } >
211- < TableCell component = "th" scope = "row" padding = "none" >
208+ < TableRow key = { row . user_profile_id } tabIndex = { - 1 } >
209+ < TableCell component = "th" scope = "row" padding = "none" >
212210 < img
213211 src = {
214212 row . applicant . profile_picture
@@ -226,23 +224,23 @@ const RecruiterApplicantsPage = () => {
226224 />
227225 </ TableCell >
228226
229- < TableCell component = "th" scope = "row" padding = "none" >
230- < Typography
231- variant = "body1"
232- sx = { {
233- margin : 0 ,
234- fontWeight : 600 ,
235- lineHeight : 1.57142 ,
236- fontSize : "0.875rem" ,
237- fontFamily : "Public Sans, sans-serif" ,
238- overflow : "hidden" ,
239- textOverflow : "ellipsis" ,
240- whiteSpace : "nowrap" ,
241- } }
242- >
243- { `${ row . applicant . first_name } ${ row . applicant . last_name } ` }
244- </ Typography >
245- </ TableCell >
227+ < TableCell component = "th" scope = "row" padding = "none" >
228+ < Typography
229+ variant = "body1"
230+ sx = { {
231+ margin : 0 ,
232+ fontWeight : 600 ,
233+ lineHeight : 1.57142 ,
234+ fontSize : "0.875rem" ,
235+ fontFamily : "Public Sans, sans-serif" ,
236+ overflow : "hidden" ,
237+ textOverflow : "ellipsis" ,
238+ whiteSpace : "nowrap" ,
239+ } }
240+ >
241+ { `${ row . applicant . first_name } ${ row . applicant . last_name } ` }
242+ </ Typography >
243+ </ TableCell >
246244
247245 < TableCell > { row . job . title } </ TableCell >
248246 < TableCell >
@@ -263,7 +261,7 @@ const RecruiterApplicantsPage = () => {
263261 e . preventDefault ( ) ;
264262 downloadResume (
265263 row . applicant . resume ,
266- `${ row . applicant . first_name } _${ row . applicant . last_name } _Resume.pdf`
264+ `${ row . applicant . first_name } _${ row . applicant . last_name } _Resume.pdf` ,
267265 ) ;
268266 } }
269267 >
@@ -272,12 +270,16 @@ const RecruiterApplicantsPage = () => {
272270 </ TableCell >
273271 < TableCell >
274272 < Button
275- variant = "outlined"
276- onClick = { ( ) => handleDialogOpen ( row ) }
277- sx = { { whiteSpace : 'nowrap' , overflow : 'hidden' , textOverflow : 'ellipsis' } }
278- >
279- Update Status
280- </ Button >
273+ variant = "outlined"
274+ onClick = { ( ) => handleDialogOpen ( row ) }
275+ sx = { {
276+ whiteSpace : "nowrap" ,
277+ overflow : "hidden" ,
278+ textOverflow : "ellipsis" ,
279+ } }
280+ >
281+ Update Status
282+ </ Button >
281283 </ TableCell >
282284 </ TableRow >
283285 ) ) }
0 commit comments