diff --git a/src/config/constants.js b/src/config/constants.js index 93382ec1c..0c85a21a6 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -1224,3 +1224,8 @@ export const MILESTONE_DEFAULT_VALUES = { export const PHASE_PRODUCT_TEMPLATE_ID = process.env.PHASE_PRODUCT_TEMPLATE_ID export const DEFAULT_NDA_UUID = process.env.DEFAULT_NDA_UUID + +/** + * The minimal duration of a TaaS Job in weeks + */ +export const TAAS_MIN_JOB_DURATION = 4 \ No newline at end of file diff --git a/src/projects/detail/components/JobPickerRow/JobPickerRow.jsx b/src/projects/detail/components/JobPickerRow/JobPickerRow.jsx index 848e26938..4f8fd96d2 100644 --- a/src/projects/detail/components/JobPickerRow/JobPickerRow.jsx +++ b/src/projects/detail/components/JobPickerRow/JobPickerRow.jsx @@ -10,6 +10,7 @@ import SelectDropdown from 'appirio-tech-react-components/components/SelectDropd import DescriptionField from '../DescriptionField' import styles from './JobPickerRow.scss' +import { TAAS_MIN_JOB_DURATION } from '../../../../config/constants' const always = () => true const never = () => false @@ -102,7 +103,7 @@ class JobPickerRow extends React.PureComponent { render() { const { value, rowIndex } = this.props - const isRowIncomplete = value.title.trim().length > 0 || value.people > 0 || value.duration > 0 || (value.skills && value.skills.length) + const isRowIncomplete = value.title.trim().length > 0 || value.people > 0 || value.duration >= TAAS_MIN_JOB_DURATION || (value.skills && value.skills.length) ||(value.role && value.role.value !== null) ||(value.workLoad && value.workLoad.value !== null) || (value.description.trim().length > 0) /* Different columns are defined here and used in componsing mobile/desktop views below */ @@ -164,12 +165,14 @@ class JobPickerRow extends React.PureComponent { + {isRowIncomplete && value.duration < TAAS_MIN_JOB_DURATION ?

Please, choose at least {TAAS_MIN_JOB_DURATION} weeks

: null} ) diff --git a/src/projects/detail/components/JobsPickerQuestion/JobsPickerQuestion.jsx b/src/projects/detail/components/JobsPickerQuestion/JobsPickerQuestion.jsx index bdcf09fe5..e3f7580ff 100644 --- a/src/projects/detail/components/JobsPickerQuestion/JobsPickerQuestion.jsx +++ b/src/projects/detail/components/JobsPickerQuestion/JobsPickerQuestion.jsx @@ -5,6 +5,7 @@ import cn from 'classnames' import JobPickerRow from '../JobPickerRow/JobPickerRow.jsx' import './JobsPickerQuestion.scss' +import { TAAS_MIN_JOB_DURATION } from '../../../../config/constants.js' class JobsPickerQuestion extends Component { @@ -19,7 +20,7 @@ class JobsPickerQuestion extends Component { this.setValidator(props) const { getValue } = props - let values = getValue() + let values = getValue() if (values) { values = _.map(values, (v) => { return { @@ -33,7 +34,7 @@ class JobsPickerQuestion extends Component { } this.state = { - values + values } } @@ -49,13 +50,13 @@ class JobsPickerQuestion extends Component { return true } return _.some(value, (v) => { - return v.title.trim().length && v.people !== '0' && v.duration !== '0' && v.skills.length > 0 && v.workLoad.value !== null && v.role.value !== null && v.description.trim().length + return v.title.trim().length && v.people !== '0' && parseInt(v.duration, 10) >= TAAS_MIN_JOB_DURATION && v.skills.length > 0 && v.workLoad.value !== null && v.role.value !== null && v.description.trim().length }) // validation body }, noPartialFillsExist: (formValues, value) => { return _.every(value, v => { - const isAllValuesFilled = v.title.trim().length > 0 && v.people > 0 && v.duration > 0 && v.skills && v.skills.length && v.description.trim().length && v.workLoad.value !== null && v.role.value !== null - return isAllValuesFilled + const isAllValuesFilled = v.title.trim().length > 0 && v.people > 0 && v.duration >= TAAS_MIN_JOB_DURATION && v.skills && v.skills.length && v.description.trim().length && v.workLoad.value !== null && v.role.value !== null + return isAllValuesFilled }) } }