Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

fix: issue-84 #94

Merged
merged 2 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/FormField/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const FormField = ({ field, isGroupField }) => {
<TextInput
placeholder={field.placeholder}
value={input?.value ?? ""}
isRequired={field.isRequired}
type="number"
minValue={field.minValue}
onChange={input.onChange}
Expand Down
7 changes: 6 additions & 1 deletion src/components/TextInput/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ function TextInput(props) {
if (event.target.value >= props.minValue) {
props.onChange(event.target.value);
} else {
props.onChange(props.minValue);
if (props.isRequired) {
props.onChange(props.minValue);
} else {
// can delete the number
props.onChange("");
}
}
} else {
props.onChange(event.target.value);
Expand Down
4 changes: 2 additions & 2 deletions src/routes/JobDetails/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ const JobDetails = ({ teamId, jobId }) => {
<DataItem title="Start Date" icon={<IconDescription />}>
{formatDate(job.startDate)}
</DataItem>
<DataItem title="End Date" icon={<IconDescription />}>
{formatDate(job.endDate)}
<DataItem title="Duration" icon={<IconDescription />}>
{job.duration || "TBD"}
</DataItem>
<DataItem title="Resource Type" icon={<IconDescription />}>
{job.resourceType}
Expand Down
2 changes: 1 addition & 1 deletion src/routes/JobForm/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const JobForm = ({ teamId, jobId }) => {
description: values.description,
title: values.title,
startDate: values.startDate,
endDate: values.endDate,
duration: values.duration,
numPositions: values.numPositions,
resourceType: values.resourceType,
rateType: values.rateType,
Expand Down
22 changes: 12 additions & 10 deletions src/routes/JobForm/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const CREATE_JOB_ROWS = [
{ type: FORM_ROW_TYPE.SINGLE, fields: ["description"] },
{ type: FORM_ROW_TYPE.SINGLE, fields: ["numPositions"] },
{ type: FORM_ROW_TYPE.SINGLE, fields: ["skills"] },
{ type: FORM_ROW_TYPE.GROUP, fields: ["startDate", "endDate"] },
{ type: FORM_ROW_TYPE.GROUP, fields: ["startDate", "duration"] },
{ type: FORM_ROW_TYPE.SINGLE, fields: ["resourceType"] },
{ type: FORM_ROW_TYPE.SINGLE, fields: ["rateType"] },
{ type: FORM_ROW_TYPE.SINGLE, fields: ["workload"] },
Expand All @@ -26,7 +26,7 @@ const EDIT_JOB_ROWS = [
{ type: FORM_ROW_TYPE.SINGLE, fields: ["description"] },
{ type: FORM_ROW_TYPE.SINGLE, fields: ["numPositions"] },
{ type: FORM_ROW_TYPE.SINGLE, fields: ["skills"] },
{ type: FORM_ROW_TYPE.GROUP, fields: ["startDate", "endDate"] },
{ type: FORM_ROW_TYPE.GROUP, fields: ["startDate", "duration"] },
{ type: FORM_ROW_TYPE.SINGLE, fields: ["resourceType"] },
{ type: FORM_ROW_TYPE.SINGLE, fields: ["rateType"] },
{ type: FORM_ROW_TYPE.SINGLE, fields: ["workload"] },
Expand Down Expand Up @@ -79,10 +79,11 @@ export const getEditJobConfig = (skillOptions, onSubmit) => {
placeholder: "Start Date",
},
{
label: "End Date",
type: FORM_FIELD_TYPE.DATE,
name: "endDate",
placeholder: "End Date",
label: "Duration",
type: FORM_FIELD_TYPE.NUMBER,
name: "duration",
minValue: 1,
placeholder: "Duration",
},
{
label: "Resource Type",
Expand Down Expand Up @@ -163,10 +164,11 @@ export const getCreateJobConfig = (skillOptions, onSubmit) => {
placeholder: "Start Date",
},
{
label: "End Date",
type: FORM_FIELD_TYPE.DATE,
name: "endDate",
placeholder: "End Date",
label: "Duration",
type: FORM_FIELD_TYPE.NUMBER,
name: "duration",
minValue: 1,
placeholder: "Duration",
},
{
label: "Resource Type",
Expand Down