Skip to content

Commit

Permalink
create file for select choises and change message to display for admin
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadysalah committed Jun 9, 2020
1 parent 4fb0016 commit 82d2740
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 70 deletions.
82 changes: 18 additions & 64 deletions client/src/components/application/NonlinearStepper/GeneralInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,66 +9,19 @@ import PropTypes from 'prop-types';
import InputText from '../../common/TextField';
import SelectBox from '../SelectBox';
import Typography from '../../common/Typography';

import selectBoxQuestions from './questions';
import { GeneralInfoStyles } from './style';

const GereralInfos = ({ handleFormInput, formValues, errorMsg }) => {
const classes = GeneralInfoStyles();
const GazaAreas = [
'North of Gaza Strip',
'Gaza City',
'Middle Area of Gaza',
'Khan Younis',
'Rafah',
];
const GazaUniversity = [
"I didn't go to university",
'Islamic University of Gaza',
'Al Azhar University',
'Palestine University',
'UCAS',
'Al Quds Open University',
'University College of Science and Technology',
'Al Aqsa University',
'Gaza University',
'I went to university outside of Gaza',
];

const KhalilUniversity = [
"I didn't go to university",
'Palestine Polytechnic University (PPU)',
'Hebron University',
'Bethlehem University',
'Birzeit University',
'Al Najah University',
'Arab American University',
'Al Quds Open University',
'Al Quds University',
'Palestine Technical University - Kadoori',
'IT College - Vocational Center',
'University outside of Palestine',
'Other',
];
const advert = [
'Gaza Sky Geeks Social Media (Facebook, Twitter, Instagram)',
'Friend or family member who is a Code Academy graduate',
'I came to a GSG workshop or event (such as “Coding for Everyone”)',
'Online / browsing the web',
'Jobs.ps',
'Other',
];
const codeExperience = [
'No Experience',
'Some experience as hobby',
'A lot of experience as a hobby',
'I have a university degree in Computer Science or another related field',
'I have had a paid job as a developer.',
];
const primaryMotivationForm = [
'I want to gain employment/earn income as a developer.',
"I want to learn something new - I don't know if I want a coding career",
'I want to be part of the GSG and Code Academy community',
];
const {
GazaAreas,
GazaUniversities,
KhalilUniversities,
advertisement,
codeExperience,
primaryMotivationForm,
} = selectBoxQuestions;

const KhalilAreas = ['Old Town', 'New Town'];
return (
Expand Down Expand Up @@ -164,11 +117,11 @@ const GereralInfos = ({ handleFormInput, formValues, errorMsg }) => {
label="university"
name="university"
items={
formValues.location === 'gaza' ? GazaUniversity : KhalilUniversity
formValues.location === 'gaza' ? GazaUniversities : KhalilUniversities
}
setVal={handleFormInput}
value={formValues.university}
isError={errorMsg.includes('university')}
isError={errorMsg.includes('Chose your university')}
/>
<InputText
className="nonlinearSelect"
Expand All @@ -177,7 +130,7 @@ const GereralInfos = ({ handleFormInput, formValues, errorMsg }) => {
label="specialization"
name="specialization"
onChange={handleFormInput}
isError={errorMsg.includes('specialization')}
isError={errorMsg.includes('Insert your Specialization')}
message="(If you didn't go to university, just write N/A) ?"
/>
<SelectBox
Expand All @@ -187,7 +140,7 @@ const GereralInfos = ({ handleFormInput, formValues, errorMsg }) => {
items={codeExperience}
setVal={handleFormInput}
value={formValues.codingExperience}
isError={errorMsg.includes('codingExperience')}
isError={errorMsg.includes('Select your coding experience')}
/>
<SelectBox
className="nonlinearSelect"
Expand All @@ -196,16 +149,16 @@ const GereralInfos = ({ handleFormInput, formValues, errorMsg }) => {
items={primaryMotivationForm}
setVal={handleFormInput}
value={formValues.primaryMotivation}
isError={errorMsg.includes('primaryMotivation')}
isError={errorMsg.includes('Select your primary motivation first')}
/>
<SelectBox
className="nonlinearSelect"
label="How did you hear about the Code Academy"
name="caReading"
items={advert}
items={advertisement}
setVal={handleFormInput}
value={formValues.caReading}
isError={errorMsg.includes('caReading')}
isError={errorMsg.includes('Select how you here about Us first')}
/>
<InputText
className="nonlinearSelect"
Expand All @@ -215,7 +168,8 @@ const GereralInfos = ({ handleFormInput, formValues, errorMsg }) => {
name="cvLink"
onChange={handleFormInput}
isError={
errorMsg.includes('cvLink') || errorMsg.includes('Enter correct url!')
errorMsg.includes('Insert Your Cv Link first') ||
errorMsg.includes('Enter correct url!')
}
/>
</div>
Expand Down
64 changes: 64 additions & 0 deletions client/src/components/application/NonlinearStepper/questions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const GazaAreas = [
'North of Gaza Strip',
'Gaza City',
'Middle Area of Gaza',
'Khan Younis',
'Rafah',
];
const GazaUniversities = [
"I didn't go to university",
'Islamic University of Gaza',
'Al Azhar University',
'Palestine University',
'UCAS',
'Al Quds Open University',
'University College of Science and Technology',
'Al Aqsa University',
'Gaza University',
'I went to university outside of Gaza',
];

const KhalilUniversities = [
"I didn't go to university",
'Palestine Polytechnic University (PPU)',
'Hebron University',
'Bethlehem University',
'Birzeit University',
'Al Najah University',
'Arab American University',
'Al Quds Open University',
'Al Quds University',
'Palestine Technical University - Kadoori',
'IT College - Vocational Center',
'University outside of Palestine',
'Other',
];
const advertisement = [
'Gaza Sky Geeks Social Media (Facebook, Twitter, Instagram)',
'Friend or family member who is a Code Academy graduate',
'I came to a GSG workshop or event (such as “Coding for Everyone”)',
'Online / browsing the web',
'Jobs.ps',
'Other',
];
const codeExperience = [
'No Experience',
'Some experience as hobby',
'A lot of experience as a hobby',
'I have a university degree in Computer Science or another related field',
'I have had a paid job as a developer.',
];
const primaryMotivationForm = [
'I want to gain employment/earn income as a developer.',
"I want to learn something new - I don't know if I want a coding career",
'I want to be part of the GSG and Code Academy community',
];

export default {
GazaAreas,
GazaUniversities,
KhalilUniversities,
advertisement,
codeExperience,
primaryMotivationForm,
};
18 changes: 12 additions & 6 deletions client/src/utils/application/nLinearStepperValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,24 @@ const generalInfosSchema = yup.object().shape({
age: yup.string().required('Age is required').trim(),
address: yup.string().required('Address is required'),
motivation: yup.string().required(`Insert motivation`).trim(),
specialization: yup.string().required(`specialization`).trim(),
university: yup.string().required(`university`).trim(),
codingExperience: yup.string().required(`codingExperience`).trim(),
primaryMotivation: yup.string().required(`primaryMotivation`).trim(),
caReading: yup.string().required(`caReading`).trim(),
specialization: yup.string().required(`Insert your Specialization`).trim(),
university: yup.string().required(`Select your university`).trim(),
codingExperience: yup
.string()
.required(`Select your coding experience`)
.trim(),
primaryMotivation: yup
.string()
.required(`Select your primary motivation first`)
.trim(),
caReading: yup.string().required(`Select how you here about Us first`).trim(),
cvLink: yup
.string()
.matches(
/^((https?):\/\/)?(www.)?[a-z0-9]+(\.[a-z]{2,}){1,3}(#?\/?[a-zA-Z0-9#]+)*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?$/,
'Enter correct url!'
)
.required(`cvLink`)
.required(`Insert Your Cv Link first`)
.trim(),
});

Expand Down

0 comments on commit 82d2740

Please sign in to comment.