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
5bd11c52
Commit
5bd11c52
authored
Oct 16, 2023
by
Riri Novita
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ENV-DEV' into 'ENV-STAGING'
Update Parameter See merge request
!2069
parents
82b1f8fd
cfb3808c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
331 additions
and
105 deletions
+331
-105
index.js
src/api/index.js
+2
-0
CreateParameter.js
src/container/MasterData/Parameter/CreateParameter.js
+329
-105
No files found.
src/api/index.js
View file @
5bd11c52
...
...
@@ -190,6 +190,7 @@ const create = (type = "") => {
const
deleteParameter
=
(
id
)
=>
api
.
post
(
`setting/delete_setting/
${
id
}
`
)
const
getDataReport
=
()
=>
api
.
get
(
'setting_type/get_all_setting_type_by_report_submit_period_group'
)
const
getFormatValue
=
()
=>
api
.
get
(
'setting_type/get_all_setting_type_by_money_format_group'
)
const
getThreshold
=
()
=>
api
.
get
(
'/setting_type/get_all_setting_type_by_threshold_control'
)
// MASTER DATA - CAT
const
getAllMasterDataCat
=
()
=>
api
.
get
(
'item_report_company/get_all_item_report_company'
)
...
...
@@ -651,6 +652,7 @@ const create = (type = "") => {
deleteParameter
,
getDataReport
,
getFormatValue
,
getThreshold
,
deletePerusahaan
,
getDataCurrency
,
deleteReportItems
,
...
...
src/container/MasterData/Parameter/CreateParameter.js
View file @
5bd11c52
...
...
@@ -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
().
getThreshold
().
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
().
getThreshold
().
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
...
...
@@ -530,6 +615,8 @@ export default class CreateParameter extends Component {
errorEndDate
:
false
,
errorGroup
:
false
,
errorPerusahaan
:
false
,
errorThresholdCurrency
:
false
,
msgErrorThresholdCurrency
:
''
,
msgErrorPerusahaan
:
''
,
msgErrorGroup
:
''
,
msgErrorParameter
:
''
,
...
...
@@ -558,6 +645,8 @@ export default class CreateParameter extends Component {
errorEndDate
:
false
,
errorGroup
:
false
,
errorPerusahaan
:
false
,
errorThresholdCurrency
:
false
,
msgErrorThresholdCurrency
:
''
,
msgErrorPerusahaan
:
''
,
msgErrorGroup
:
''
,
msgErrorParameter
:
''
,
...
...
@@ -587,6 +676,8 @@ export default class CreateParameter extends Component {
errorEndDate
:
false
,
errorGroup
:
false
,
errorPerusahaan
:
false
,
errorThresholdCurrency
:
false
,
msgErrorThresholdCurrency
:
''
,
msgErrorPerusahaan
:
''
,
msgErrorGroup
:
''
,
msgErrorParameter
:
''
,
...
...
@@ -617,6 +708,8 @@ export default class CreateParameter extends Component {
errorEndDate
:
false
,
errorGroup
:
false
,
errorPerusahaan
:
false
,
errorThresholdCurrency
:
false
,
msgErrorThresholdCurrency
:
''
,
msgErrorPerusahaan
:
''
,
msgErrorGroup
:
''
,
msgErrorParameter
:
''
,
...
...
@@ -683,18 +776,17 @@ 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
{
...
...
@@ -702,7 +794,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
({
...
...
@@ -711,43 +803,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
()
}
}
...
...
@@ -760,7 +852,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
)
{
...
...
@@ -772,7 +864,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
)
{
...
...
@@ -786,10 +878,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
)
{
...
...
@@ -803,7 +895,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
)
{
...
...
@@ -814,27 +906,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
()
}
}
...
...
@@ -859,7 +951,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
)
{
...
...
@@ -873,13 +965,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
()
}
}
...
...
@@ -890,10 +982,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
()
}
}
...
...
@@ -901,11 +993,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
()
}
}
...
...
@@ -914,11 +1006,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'
})
}
}
...
...
@@ -927,12 +1019,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
{
...
...
@@ -1030,16 +1122,76 @@ 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
))
{
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"
)
{
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
/
),
minLength
:
11
,
maxLength
:
11
}
}
else
{
switch
(
this
.
state
.
getParameter
.
setting_type_name
)
{
case
"MASTER_BUDGET"
:
obj
=
{
minMaxRegex
:
(
/^
(\d{1,2}\s(
Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
))(?:\s\d{4})?
$/
),
minLength
:
11
,
maxLength
:
11
}
break
case
"MONTHLY_REPORT"
:
obj
=
{
minMaxRegex
:
(
/^
(?:\d{1,2}
|
(\d{1,2}\s(
Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
)\s\d{4}))
$/
),
minLength
:
11
,
maxLength
:
11
}
break
case
"OUTLOOK_Q1"
:
obj
=
{
minMaxRegex
:
(
/^
(\d{1,2}\s(
Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
))(?:\s\d{4})?
$/
),
minLength
:
11
,
maxLength
:
11
}
break
case
"OUTLOOK_Q2"
:
obj
=
{
minMaxRegex
:
(
/^
(\d{1,2}\s(
Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
))(?:\s\d{4})?
$/
),
minLength
:
11
,
maxLength
:
11
}
break
case
"OUTLOOK_Q3"
:
obj
=
{
minMaxRegex
:
(
/^
(\d{1,2}\s(
Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
))(?:\s\d{4})?
$/
),
minLength
:
11
,
maxLength
:
11
}
break
case
"OUTLOOK_PA"
:
obj
=
{
minMaxRegex
:
(
/^
(\d{1,2}\s(
Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
))(?:\s\d{4})?
$/
),
minLength
:
11
,
maxLength
:
11
}
break
default
:
obj
=
{
minMaxRegex
:
(
/^
(\d{1,2}\s(
Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
))(?:\s\d{4})?
$/
),
minLength
:
11
,
maxLength
:
11
}
}
}
}
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
}
}
}
break
case
"THRESHOLD_CONTROL"
:
obj
=
{
minMaxRegex
:
(
/
^-
?\d
+
\.?\d
+
$/
),
minLength
:
this
.
state
.
minValue
.
length
,
maxLength
:
this
.
state
.
maxValue
.
length
}
obj
=
{
minMaxRegex
:
(
/
-
?\d
+
(\.?\d
+
)?
$/
),
minLength
:
this
.
state
.
minValue
.
length
,
maxLength
:
this
.
state
.
maxValue
.
length
}
break
default
:
obj
=
{
regexValue
:
null
,
minLength
:
11
,
maxLength
:
11
}
...
...
@@ -1048,31 +1200,52 @@ 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
;
}
validasiCurrencyTC
(){
console
.
log
(
this
.
state
.
getThresholdCurrency
)
console
.
log
(
this
.
state
.
errorThresholdCurrency
)
console
.
log
(
this
.
state
.
msgErrorThresholdCurrency
)
if
(
R
.
isNil
(
this
.
state
.
getThresholdCurrency
)){
this
.
setState
({
errorThresholdCurrency
:
true
,
msgErrorThresholdCurrency
:
'Currency Cannot be Empty'
})
}
}
async
validasiMaxValue
()
{
let
data
=
await
this
.
validasiValueData
()
let
minMaxValidasi
=
await
this
.
validasiMinMaxValue
()
if
(
R
.
isEmpty
(
data
.
maxValue
))
{
this
.
validasiMaxResponse
()
this
.
validasiCurrencyTC
()
}
else
{
if
(
data
.
maxValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
maxValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
maxValue
.
length
<=
minMaxValidasi
.
maxLength
)
{
if
(
R
.
isNil
(
this
.
state
.
getTypes
)){
if
(
data
.
maxValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
maxValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
maxValue
.
length
<=
minMaxValidasi
.
maxLength
)
{
this
.
validasiCurrencyTC
()
}
else
{
this
.
validasiMaxResponse
()
this
.
validasiCurrencyTC
()
}
}
else
{
if
(
data
.
maxValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
(
this
.
state
.
getTypes
.
setting_group_name
!=
"THRESHOLD_CONTROL"
?
data
.
maxValue
.
substring
(
0
,
1
)
!=
"0"
:
true
)
&&
data
.
maxValue
.
length
<=
minMaxValidasi
.
maxLength
)
{
this
.
validasiCurrencyTC
()
}
else
{
this
.
validasiMaxResponse
()
this
.
validasiCurrencyTC
()
}
}
}
}
validasiFormatData
()
{
if
(
R
.
isNil
(
this
.
state
.
getFormatData
)){
if
(
R
.
isNil
(
this
.
state
.
getFormatData
))
{
this
.
validasiFormatResponse
()
this
.
validasiMaxValue
()
}
else
{
...
...
@@ -1087,64 +1260,73 @@ export default class CreateParameter extends Component {
this
.
validasiMinResponse
()
this
.
validasiFormatData
()
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getTypes
)){
if
(
data
.
minValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
data
.
minValue
.
substring
(
0
,
1
)
!=
"0"
&&
data
.
minValue
.
length
<=
minMaxValidasi
.
minLength
){
this
.
validasiFormatData
()
}
else
{
this
.
validasiMinResponse
()
this
.
validasiFormatData
()
}
}
else
{
if
(
data
.
minValue
.
match
(
minMaxValidasi
.
minMaxRegex
)
&&
(
this
.
state
.
getTypes
.
setting_group_name
!=
"THRESHOLD_CONTROL"
?
data
.
minValue
.
substring
(
0
,
1
)
!=
"0"
:
true
)
&&
data
.
minValue
.
length
<=
minMaxValidasi
.
minLength
){
this
.
validasiFormatData
()
}
else
{
this
.
validasiMinResponse
()
this
.
validasiFormatData
()
}
}
}
}
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
()
}
}
...
...
@@ -1248,9 +1430,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
})
...
...
@@ -1315,7 +1497,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
}
...
...
@@ -1519,6 +1701,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 ?
...
...
@@ -1804,7 +2007,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
}
...
...
@@ -1967,7 +2170,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
}
...
...
@@ -2001,6 +2205,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