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
22c0e97f
Commit
22c0e97f
authored
Oct 15, 2020
by
d.arizona
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://103.44.149.204/d.arizona/tia-dev
into didam
parents
49e23dea
f6976f03
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2145 additions
and
60 deletions
+2145
-60
SubHolding.js
src/container/Laporan/SubHolding.js
+295
-60
TableSubHolding.js
src/container/Laporan/TableSubHolding.js
+1850
-0
No files found.
src/container/Laporan/SubHolding.js
View file @
22c0e97f
import
React
,
{
Component
}
from
'react'
import
{
Typography
,
MenuItem
,
TextField
,
AppBar
,
Paper
,
Tabs
,
Tab
}
from
'@material-ui/core'
import
Constant
from
'../../library/Constant'
import
api
from
'../../api'
import
{
titleCase
}
from
'../../library/Utils'
import
{
Autocomplete
}
from
'@material-ui/lab'
import
TableSubHolding
from
'./TableSubHolding'
import
{
PropagateLoader
}
from
'react-spinners'
export
default
class
SubHolding
extends
Component
{
constructor
(
props
)
{
...
...
@@ -8,7 +14,19 @@ export default class SubHolding extends Component {
periode
:
'2020'
,
perusahaan
:
'TAP Group'
,
laporan
:
'Balance Sheet - Montly'
,
tab
:
0
tab
:
0
,
listCompany
:
null
,
company
:
null
,
listPeriode
:
null
,
periode
:
null
,
reportType
:
[
{
value
:
'DB Balance Sheet'
,
label
:
'DB Balance Sheet'
},
{
value
:
'DB Profit & Loss'
,
label
:
'DB Profit & Loss'
},
{
value
:
'DB Balance Sheet Detail'
,
label
:
'DB Balance Sheet Detail'
},
{
value
:
'DB Ratio'
,
label
:
'DB Ratio'
},
],
report
:
null
,
loading
:
false
}
}
...
...
@@ -16,25 +34,233 @@ export default class SubHolding extends Component {
this
.
setState
({
tab
:
newEvent
})
}
componentDidMount
()
{
this
.
getDetailUser
()
this
.
setState
({
report
:
this
.
state
.
reportType
[
0
],
loading
:
true
})
}
getDetailUser
()
{
let
userId
=
localStorage
.
getItem
(
Constant
.
USER
)
api
.
create
().
getDetailUser
(
userId
).
then
((
response
)
=>
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
userCompany
:
response
.
data
.
data
.
company
},
()
=>
{
this
.
getCompanyActive
()
})
}
}
}
})
}
getCompanyActive
()
{
api
.
create
().
getPerusahaanActive
().
then
((
response
)
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
comID
=
this
.
state
.
rawData
?
this
.
state
.
rawData
.
company_id
:
0
let
companyData
=
data
.
map
((
item
)
=>
{
return
{
company_id
:
item
.
company_id
,
company_name
:
item
.
company_name
,
}
})
let
arrayBaru
=
[]
this
.
state
.
userCompany
.
map
((
item
,
index
)
=>
{
let
indexID
=
companyData
.
findIndex
((
val
)
=>
val
.
company_id
==
item
)
if
(
indexID
!==
-
1
)
{
arrayBaru
.
push
(
companyData
[
indexID
])
}
})
let
defaultProps
=
{
options
:
arrayBaru
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
company_name
),
};
let
index
=
arrayBaru
.
findIndex
((
val
)
=>
val
.
company_id
==
comID
)
this
.
setState
({
listCompany
:
defaultProps
,
company
:
arrayBaru
.
length
<
1
?
companyData
[
0
]
:
(
index
==
-
1
?
arrayBaru
[
0
]
:
arrayBaru
[
index
])
},
()
=>
{
this
.
getLastPeriod
()
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
listCompany
:
null
,
company
:
null
})
}
})
}
getLastPeriod
()
{
api
.
create
().
getLastPeriod
(
this
.
state
.
company
.
company_id
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
lastPeriod
:
response
.
data
.
data
.
last_periode
,
latestPeriode
:
response
.
data
.
data
.
latest_periode
},
()
=>
{
this
.
getPeriode
()
})
}
})
}
getPeriode
()
{
api
.
create
().
getPeriodeTransaction
().
then
(
response
=>
{
let
currentYear
=
new
Date
().
getFullYear
()
// console.log(currentYear)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
data
=
[]
response
.
data
.
data
.
map
((
item
)
=>
{
if
(
this
.
state
.
isApprover
)
{
if
(
item
>=
2000
&&
item
<=
(
Number
(
currentYear
)
+
1
))
{
data
.
push
(
item
)
}
}
else
{
if
((
item
>=
2000
)
&&
(
item
==
this
.
state
.
lastPeriod
||
item
<
this
.
state
.
lastPeriod
))
{
data
.
push
(
item
)
}
}
})
let
periodeData
=
data
.
map
((
item
)
=>
{
return
{
periode
:
item
,
}
})
let
defaultProps
=
{
options
:
periodeData
,
getOptionLabel
:
(
option
)
=>
option
.
periode
,
};
let
periode
=
(
this
.
state
.
lastPeriod
==
""
?
String
(
Number
(
currentYear
)
+
1
)
:
this
.
state
.
lastPeriod
)
let
index
=
data
.
sort
((
a
,
b
)
=>
a
-
b
).
findIndex
((
val
)
=>
val
===
periode
)
// console.log(data)
// console.log(this.state.latestPeriode)
// console.log(periodeData)
// console.log(index)
this
.
setState
({
listPeriode
:
defaultProps
,
periode
:
index
===
-
1
?
periodeData
[
0
]
:
periodeData
[
index
]
},
()
=>
{
this
.
getDataTable
()
// if (this.state.isApprover === true) {
// this.getCompanySubmitted()
// } else {
// this.getRevision()
// }
})
}
}
})
}
async
getDataTable
()
{
let
payload
=
{
"report_id"
:
1
,
"revision"
:
0
,
"periode"
:
this
.
state
.
periode
.
periode
,
"company_id"
:
this
.
state
.
company
.
company_id
,
"submission_id"
:
null
}
let
response
=
await
api
.
create
().
getDetailReportMB
(
payload
)
console
.
log
(
response
);
let
dataTable
=
[]
if
(
response
.
data
)
{
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
if
(
indexIDzz
===
-
1
)
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
balance_sheet
.
total_actual_before
===
null
?
"0.0"
:
item
.
balance_sheet
.
total_actual_before
===
""
?
"0.0"
:
item
.
balance_sheet
.
total_actual_before
,
Number
(
item
.
balance_sheet
.
january
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
february
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
march
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
april
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
may
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
june
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
july
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
august
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
september
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
october
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
november
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
december
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
total_current_year
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
total_next_year
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
total_more_year
).
toFixed
(
1
),
item
.
order
,
item
.
condition_it_should_be
,
item
.
condition_if_wrong
])
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
res
.
map
((
item
,
index
)
=>
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
balance_sheet
.
total_actual_before
===
null
?
"0.0"
:
item
.
balance_sheet
.
total_actual_before
===
""
?
"0.0"
:
item
.
balance_sheet
.
total_actual_before
,
Number
(
item
.
balance_sheet
.
january
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
february
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
march
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
april
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
may
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
june
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
july
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
august
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
september
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
october
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
november
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
december
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
total_current_year
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
total_next_year
).
toFixed
(
1
),
Number
(
item
.
balance_sheet
.
total_more_year
).
toFixed
(
1
),
item
.
order
,
item
.
condition_it_should_be
,
item
.
condition_if_wrong
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
this
.
setState
({
dataTable
,
loading
:
false
})
}
else
{
}
}
render
()
{
const
laporan
=
[
{
value
:
'Balance Sheet - Montly'
,
label
:
'Balance Sheet - Montly'
},
{
value
:
'Profit & Loss - Montly'
,
label
:
'Profit & Loss - Montly'
},
{
value
:
'Fixed Assets Movement - Montly'
,
label
:
'Fixed Assets Movement - Montly'
},
]
const
perusahaan
=
[
{
value
:
'TIA'
,
label
:
'TIA'
},
{
value
:
'TAP Group'
,
label
:
'TAP Group'
},
{
value
:
'EKSAD'
,
label
:
'EKSAD'
},
{
value
:
'Puninar'
,
label
:
'Puninar'
},
]
const
periode
=
[
{
value
:
'2020'
,
label
:
'2020'
},
{
value
:
'2019'
,
label
:
'2019'
},
{
value
:
'2018'
,
label
:
'2018'
},
{
value
:
'2017'
,
label
:
'2017'
},
{
value
:
'2016'
,
label
:
'2016'
},
]
const
loadingComponent
=
(
<
div
style
=
{{
position
:
'absolute'
,
zIndex
:
110
,
top
:
0
,
left
:
0
,
width
:
'100%'
,
height
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
background
:
'rgba(255,255,255,0.8)'
}}
>
<
PropagateLoader
// css={override}
size
=
{
20
}
color
=
{
"#274B80"
}
loading
=
{
this
.
state
.
loading
}
/
>
<
/div
>
);
return
(
<
div
style
=
{{
flex
:
1
,
backgroundColor
:
'#f8f8f8'
}}
ref
=
{
this
.
myRef
}
>
<
div
>
...
...
@@ -46,56 +272,65 @@ export default class SubHolding extends Component {
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Sub
Holding
<
/Typography
>
<
/div
>
<
div
className
=
"padding-20px"
style
=
{{
minWidth
:
'max-content'
}}
>
<
div
className
=
"padding-20px"
style
=
{{
minWidth
:
'max-content'
}}
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
TextField
<
Autocomplete
options
=
{
this
.
state
.
reportType
}
getOptionLabel
=
{(
option
)
=>
titleCase
(
option
.
value
)}
id
=
"typereport"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
report
:
newInputValue
})}
disableClearable
style
=
{{
width
:
250
}}
id
=
"laporan"
select
label
=
"Jenis Laporan"
value
=
{
this
.
state
.
laporan
}
onChange
=
{(
e
)
=>
this
.
setState
({
laporan
:
e
.
target
.
value
})}
>
{
laporan
.
map
((
option
)
=>
(
<
MenuItem
key
=
{
option
.
value
}
value
=
{
option
.
value
}
>
{
option
.
label
}
<
/MenuItem
>
))}
<
/TextField
>
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Report Type"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
report
}
/
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
TextField
style
=
{{
width
:
250
,
}}
id
=
"perusahaan"
select
label
=
"Perusahaan"
value
=
{
this
.
state
.
perusahaan
}
onChange
=
{(
e
)
=>
this
.
setState
({
perusahaan
:
e
.
target
.
value
})}
>
{
perusahaan
.
map
((
option
)
=>
(
<
MenuItem
key
=
{
option
.
value
}
value
=
{
option
.
value
}
>
{
option
.
label
}
<
/MenuItem
>
))}
<
/TextField
>
<
Autocomplete
{...
this
.
state
.
listCompany
}
id
=
"company"
disabled
=
{
this
.
state
.
intent
===
'Home'
?
true
:
false
}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
})}
disableClearable
style
=
{{
width
:
250
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Company"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
company
}
/
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
TextField
style
=
{{
width
:
250
,
}
}
<
Autocomplete
{...
this
.
state
.
listPeriode
}
id
=
"periode"
select
label
=
"Periode"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periode
:
newInputValue
},
()
=>
{
// if (this.state.isApprover === true) {
// this.getCompanySubmitted()
// } else {
// this.setState({ visibleTableHistory: false })
// this.getRevision()
// }
})}
disabled
=
{
this
.
state
.
intent
===
'Home'
?
true
:
false
}
disableClearable
style
=
{{
width
:
250
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Period"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
periode
}
onChange
=
{(
e
)
=>
this
.
setState
({
periode
:
e
.
target
.
value
})}
>
{
periode
.
map
((
option
)
=>
(
<
MenuItem
key
=
{
option
.
value
}
value
=
{
option
.
value
}
>
{
option
.
label
}
<
/MenuItem
>
))}
<
/TextField
>
/
>
<
/div
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
}}
>
{
this
.
state
.
loading
&&
loadingComponent
}
{
!
this
.
state
.
loading
&&
(
<
TableSubHolding
width
=
{
this
.
props
.
width
}
height
=
{
this
.
props
.
height
}
open
=
{
this
.
props
.
open
}
type
=
{
1
}
dataTable
=
{
this
.
state
.
dataTable
}
periode
=
{
this
.
state
.
periode
?
this
.
state
.
periode
.
periode
:
null
}
/
>
)}
<
/div
>
<
/Paper
>
<
/div
>
...
...
src/container/Laporan/TableSubHolding.js
0 → 100644
View file @
22c0e97f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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