Skip to content

Commit

Permalink
Merge pull request #116 from nishantarora23/feature-39/select-candidate
Browse files Browse the repository at this point in the history
#39 Added logout functionality for Employer
  • Loading branch information
navkamboj committed Aug 1, 2023
2 parents 3097ef1 + 5372e38 commit e3a5cd4
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 10 deletions.
51 changes: 51 additions & 0 deletions web/src/components/EmployerDashboard/Applicants/Applicants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ import {
Box,
Stack,
Chip,
IconButton,
Avatar,
} from "@mui/material";
import { getCompany, getFullName, getAddress, getEmail, getDOB} from "../../../services/userInfoService";
import { Link, useNavigate, useParams } from "react-router-dom";
import {
Person4,
LogoutOutlined,
Bookmark
} from "@mui/icons-material";
import CreateIcon from '@mui/icons-material/Create';
import PersonIcon from '@mui/icons-material/Person';
import AttachMoneyIcon from '@mui/icons-material/AttachMoney';
import LocationOnIcon from '@mui/icons-material/LocationOn';
import { indigo } from "@mui/material/colors";

import { getMyJobOffers, deleteJobOffer, getApplicats, getApplicantResume, selectCandidateForInterview, deleteApplication, rejectApplication } from "../../../services/userService";
import { getUserName } from "../../../services/userInfoService";
Expand Down Expand Up @@ -106,6 +111,10 @@ const Applicants = () => {
const { id } = useParams();

const [applicants, setApplicants] = useState<Applicants[]>([]);
const doLogout = () => {
localStorage.clear();
navigate("/login");
};

useEffect(() => {
const username :any = getUserName();
Expand Down Expand Up @@ -149,6 +158,48 @@ const Applicants = () => {

return (
<>
<Grid
container
className="userProfile-container end-container"
sx={{
justifyContent: "flex-end",
marginTop: "-60px",
zIndex: 9999,
}}
>
<Avatar
sx={{
bgcolor: indigo[100],
width: "40px",
height: "40px",
marginTop: "-5px",
marginRight: "10px",
}}
>
<Person4 color="primary" />
</Avatar>
<Typography variant="h6" sx={{ color: indigo[100] }}>
{getFullName()}
</Typography>
<IconButton
color="secondary"
component={Link}
to={"/"}
onClick={doLogout}
sx={{
marginRight: "50px",
color: indigo[100],
marginTop: "-10px",
marginLeft: "10px",
}}
>
<LogoutOutlined
sx={{
fontSize: "2rem",
}}
/>
</IconButton>
</Grid>
<Grid container spacing={1}>
<Grid item xs={12} sm={6} md={5} lg={3}>
<Card
Expand Down
54 changes: 54 additions & 0 deletions web/src/components/EmployerDashboard/EmployerHome/EmployerHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,74 @@ import {
Typography,
Button,
Grid,
IconButton,
Avatar,
} from "@mui/material";
import { getCompany, getFullName, getAddress, getEmail, getDOB} from "../../../services/userInfoService";
import { Link, useNavigate } from "react-router-dom";
import {
Bookmark
} from "@mui/icons-material";
import {Person4,
LogoutOutlined,
} from "@mui/icons-material";
import CreateIcon from '@mui/icons-material/Create';
import PersonIcon from '@mui/icons-material/Person';
import { indigo } from "@mui/material/colors";

const EmployerHome = () => {
const company = getCompany();
const navigate = useNavigate();

const doLogout = () => {
localStorage.clear();
navigate("/login");
};

return (
<>
<Grid
container
className="userProfile-container end-container"
sx={{
justifyContent: "flex-end",
marginTop: "-60px",
zIndex: 9999,
}}
>
<Avatar
sx={{
bgcolor: indigo[100],
width: "40px",
height: "40px",
marginTop: "-5px",
marginRight: "10px",
}}
>
<Person4 color="primary" />
</Avatar>
<Typography variant="h6" sx={{ color: indigo[100] }}>
{getFullName()}
</Typography>
<IconButton
color="secondary"
component={Link}
to={"/"}
onClick={doLogout}
sx={{
marginRight: "50px",
color: indigo[100],
marginTop: "-10px",
marginLeft: "10px",
}}
>
<LogoutOutlined
sx={{
fontSize: "2rem",
}}
/>
</IconButton>
</Grid>
<Grid container spacing={1}>
<Grid item xs={12} sm={6} md={5} lg={3}>
<Card
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ import {
Box,
Stack,
Chip,
IconButton,
Avatar
} from "@mui/material";
import { getCompany, getUserName, getFullName, getAddress, getEmail, getDOB} from "../../../services/userInfoService";
import { Link, useNavigate, useParams } from "react-router-dom";
import {
Bookmark
Bookmark,
Person4,
LogoutOutlined,
} from "@mui/icons-material";
import CreateIcon from '@mui/icons-material/Create';
import PersonIcon from '@mui/icons-material/Person';
Expand All @@ -23,6 +27,7 @@ import { getMyJobOffers, deleteJobOffer } from "../../../services/userService";

import './EmployerJobOffers.scss';
import { useEffect, useState } from "react";
import { indigo } from "@mui/material/colors";
import axios from "axios";

const styles = {
Expand Down Expand Up @@ -88,8 +93,8 @@ interface JobOffer {
id?: any;
company?: string;
title?: string;
contract_type?: string;
salar_range?: string;
contractType?: string;
salaryRange?: string;
description?: string;
location?: string;
};
Expand Down Expand Up @@ -130,8 +135,55 @@ const EmployerJobOffers = () => {
navigate(`/employer/addJobOffer/${id}`);
}

const doLogout = () => {
localStorage.clear();
navigate("/login");
};

return (
<>
<Grid
container
className="userProfile-container end-container"
sx={{
justifyContent: "flex-end",
marginTop: "-60px",
zIndex: 9999,
}}
>
<Avatar
sx={{
bgcolor: indigo[100],
width: "40px",
height: "40px",
marginTop: "-5px",
marginRight: "10px",
}}
>
<Person4 color="primary" />
</Avatar>
<Typography variant="h6" sx={{ color: indigo[100] }}>
{getFullName()}
</Typography>
<IconButton
color="secondary"
component={Link}
to={"/"}
onClick={doLogout}
sx={{
marginRight: "50px",
color: indigo[100],
marginTop: "-10px",
marginLeft: "10px",
}}
>
<LogoutOutlined
sx={{
fontSize: "2rem",
}}
/>
</IconButton>
</Grid>
<Grid container spacing={1}>
<Grid item xs={12} sm={6} md={5} lg={3}>
<Card
Expand Down Expand Up @@ -194,8 +246,8 @@ const EmployerJobOffers = () => {
<Typography variant="subtitle1">{offer.company}</Typography>
<Typography variant="body2">{offer.title}</Typography>
<Typography className="location" variant="body2"> <LocationOnIcon/> {offer.location}</Typography>
<Typography variant="subtitle1"> <AttachMoneyIcon />{offer.salar_range}</Typography>
<Typography variant="body2">{offer.contract_type}</Typography>
<Typography variant="subtitle1"> <AttachMoneyIcon />{offer.salaryRange}</Typography>
<Typography variant="body2">{offer.contractType}</Typography>
<Typography variant="body2">{offer.description}</Typography>
<Stack direction="row" spacing={1}>
<Chip label="Edit" color="primary" onClick={() => handleEdit(offer.id)}/>
Expand Down
72 changes: 67 additions & 5 deletions web/src/components/EmployerDashboard/ViewJobOffer/ViewJobOffer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ import {
MenuItem,
Select,
Box,
IconButton,
Avatar,
NativeSelect,
Chip,
} from "@mui/material";
import { getCompany, getFullName, getAddress, getEmail, getDOB} from "../../../services/userInfoService";
import { Link, useNavigate, useParams } from "react-router-dom";
import {
Person4,
LogoutOutlined,
Bookmark
} from "@mui/icons-material";
import { indigo } from "@mui/material/colors";
import CreateIcon from '@mui/icons-material/Create';
import PersonIcon from '@mui/icons-material/Person';
import { useEffect, useState } from "react";
Expand All @@ -33,6 +38,7 @@ interface JobOffer {
location?: string;
responsibilities?: string;
qualifications?:string;
deadline?: string;
status: any;
};

Expand All @@ -44,6 +50,11 @@ const EmployerHome = () => {
const navigate = useNavigate();
const {jobId} = useParams();

const doLogout = () => {
localStorage.clear();
navigate("/login");
};

useEffect(() => {
getJobOfferById(jobId?.charAt(1))
.then((res) => {setJobOffer(res.data); console.log(res)})
Expand All @@ -56,16 +67,58 @@ const EmployerHome = () => {
}

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

return (
<>
<Grid
container
className="userProfile-container end-container"
sx={{
justifyContent: "flex-end",
marginTop: "-60px",
zIndex: 9999,
}}
>
<Avatar
sx={{
bgcolor: indigo[100],
width: "40px",
height: "40px",
marginTop: "-5px",
marginRight: "10px",
}}
>
<Person4 color="primary" />
</Avatar>
<Typography variant="h6" sx={{ color: indigo[100] }}>
{getFullName()}
</Typography>
<IconButton
color="secondary"
component={Link}
to={"/"}
onClick={doLogout}
sx={{
marginRight: "50px",
color: indigo[100],
marginTop: "-10px",
marginLeft: "10px",
}}
>
<LogoutOutlined
sx={{
fontSize: "2rem",
}}
/>
</IconButton>
</Grid>
<Grid container spacing={1}>
<Grid item xs={12} sm={6} md={5} lg={3}>
<Card
Expand Down Expand Up @@ -141,6 +194,15 @@ const EmployerHome = () => {
{jobOffer?.qualifications}
</Typography>
<Typography sx={{ color: "#868686" }}>
{jobOffer?.responsibilities}
</Typography>
<Typography sx={{ color: "#868686" }}>
{jobOffer?.contractType}
</Typography>
<Typography sx={{ color: "#868686" }}>
{jobOffer?.deadline}
</Typography>
<Typography sx={{ color: "#868686" }}>
{jobOffer?.description}
</Typography>
<Typography sx={{ color: "#868686" }}>
Expand Down

0 comments on commit e3a5cd4

Please sign in to comment.