1
|
|
|
import React from "react"; |
2
|
|
|
import { useIntl } from "react-intl"; |
3
|
|
|
import { getLocale } from "../../../helpers/localize"; |
4
|
|
|
import { fakeApplication } from "../../../fakeData/fakeApplications"; |
5
|
|
|
import fakeJob from "../../../fakeData/fakeJob"; |
6
|
|
|
import { navigate } from "../../../helpers/router"; |
7
|
|
|
import { |
8
|
|
|
applicationSkillsIntro, |
9
|
|
|
applicationBasic, |
10
|
|
|
applicationIndex, |
11
|
|
|
} from "../../../helpers/routes"; |
12
|
|
|
import ProgressBar, { stepNames } from "../ProgressBar/ProgressBar"; |
13
|
|
|
import makeProgressBarSteps from "../ProgressBar/progressHelpers"; |
14
|
|
|
import Experience, { ExperienceSubmitData } from "./Experience"; |
15
|
|
|
import { fakeCriteria } from "../../../fakeData/fakeCriteria"; |
16
|
|
|
import fakeExperienceSkills from "../../../fakeData/fakeExperienceSkills"; |
17
|
|
|
import fakeExperiences from "../../../fakeData/fakeExperience"; |
18
|
|
|
import { Experience as ExperienceType } from "../../../models/types"; |
19
|
|
|
import { EducationSubformProps } from "../ExperienceModals/EducationSubform"; |
20
|
|
|
|
21
|
|
|
interface ExperiencePageProps { |
22
|
|
|
applicationId: number; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
const educationMessages = { |
26
|
|
|
educationReqTitle: { |
27
|
|
|
id: "application.experience.education.requirementTitle", |
28
|
|
|
defaultMessage: "2 year post secondary degree", |
29
|
|
|
description: |
30
|
|
|
"Short description of the default education requirement for this job.", |
31
|
|
|
}, |
32
|
|
|
educationReqDescription: { |
33
|
|
|
id: "application.experience.education.requirmentDescription", |
34
|
|
|
defaultMessage: |
35
|
|
|
"Successful completion of 2 years post secondary degree in a relevant field.", |
36
|
|
|
description: |
37
|
|
|
"Longer description of the default education requirement for this job.", |
38
|
|
|
}, |
39
|
|
|
equivalentReqTitle: { |
40
|
|
|
id: "application.experience.education.equivalentRequirementTitle", |
41
|
|
|
defaultMessage: "Combination Experience", |
42
|
|
|
description: |
43
|
|
|
"Short description of an equivalent for the education requirement for this job.", |
44
|
|
|
}, |
45
|
|
|
equivalentReqDescription: { |
46
|
|
|
id: "application.experience.education.equivalentRequirmentDescription", |
47
|
|
|
defaultMessage: |
48
|
|
|
"If you believe your training, education, and/or experiences are equivalent to a 2-year post-secondary requirment, put it forward for consideration.\nThe hiring manager may accept these an alternative to the minimum education requirment.", |
49
|
|
|
description: |
50
|
|
|
"Longer description of an equivalent for the default education requirement for this job.", |
51
|
|
|
}, |
52
|
|
|
}; |
53
|
|
|
|
54
|
|
|
export const ExperiencePage: React.FC<ExperiencePageProps> = ({ |
55
|
|
|
applicationId, |
56
|
|
|
}) => { |
57
|
|
|
const intl = useIntl(); |
58
|
|
|
const locale = getLocale(intl.locale); |
59
|
|
|
|
60
|
|
|
const application = fakeApplication(); // TODO: get real application. |
61
|
|
|
const job = fakeJob(); // TODO: Get real job associated with application. |
62
|
|
|
const criteria = fakeCriteria(); // TODO: Get criteria associated with job. |
63
|
|
|
const experiences = fakeExperiences(); // TODO: get experienciences associated with application. |
64
|
|
|
const experienceSkills = fakeExperienceSkills(); // TODO: Get experienceSkills associated with experiences. |
65
|
|
|
|
66
|
|
|
// TODO: load constants from backend. |
67
|
|
|
const educationStatuses = []; |
68
|
|
|
const educationTypes = []; |
69
|
|
|
const skills = []; |
70
|
|
|
const recipientTypes = []; |
71
|
|
|
const recognitionTypes = []; |
72
|
|
|
|
73
|
|
|
const handleSubmit = async (data: ExperienceSubmitData): Promise<void> => { |
74
|
|
|
console.log(data); // TODO: Save the data. |
75
|
|
|
}; |
76
|
|
|
const handleDelete = async ( |
77
|
|
|
id: number, |
78
|
|
|
type: ExperienceType["type"], |
79
|
|
|
): Promise<void> => { |
80
|
|
|
// TODO: Delete the experience. |
81
|
|
|
console.log(`Delete experience id: ${id}, type: ${type}`); |
82
|
|
|
}; |
83
|
|
|
|
84
|
|
|
const handleContinue = (): void => { |
85
|
|
|
navigate(applicationSkillsIntro(locale, applicationId)); |
86
|
|
|
}; |
87
|
|
|
const handleReturn = (): void => { |
88
|
|
|
navigate(applicationBasic(locale, applicationId)); |
89
|
|
|
}; |
90
|
|
|
const handleQuit = (): void => { |
91
|
|
|
window.location.href = applicationIndex(locale); |
92
|
|
|
}; |
93
|
|
|
const closeDate = new Date(); // TODO: get from application. |
94
|
|
|
return ( |
95
|
|
|
<> |
96
|
|
|
<ProgressBar |
97
|
|
|
closeDateTime={closeDate} |
98
|
|
|
currentTitle={intl.formatMessage(stepNames.step01)} |
99
|
|
|
steps={makeProgressBarSteps(application, intl, "experience")} |
100
|
|
|
/> |
101
|
|
|
<Experience |
102
|
|
|
experiences={experiences} |
103
|
|
|
educationStatuses={educationStatuses} |
104
|
|
|
educationTypes={educationTypes} |
105
|
|
|
experienceSkills={experienceSkills} |
106
|
|
|
criteria={criteria} |
107
|
|
|
skills={skills} |
108
|
|
|
jobId={job.id} |
109
|
|
|
jobClassificationId={job.classification_id ?? 1} |
110
|
|
|
recipientTypes={recipientTypes} |
111
|
|
|
recognitionTypes={recognitionTypes} |
112
|
|
|
handleSubmitExperience={handleSubmit} |
113
|
|
|
handleDeleteExperience={handleDelete} |
114
|
|
|
handleContinue={handleContinue} |
115
|
|
|
handleReturn={handleReturn} |
116
|
|
|
handleQuit={handleQuit} |
117
|
|
|
/> |
118
|
|
|
</> |
119
|
|
|
); |
120
|
|
|
}; |
121
|
|
|
|
122
|
|
|
export default ExperiencePage; |
123
|
|
|
|