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
ef813eab
Commit
ef813eab
authored
Feb 24, 2021
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
87576ef4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
211 additions
and
193 deletions
+211
-193
CreateMasterDataCAT.js
...container/MasterData/MasterDataCAT/CreateMasterDataCAT.js
+211
-193
No files found.
src/container/MasterData/MasterDataCAT/CreateMasterDataCAT.js
View file @
ef813eab
...
@@ -75,6 +75,7 @@ export default class CreateMasterDataCAT extends Component {
...
@@ -75,6 +75,7 @@ export default class CreateMasterDataCAT extends Component {
maxAchDisable
:
true
,
maxAchDisable
:
true
,
listPeriode
:
null
,
listPeriode
:
null
,
// periode: null,
// periode: null,
getParent
:
[]
}
}
}
}
...
@@ -102,9 +103,9 @@ export default class CreateMasterDataCAT extends Component {
...
@@ -102,9 +103,9 @@ export default class CreateMasterDataCAT extends Component {
let
data
=
[]
let
data
=
[]
response
.
data
.
data
.
map
((
item
)
=>
{
response
.
data
.
data
.
map
((
item
)
=>
{
// if (this.state.isApprover) {
// if (this.state.isApprover) {
if
(
item
>=
2000
&&
item
<=
(
Number
(
currentYear
)
+
1
))
{
if
(
item
>=
2000
&&
item
<=
(
Number
(
currentYear
)
+
1
))
{
data
.
push
(
item
)
data
.
push
(
item
)
}
}
// } else {
// } else {
// if ((item >= 2000) && (item == this.state.lastPeriod || item < this.state.lastPeriod)) {
// if ((item >= 2000) && (item == this.state.lastPeriod || item < this.state.lastPeriod)) {
// data.push(item)
// data.push(item)
...
@@ -135,20 +136,21 @@ export default class CreateMasterDataCAT extends Component {
...
@@ -135,20 +136,21 @@ export default class CreateMasterDataCAT extends Component {
getParentIR
()
{
getParentIR
()
{
let
payload
=
{
let
payload
=
{
"report_id"
:
3
,
"report_id"
:
3
,
"years"
:
this
.
state
.
periode
.
periode
"years"
:
this
.
state
.
periode
.
periode
}
}
api
.
create
().
getParentItemReport
(
payload
).
then
(
response
=>
{
api
.
create
().
getParentItemReport
(
payload
).
then
(
response
=>
{
console
.
log
(
payload
)
console
.
log
(
payload
)
console
.
log
(
response
)
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
response
.
data
.
data
.
map
((
item
)
=>
{
this
.
setState
({
getParent
:
response
.
data
.
data
.
filter
((
val
)
=>
String
(
val
.
type_item_report_name
).
toLocaleLowerCase
()
!=
'break'
)})
console
.
log
(
item
.
description
)
// response.data.data.map((item) => {
this
.
setState
({
// console.log(item.description)
itemReport1
:
String
(
item
.
description
).
toLocaleLowerCase
().
includes
(
"financial"
).
tolocal
?
item
.
description
:
null
// this.setState({
})
// itemReport1: String(item.description).toLocaleLowerCase().includes("financial").tolocal ? item.description : null
})
// })
// })
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
...
@@ -157,70 +159,79 @@ export default class CreateMasterDataCAT extends Component {
...
@@ -157,70 +159,79 @@ export default class CreateMasterDataCAT extends Component {
})
})
}
}
handleChange
(
e
,
type
)
{
handleChange
(
e
,
item
)
{
let
data
=
this
.
state
// let data = this.state
let
isDate
=
type
!==
''
?
true
:
false
// let isDate = type !== '' ? true : false
if
(
isDate
&&
type
===
'start_date'
)
{
let
dataSource
=
this
.
state
.
getParent
this
.
setState
({
let
indexID
=
dataSource
.
findIndex
((
val
)
=>
val
.
item_report_id
==
item
.
item_report_id
)
...
data
,
startDate
:
format
(
e
,
'yyyy-MM-dd'
),
endDate
:
null
,
// console.log(indexID)
errorOrder
:
false
,
if
(
indexID
!=
-
1
)
{
errorDesc
:
false
,
dataSource
[
indexID
].
weight
=
e
.
target
.
value
errorFormula
:
false
,
this
.
setState
({
getParent
:
dataSource
},
()
=>
{
errorRV
:
false
,
console
.
log
(
this
.
state
.
getParent
);
errorStartDate
:
false
,
errorEndDate
:
false
,
errorTipeData
:
false
,
errorCondition
:
false
,
msgErrorTipeData
:
''
,
msgErrorCondition
:
''
,
msgErrorOrder
:
''
,
msgErrorDesc
:
''
,
msgErrorFormula
:
''
,
msgErrorRV
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
})
}
else
if
(
isDate
&&
type
===
'end_date'
)
{
this
.
setState
({
...
data
,
endDate
:
format
(
e
,
'yyyy-MM-dd'
),
errorOrder
:
false
,
errorDesc
:
false
,
errorFormula
:
false
,
errorRV
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
errorTipeData
:
false
,
errorCondition
:
false
,
msgErrorTipeData
:
''
,
msgErrorCondition
:
''
,
msgErrorOrder
:
''
,
msgErrorDesc
:
''
,
msgErrorFormula
:
''
,
msgErrorRV
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
})
}
else
{
this
.
setState
({
...
data
,
[
e
.
target
.
name
]:
e
.
target
.
value
,
errorOrder
:
false
,
errorDesc
:
false
,
errorFormula
:
false
,
errorRV
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
errorTipeData
:
false
,
errorCondition
:
false
,
msgErrorTipeData
:
''
,
msgErrorCondition
:
''
,
msgErrorOrder
:
''
,
msgErrorDesc
:
''
,
msgErrorFormula
:
''
,
msgErrorRV
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
})
})
}
}
// if (isDate && type === 'start_date') {
// this.setState({
// ...data, startDate: format(e, 'yyyy-MM-dd'), endDate: null,
// errorOrder: false,
// errorDesc: false,
// errorFormula: false,
// errorRV: false,
// errorStartDate: false,
// errorEndDate: false,
// errorTipeData: false,
// errorCondition: false,
// msgErrorTipeData: '',
// msgErrorCondition: '',
// msgErrorOrder: '',
// msgErrorDesc: '',
// msgErrorFormula: '',
// msgErrorRV: '',
// msgErrorSD: '',
// msgErrorED: '',
// })
// } else if (isDate && type === 'end_date') {
// this.setState({
// ...data, endDate: format(e, 'yyyy-MM-dd'),
// errorOrder: false,
// errorDesc: false,
// errorFormula: false,
// errorRV: false,
// errorStartDate: false,
// errorEndDate: false,
// errorTipeData: false,
// errorCondition: false,
// msgErrorTipeData: '',
// msgErrorCondition: '',
// msgErrorOrder: '',
// msgErrorDesc: '',
// msgErrorFormula: '',
// msgErrorRV: '',
// msgErrorSD: '',
// msgErrorED: '',
// })
// } else {
// this.setState({
// ...data, [e.target.name]: e.target.value,
// errorOrder: false,
// errorDesc: false,
// errorFormula: false,
// errorRV: false,
// errorStartDate: false,
// errorEndDate: false,
// errorTipeData: false,
// errorCondition: false,
// msgErrorTipeData: '',
// msgErrorCondition: '',
// msgErrorOrder: '',
// msgErrorDesc: '',
// msgErrorFormula: '',
// msgErrorRV: '',
// msgErrorSD: '',
// msgErrorED: '',
// })
// }
}
}
validasi
()
{
validasi
()
{
...
@@ -657,129 +668,136 @@ export default class CreateMasterDataCAT extends Component {
...
@@ -657,129 +668,136 @@ export default class CreateMasterDataCAT extends Component {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
,
margin
:
20
,
marginBottom
:
10
}}
>
{
this
.
state
.
getParent
.
map
((
item
,
index
)
=>
{
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
padding
:
10
,
fontWeight
:
'bold'
}}
>
Item
Report
-
1
<
/Typography
>
return
(
<
/div
>
<
div
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
,
margin
:
20
,
marginBottom
:
10
}}
>
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
padding
:
10
,
fontWeight
:
'bold'
}}
>
{
`Item Report -
${
index
+
1
}
`
}
<
/Typography
>
<
/div
>
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
div
className
=
"margin-top-10px"
style
=
{{
backgroundColor
:
'#e8e8e8'
,
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
backgroundColor
:
'#e8e8e8'
,
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
<
TextField
style
=
{{
width
:
'100%'
}}
style
=
{{
width
:
'100%'
}}
value
=
{
'-'
}
value
=
{
item
.
item_report_id
}
id
=
"ID"
id
=
"ID"
label
=
"ID"
label
=
"ID"
disabled
disabled
inputProps
=
{{
inputProps
=
{{
style
:
{
style
:
{
fontSize
:
11
,
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}
}}
}}
InputLabelProps
=
{{
InputLabelProps
=
{{
style
:
{
style
:
{
fontSize
:
11
,
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
color
:
'#7e8085'
,
color
:
'#7e8085'
,
}
}
}}
}}
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
<
TextField
style
=
{{
width
:
'100%'
}}
style
=
{{
width
:
'100%'
}}
id
=
"reportName1"
id
=
"reportName1"
name
=
"reportName1"
name
=
"reportName1"
label
=
"Report Name"
label
=
"Report Name"
disabled
disabled
// onChange={(e) => this.handleChange(e, null)}
// onChange={(e) => this.handleChange(e, null)}
// value={this.state.order}
// value={this.state.order}
value
=
{
'CAT'
}
value
=
{
item
.
report_name
}
// error={this.state.errorOrder}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
// helperText={this.state.msgErrorOrder}
inputProps
=
{{
inputProps
=
{{
min
:
0
,
min
:
0
,
style
:
{
style
:
{
fontSize
:
11
,
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}
}}
}}
InputLabelProps
=
{{
InputLabelProps
=
{{
style
:
{
style
:
{
fontSize
:
11
,
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
color
:
'#7e8085'
,
color
:
'#7e8085'
,
}
}
}}
}}
>
>
<
/TextField
>
<
/TextField
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
<
TextField
style
=
{{
width
:
'100%'
}}
style
=
{{
width
:
'100%'
}}
id
=
"itemReportName1"
id
=
"itemReportName1"
name
=
"itemReportName1"
name
=
"itemReportName1"
label
=
"Item Report Name"
label
=
"Item Report Name"
disabled
disabled
// onChange={(e) => this.handleChange(e, null)}
// onChange={(e) => this.handleChange(e, null)}
// value={this.state.order}
// value={this.state.order}
value
=
{
'item report name'
}
value
=
{
item
.
description
}
// error={this.state.errorOrder}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
// helperText={this.state.msgErrorOrder}
inputProps
=
{{
inputProps
=
{{
min
:
0
,
min
:
0
,
style
:
{
style
:
{
fontSize
:
11
,
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}
}}
}}
InputLabelProps
=
{{
InputLabelProps
=
{{
style
:
{
style
:
{
fontSize
:
11
,
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
color
:
'#7e8085'
,
color
:
'#7e8085'
,
}
}
}}
}}
>
>
<
/TextField
>
<
/TextField
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
<
TextField
style
=
{{
width
:
'100%'
}}
style
=
{{
width
:
'100%'
}}
id
=
"weight1"
id
=
"weight1"
name
=
"weight1"
name
=
"weight1"
label
=
"Weight"
label
=
"Weight"
value
=
{
this
.
state
.
weight
}
value
=
{
item
.
weight
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
item
)}
inputProps
=
{{
inputProps
=
{{
style
:
{
style
:
{
fontSize
:
11
,
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}
}}
}}
InputLabelProps
=
{{
InputLabelProps
=
{{
style
:
{
style
:
{
fontSize
:
11
,
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
color
:
'#7e8085'
,
color
:
'#7e8085'
,
}
}
}}
}}
>
>
<
/TextField
>
<
/TextField
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)
<
/div
>
})}
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
,
margin
:
20
,
marginBottom
:
10
}}
>
{
/* <div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10, fontWeight: 'bold' }}>Item Report - 2</Typography>
<Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10, fontWeight: 'bold' }}>Item Report - 2</Typography>
</div>
</div>
...
@@ -1143,7 +1161,7 @@ export default class CreateMasterDataCAT extends Component {
...
@@ -1143,7 +1161,7 @@ export default class CreateMasterDataCAT extends Component {
</TextField>
</TextField>
</div>
</div>
</div>
</div>
<
/div
>
</div>
*/
}
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
...
...
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