Skip to content

Commit 4c204cd

Browse files
committed
v1 for #5429
1 parent bd15106 commit 4c204cd

File tree

4 files changed

+53
-20
lines changed

4 files changed

+53
-20
lines changed

src/shared/actions/recruitCRM.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,11 @@ function normalizeRecruitPayload(job, payload) {
5858
const perJob = [
5959
`${job.name} ->`,
6060
`Pay Expectation: ${payload.payExpectation}`,
61-
`Date Available: ${new Date(payload.availFrom).toDateString()}`,
62-
`Heard About Gig: ${payload.reffereal}`,
6361
`Able to work during timezone? ${payload.timezoneConfirm.filter(s => s.value).map(() => getCustomField(job.custom_fields, 'Timezone')).join(',')}`,
64-
`Am I ok to work the duration? ${payload.durationConfirm.filter(s => s.value).map(s => s.label).join(',')}`,
62+
`Am I ok to work the duration? ${payload.durationConfirm.filter(s => s.value).map(() => getCustomField(job.custom_fields, 'Duration')).join(',')}`,
6563
];
66-
return {
64+
const referral = _.find(payload.reffereal, { selected: true });
65+
const normalized = {
6766
last_name: payload.lname,
6867
first_name: payload.fname,
6968
email: payload.email,
@@ -73,13 +72,9 @@ function normalizeRecruitPayload(job, payload) {
7372
salary_expectation: payload.payExpectation,
7473
skill: payload.skills.filter(s => s.selected).map(s => s.label).join(','),
7574
custom_fields: [
76-
{
77-
field_id: 13,
78-
value: payload.reffereal || '',
79-
},
8075
{
8176
field_id: 1,
82-
value: payload.tcProfileLink || (payload.handle ? `topcoder.com/members/${payload.handle}` : ''),
77+
value: payload.tcProfileLink || (payload.handle ? `https://topcoder.com/members/${payload.handle}` : ''),
8378
},
8479
{
8580
field_id: 2,
@@ -92,6 +87,14 @@ function normalizeRecruitPayload(job, payload) {
9287
],
9388
resume: payload.fileCV,
9489
};
90+
if (referral) {
91+
normalized.custom_fields.push({
92+
field_id: 13,
93+
value: referral.label,
94+
});
95+
}
96+
97+
return normalized;
9598
}
9699

97100
/**

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

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

30-
console.log('GigApply', recruitProfile)
30+
console.log('GigApply', recruitProfile, formErrors);
3131

3232
return user ? (
3333
<div styleName="container">
@@ -94,8 +94,16 @@ export default function GigApply(props) {
9494
{
9595
!application && !applying ? (
9696
<div styleName="form-wrap">
97+
{!_.isEmpty(recruitProfile)
98+
&& (
99+
<p styleName="info-text">It looks like you have applied to a gig previously.
100+
Perfect! We have most of your information.
101+
Is there anything you would like to update to your Gig Work Profile?
102+
</p>
103+
)}
97104
<h4>PERSONAL INFORMATION</h4>
98-
<p>Welcome to Topcoder Gigs! We’d like to get to know you.</p>
105+
{_.isEmpty(recruitProfile)
106+
&& <p>Welcome to Topcoder Gigs! We’d like to get to know you.</p>}
99107
<div styleName="form-section">
100108
<div styleName="form-row">
101109
<TextInput
@@ -153,7 +161,8 @@ export default function GigApply(props) {
153161
/>
154162
</div>
155163
</div>
156-
<h4>TOPCODER INFORMATION</h4>
164+
{_.isEmpty(recruitProfile) && <h4>TOPCODER INFORMATION</h4>}
165+
{_.isEmpty(recruitProfile) && (
157166
<div styleName="form-section">
158167
<div styleName="form-row">
159168
<TextInput
@@ -174,8 +183,9 @@ export default function GigApply(props) {
174183
/>
175184
</div>
176185
</div>
186+
)}
177187
<h4>SHARE YOUR EXPECTATIONS</h4>
178-
<p>Your Professional Work History</p>
188+
{_.isEmpty(recruitProfile) && <p>Your Professional Work History</p>}
179189
<div styleName="form-section">
180190
<div styleName="form-row">
181191
<TextInput
@@ -214,6 +224,7 @@ export default function GigApply(props) {
214224
<h4>FINAL QUESTIONS</h4>
215225
<p>Please Complete the Following Questions</p>
216226
<div styleName="form-section">
227+
{_.isEmpty(recruitProfile) && (
217228
<Dropdown
218229
placeholder="How did you find out about Topcoder Gig Work?"
219230
label="How did you find out about Topcoder Gig Work?"
@@ -222,16 +233,17 @@ export default function GigApply(props) {
222233
options={formData.reffereal}
223234
required
224235
/>
236+
)}
225237
<div styleName="input-bot-margin" />
226-
<p>Are you able to work during the specified timezone? (<strong>{`${getCustomField(job.custom_fields, 'Timezone')}`}</strong>)</p>
238+
<p>Are you able to work during the specified timezone? (<strong>{`${getCustomField(job.custom_fields, 'Timezone')}`}</strong>) *</p>
227239
<RadioButton
228240
onChange={val => onFormInputChange('timezoneConfirm', val)}
229241
errorMsg={formErrors.timezoneConfirm}
230242
options={formData.timezoneConfirm}
231243
size="lg"
232244
/>
233245
<div styleName="last-input">
234-
<p>Are you ok to work with the duration of the gig? (<strong>{`${getCustomField(job.custom_fields, 'Duration')}`}</strong>)</p>
246+
<p>Are you ok to work with the duration of the gig? (<strong>{`${getCustomField(job.custom_fields, 'Duration')}`}</strong>) *</p>
235247
<RadioButton
236248
onChange={val => onFormInputChange('durationConfirm', val)}
237249
errorMsg={formErrors.durationConfirm}

src/shared/components/Gigs/GigApply/style.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@
148148
}
149149
}
150150

151+
.info-text {
152+
font-size: 16px;
153+
margin-top: 35px;
154+
}
155+
151156
.form-section {
152157
margin: 13px 0 50px;
153158

src/shared/containers/Gigs/RecruitCRMJobApply.jsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class RecruitCRMJobApplyContainer extends React.Component {
7777
validateForm(prop) {
7878
this.setState((state) => {
7979
const { formData, formErrors } = state;
80+
const { recruitProfile } = this.props;
8081
// Form validation happens here
8182
const requiredTextFields = [
8283
'fname', 'lname', 'city', 'phone', 'email',
@@ -110,8 +111,10 @@ class RecruitCRMJobApplyContainer extends React.Component {
110111
}
111112
// check for selected reffereal
112113
if (!prop || prop === 'reffereal') {
113-
if (!_.find(formData.reffereal, { selected: true })) formErrors.reffereal = 'Please, select your reffereal';
114-
else delete formErrors.reffereal;
114+
if (!recruitProfile) {
115+
if (!_.find(formData.reffereal, { selected: true })) formErrors.reffereal = 'Please, select your reffereal';
116+
else delete formErrors.reffereal;
117+
}
115118
}
116119
// check payExpectation to be a number
117120
if (!prop || prop === 'payExpectation') {
@@ -154,13 +157,23 @@ class RecruitCRMJobApplyContainer extends React.Component {
154157
}
155158
}
156159
}
157-
// timezone & duration
158-
if (!prop || prop === 'timezoneConfirm' || prop === 'durationConfirm') {
160+
// timezone
161+
if (!prop || prop === 'timezoneConfirm') {
159162
const a = _.find(formData[prop], { value: true });
160163
if (a) {
161164
if (a.label === 'No') formErrors[prop] = 'Sorry, we are only looking for candidates that can work the hours and duration listed';
162165
else delete formErrors[prop];
163-
}
166+
} else if (prop) formErrors[prop] = 'Required field';
167+
else if (!prop && !_.find(formData.timezoneConfirm, { value: true })) formErrors.timezoneConfirm = 'Required field';
168+
}
169+
// duration
170+
if (!prop || prop === 'durationConfirm') {
171+
const a = _.find(formData[prop], { value: true });
172+
if (a) {
173+
if (a.label === 'No') formErrors[prop] = 'Sorry, we are only looking for candidates that can work the hours and duration listed';
174+
else delete formErrors[prop];
175+
} else if (prop) formErrors[prop] = 'Required field';
176+
else if (!prop && !_.find(formData.durationConfirm, { value: true })) formErrors.durationConfirm = 'Required field';
164177
}
165178
// updated state
166179
return {

0 commit comments

Comments
 (0)