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

Commit ad02cdf

Browse files
authored
Merge pull request #94 from yoution/issue-84
fix: issue-84
2 parents ad5dbd4 + affa385 commit ad02cdf

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

src/components/FormField/index.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const FormField = ({ field, isGroupField }) => {
4646
<TextInput
4747
placeholder={field.placeholder}
4848
value={input?.value ?? ""}
49+
isRequired={field.isRequired}
4950
type="number"
5051
minValue={field.minValue}
5152
onChange={input.onChange}

src/components/TextInput/index.jsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ function TextInput(props) {
2020
if (event.target.value >= props.minValue) {
2121
props.onChange(event.target.value);
2222
} else {
23-
props.onChange(props.minValue);
23+
if (props.isRequired) {
24+
props.onChange(props.minValue);
25+
} else {
26+
// can delete the number
27+
props.onChange("");
28+
}
2429
}
2530
} else {
2631
props.onChange(event.target.value);

src/routes/JobDetails/index.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ const JobDetails = ({ teamId, jobId }) => {
6464
<DataItem title="Start Date" icon={<IconDescription />}>
6565
{formatDate(job.startDate)}
6666
</DataItem>
67-
<DataItem title="End Date" icon={<IconDescription />}>
68-
{formatDate(job.endDate)}
67+
<DataItem title="Duration" icon={<IconDescription />}>
68+
{job.duration || "TBD"}
6969
</DataItem>
7070
<DataItem title="Resource Type" icon={<IconDescription />}>
7171
{job.resourceType}

src/routes/JobForm/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const JobForm = ({ teamId, jobId }) => {
6666
description: values.description,
6767
title: values.title,
6868
startDate: values.startDate,
69-
endDate: values.endDate,
69+
duration: values.duration,
7070
numPositions: values.numPositions,
7171
resourceType: values.resourceType,
7272
rateType: values.rateType,

src/routes/JobForm/utils.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const CREATE_JOB_ROWS = [
1414
{ type: FORM_ROW_TYPE.SINGLE, fields: ["description"] },
1515
{ type: FORM_ROW_TYPE.SINGLE, fields: ["numPositions"] },
1616
{ type: FORM_ROW_TYPE.SINGLE, fields: ["skills"] },
17-
{ type: FORM_ROW_TYPE.GROUP, fields: ["startDate", "endDate"] },
17+
{ type: FORM_ROW_TYPE.GROUP, fields: ["startDate", "duration"] },
1818
{ type: FORM_ROW_TYPE.SINGLE, fields: ["resourceType"] },
1919
{ type: FORM_ROW_TYPE.SINGLE, fields: ["rateType"] },
2020
{ type: FORM_ROW_TYPE.SINGLE, fields: ["workload"] },
@@ -26,7 +26,7 @@ const EDIT_JOB_ROWS = [
2626
{ type: FORM_ROW_TYPE.SINGLE, fields: ["description"] },
2727
{ type: FORM_ROW_TYPE.SINGLE, fields: ["numPositions"] },
2828
{ type: FORM_ROW_TYPE.SINGLE, fields: ["skills"] },
29-
{ type: FORM_ROW_TYPE.GROUP, fields: ["startDate", "endDate"] },
29+
{ type: FORM_ROW_TYPE.GROUP, fields: ["startDate", "duration"] },
3030
{ type: FORM_ROW_TYPE.SINGLE, fields: ["resourceType"] },
3131
{ type: FORM_ROW_TYPE.SINGLE, fields: ["rateType"] },
3232
{ type: FORM_ROW_TYPE.SINGLE, fields: ["workload"] },
@@ -79,10 +79,11 @@ export const getEditJobConfig = (skillOptions, onSubmit) => {
7979
placeholder: "Start Date",
8080
},
8181
{
82-
label: "End Date",
83-
type: FORM_FIELD_TYPE.DATE,
84-
name: "endDate",
85-
placeholder: "End Date",
82+
label: "Duration",
83+
type: FORM_FIELD_TYPE.NUMBER,
84+
name: "duration",
85+
minValue: 1,
86+
placeholder: "Duration",
8687
},
8788
{
8889
label: "Resource Type",
@@ -163,10 +164,11 @@ export const getCreateJobConfig = (skillOptions, onSubmit) => {
163164
placeholder: "Start Date",
164165
},
165166
{
166-
label: "End Date",
167-
type: FORM_FIELD_TYPE.DATE,
168-
name: "endDate",
169-
placeholder: "End Date",
167+
label: "Duration",
168+
type: FORM_FIELD_TYPE.NUMBER,
169+
name: "duration",
170+
minValue: 1,
171+
placeholder: "Duration",
170172
},
171173
{
172174
label: "Resource Type",

0 commit comments

Comments
 (0)