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

Commit 249139a

Browse files
authored
Merge pull request #141 from yoution/issue-138
fix: issue #138
2 parents c075dd4 + cf1e637 commit 249139a

File tree

8 files changed

+67
-23
lines changed

8 files changed

+67
-23
lines changed

src/components/DateInput/index.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const DateInput = (props) => {
1616
dateFormat="MM/dd/yyyy"
1717
placeholderText={props.placeholder}
1818
selected={props.value}
19+
disabled={props.disabled}
1920
onChange={props.onChange}
2021
onBlur={props.onBlur}
2122
onCalendarClose={props.onBlur}
@@ -28,6 +29,7 @@ const DateInput = (props) => {
2829
DateInput.propTypes = {
2930
value: PT.string,
3031
onChange: PT.func.isRequired,
32+
disabled: PT.bool,
3133
placeholder: PT.string,
3234
onBlur: PT.func,
3335
onFocus: PT.func,

src/components/FormField/index.jsx

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const FormField = ({ field }) => {
3737
<TextInput
3838
maxLength={field.maxLength}
3939
placeholder={field.placeholder}
40+
disabled={field.disabled}
4041
value={input.value ?? ""}
4142
type="text"
4243
className={meta.error && meta.touched ? "error" : ""}
@@ -52,6 +53,7 @@ const FormField = ({ field }) => {
5253
value={input?.value ?? ""}
5354
isRequired={field.isRequired}
5455
type="number"
56+
disabled={field.disabled}
5557
minValue={field.minValue}
5658
onChange={input.onChange}
5759
onBlur={input.onBlur}
@@ -64,6 +66,7 @@ const FormField = ({ field }) => {
6466
<MarkdownEditor
6567
placeholder={field.placeholder}
6668
value={input?.value ?? ""}
69+
errorMessage={field.errorMessage}
6770
disabled={field.disabled}
6871
onChange={input.onChange}
6972
onBlur={input.onBlur}
@@ -86,6 +89,7 @@ const FormField = ({ field }) => {
8689
placeholder={field.placeholder}
8790
value={input?.value ?? ""}
8891
onChange={input.onChange}
92+
disabled={field.disabled}
8993
onBlur={input.onBlur}
9094
onFocus={input.onFocus}
9195
className={meta.error && meta.touched ? "error" : ""}

src/components/MarkdownEditor/index.jsx

+19-17
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import cn from "classnames";
88
import TuiEditor from "../TuiEditor";
99
import MarkdownEditorViewer from "../MarkdownEditorViewer";
1010
import styles from "./styles.module.scss";
11-
import { DISABLED_DESCRIPTION_MESSAGE } from "constants";
1211

1312
const MarkdownEditor = (props) => {
1413
const editorElement = useRef(null);
@@ -21,7 +20,9 @@ const MarkdownEditor = (props) => {
2120
return (
2221
<div styleName="editor-viewer">
2322
<MarkdownEditorViewer {...props} />
24-
<div styleName="message">{DISABLED_DESCRIPTION_MESSAGE}</div>
23+
{props.errorMessage && (
24+
<div styleName="message">{props.errorMessage}</div>
25+
)}
2526
</div>
2627
);
2728
}
@@ -34,21 +35,21 @@ const MarkdownEditor = (props) => {
3435
onChange={onChange}
3536
initialValue={props.value}
3637
toolbarItems={[
37-
'heading',
38-
'bold',
39-
'italic',
40-
'strike',
41-
'code',
42-
'divider',
43-
'quote',
44-
'codeblock',
45-
'hr',
46-
'divider',
47-
'ul',
48-
'ol',
49-
'divider',
50-
'image',
51-
'link',
38+
"heading",
39+
"bold",
40+
"italic",
41+
"strike",
42+
"code",
43+
"divider",
44+
"quote",
45+
"codeblock",
46+
"hr",
47+
"divider",
48+
"ul",
49+
"ol",
50+
"divider",
51+
"image",
52+
"link",
5253
]}
5354
plugins={[]}
5455
/>
@@ -59,6 +60,7 @@ const MarkdownEditor = (props) => {
5960
MarkdownEditor.propTypes = {
6061
value: PropTypes.string,
6162
disabled: PropTypes.bool,
63+
errorMessage: PropTypes.string,
6264
className: PropTypes.string,
6365
onChange: PropTypes.func,
6466
onFocus: PropTypes.func,

src/components/MarkdownEditor/styles.module.scss

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22

33
.editor-viewer {
44
> div:first-child {
5-
border: 1px solid #aaaaab;
5+
// border: 1px solid #aaaaab;
66
border-radius: 4px;
77
overflow: hidden;
88
box-sizing: border-box;
99
padding: 16px 25px 0px 25px;
1010
height: 280px;
1111
overflow-y: auto;
12+
border: 0;
13+
background: #fafafb;
14+
box-shadow: none;
15+
color: #6b6b6b;
16+
-webkit-text-fill-color: #808080;
1217
}
1318
.message {
1419
@include font-roboto;

src/components/ReactSelect/index.jsx

+15-4
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ const ReactSelect = (props) => {
1414
control: (provided, state) => ({
1515
...provided,
1616
minHeight: "40px",
17-
border: "1px solid #aaaaab",
17+
border: state.isDisabled ? "none" : "1px solid #aaaaab",
1818
borderColor: state.isFocused ? "#55a5ff" : "#aaaaab",
19-
boxShadow: state.isFocused ? "0 0 2px 1px #cee6ff" : provided.boxShadow,
19+
boxShadow: state.isDisabled
20+
? "none"
21+
: state.isFocused
22+
? "0 0 2px 1px #cee6ff"
23+
: provided.boxShadow,
24+
backgroundColor: state.isDisabled ? "#fafafb" : provided.backgroundColor,
25+
color: state.isDisabled ? "#6b6b6b" : provided.color,
2026
}),
2127
menu: (provided) => ({
2228
...provided,
@@ -53,16 +59,21 @@ const ReactSelect = (props) => {
5359
textAlign: "left",
5460
fontWeight: "400",
5561
}),
56-
multiValue: (provided) => ({
62+
multiValue: (provided, state) => ({
5763
...provided,
5864
margin: "3px 3px",
59-
color: "#AAAAAA",
65+
color: state.isDisabled ? "#808080" : "#AAAAAA",
66+
paddingRight: state.isDisabled ? "6px" : "0",
6067
fontFamily: "Roboto",
6168
fontSize: "14px",
6269
lineHeight: "22px",
6370
textAlign: "left",
6471
borderRadius: "5px",
6572
}),
73+
multiValueRemove: (provided, state) => ({
74+
...provided,
75+
display: state.isDisabled ? "none" : provided.display,
76+
}),
6677
dropdownIndicator: () => ({
6778
display: "none",
6879
}),

src/components/TextInput/index.jsx

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function TextInput(props) {
1414
styleName={cn("TextInput", props.className, { readonly: props.readonly })}
1515
maxLength={props.maxLength}
1616
min={props.minValue}
17+
disabled={props.disabled}
1718
onChange={(event) => {
1819
if (props.type === "number") {
1920
if (event.target.value >= props.minValue) {
@@ -47,6 +48,7 @@ TextInput.defaultProps = {
4748
maxLength: Number.MAX_VALUE,
4849
placeholder: "",
4950
minValue: 0,
51+
disabled: false,
5052
step: null,
5153
};
5254

@@ -58,6 +60,7 @@ TextInput.propTypes = {
5860
onFocus: PT.func,
5961
placeholder: PT.string,
6062
value: PT.string.isRequired,
63+
disabled: PT.bool,
6164
type: PT.string.isRequired,
6265
readonly: PT.bool,
6366
minValue: PT.number,

src/routes/JobForm/index.jsx

+5
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ const JobForm = ({ teamId, jobId }) => {
108108
configuration={getEditJobConfig(
109109
options,
110110
job.isApplicationPageActive,
111+
isEdit
112+
? job.status === "assigned" ||
113+
job.status === "closed" ||
114+
job.status === "cancelled"
115+
: false,
111116
onSubmit
112117
)}
113118
initialValue={job}

src/routes/JobForm/utils.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44
import { PERMISSIONS } from "constants/permissions";
55
import { hasPermission } from "utils/permissions";
6+
import { DISABLED_DESCRIPTION_MESSAGE } from "constants";
67
import {
78
RATE_TYPE_OPTIONS,
89
STATUS_OPTIONS,
@@ -28,11 +29,13 @@ const EDIT_JOB_ROWS = [
2829
* return edit job configuration
2930
* @param {any} skillOptions skill options
3031
* @param {boolean} isMarkdownEditorDisabled is markedownEditor disabled
32+
* @param {onlyEnableStatus} only can select status field
3133
* @param {func} onSubmit submit callback
3234
*/
3335
export const getEditJobConfig = (
3436
skillOptions,
3537
isMarkdownEditorDisabled,
38+
onlyEnableStatus,
3639
onSubmit
3740
) => {
3841
return {
@@ -44,13 +47,15 @@ export const getEditJobConfig = (
4447
validationMessage: "Please, enter Job Name",
4548
name: "title",
4649
maxLength: 128,
50+
disabled: onlyEnableStatus,
4751
placeholder: "Job Name",
4852
},
4953
{
5054
label: "Job Description",
5155
type: FORM_FIELD_TYPE.MARKDOWNEDITOR,
5256
name: "description",
53-
disabled: isMarkdownEditorDisabled,
57+
disabled: isMarkdownEditorDisabled || onlyEnableStatus,
58+
errorMessage: isMarkdownEditorDisabled && DISABLED_DESCRIPTION_MESSAGE,
5459
placeholder: "Job Description",
5560
},
5661
{
@@ -61,19 +66,22 @@ export const getEditJobConfig = (
6166
name: "numPositions",
6267
minValue: 1,
6368
placeholder: "Number Of Opening",
69+
disabled: onlyEnableStatus,
6470
step: 1,
6571
},
6672
{
6773
label: "Job Skills",
6874
type: FORM_FIELD_TYPE.SELECT,
6975
isMulti: true,
7076
name: "skills",
77+
disabled: onlyEnableStatus,
7178
selectOptions: skillOptions,
7279
},
7380
{
7481
label: "Start Date",
7582
type: FORM_FIELD_TYPE.DATE,
7683
name: "startDate",
84+
disabled: onlyEnableStatus,
7785
placeholder: "Start Date",
7886
},
7987
{
@@ -82,24 +90,28 @@ export const getEditJobConfig = (
8290
name: "duration",
8391
minValue: 1,
8492
placeholder: "Duration",
93+
disabled: onlyEnableStatus,
8594
step: 1,
8695
},
8796
{
8897
label: "Resource Type",
8998
type: FORM_FIELD_TYPE.SELECT,
9099
name: "resourceType",
100+
disabled: onlyEnableStatus,
91101
selectOptions: RESOURCE_TYPE_OPTIONS,
92102
},
93103
{
94104
label: "Resource Rate Frequency",
95105
type: FORM_FIELD_TYPE.SELECT,
96106
name: "rateType",
107+
disabled: onlyEnableStatus,
97108
selectOptions: RATE_TYPE_OPTIONS,
98109
},
99110
{
100111
label: "Workload",
101112
type: FORM_FIELD_TYPE.SELECT,
102113
name: "workload",
114+
disabled: onlyEnableStatus,
103115
selectOptions: WORKLOAD_OPTIONS,
104116
},
105117
{

0 commit comments

Comments
 (0)