3
3
*/
4
4
import { PERMISSIONS } from "constants/permissions" ;
5
5
import { hasPermission } from "utils/permissions" ;
6
+ import { DISABLED_DESCRIPTION_MESSAGE } from "constants" ;
6
7
import {
7
8
RATE_TYPE_OPTIONS ,
8
9
STATUS_OPTIONS ,
@@ -28,11 +29,13 @@ const EDIT_JOB_ROWS = [
28
29
* return edit job configuration
29
30
* @param {any } skillOptions skill options
30
31
* @param {boolean } isMarkdownEditorDisabled is markedownEditor disabled
32
+ * @param {onlyEnableStatus } only can select status field
31
33
* @param {func } onSubmit submit callback
32
34
*/
33
35
export const getEditJobConfig = (
34
36
skillOptions ,
35
37
isMarkdownEditorDisabled ,
38
+ onlyEnableStatus ,
36
39
onSubmit
37
40
) => {
38
41
return {
@@ -44,13 +47,15 @@ export const getEditJobConfig = (
44
47
validationMessage : "Please, enter Job Name" ,
45
48
name : "title" ,
46
49
maxLength : 128 ,
50
+ disabled : onlyEnableStatus ,
47
51
placeholder : "Job Name" ,
48
52
} ,
49
53
{
50
54
label : "Job Description" ,
51
55
type : FORM_FIELD_TYPE . MARKDOWNEDITOR ,
52
56
name : "description" ,
53
- disabled : isMarkdownEditorDisabled ,
57
+ disabled : isMarkdownEditorDisabled || onlyEnableStatus ,
58
+ errorMessage : isMarkdownEditorDisabled && DISABLED_DESCRIPTION_MESSAGE ,
54
59
placeholder : "Job Description" ,
55
60
} ,
56
61
{
@@ -61,19 +66,22 @@ export const getEditJobConfig = (
61
66
name : "numPositions" ,
62
67
minValue : 1 ,
63
68
placeholder : "Number Of Opening" ,
69
+ disabled : onlyEnableStatus ,
64
70
step : 1 ,
65
71
} ,
66
72
{
67
73
label : "Job Skills" ,
68
74
type : FORM_FIELD_TYPE . SELECT ,
69
75
isMulti : true ,
70
76
name : "skills" ,
77
+ disabled : onlyEnableStatus ,
71
78
selectOptions : skillOptions ,
72
79
} ,
73
80
{
74
81
label : "Start Date" ,
75
82
type : FORM_FIELD_TYPE . DATE ,
76
83
name : "startDate" ,
84
+ disabled : onlyEnableStatus ,
77
85
placeholder : "Start Date" ,
78
86
} ,
79
87
{
@@ -82,24 +90,28 @@ export const getEditJobConfig = (
82
90
name : "duration" ,
83
91
minValue : 1 ,
84
92
placeholder : "Duration" ,
93
+ disabled : onlyEnableStatus ,
85
94
step : 1 ,
86
95
} ,
87
96
{
88
97
label : "Resource Type" ,
89
98
type : FORM_FIELD_TYPE . SELECT ,
90
99
name : "resourceType" ,
100
+ disabled : onlyEnableStatus ,
91
101
selectOptions : RESOURCE_TYPE_OPTIONS ,
92
102
} ,
93
103
{
94
104
label : "Resource Rate Frequency" ,
95
105
type : FORM_FIELD_TYPE . SELECT ,
96
106
name : "rateType" ,
107
+ disabled : onlyEnableStatus ,
97
108
selectOptions : RATE_TYPE_OPTIONS ,
98
109
} ,
99
110
{
100
111
label : "Workload" ,
101
112
type : FORM_FIELD_TYPE . SELECT ,
102
113
name : "workload" ,
114
+ disabled : onlyEnableStatus ,
103
115
selectOptions : WORKLOAD_OPTIONS ,
104
116
} ,
105
117
{
0 commit comments