Skip to content

Commit

Permalink
#35 #39 #32 Added functionality for selecting, browsing candidates an…
Browse files Browse the repository at this point in the history
…d tracking job offers
  • Loading branch information
navkamboj committed Jul 30, 2023
1 parent 2144582 commit 90b9f9b
Show file tree
Hide file tree
Showing 7 changed files with 260 additions and 72 deletions.
65 changes: 21 additions & 44 deletions web/src/components/EmployerDashboard/Applicants/Applicants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import PersonIcon from '@mui/icons-material/Person';
import AttachMoneyIcon from '@mui/icons-material/AttachMoney';
import LocationOnIcon from '@mui/icons-material/LocationOn';

import { getMyJobOffers, deleteJobOffer, getApplicats, getApplicantResume } from "../../../services/userService";
import { getMyJobOffers, deleteJobOffer, getApplicats, getApplicantResume, selectCandidateForInterview, deleteApplication, rejectApplication } from "../../../services/userService";
import { getUserName } from "../../../services/userInfoService";

import './Applicants.scss';
Expand Down Expand Up @@ -103,54 +103,29 @@ const Applicants = () => {
const company = getCompany();
const navigate = useNavigate();

const { id } = useParams();

const [applicants, setApplicants] = useState<Applicants[]>([]);

useEffect(() => {
const username :any = getUserName();
const mockedApplicants = [
{
id: 1,
fullName: 'Sam Smith',
username: 'samSmith08',
user_role: 'Student',
role_id: '654',
email: 'sam26@gmail.com',
address: '1998 Boul De Maisoneuve Montreal',
dob: '1997-03-09',
college_name: 'Concordia University'
},
{
id: 2,
fullName: 'Sam Smith',
username: 'samSmith08',
user_role: 'Student',
role_id: '654',
email: 'sam26@gmail.com',
address: '1998 Boul De Maisoneuve Montreal',
dob: '1997-03-09',
college_name: 'Concordia University'
},
{
id: 3,
fullName: 'Sam Smith',
username: 'samSmith08',
user_role: 'Student',
role_id: '654',
email: 'sam26@gmail.com',
address: '1998 Boul De Maisoneuve Montreal',
dob: '1997-03-09',
college_name: 'Concordia University'
}
];
getApplicats(username, undefined)
getApplicats(username, id?.charAt(1))
.then((res) => {
res.data.length ? setApplicants(res.data) : setApplicants(mockedApplicants);
setApplicants(res.data);
})
.catch(err => console.error(err));
}, []);

const handleReject = (id: string | number) => {
console.log("Hello");
const handleReject = (username: any) => {
rejectApplication(username, id?.charAt(1))
.then(res => console.log(res))
.catch(err => console.error(err));
}

const handleDelete = (username: any) => {
deleteApplication(username, id?.charAt(1))
.then((res) => console.log(res))
.catch(err => console.error(err))
}

const handleViewResume = async (username : string | undefined) => {
Expand All @@ -160,15 +135,16 @@ const Applicants = () => {
const pdfBlob = new Blob([res.data], { type: 'application/pdf' });
const pdfUrl = URL.createObjectURL(pdfBlob);

// Open the PDF in a new tab
window.open(pdfUrl, '_blank');
})
.catch(err => console.error(err));
}
}

