Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dida Adams Arizona
Tia-dev
Commits
e239116b
Commit
e239116b
authored
Jan 22, 2024
by
fahrur huzain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parameter day off validasi
parent
7543c078
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
CreateParameter.js
src/container/MasterData/Parameter/CreateParameter.js
+62
-0
No files found.
src/container/MasterData/Parameter/CreateParameter.js
View file @
e239116b
...
...
@@ -821,6 +821,8 @@ export default class CreateParameter extends Component {
}
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"CURRENCY"
)
{
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : 15000'
})
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"DAY_OFF"
)
{
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : 2023'
})
}
}
}
...
...
@@ -906,6 +908,28 @@ export default class CreateParameter extends Component {
}
}
}
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"DAY_OFF"
){
console
.
log
(
this
.
state
.
errorMaxValue
)
if
(
R
.
isEmpty
(
data
.
value
))
{
}
else
{
if
(
data
.
value
.
match
(
response
.
regexValue
)
&&
data
.
value
.
length
<=
response
.
valueLength
)
{
if
(
R
.
isEmpty
(
data
.
minValue
))
{
}
else
{
if
(
data
.
minValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
minValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
minValue
.
length
<=
minMaxValidasi
.
minLength
)
{
if
(
R
.
isEmpty
(
data
.
maxValue
))
{
}
else
{
if
(
data
.
maxValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
maxValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
maxValue
.
length
<=
minMaxValidasi
.
maxLength
)
{
if
(
data
.
maxValue
.
slice
(
-
4
)
==
data
.
value
){
this
.
updateParameter
()
}
else
{
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, value must same with a year of max value'
})
}
}
}
}
}
}
}
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
))
{
}
else
{
...
...
@@ -993,6 +1017,28 @@ export default class CreateParameter extends Component {
}
}
}
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"DAY_OFF"
){
console
.
log
(
this
.
state
.
errorMaxValue
)
if
(
R
.
isEmpty
(
data
.
value
))
{
}
else
{
if
(
data
.
value
.
match
(
response
.
regexValue
)
&&
data
.
value
.
length
<=
response
.
valueLength
)
{
if
(
R
.
isEmpty
(
data
.
minValue
))
{
}
else
{
if
(
data
.
minValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
minValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
minValue
.
length
<=
minMaxValidasi
.
minLength
)
{
if
(
R
.
isEmpty
(
data
.
maxValue
))
{
}
else
{
if
(
data
.
maxValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
maxValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
maxValue
.
length
<=
minMaxValidasi
.
maxLength
)
{
if
(
data
.
maxValue
.
slice
(
-
4
)
==
data
.
value
){
this
.
createParameter
()
}
else
{
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, value must same with a year of max value'
})
}
}
}
}
}
}
}
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
))
{
}
else
{
...
...
@@ -1054,6 +1100,8 @@ export default class CreateParameter extends Component {
obj
=
{
regexValue
:
(
/Q1
\s\d{4}
/
),
valueLength
:
7
}
}
}
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
===
"DAY_OFF"
){
obj
=
{
regexValue
:
(
/
\b\d{4}\b
/
),
valueLength
:
4
}
}
else
{
obj
=
{
regexValue
:
(
/null.*$/
),
valueLength
:
20
}
}
...
...
@@ -1083,6 +1131,12 @@ export default class CreateParameter extends Component {
case
"THRESHOLD_VARIANCE"
:
this
.
setState
({
errorMaxValue
:
true
,
msgErrorMaxValue
:
'Incorrect max value format, example : 99999999'
})
break
case
"DAY_OFF"
:
this
.
setState
({
errorMaxValue
:
true
,
msgErrorMaxValue
:
'Incorrect max value format, example : 31 Jan 2023'
})
break
default
:
this
.
setState
({
errorMaxValue
:
false
,
msgErrorMaxValue
:
''
})
}
...
...
@@ -1111,6 +1165,9 @@ export default class CreateParameter extends Component {
case
"THRESHOLD_VARIANCE"
:
this
.
setState
({
errorMinValue
:
true
,
msgErrorMinValue
:
'Incorrect min value format, example : -99999999'
})
break
case
"DAY_OFF"
:
this
.
setState
({
errorMinValue
:
true
,
msgErrorMinValue
:
'Incorrect min value format, example : 1 Jan 2023'
})
break
default
:
this
.
setState
({
errorMinValue
:
false
,
msgErrorMinValue
:
''
})
}
...
...
@@ -1195,6 +1252,11 @@ export default class CreateParameter extends Component {
case
"THRESHOLD_CONTROL"
:
obj
=
{
minMaxRegex
:
(
/^-
?\d
+
(\.\d
+
)?
$/
),
minLength
:
this
.
state
.
minValue
.
length
,
maxLength
:
this
.
state
.
maxValue
.
length
}
break
case
"DAY_OFF"
:
obj
=
{
minMaxRegex
:
(
/
\b\d{1,2}\s(
Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
)\s\d{4}\b
/
),
minLength
:
11
,
maxLength
:
11
}
default
:
obj
=
{
regexValue
:
null
,
minLength
:
11
,
maxLength
:
11
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment