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
Show 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 {
maxAchDisable
:
true
,
listPeriode
:
null
,
// periode: null,
getParent
:
[]
}
}
...
...
@@ -135,20 +136,21 @@ export default class CreateMasterDataCAT extends Component {
getParentIR
()
{
let
payload
=
{
"report_id"
:
3
,
"years"
:
this
.
state
.
periode
.
periode
"report_id"
:
3
,
"years"
:
this
.
state
.
periode
.
periode
}
api
.
create
().
getParentItemReport
(
payload
).
then
(
response
=>
{
console
.
log
(
payload
)
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
response
.
data
.
data
.
map
((
item
)
=>
{
console
.
log
(
item
.
description
)
this
.
setState
({
itemReport1
:
String
(
item
.
description
).
toLocaleLowerCase
().
includes
(
"financial"
).
tolocal
?
item
.
description
:
null
})
})
this
.
setState
({
getParent
:
response
.
data
.
data
.
filter
((
val
)
=>
String
(
val
.
type_item_report_name
).
toLocaleLowerCase
()
!=
'break'
)})
// response.data.data.map((item) => {
// console.log(item.description)
// this.setState({
// itemReport1: String(item.description).toLocaleLowerCase().includes("financial").tolocal ? item.description : null
// })
// })
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
...
...
@@ -157,70 +159,79 @@ export default class CreateMasterDataCAT extends Component {
})
}
handleChange
(
e
,
type
)
{
let
data
=
this
.
state
let
isDate
=
type
!==
''
?
true
:
false
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
:
''
,
handleChange
(
e
,
item
)
{
// let data = this.state
// let isDate = type !== '' ? true : false
let
dataSource
=
this
.
state
.
getParent
let
indexID
=
dataSource
.
findIndex
((
val
)
=>
val
.
item_report_id
==
item
.
item_report_id
)
// console.log(indexID)
if
(
indexID
!=
-
1
)
{
dataSource
[
indexID
].
weight
=
e
.
target
.
value
this
.
setState
({
getParent
:
dataSource
},
()
=>
{
console
.
log
(
this
.
state
.
getParent
);
})
}
// 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
()
{
...
...
@@ -657,8 +668,11 @@ export default class CreateMasterDataCAT extends Component {
<
/div
>
<
/div
>
{
this
.
state
.
getParent
.
map
((
item
,
index
)
=>
{
return
(
<
div
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
,
margin
:
20
,
marginBottom
:
10
}}
>
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
padding
:
10
,
fontWeight
:
'bold'
}}
>
Item
Report
-
1
<
/Typography
>
<
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
}}
>
...
...
@@ -666,7 +680,7 @@ export default class CreateMasterDataCAT extends Component {
<
div
className
=
"margin-top-10px"
style
=
{{
backgroundColor
:
'#e8e8e8'
,
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
style
=
{{
width
:
'100%'
}}
value
=
{
'-'
}
value
=
{
item
.
item_report_id
}
id
=
"ID"
label
=
"ID"
disabled
...
...
@@ -696,7 +710,7 @@ export default class CreateMasterDataCAT extends Component {
disabled
// onChange={(e) => this.handleChange(e, null)}
// value={this.state.order}
value
=
{
'CAT'
}
value
=
{
item
.
report_name
}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
inputProps
=
{{
...
...
@@ -730,7 +744,7 @@ export default class CreateMasterDataCAT extends Component {
disabled
// onChange={(e) => this.handleChange(e, null)}
// value={this.state.order}
value
=
{
'item report name'
}
value
=
{
item
.
description
}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
inputProps
=
{{
...
...
@@ -758,8 +772,8 @@ export default class CreateMasterDataCAT extends Component {
id
=
"weight1"
name
=
"weight1"
label
=
"Weight"
value
=
{
this
.
state
.
weight
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
value
=
{
item
.
weight
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
item
)}
inputProps
=
{{
style
:
{
fontSize
:
11
,
...
...
@@ -778,8 +792,12 @@ export default class CreateMasterDataCAT extends Component {
<
/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>
</div>
...
...
@@ -1143,7 +1161,7 @@ export default class CreateMasterDataCAT extends Component {
</TextField>
</div>
</div>
<
/div
>
</div>
*/
}
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
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