const handleAcceptApplicant = (id : string) => {
console.log("Hello");
const handleAcceptApplicant = (username : any) => {
selectCandidateForInterview(username, id?.charAt(1))
.then((res) => console.log(res))
.catch(err => console.error(err))
}

return (
Expand Down Expand Up @@ -241,7 +217,8 @@ const Applicants = () => {
<Stack direction="row" spacing={1}>
<Chip label="View Resume" color="primary" onClick={() => handleViewResume(offer.username)}/>
<Chip label="Reject" color="warning" onClick={() => handleReject(offer.id)}/>
<Chip label="Accept Application" color="success" onClick={() => handleAcceptApplicant(offer.id)}/>
<Chip label="Accept Application" color="success" onClick={() => handleAcceptApplicant(offer.username)}/>
<Chip label="Accept Application" color="error" onClick={() => handleDelete(offer.username)}/>
</Stack>
</Card>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,29 +105,6 @@ const EmployerJobOffers = () => {

const [myJobOffers, setJobOffers] = useState<JobOffer[]>([]);

const jobRecommendations = [
{
id: 1,
title: "Frontend Developer",
company: "Tech Co.",
location: "Montreal",
description: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
salar_range: "70,000 - 80,000",
responsibilities: "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
contract_type: "Fulltime"
},
{
id: 2,
title: "SQL Developer",
company: "Tech Co.",
location: "Toronto",
description: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
salar_range: "70,000 - 80,000",
responsibilities: "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
contract_type: "Fulltime"
},
];

useEffect(() => {
const username = getUserName();
getMyJobOffers(username)
Expand All @@ -145,6 +122,10 @@ const EmployerJobOffers = () => {
navigate(`/employer/Applicants/:${id}`)
}

const handleNavigateToJobDetails = (id: any) => {
navigate(`/employer/jobOffers/:${id}`);
}

const handleEdit = (id : string | number) => {
navigate(`/employer/addJobOffer/${id}`);
}
Expand Down Expand Up @@ -219,7 +200,9 @@ const EmployerJobOffers = () => {
<Stack direction="row" spacing={1}>
<Chip label="Edit" color="primary" onClick={() => handleEdit(offer.id)}/>
<Chip label="View applicants for this Job" color="info" onClick={() => handleNavigateToApplicants(offer.id)}/>
<Chip label="View application" color="info" onClick={() => handleNavigateToJobDetails(offer.id)}/>
<Chip label="Delete" color="error" onClick={() => handleDelete(offer.id)}/>

</Stack>
</Card>
))}
Expand Down
Empty file.
175 changes: 175 additions & 0 deletions web/src/components/EmployerDashboard/ViewJobOffer/ViewJobOffer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import { injectIntl } from "react-intl";
import {
Card,
CardContent,
Typography,
Button,
Grid,
FormControl,
InputLabel,
MenuItem,
Select,
Box,
NativeSelect,
Chip,
} from "@mui/material";
import { getCompany, getFullName, getAddress, getEmail, getDOB} from "../../../services/userInfoService";
import { Link, useNavigate, useParams } from "react-router-dom";
import {
Bookmark
} from "@mui/icons-material";
import CreateIcon from '@mui/icons-material/Create';
import PersonIcon from '@mui/icons-material/Person';
import { useEffect, useState } from "react";
import { getJobOfferById, updateJobOfferHelper } from "../../../services/userService";

interface JobOffer {
id?: any;
company?: string;
title?: string;
contractType?: string;
salaryRange?: string;
description?: string;
location?: string;
responsibilities?: string;
qualifications?:string;
status: any;
};


const EmployerHome = () => {
const company = getCompany();
const [jobOffer, setJobOffer] = useState<JobOffer>();
const [curStatus, setCurStatus] = useState<any>();
const navigate = useNavigate();
const {jobId} = useParams();

useEffect(() => {
getJobOfferById(jobId?.charAt(1))
.then((res) => {setJobOffer(res.data); console.log(res)})
.catch((err) => console.log(err));
}, []);


const handleChangeStatus = (event: any) => {
setCurStatus(event.target?.value)
}

const handleUpdateStatus = () => {
const tempJobOffer = {...jobOffer};
tempJobOffer.status = curStatus;
setJobOffer(tempJobOffer as JobOffer);
updateJobOfferHelper(jobOffer)
.then(res => alert('Status has been updated'))
.catch(err => console.log(err));
}

return (
<>
<Grid container spacing={1}>
<Grid item xs={12} sm={6} md={5} lg={3}>
<Card
sx={{
textAlign: "left",
margin: "25px",
padding: "15px",
borderRadius: "10px",
border: "1px solid #c4c4c4",
height: "70vh",
}}
>
<div>
<Button
component={Link}
to={"/employer/jobOffers"}
color="primary"
sx={{ fontSize: "1.1rem" }}
>
<Bookmark sx={{ marginRight: "10px" }} /> My Jobs Offers
</Button>
</div>
<div>
<Button
component={Link}
to={"/employer/addJobOffer"}
color="primary"
sx={{ fontSize: "1.1rem" }}
>
<CreateIcon sx={{ marginRight: "10px" }} /> Add New Job
</Button>
</div>
<div>
<Button
component={Link}
to={"/employer/Applicants"}
color="primary"
sx={{ fontSize: "1.1rem" }}
>
<PersonIcon sx={{ marginRight: "10px" }} /> Applicants
</Button>
</div>
</Card>
</Grid>
<Grid item xs={12} sm={6} md={7} lg={9}>
<Card
sx={{
textAlign: "left",
margin: "25px 25px 25px 0",
padding: "15px",
borderRadius: "10px",
border: "1px solid #c4c4c4",
height: "70vh",
}}
>
<CardContent>
<Typography
variant="h4"
sx={{ textTransform: "capitalize", fontWeight: "bold" }}
>
{jobOffer?.title}
</Typography>
<Typography variant="h6">
{jobOffer?.company}
</Typography>
<Typography sx={{ color: "#868686" }}>
{jobOffer?.salaryRange}
</Typography>
<Typography sx={{ color: "#868686" }}>
{jobOffer?.location}
</Typography>
<Typography sx={{ color: "#868686" }}>
{jobOffer?.qualifications}
</Typography>
<Typography sx={{ color: "#868686" }}>
{jobOffer?.description}
</Typography>
<Typography sx={{ color: "#868686" }}>
Job Offer Status : {jobOffer?.status}
</Typography>
<Box sx={{ maxWidth: 300 }}>
<FormControl fullWidth>
<InputLabel id="demo-simple-select-label">Change Status</InputLabel>
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
value={jobOffer?.status}
defaultValue={jobOffer?.status}
label="Change Status"
onChange={handleChangeStatus}
>
<MenuItem value={'Deactivate'}>Deactivate</MenuItem>
<MenuItem value={'Interviewing'}>Interviewing</MenuItem>
<MenuItem value={'Active'}>Active</MenuItem>
</Select>
</FormControl>
<Chip label="Update Status" color="success" onClick={() => handleUpdateStatus()}/>
</Box>
</CardContent>
</Card>
</Grid>
</Grid>
</>
);
};

export default injectIntl(EmployerHome);
Loading

0 comments on commit 90b9f9b

Please sign in to comment.