1 | import "../job_advertisements/JobAdvertisements.css"
|
---|
2 | import {useDispatch, useSelector} from "react-redux";
|
---|
3 | import {useEffect, useState} from "react";
|
---|
4 | import {JobAdvertisementActions} from "../../redux/actions/jobAdvertisementActions";
|
---|
5 | import {formatRelativeTime, sortElementsBy} from "../../utils/utils";
|
---|
6 | import {Link} from "react-router-dom";
|
---|
7 | import JobType from "../../enumerations/JobType";
|
---|
8 | import {RecruiterActions} from "../../redux/actions/recruiterActions";
|
---|
9 |
|
---|
10 | import {useParams} from "react-router";
|
---|
11 |
|
---|
12 |
|
---|
13 | export const RecruiterProfile = () => {
|
---|
14 |
|
---|
15 | const dispatch = useDispatch();
|
---|
16 | const {id} = useParams();
|
---|
17 | const auth = useSelector(state => (state.auth.currentUser))
|
---|
18 |
|
---|
19 | const [jobAdvertisementsByRecruiter, setJobAdvertisementsByRecruiter] = useState([]);
|
---|
20 | const [recruiterDetails, setRecruiterDetails] = useState(null);
|
---|
21 |
|
---|
22 | let logosState = useSelector(state => state.images.logos)
|
---|
23 | const [logoDispatched, setLogoDispatched] = useState(false)
|
---|
24 | const [logoView, setLogoView] = useState(null);
|
---|
25 |
|
---|
26 | const [activeJobListingsCount, setActiveJobListingsCount] = useState(0);
|
---|
27 |
|
---|
28 |
|
---|
29 | useEffect(() => {
|
---|
30 |
|
---|
31 | JobAdvertisementActions.fetchRecruiterDetailsById(id, (success, response) => {
|
---|
32 | if (success) {
|
---|
33 | setRecruiterDetails(response.data)
|
---|
34 | }
|
---|
35 | })
|
---|
36 |
|
---|
37 | }, []);
|
---|
38 |
|
---|
39 | useEffect(() => {
|
---|
40 | if (id) {
|
---|
41 | if (!logoDispatched && !logosState[id]) {
|
---|
42 | dispatch(RecruiterActions.downloadLogo(id, (success, response) => {
|
---|
43 | if (success) {
|
---|
44 | setLogoView(response)
|
---|
45 | setLogoDispatched(true)
|
---|
46 | }
|
---|
47 | }))
|
---|
48 | } else {
|
---|
49 | setLogoView(logosState[id])
|
---|
50 | }
|
---|
51 | }
|
---|
52 |
|
---|
53 | }, [auth])
|
---|
54 |
|
---|
55 | useEffect(() => {
|
---|
56 |
|
---|
57 | dispatch(JobAdvertisementActions.fetchJobAdvertisementsByRecruiterProfile(id, (success, response) => {
|
---|
58 | if (success && response.data.length > 0) {
|
---|
59 | setJobAdvertisementsByRecruiter(sortElementsBy(response.data, "postedOn"))
|
---|
60 | setActiveJobListingsCount(countActiveJobListings(response.data));
|
---|
61 | }
|
---|
62 | }))
|
---|
63 | }, [])
|
---|
64 |
|
---|
65 |
|
---|
66 | function countActiveJobListings(jobAds) {
|
---|
67 | if (jobAds.length > 0) {
|
---|
68 | const activeJobListings = jobAds.filter(job => job.active)
|
---|
69 | return activeJobListings.length;
|
---|
70 | }
|
---|
71 | return 0;
|
---|
72 | }
|
---|
73 |
|
---|
74 |
|
---|
75 | return (<div className="my-workspace">
|
---|
76 | <div className="custom-container no-additional-margin">
|
---|
77 | <div className="photo-box">
|
---|
78 | <div>
|
---|
79 | <img
|
---|
80 | src="/images/default-company-banner.jpg"
|
---|
81 | className="company-banner"
|
---|
82 | alt="Company Banner"
|
---|
83 | />
|
---|
84 | <img
|
---|
85 | // loading gif
|
---|
86 | src={logoView}
|
---|
87 | className="company-logo"
|
---|
88 | alt=""
|
---|
89 | width={200} height={200}
|
---|
90 | />
|
---|
91 |
|
---|
92 | </div>
|
---|
93 |
|
---|
94 | <div className="info-tab">
|
---|
95 | <h3>{recruiterDetails && recruiterDetails.companyName}</h3>
|
---|
96 | <p>Active job listings: <span>{activeJobListingsCount}</span></p>
|
---|
97 | </div>
|
---|
98 | </div>
|
---|
99 |
|
---|
100 | {recruiterDetails &&
|
---|
101 | <>
|
---|
102 | <div className="details-wrap-profile">
|
---|
103 | <h4>About the company</h4>
|
---|
104 | <p>{recruiterDetails.companyDescription ?
|
---|
105 | recruiterDetails.companyDescription : "There is no info about this company yet."
|
---|
106 | }</p>
|
---|
107 | <p>
|
---|
108 | <span> <i
|
---|
109 | className="fa-solid fa-envelope"></i> {recruiterDetails.contactEmail}</span> • <span>
|
---|
110 | <i className="fa-solid fa-phone"></i> {recruiterDetails.contactPhoneNumber}</span>
|
---|
111 | {recruiterDetails.receptionist && <span> • <i
|
---|
112 | className="fa-solid fa-user"></i> {recruiterDetails.receptionist}</span>}
|
---|
113 | </p>
|
---|
114 | </div>
|
---|
115 | </>
|
---|
116 | }
|
---|
117 |
|
---|
118 | {/*<div className="line-separator"></div>*/}
|
---|
119 |
|
---|
120 | {/*<div className="head-dashboard-box">*/}
|
---|
121 | {/* <div className="row">*/}
|
---|
122 | {/* <div className="col-md-12 filter-container">*/}
|
---|
123 | {/* <div className="search-container">*/}
|
---|
124 | {/* <i className="fa-solid fa-magnifying-glass search-icon"></i>*/}
|
---|
125 | {/* <input*/}
|
---|
126 | {/* className="search-input"*/}
|
---|
127 | {/* type="text"*/}
|
---|
128 | {/* placeholder="Search job advertisement by title..."*/}
|
---|
129 | {/* value={searchTerm}*/}
|
---|
130 | {/* onChange={event => setSearchTerm(event.target.value)}*/}
|
---|
131 | {/* />*/}
|
---|
132 | {/* </div>*/}
|
---|
133 | {/* <div className="sort-section item">*/}
|
---|
134 | {/* <Select*/}
|
---|
135 | {/* defaultValue={{value: "all", label: "All industries"}}*/}
|
---|
136 | {/* value={selectedIndustry.value}*/}
|
---|
137 | {/* onChange={option => setSelectedIndustry(option.value)}*/}
|
---|
138 | {/* options={industryOptionsFilter}*/}
|
---|
139 | {/* className="sort-range sort"*/}
|
---|
140 | {/* />*/}
|
---|
141 | {/* </div>*/}
|
---|
142 | {/* <div className="sort-section item">*/}
|
---|
143 | {/* <Select*/}
|
---|
144 | {/* defaultValue={{value: "newest", label: "Date (Newest First)"}}*/}
|
---|
145 | {/* value={selectedSortOrder.value}*/}
|
---|
146 | {/* onChange={option => setSelectedSortOrder(option.value)}*/}
|
---|
147 | {/* options={sortOptions}*/}
|
---|
148 | {/* className="sort-range sort"*/}
|
---|
149 | {/* />*/}
|
---|
150 | {/* </div>*/}
|
---|
151 | {/* <button onClick={filterJobAdvertisements} className="btn-open-modal">Find jobs</button>*/}
|
---|
152 | {/* </div>*/}
|
---|
153 | {/* </div>*/}
|
---|
154 | {/*</div>*/}
|
---|
155 | <div className="row row-cols-1 row-cols-md-4 g-4">
|
---|
156 |
|
---|
157 | {jobAdvertisementsByRecruiter && jobAdvertisementsByRecruiter.map((jobAd, index) => (
|
---|
158 | <div key={index} className="col">
|
---|
159 | <div className="custom-card hub-card">
|
---|
160 | <div className="card-head">
|
---|
161 | <span className="hourly-salary"><b>${jobAd.startingSalary}/hr</b></span>
|
---|
162 | <span
|
---|
163 | className="job-type"> {jobAd.jobType === JobType.JOB ? "Job" : "Internship"}</span>
|
---|
164 | {!jobAd.active && <span className="expired">Expired</span>}
|
---|
165 | </div>
|
---|
166 | <div className="card-body">
|
---|
167 | <h5 className="card-title">{jobAd.title}</h5>
|
---|
168 | <span>{jobAd.industry} • <span style={{
|
---|
169 | color: "black", fontWeight: "bold"
|
---|
170 | }}>{formatRelativeTime(jobAd.postedOn)}</span></span>
|
---|
171 | <div className="card-info">
|
---|
172 | <span><i className="fa-solid fa-building"
|
---|
173 | style={{color: "#000000"}}></i> Company: <span style={{
|
---|
174 | color: "black", fontWeight: "bold"
|
---|
175 | }}>{jobAd.recruiterName}</span></span> <br/>
|
---|
176 | </div>
|
---|
177 |
|
---|
178 | </div>
|
---|
179 | <div className="card-foot">
|
---|
180 | <Link to={`/job-advertisements/${jobAd.id}`} className="card-button">Read
|
---|
181 | more</Link>
|
---|
182 | </div>
|
---|
183 | </div>
|
---|
184 | </div>))}
|
---|
185 |
|
---|
186 | </div>
|
---|
187 |
|
---|
188 |
|
---|
189 | </div>
|
---|
190 | </div>
|
---|
191 |
|
---|
192 | )
|
---|
193 | } |
---|