Skip to content

Commit 18b5533

Browse files
committed
Final tweaks #5429
1 parent 5f29c1e commit 18b5533

File tree

9 files changed

+95
-38
lines changed

9 files changed

+95
-38
lines changed

src/server/services/recruitCRM.js

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ export default class RecruitCRMService {
187187
const { body, file } = req;
188188
const form = JSON.parse(body.form);
189189
const fileData = new FormData();
190-
fileData.append('resume', file.buffer, file.originalname);
190+
if (file) {
191+
fileData.append('resume', file.buffer, file.originalname);
192+
}
191193
let candidateSlug;
192194
let referralCookie = req.cookies[config.GROWSURF_COOKIE];
193195
if (referralCookie) referralCookie = JSON.parse(referralCookie);
@@ -272,29 +274,31 @@ export default class RecruitCRMService {
272274
});
273275
}
274276
candidateData = await workCandidateResponse.json();
275-
// Attach resume to candidate
276-
const formHeaders = fileData.getHeaders();
277-
const fileCandidateResponse = await fetch(`${this.private.baseUrl}/v1/candidates/${candidateData.slug}`, {
278-
method: 'POST',
279-
headers: {
280-
Authorization: this.private.authorization,
281-
...formHeaders,
282-
},
283-
body: fileData,
284-
});
285-
if (fileCandidateResponse.status >= 300) {
286-
return res.send({
287-
error: true,
288-
status: fileCandidateResponse.status,
289-
url: `${this.private.baseUrl}/v1/candidates/${candidateData.slug}`,
290-
form,
291-
fileData,
292-
file,
293-
formHeaders,
294-
errObj: await fileCandidateResponse.json(),
277+
// Attach resume to candidate if uploaded
278+
if (file) {
279+
const formHeaders = fileData.getHeaders();
280+
const fileCandidateResponse = await fetch(`${this.private.baseUrl}/v1/candidates/${candidateData.slug}`, {
281+
method: 'POST',
282+
headers: {
283+
Authorization: this.private.authorization,
284+
...formHeaders,
285+
},
286+
body: fileData,
295287
});
288+
if (fileCandidateResponse.status >= 300) {
289+
return res.send({
290+
error: true,
291+
status: fileCandidateResponse.status,
292+
url: `${this.private.baseUrl}/v1/candidates/${candidateData.slug}`,
293+
form,
294+
fileData,
295+
file,
296+
formHeaders,
297+
errObj: await fileCandidateResponse.json(),
298+
});
299+
}
300+
candidateData = await fileCandidateResponse.json();
296301
}
297-
candidateData = await fileCandidateResponse.json();
298302
// Candidate ready to apply for job
299303
const applyResponse = await fetch(`${this.private.baseUrl}/v1/candidates/${candidateData.slug}/assign?job_slug=${id}`, {
300304
method: 'POST',

src/shared/actions/recruitCRM.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@ function normalizeRecruitPayload(job, payload) {
8585
value: perJob.join(','),
8686
},
8787
],
88-
resume: payload.fileCV,
8988
};
9089
if (referral) {
9190
normalized.custom_fields.push({
9291
field_id: 13,
9392
value: referral.label,
9493
});
9594
}
95+
if (payload.fileCV) {
96+
normalized.resume = payload.fileCV;
97+
}
9698

9799
return normalized;
98100
}

src/shared/components/GUIKit/Assets/Styles/Includes/_mixin.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ $gui-kit-gray-90: #2a2a2a;
44
$gui-kit-level-2: #0ab88a;
55
$gui-kit-level-5: #ef476f;
66
$gui-kit-active-label: #229174;
7+
$gui-kit-readonly: #d4d4d4;
78

89
@mixin textInputLabel {
910
font-size: 12px;

src/shared/components/GUIKit/DropdownTerms/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ function DropdownTerms({
4141
selectInput[0].style.borderTop = 'none';
4242
}
4343
}, [focused, selectedOption]);
44+
useEffect(() => {
45+
setInternalTerms(terms);
46+
}, [terms]);
4447

4548
const CustomReactSelectRow = React.forwardRef(({
4649
className,

src/shared/components/GUIKit/TextInput/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function TextInput({
2828
const sizeStyle = size === 'lg' ? 'lgSize' : 'xsSize';
2929

3030
return (
31-
<div className="textInputContainer" styleName={`container ${sizeStyle}`}>
31+
<div className="textInputContainer" styleName={`container ${sizeStyle}${readonly ? ' readonly' : ''}`}>
3232
<input
3333
readOnly={readonly}
3434
defaultValue={value}

src/shared/components/GUIKit/TextInput/style.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@
4040
}
4141
}
4242

43+
// readonly
44+
&.readonly {
45+
input:not([type='checkbox']) {
46+
border: 1px solid $gui-kit-readonly;
47+
color: $gui-kit-gray-30;
48+
}
49+
}
50+
4351
input:not([type='checkbox']).haveValue + label,
4452
input:not([type='checkbox']).haveError + label,
4553
input:not([type='checkbox']):focus + label {

src/shared/components/Gigs/GigApply/index.jsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ export default function GigApply(props) {
2727
} = props;
2828
const retUrl = window.location.href;
2929

30-
console.log('GigApply', recruitProfile, formErrors);
31-
3230
return user ? (
3331
<div styleName="container">
3432
{
@@ -76,7 +74,7 @@ export default function GigApply(props) {
7674
<Link to={`${config.GIGS_PAGES_PATH}`}>VIEW OTHER GIGS</Link>
7775
</React.Fragment>
7876
) : (
79-
<Link to={`${config.GIGS_PAGES_PATH}`} styleName="primaryBtn">GO TO GIG LIST</Link>
77+
<Link to={`${config.GIGS_PAGES_PATH}`} styleName="primaryBtn">GO TO GIGS LIST</Link>
8078
)
8179
}
8280
</div>
@@ -113,6 +111,7 @@ export default function GigApply(props) {
113111
errorMsg={formErrors.fname}
114112
value={formData.fname}
115113
required
114+
readonly
116115
/>
117116
<TextInput
118117
placeholder="Last Name"
@@ -121,6 +120,7 @@ export default function GigApply(props) {
121120
errorMsg={formErrors.lname}
122121
value={formData.lname}
123122
required
123+
readonly
124124
/>
125125
</div>
126126
<div styleName="form-row">
@@ -184,8 +184,7 @@ export default function GigApply(props) {
184184
</div>
185185
</div>
186186
)}
187-
<h4>SHARE YOUR EXPECTATIONS</h4>
188-
{_.isEmpty(recruitProfile) && <p>Your Professional Work History</p>}
187+
<h4>SHARE YOUR WEEKLY PAY EXPECTATIONS</h4>
189188
<div styleName="form-section">
190189
<div styleName="form-row">
191190
<TextInput
@@ -199,7 +198,13 @@ export default function GigApply(props) {
199198
</div>
200199
</div>
201200
<h4>RESUME & SKILLS</h4>
202-
<p>Upload Your Resume or CV</p>
201+
{
202+
recruitProfile.resume ? (
203+
<p>Upload Your Resume or CV, <a href={recruitProfile.resume.file_link} target="_blank" rel="noreferrer">{recruitProfile.resume.filename}</a></p>
204+
) : (
205+
<p>Upload Your Resume or CV</p>
206+
)
207+
}
203208
<div styleName="form-section">
204209
<FilestackFilePicker
205210
file={formData.fileCV}
@@ -222,7 +227,6 @@ export default function GigApply(props) {
222227
/>
223228
</div>
224229
<h4>FINAL QUESTIONS</h4>
225-
<p>Please Complete the Following Questions</p>
226230
<div styleName="form-section">
227231
{_.isEmpty(recruitProfile) && (
228232
<Dropdown

src/shared/components/Gigs/LoginModal/modal.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
color: #ef476f;
3030
font-size: 24px;
3131
line-height: 36px;
32-
margin-bottom: 40px;
32+
margin-bottom: 20px;
3333
}
3434

3535
.ctaButtons {

src/shared/containers/Gigs/RecruitCRMJobApply.jsx

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ class RecruitCRMJobApplyContainer extends React.Component {
2929
country: _.map(countries.getNames('en'), val => ({ label: val, selected: false })),
3030
reffereal: [
3131
{ label: 'Google', selected: false },
32+
{ label: 'LinkedIn', selected: false },
33+
{ label: 'Other Ad or Promotion', selected: false },
34+
{ label: 'Quora', selected: false },
35+
{ label: 'Uprisor Podcast', selected: false },
36+
{ label: 'YouTube or Video Ad', selected: false },
3237
],
3338
// eslint-disable-next-line react/destructuring-assignment
3439
},
@@ -51,6 +56,36 @@ class RecruitCRMJobApplyContainer extends React.Component {
5156
}
5257
}
5358

59+
componentDidUpdate(prevProps) {
60+
const { recruitProfile } = this.props;
61+
if (recruitProfile !== prevProps.recruitProfile && !_.isEmpty(recruitProfile)) {
62+
// when recruit profile loaded
63+
const { formData } = this.state;
64+
const { country, skills } = formData;
65+
const recruitSkills = recruitProfile.skill.split(',').map(s => s.toLowerCase());
66+
const updatedForm = {
67+
formData: {
68+
...formData,
69+
phone: recruitProfile.contact_number,
70+
country: _.map(
71+
country,
72+
c => ({
73+
label: c.label,
74+
selected: c.label.toLowerCase() === recruitProfile.locality.toLowerCase(),
75+
}),
76+
),
77+
skills: skills.map(s => ({
78+
label: s.label,
79+
selected: recruitSkills.includes(s.label.toLowerCase()),
80+
})),
81+
payExpectation: recruitProfile.salary_expectation,
82+
},
83+
};
84+
// eslint-disable-next-line react/no-did-update-set-state
85+
this.setState(updatedForm);
86+
}
87+
}
88+
5489
onFormInputChange(key, value) {
5590
// update the state
5691
this.setState(state => ({
@@ -111,7 +146,7 @@ class RecruitCRMJobApplyContainer extends React.Component {
111146
}
112147
// check for selected reffereal
113148
if (!prop || prop === 'reffereal') {
114-
if (!recruitProfile) {
149+
if (_.isEmpty(recruitProfile)) {
115150
if (!_.find(formData.reffereal, { selected: true })) formErrors.reffereal = 'Please, select your reffereal';
116151
else delete formErrors.reffereal;
117152
}
@@ -144,8 +179,8 @@ class RecruitCRMJobApplyContainer extends React.Component {
144179
}
145180
// has CV file ready for upload
146181
if (!prop || prop === 'fileCV') {
147-
if (!formData.fileCV) formErrors.fileCV = 'Please, pick your CV file for uploading';
148-
else {
182+
if (!formData.fileCV && _.isEmpty(recruitProfile)) formErrors.fileCV = 'Please, pick your CV file for uploading';
183+
else if (formData.fileCV) {
149184
const sizeInMB = (formData.fileCV.size / (1024 * 1024)).toFixed(2);
150185
if (sizeInMB > 8) {
151186
formErrors.fileCV = 'Max file size is limited to 8 MB';
@@ -185,8 +220,8 @@ class RecruitCRMJobApplyContainer extends React.Component {
185220

186221
render() {
187222
const { formErrors, formData } = this.state;
188-
const { recruitProfile } = this.props;
189-
return !recruitProfile ? <LoadingIndicator /> : (
223+
const { recruitProfile, user } = this.props;
224+
return !recruitProfile && user ? <LoadingIndicator /> : (
190225
<GigApply
191226
{...this.props}
192227
onFormInputChange={this.onFormInputChange}
@@ -234,7 +269,7 @@ function mapStateToProps(state, ownProps) {
234269
? state.recruitCRM[job.slug].applying : false,
235270
application: state.recruitCRM && state.recruitCRM[job.slug]
236271
? state.recruitCRM[job.slug].application : null,
237-
recruitProfile: state.recruitCRM && state.recruitCRM[profile.email]
272+
recruitProfile: state.recruitCRM && profile && state.recruitCRM[profile.email]
238273
? state.recruitCRM[profile.email].profile : null,
239274
};
240275
}

0 commit comments

Comments
 (0)