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
8eccd40a
Commit
8eccd40a
authored
Oct 12, 2023
by
Riri Novita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Parameter Threshold
parent
2d79f5b9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
237 additions
and
110 deletions
+237
-110
CreateParameter.js
src/container/MasterData/Parameter/CreateParameter.js
+237
-110
No files found.
src/container/MasterData/Parameter/CreateParameter.js
View file @
8eccd40a
...
...
@@ -16,6 +16,7 @@ export default class CreateParameter extends Component {
enableParameter
:
false
,
enableReportName
:
false
,
enableFormat
:
false
,
enableThreshold
:
false
,
id
:
''
,
description
:
''
,
value
:
''
,
...
...
@@ -32,8 +33,10 @@ export default class CreateParameter extends Component {
perusahaan
:
null
,
reportName
:
null
,
formatCurrency
:
null
,
thresholdCurrency
:
null
,
getReportName
:
null
,
getFormatData
:
null
,
getThresholdCurrency
:
null
,
getPerusahaan
:
null
,
parameter
:
null
,
getParameter
:
null
,
...
...
@@ -45,6 +48,7 @@ export default class CreateParameter extends Component {
errorDeskripsi
:
false
,
errorReportName
:
false
,
errorFormatValue
:
false
,
errorThresholdCurrency
:
false
,
errorValue
:
false
,
errorMinValue
:
false
,
errorOrder
:
false
,
...
...
@@ -59,6 +63,7 @@ export default class CreateParameter extends Component {
msgErrorDeskripsi
:
''
,
msgErrorReportName
:
''
,
msgErrorFormatValue
:
''
,
msgErrorThresholdCurrency
:
''
,
msgErrorValue
:
''
,
msgErrorMinValue
:
''
,
msgErrorOrder
:
''
,
...
...
@@ -87,6 +92,7 @@ export default class CreateParameter extends Component {
this
.
getDataPerusahaan
()
this
.
getDataReportName
()
this
.
getDataFormat
()
this
.
getDataCurrencyThreshold
()
}
}
...
...
@@ -107,6 +113,7 @@ export default class CreateParameter extends Component {
getTypeReportID
:
data
.
setting_type_id
,
enableReportName
:
data
.
setting_group
===
"CURRENCY"
?
true
:
false
,
enableFormat
:
data
.
setting_group
===
"CURRENCY_MONEY_FORMAT"
?
true
:
false
,
enableThreshold
:
data
.
setting_group
===
"THRESHOLD_CONTROL"
?
true
:
false
,
tesValue
:
response
.
data
.
data
.
setting_group
===
"CURRENCY"
?
Number
(
response
.
data
.
data
.
value
)
*
1000
:
response
.
data
.
data
.
value
},
()
=>
{
...
...
@@ -114,6 +121,7 @@ export default class CreateParameter extends Component {
this
.
getPerusahaan
()
this
.
getReport
()
this
.
getFormat
()
this
.
getCurrencyByThreshold
()
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
...
...
@@ -289,6 +297,44 @@ export default class CreateParameter extends Component {
})
}
getCurrencyByThreshold
()
{
api
.
create
().
getFormatValue
().
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
currencyData
=
data
.
map
((
item
)
=>
{
return
{
setting_type_id
:
item
.
setting_type_id
,
setting_type_name
:
item
.
setting_type_name
}
})
let
index
=
currencyData
.
findIndex
((
val
)
=>
val
.
setting_type_id
==
this
.
state
.
tempData
.
reference_id
)
let
currencyProps
=
{
options
:
currencyData
,
getOptionLabel
:
(
option
)
=>
option
.
setting_type_name
,
};
this
.
setState
({
thresholdCurrency
:
currencyProps
,
currencyData
:
response
.
data
.
data
,
getThresholdCurrency
:
index
==
-
1
?
currencyData
[
0
]
:
currencyData
[
index
]
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
getDataGroup
()
{
api
.
create
().
getAllGroup
().
then
((
response
)
=>
{
if
(
response
.
data
)
{
...
...
@@ -367,11 +413,13 @@ export default class CreateParameter extends Component {
getParameterByGroup
(
id
,
name
)
{
if
(
name
===
"CURRENCY"
)
{
this
.
setState
({
enableReportName
:
true
,
enableFormat
:
false
})
this
.
setState
({
enableReportName
:
true
,
enableFormat
:
false
,
enableThreshold
:
false
})
}
else
if
(
name
===
"CURRENCY_MONEY_FORMAT"
)
{
this
.
setState
({
enableFormat
:
true
,
enableReportName
:
false
})
this
.
setState
({
enableFormat
:
true
,
enableReportName
:
false
,
enableThreshold
:
false
})
}
else
if
(
name
===
"THRESHOLD_CONTROL"
)
{
this
.
setState
({
enableThreshold
:
true
,
enableFormat
:
false
,
enableReportName
:
false
})
}
else
{
this
.
setState
({
enableReportName
:
false
,
enableFormat
:
false
})
this
.
setState
({
enableReportName
:
false
,
enableFormat
:
false
,
enableThreshold
:
false
})
}
api
.
create
().
getParameterByGroup
(
id
).
then
(
response
=>
{
// console.log(id, response);
...
...
@@ -512,6 +560,43 @@ export default class CreateParameter extends Component {
})
}
getDataCurrencyThreshold
()
{
api
.
create
().
getFormatValue
().
then
((
response
)
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
currencyData
=
data
.
map
((
item
)
=>
{
return
{
setting_type_id
:
item
.
setting_type_id
,
setting_type_name
:
item
.
setting_type_name
}
})
let
currencyProps
=
{
options
:
currencyData
,
getOptionLabel
:
(
option
)
=>
option
.
setting_type_name
,
};
this
.
setState
({
thresholdCurrency
:
currencyProps
,
currencyData
:
response
.
data
.
data
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
handleChange
(
e
,
type
)
{
let
data
=
this
.
state
let
isDate
=
type
!==
''
?
true
:
false
...
...
@@ -686,14 +771,14 @@ export default class CreateParameter extends Component {
async
validasiValueResponse
()
{
let
data
=
await
this
.
validasiValueData
()
if
(
R
.
isNil
(
this
.
state
.
getTypes
))
{
}
else
{
}
else
{
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"REPORT_SUBMIT_PERIOD"
)
{
if
(
R
.
isEmpty
(
data
.
value
))
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
)){
}
else
{
if
(
this
.
state
.
getPerusahaan
.
company_name
==
"Default"
){
}
else
{
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Value Cannot be Empty'
})
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
))
{
}
else
{
if
(
this
.
state
.
getPerusahaan
.
company_name
==
"Default"
)
{
}
else
{
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Value Cannot be Empty'
})
}
}
}
else
{
...
...
@@ -701,7 +786,7 @@ export default class CreateParameter extends Component {
}
else
{
switch
(
this
.
state
.
getParameter
.
setting_type_name
)
{
case
"MASTER_BUDGET"
:
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : 2023'
})
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : 2023'
})
break
case
"MONTHLY_REPORT"
:
this
.
setState
({
...
...
@@ -710,43 +795,43 @@ export default class CreateParameter extends Component {
})
break
case
"OUTLOOK_Q1"
:
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : Q1 2023'
})
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : Q1 2023'
})
break
case
"OUTLOOK_Q2"
:
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : Q2 2023'
})
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : Q2 2023'
})
break
case
"OUTLOOK_Q3"
:
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : Q3 2023'
})
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : Q3 2023'
})
break
case
"OUTLOOK_PA"
:
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : 2023'
})
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : 2023'
})
break
default
:
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : 2023'
})
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : 2023'
})
}
}
}
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"CURRENCY"
)
{
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : 15000'
})
this
.
setState
({
errorValue
:
true
,
msgErrorValue
:
'Incorrect value format, example : 15000'
})
}
}
}
async
validasiCreateEdit
(){
async
validasiCreateEdit
()
{
let
data
=
await
this
.
validasiValueData
()
let
response
=
await
this
.
validasiRegexValue
()
let
minMaxValidasi
=
await
this
.
validasiMinMaxValue
()
console
.
log
(
"Masuk ke menu creat : "
+
R
.
isNil
(
this
.
state
.
getFormatData
))
if
(
this
.
props
.
type
===
"edit"
){
if
(
this
.
props
.
type
===
"edit"
)
{
if
(
R
.
isNil
(
this
.
state
.
getTypes
))
{
}
else
{
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"CURRENCY_MONEY_FORMAT"
)
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
)){
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
)){
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getFormatData
)){
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
))
{
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
))
{
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getFormatData
))
{
}
else
{
this
.
updateParameterCurrebcyMoneyFormat
()
}
}
...
...
@@ -759,7 +844,7 @@ export default class CreateParameter extends Component {
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
(
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
)
{
...
...
@@ -771,7 +856,7 @@ export default class CreateParameter extends Component {
}
}
}
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"THRESHOLD_VARIANCE"
||
this
.
state
.
getTypes
.
setting_group_name
==
"THRESHOLD_CONTROL"
)
{
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"THRESHOLD_VARIANCE"
||
this
.
state
.
getTypes
.
setting_group_name
==
"THRESHOLD_CONTROL"
)
{
if
(
R
.
isEmpty
(
data
.
minValue
))
{
}
else
{
if
(
data
.
minValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
minValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
minValue
.
length
<=
minMaxValidasi
.
minLength
)
{
...
...
@@ -785,10 +870,10 @@ export default class CreateParameter extends Component {
}
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"REPORT_SUBMIT_PERIOD"
)
{
if
(
R
.
isEmpty
(
data
.
value
))
{
if
(
this
.
state
.
getPerusahaan
.
company_name
==
"Default"
){
if
(
this
.
state
.
getPerusahaan
.
company_name
==
"Default"
)
{
if
(
R
.
isEmpty
(
data
.
minValue
))
{
}
else
{
if
(
data
.
minValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
minValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
minValue
.
length
<=
minMaxValidasi
.
minLength
)
{
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
)
{
...
...
@@ -802,7 +887,7 @@ export default class CreateParameter extends Component {
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
(
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
)
{
...
...
@@ -813,27 +898,27 @@ export default class CreateParameter extends Component {
}
}
}
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
)){
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
)){
}
else
{
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
))
{
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
))
{
}
else
{
this
.
updateParameter
()
}
}
}
}
}
else
{
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getTypes
))
{
}
else
{
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"CURRENCY_MONEY_FORMAT"
)
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
)){
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
)){
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
))
{
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
))
{
}
else
{
console
.
log
()
if
(
R
.
isNil
(
this
.
state
.
getFormatData
)){
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getFormatData
))
{
}
else
{
this
.
createParameterCurrebcyMoneyFormat
()
}
}
...
...
@@ -858,7 +943,7 @@ export default class CreateParameter extends Component {
}
}
}
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"THRESHOLD_VARIANCE"
||
this
.
state
.
getTypes
.
setting_group_name
==
"THRESHOLD_CONTROL"
)
{
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"THRESHOLD_VARIANCE"
||
this
.
state
.
getTypes
.
setting_group_name
==
"THRESHOLD_CONTROL"
)
{
if
(
R
.
isEmpty
(
data
.
minValue
))
{
}
else
{
if
(
data
.
minValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
minValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
minValue
.
length
<=
minMaxValidasi
.
minLength
)
{
...
...
@@ -872,13 +957,13 @@ export default class CreateParameter extends Component {
}
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"REPORT_SUBMIT_PERIOD"
)
{
if
(
R
.
isEmpty
(
data
.
value
))
{
if
(
this
.
state
.
getPerusahaan
.
company_name
==
"Default"
){
if
(
this
.
state
.
getPerusahaan
.
company_name
==
"Default"
)
{
if
(
R
.
isEmpty
(
data
.
minValue
))
{
}
else
{
if
(
data
.
minValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
minValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
minValue
.
length
<=
minMaxValidasi
.
minLength
)
{
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
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
maxValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
maxValue
.
length
<=
minMaxValidasi
.
maxLength
)
{
this
.
createParameter
()
}
}
...
...
@@ -889,10 +974,10 @@ export default class CreateParameter extends Component {
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
(
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
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
maxValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
maxValue
.
length
<=
minMaxValidasi
.
maxLength
)
{
this
.
createParameter
()
}
}
...
...
@@ -900,11 +985,11 @@ export default class CreateParameter extends Component {
}
}
}
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
)){
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
)){
}
else
{
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
))
{
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
))
{
}
else
{
this
.
createParameter
()
}
}
...
...
@@ -913,11 +998,11 @@ export default class CreateParameter extends Component {
}
}
validasiFormatResponse
(){
if
(
R
.
isNil
(
this
.
state
.
getTypes
)){
}
else
{
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"CURRENCY_MONEY_FORMAT"
){
if
(
R
.
isNil
(
this
.
state
.
getFormatData
)){
validasiFormatResponse
()
{
if
(
R
.
isNil
(
this
.
state
.
getTypes
))
{
}
else
{
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"CURRENCY_MONEY_FORMAT"
)
{
if
(
R
.
isNil
(
this
.
state
.
getFormatData
))
{
this
.
setState
({
errorFormatValue
:
true
,
msgErrorFormatValue
:
'Format Cannot be Empty'
})
}
}
...
...
@@ -926,12 +1011,12 @@ export default class CreateParameter extends Component {
validasiRegexValue
()
{
let
obj
=
null
if
(
R
.
isNil
(
this
.
state
.
getTypes
)){
if
(
R
.
isNil
(
this
.
state
.
getTypes
))
{
obj
=
{
regexValue
:
""
,
valueLength
:
""
}
}
else
{
if
(
this
.
state
.
getTypes
.
setting_group_name
===
"CURRENCY"
){
}
else
{
if
(
this
.
state
.
getTypes
.
setting_group_name
===
"CURRENCY"
)
{
obj
=
{
regexValue
:
(
/
\d
+
(\.\d
+
)?
/
),
valueLength
:
20
}
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
===
"REPORT_SUBMIT_PERIOD"
){
}
else
if
(
this
.
state
.
getTypes
.
setting_group_name
===
"REPORT_SUBMIT_PERIOD"
)
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
))
{
obj
=
{
regexValue
:
(
/
\b\d{4}\b
/
),
valueLength
:
4
}
}
else
{
...
...
@@ -1029,16 +1114,16 @@ export default class CreateParameter extends Component {
}
else
{
switch
(
this
.
state
.
getTypes
.
setting_group_name
)
{
case
"CURRENCY"
:
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
,
regexValue
:
(
/^
\d
+$/
)}
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
,
regexValue
:
(
/^
\d
+$/
)
}
break
case
"REPORT_SUBMIT_PERIOD"
:
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
)){
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
))
{
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
}
}
else
{
if
(
this
.
state
.
getPerusahaan
.
company_name
==
"Default"
){
}
else
{
if
(
this
.
state
.
getPerusahaan
.
company_name
==
"Default"
)
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
))
{
obj
=
{
minMaxRegex
:
(
/
\b\d{1,2}\s(
Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
)\s\d{4}\b
/
),
...
...
@@ -1089,7 +1174,7 @@ export default class CreateParameter extends Component {
}
}
}
}
else
{
}
else
{
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
...
...
@@ -1107,12 +1192,12 @@ export default class CreateParameter extends Component {
return
obj
;
}
validasiValueData
(){
validasiValueData
()
{
let
obj
=
null
if
(
this
.
props
.
type
===
"edit"
){
obj
=
{
value
:
this
.
state
.
tempData
.
value
.
toString
(),
minValue
:
this
.
state
.
tempData
.
min_value
,
maxValue
:
this
.
state
.
tempData
.
max_value
,
endDate
:
this
.
state
.
tempData
.
end_date
,
startDate
:
this
.
state
.
tempData
.
start_date
}
}
else
{
obj
=
{
value
:
this
.
state
.
value
,
minValue
:
this
.
state
.
minValue
,
maxValue
:
this
.
state
.
maxValue
,
endDate
:
this
.
state
.
endDate
,
startDate
:
this
.
state
.
startDate
}
if
(
this
.
props
.
type
===
"edit"
)
{
obj
=
{
value
:
this
.
state
.
tempData
.
value
.
toString
(),
minValue
:
this
.
state
.
tempData
.
min_value
,
maxValue
:
this
.
state
.
tempData
.
max_value
,
endDate
:
this
.
state
.
tempData
.
end_date
,
startDate
:
this
.
state
.
tempData
.
start_date
}
}
else
{
obj
=
{
value
:
this
.
state
.
value
,
minValue
:
this
.
state
.
minValue
,
maxValue
:
this
.
state
.
maxValue
,
endDate
:
this
.
state
.
endDate
,
startDate
:
this
.
state
.
startDate
}
}
return
obj
;
}
...
...
@@ -1131,7 +1216,7 @@ export default class CreateParameter extends Component {
}
validasiFormatData
()
{
if
(
R
.
isNil
(
this
.
state
.
getFormatData
)){
if
(
R
.
isNil
(
this
.
state
.
getFormatData
))
{
this
.
validasiFormatResponse
()
this
.
validasiMaxValue
()
}
else
{
...
...
@@ -1146,7 +1231,7 @@ export default class CreateParameter extends Component {
this
.
validasiMinResponse
()
this
.
validasiFormatData
()
}
else
{
if
(
data
.
minValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
minValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
minValue
.
length
<=
minMaxValidasi
.
minLength
)
{
if
(
data
.
minValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
minValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
minValue
.
length
<=
minMaxValidasi
.
minLength
)
{
this
.
validasiFormatData
()
}
else
{
this
.
validasiMinResponse
()
...
...
@@ -1155,55 +1240,55 @@ export default class CreateParameter extends Component {
}
}
async
validasiValue
()
{
async
validasiValue
()
{
let
data
=
await
this
.
validasiValueData
()
let
response
=
await
this
.
validasiRegexValue
()
if
(
R
.
isEmpty
(
data
.
value
)){
if
(
R
.
isEmpty
(
data
.
value
))
{
this
.
validasiValueResponse
()
this
.
validsiMinValue
()
}
else
{
if
(
data
.
value
.
match
(
response
.
regexValue
)
&&
data
.
value
.
length
<=
response
.
valueLength
){
}
else
{
if
(
data
.
value
.
match
(
response
.
regexValue
)
&&
data
.
value
.
length
<=
response
.
valueLength
)
{
this
.
validsiMinValue
()
}
else
{
}
else
{
this
.
validasiValueResponse
()
this
.
validsiMinValue
()
}
}
}
validasiReportName
(){
if
(
R
.
isNil
(
this
.
state
.
getReportName
)){
validasiReportName
()
{
if
(
R
.
isNil
(
this
.
state
.
getReportName
))
{
this
.
setState
({
errorReportName
:
true
,
msgErrorReportName
:
'Report Cannot be Empty'
})
this
.
validasiValue
()
}
else
{
}
else
{
this
.
validasiValue
()
}
}
validasiPerusahaan
(){
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
)){
validasiPerusahaan
()
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
))
{
this
.
setState
({
errorPerusahaan
:
true
,
msgErrorPerusahaan
:
'Company Cannot be Empty'
})
this
.
validasiReportName
()
}
else
{
}
else
{
this
.
validasiReportName
()
this
.
validasiCreateEdit
()
}
}
validasiParameter
(){
if
(
R
.
isNil
(
this
.
state
.
getParameter
))
{
validasiParameter
()
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
))
{
this
.
setState
({
errorParameter
:
true
,
msgErrorParameter
:
'Parameter Cannot be Empty'
})
this
.
validasiPerusahaan
()
}
else
{
}
else
{
this
.
validasiPerusahaan
()
}
}
validasiGroup
(){
validasiGroup
()
{
if
(
R
.
isNil
(
this
.
state
.
getTypes
))
{
this
.
setState
({
errorGroup
:
true
,
msgErrorGroup
:
'Group Cannot be Empty'
})
this
.
validasiParameter
()
}
else
{
}
else
{
this
.
validasiParameter
()
}
}
...
...
@@ -1307,9 +1392,9 @@ export default class CreateParameter extends Component {
}
openPopUp
()
{
if
(
!
R
.
isNil
(
this
.
state
.
getTypes
)){
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"CURRENCY"
){
if
(
!
R
.
isNil
(
this
.
state
.
getReportName
)){
if
(
!
R
.
isNil
(
this
.
state
.
getTypes
))
{
if
(
this
.
state
.
getTypes
.
setting_group_name
==
"CURRENCY"
)
{
if
(
!
R
.
isNil
(
this
.
state
.
getReportName
))
{
this
.
setState
({
visiblePopupInformation
:
true
})
...
...
@@ -1374,7 +1459,7 @@ export default class CreateParameter extends Component {
{...
this
.
state
.
types
}
debug
id
=
"tipe"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getTypes
:
newInputValue
},
()
=>
newInputValue
===
null
?
this
.
setState
({
enableParameter
:
false
,
enableReportName
:
false
,
enableFormat
:
false
,
getParameter
:
null
,
getReportName
:
null
},
()
=>
this
.
clearMessage
())
:
this
.
getParameterByGroup
(
newInputValue
.
setting_group_id
,
newInputValue
.
setting_group_name
),
this
.
clearMessage
())}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getTypes
:
newInputValue
},
()
=>
newInputValue
===
null
?
this
.
setState
({
enableParameter
:
false
,
enableReportName
:
false
,
enableFormat
:
false
,
enableThreshold
:
false
,
getParameter
:
null
,
getReportName
:
null
},
()
=>
this
.
clearMessage
())
:
this
.
getParameterByGroup
(
newInputValue
.
setting_group_id
,
newInputValue
.
setting_group_name
),
this
.
clearMessage
())}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
...
...
@@ -1578,6 +1663,27 @@ export default class CreateParameter extends Component {
/
>
<
/div
>
:
this
.
state
.
enableThreshold
==
true
?
<
div
className
=
""
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
{...
this
.
state
.
thresholdCurrency
}
debug
id
=
"report"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getThresholdCurrency
:
newInputValue
},
()
=>
this
.
clearMessage
())}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
label
=
"Currency"
error
=
{
this
.
state
.
errorThresholdCurrency
}
helperText
=
{
this
.
state
.
msgErrorThresholdCurrency
}
/>
}
value
=
{
this
.
state
.
getThresholdCurrency
}
/
>
<
/div
>
:
null
}
{
/* {this.state.enableFormat == true ?
...
...
@@ -1863,7 +1969,7 @@ export default class CreateParameter extends Component {
{...
this
.
state
.
types
}
debug
id
=
"tipe"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getTypes
:
newInputValue
},
()
=>
newInputValue
===
null
?
this
.
setState
({
enableParameter
:
false
,
enableReportName
:
false
,
enableFormat
:
false
,
getParameter
:
null
,
getReportName
:
null
},
()
=>
this
.
clearMessage
())
:
this
.
getParameterByGroup
(
newInputValue
.
setting_group_id
,
newInputValue
.
setting_group_name
),
this
.
clearMessage
())}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getTypes
:
newInputValue
},
()
=>
newInputValue
===
null
?
this
.
setState
({
enableParameter
:
false
,
enableReportName
:
false
,
enableFormat
:
false
,
enableThreshold
:
false
,
getParameter
:
null
,
getReportName
:
null
},
()
=>
this
.
clearMessage
())
:
this
.
getParameterByGroup
(
newInputValue
.
setting_group_id
,
newInputValue
.
setting_group_name
),
this
.
clearMessage
())}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
...
...
@@ -2026,7 +2132,8 @@ export default class CreateParameter extends Component {
id
=
"report"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getReportName
:
newInputValue
},
()
=>
{
this
.
clearMessage
()
this
.
openPopUp
()})}
this
.
openPopUp
()
})}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
...
...
@@ -2060,6 +2167,26 @@ export default class CreateParameter extends Component {
/
>
<
/div
>
:
this
.
state
.
enableThreshold
==
true
?
<
div
className
=
""
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
{...
this
.
state
.
thresholdCurrency
}
debug
id
=
"report"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getThresholdCurrency
:
newInputValue
},
()
=>
this
.
clearMessage
())}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
label
=
"Currency"
error
=
{
this
.
state
.
errorThresholdCurrency
}
helperText
=
{
this
.
state
.
msgErrorThresholdCurrency
}
/>
}
value
=
{
this
.
state
.
getThresholdCurrency
}
/
>
<
/div
>
:
null
}
...
...
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