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
c3ca8e19
Commit
c3ca8e19
authored
Sep 03, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
validasi value parameter
parent
39c75b90
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
CreateParameter.js
src/container/MasterData/Parameter/CreateParameter.js
+22
-22
No files found.
src/container/MasterData/Parameter/CreateParameter.js
View file @
c3ca8e19
...
...
@@ -15,10 +15,10 @@ export default class CreateParameter extends Component {
enableParameter
:
false
,
id
:
''
,
description
:
''
,
value
:
null
,
value
:
''
,
order
:
null
,
minValue
:
null
,
maxValue
:
null
,
minValue
:
''
,
maxValue
:
''
,
startDate
:
''
,
endDate
:
null
,
date
:
new
Date
(),
...
...
@@ -82,13 +82,12 @@ export default class CreateParameter extends Component {
let
data
=
response
.
data
.
data
this
.
setState
({
tempData
:
response
.
data
.
data
,
getSettingGroupID
:
data
.
setting_group_id
,
getSettingGroupID
:
response
.
data
.
data
.
setting_group_id
,
getCompanyID
:
data
.
company_id
,
settingType
:
data
.
setting_type
,
},
()
=>
{
this
.
getAllGroup
()
this
.
getPerusahaan
()
this
.
getParameterByGroup
(
data
.
setting_group_id
)
console
.
log
(
this
.
state
.
tempData
)
})
}
else
{
...
...
@@ -128,7 +127,8 @@ export default class CreateParameter extends Component {
options
:
typeData
,
getOptionLabel
:
(
option
)
=>
option
.
setting_group_name
,
};
this
.
setState
({
types
:
typeProps
,
typeData
:
response
.
data
.
data
,
getTypes
:
index
==
-
1
?
typeData
[
0
]
:
typeData
[
index
]
})
this
.
setState
({
types
:
typeProps
,
typeData
:
response
.
data
.
data
,
getTypes
:
index
==
-
1
?
typeData
[
0
]
:
typeData
[
index
]
},
()
=>
{
this
.
getParameterByGroup
(
this
.
state
.
getTypes
.
setting_group_id
)})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
...
...
@@ -267,7 +267,7 @@ export default class CreateParameter extends Component {
getParameterByGroup
(
id
)
{
api
.
create
().
getParameterByGroup
(
id
).
then
(
response
=>
{
console
.
log
(
response
);
console
.
log
(
id
,
response
);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
...
...
@@ -432,15 +432,15 @@ export default class CreateParameter extends Component {
this
.
setState
({
errorPerusahaan
:
true
,
msgErrorPerusahaan
:
'Company Cannot be Empty.'
})
// } else if (R.isEmpty(this.state.tempData.description)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
// } else if (R.isEmpty(this.state.tempData.
value)) {
//
this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' })
}
else
if
((
!
R
.
is
Nil
(
this
.
state
.
tempData
.
max_value
)
&&
R
.
isNil
(
this
.
state
.
tempData
.
min_value
))
||
(
!
R
.
is
Empty
(
this
.
state
.
tempData
.
max_value
)
&&
R
.
isEmpty
(
this
.
state
.
tempData
.
min_value
)))
{
}
else
if
(
R
.
isEmpty
(
this
.
state
.
tempData
.
value
)
&&
R
.
isEmpty
(
this
.
state
.
tempData
.
min_value
)
&&
R
.
isEmpty
(
this
.
state
.
tempData
.
max_
value
))
{
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Value tidak boleh kosong'
})
}
else
if
((
!
R
.
isEmpty
(
this
.
state
.
tempData
.
max_value
)
&&
R
.
isEmpty
(
this
.
state
.
tempData
.
min_value
)))
{
this
.
setState
({
errorMinValue
:
true
,
msgErrorMinValue
:
'Min Value Cannot be Empty.'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
start_date
))
{
this
.
setState
({
errorStartDate
:
true
,
msgErrorStartDate
:
'Valid From Cannot be Empty.'
})
// } else if (R.isNil(this.state.tempData.order)) {
// this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
}
else
if
((
!
R
.
is
Nil
(
this
.
state
.
tempData
.
min_value
)
&&
R
.
isNil
(
this
.
state
.
tempData
.
max_value
))
||
(
!
R
.
is
Empty
(
this
.
state
.
tempData
.
min_value
)
&&
R
.
isEmpty
(
this
.
state
.
tempData
.
max_value
)))
{
}
else
if
((
!
R
.
isEmpty
(
this
.
state
.
tempData
.
min_value
)
&&
R
.
isEmpty
(
this
.
state
.
tempData
.
max_value
)))
{
this
.
setState
({
errorMaxValue
:
true
,
msgErrorMaxValue
:
'Max Value Cannot be Empty.'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
end_date
))
{
this
.
setState
({
errorEndDate
:
true
,
msgErrorEndDate
:
'Valid To Cannot be Empty.'
})
...
...
@@ -458,15 +458,15 @@ export default class CreateParameter extends Component {
this
.
setState
({
errorPerusahaan
:
true
,
msgErrorPerusahaan
:
'Company Cannot be Empty.'
})
// } else if (R.isEmpty(this.state.description)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
// } else if (R.isNil(this.state.value
)) {
//
this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' })
}
else
if
((
!
R
.
is
Nil
(
this
.
state
.
maxValue
)
&&
R
.
isNil
(
this
.
state
.
minValue
))
||
(
!
R
.
isNil
(
this
.
state
.
maxValue
)
&&
R
.
isEmpty
(
this
.
state
.
minValue
)))
{
}
else
if
((
R
.
isEmpty
(
this
.
state
.
value
)
&&
R
.
isEmpty
(
this
.
state
.
maxValue
)
&&
R
.
isEmpty
(
this
.
state
.
minValue
)
))
{
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Value tidak boleh kosong'
})
}
else
if
((
!
R
.
is
Empty
(
this
.
state
.
maxValue
)
&&
R
.
isEmpty
(
this
.
state
.
minValue
)))
{
this
.
setState
({
errorMinValue
:
true
,
msgErrorMinValue
:
'Min Value Cannot be Empty.'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
startDate
))
{
this
.
setState
({
errorStartDate
:
true
,
msgErrorStartDate
:
'Valid From Cannot be Empty.'
})
// } else if (R.isNil(this.state.order)) {
// this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
}
else
if
((
!
R
.
is
Nil
(
this
.
state
.
minValue
)
&&
R
.
isNil
(
this
.
state
.
maxValue
))
||
(
!
R
.
isNil
(
this
.
state
.
minValue
)
&&
R
.
isEmpty
(
this
.
state
.
maxValue
)))
{
}
else
if
((
!
R
.
is
Empty
(
this
.
state
.
minValue
)
&&
R
.
isEmpty
(
this
.
state
.
maxValue
)))
{
this
.
setState
({
errorMaxValue
:
true
,
msgErrorMaxValue
:
'Max Value Cannot be Empty.'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
endDate
))
{
this
.
setState
({
errorEndDate
:
true
,
msgErrorEndDate
:
'Valid To Cannot be Empty.'
})
...
...
@@ -632,8 +632,8 @@ export default class CreateParameter extends Component {
}
// this.handleChange(coba, 'value')}
}
//
error={this.state.errorValue}
//
helperText={this.state.msgErrorValue}
error
=
{
this
.
state
.
errorValue
}
helperText
=
{
this
.
state
.
msgErrorValue
}
>
<
/TextField
>
<
/div
>
...
...
@@ -990,7 +990,7 @@ export default class CreateParameter extends Component {
style
=
{{
width
:
'100%'
}}
id
=
"value"
label
=
"Value"
value
=
{
this
.
state
.
value
===
null
?
''
:
this
.
state
.
value
}
value
=
{
this
.
state
.
value
}
inputProps
=
{{
min
:
0
,
style
:
{
...
...
@@ -1014,8 +1014,8 @@ export default class CreateParameter extends Component {
}
// this.handleChange(coba, 'value')}
}
//
error={this.state.errorValue}
//
helperText={this.state.msgErrorValue}
error
=
{
this
.
state
.
errorValue
}
helperText
=
{
this
.
state
.
msgErrorValue
}
>
<
/TextField
>
<
/div
>
...
...
@@ -1024,7 +1024,7 @@ export default class CreateParameter extends Component {
style
=
{{
width
:
'100%'
}}
id
=
"min_value"
label
=
"Min Value"
value
=
{
this
.
state
.
minValue
===
null
?
''
:
this
.
state
.
minValue
}
value
=
{
this
.
state
.
minValue
}
inputProps
=
{{
min
:
0
,
style
:
{
...
...
@@ -1183,7 +1183,7 @@ export default class CreateParameter extends Component {
style
=
{{
width
:
'100%'
}}
id
=
"max_value"
label
=
"Max Value"
value
=
{
this
.
state
.
maxValue
===
null
?
''
:
this
.
state
.
maxValue
}
value
=
{
this
.
state
.
maxValue
}
inputProps
=
{{
min
:
0
,
style
:
{
...
...
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