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
a6eb6f48
Commit
a6eb6f48
authored
Nov 12, 2020
by
faisalhamdi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dikit lagi
parent
dadcbeff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
51 deletions
+86
-51
SubHolding.js
src/container/Laporan/SubHolding.js
+86
-51
No files found.
src/container/Laporan/SubHolding.js
View file @
a6eb6f48
import
React
,
{
Component
}
from
'react'
import
React
,
{
Component
}
from
'react'
import
{
Typography
,
MenuItem
,
TextField
,
AppBar
,
Paper
,
Tabs
,
Tab
}
from
'@material-ui/core'
import
{
Typography
,
MenuItem
,
TextField
,
AppBar
,
Paper
,
Tabs
,
Tab
,
Snackbar
,
withStyles
}
from
'@material-ui/core'
import
Constant
from
'../../library/Constant'
import
Constant
from
'../../library/Constant'
import
api
from
'../../api'
import
api
from
'../../api'
import
{
titleCase
}
from
'../../library/Utils'
import
{
titleCase
}
from
'../../library/Utils'
...
@@ -8,6 +8,10 @@ import TableSubHolding from './TableSubHolding'
...
@@ -8,6 +8,10 @@ import TableSubHolding from './TableSubHolding'
import
{
PropagateLoader
}
from
'react-spinners'
import
{
PropagateLoader
}
from
'react-spinners'
import
ReactTooltip
from
'react-tooltip'
import
ReactTooltip
from
'react-tooltip'
import
Images
from
'../../assets/Images'
import
Images
from
'../../assets/Images'
import
MuiAlert
from
'@material-ui/lab/Alert'
;
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
export
default
class
SubHolding
extends
Component
{
export
default
class
SubHolding
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -193,7 +197,18 @@ export default class SubHolding extends Component {
...
@@ -193,7 +197,18 @@ export default class SubHolding extends Component {
this
.
getSubmission
()
this
.
getSubmission
()
})
})
}
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
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'
,
loading
:
false
})
}
}
})
})
}
}
...
@@ -493,10 +508,48 @@ export default class SubHolding extends Component {
...
@@ -493,10 +508,48 @@ export default class SubHolding extends Component {
console
.
log
(
response
);
console
.
log
(
response
);
let
dataTable
=
[]
let
dataTable
=
[]
if
(
response
.
data
)
{
if
(
response
.
data
)
{
let
res
=
response
.
data
.
data
if
(
response
.
data
.
status
===
'success'
)
{
const
handlePushChild
=
(
item
)
=>
{
let
res
=
response
.
data
.
data
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
const
handlePushChild
=
(
item
)
=>
{
if
(
indexIDzz
===
-
1
)
{
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
.
uom
,
item
.
ratio
.
total_actual_before
===
null
?
"0.0"
:
item
.
ratio
.
total_actual_before
===
""
?
"0.0"
:
item
.
ratio
.
total_actual_before
,
Number
(
item
.
ratio
.
january
).
toFixed
(
1
),
Number
(
item
.
ratio
.
february
).
toFixed
(
1
),
Number
(
item
.
ratio
.
march
).
toFixed
(
1
),
Number
(
item
.
ratio
.
april
).
toFixed
(
1
),
Number
(
item
.
ratio
.
may
).
toFixed
(
1
),
Number
(
item
.
ratio
.
june
).
toFixed
(
1
),
Number
(
item
.
ratio
.
july
).
toFixed
(
1
),
Number
(
item
.
ratio
.
august
).
toFixed
(
1
),
Number
(
item
.
ratio
.
september
).
toFixed
(
1
),
Number
(
item
.
ratio
.
october
).
toFixed
(
1
),
Number
(
item
.
ratio
.
november
).
toFixed
(
1
),
Number
(
item
.
ratio
.
december
).
toFixed
(
1
),
Number
(
item
.
ratio
.
total_next_year
).
toFixed
(
1
),
Number
(
item
.
ratio
.
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
([
dataTable
.
push
([
item
.
type_report_id
,
item
.
type_report_id
,
item
.
id
,
item
.
id
,
...
@@ -504,7 +557,7 @@ export default class SubHolding extends Component {
...
@@ -504,7 +557,7 @@ export default class SubHolding extends Component {
item
.
formula
,
item
.
formula
,
item
.
level
,
item
.
level
,
item
.
description
,
item
.
description
,
item
.
uo
m
,
item
.
ou
m
,
item
.
ratio
.
total_actual_before
===
null
?
"0.0"
:
item
.
ratio
.
total_actual_before
===
""
?
"0.0"
:
item
.
ratio
.
total_actual_before
,
item
.
ratio
.
total_actual_before
===
null
?
"0.0"
:
item
.
ratio
.
total_actual_before
===
""
?
"0.0"
:
item
.
ratio
.
total_actual_before
,
Number
(
item
.
ratio
.
january
).
toFixed
(
1
),
Number
(
item
.
ratio
.
january
).
toFixed
(
1
),
Number
(
item
.
ratio
.
february
).
toFixed
(
1
),
Number
(
item
.
ratio
.
february
).
toFixed
(
1
),
...
@@ -524,54 +577,27 @@ export default class SubHolding extends Component {
...
@@ -524,54 +577,27 @@ export default class SubHolding extends Component {
item
.
condition_it_should_be
,
item
.
condition_it_should_be
,
item
.
condition_if_wrong
item
.
condition_if_wrong
])
])
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
handlePushChild
(
items
)
}
)
}
)
}
}
}
}
})
}
this
.
setState
({
dataTable
,
previewTable
:
true
,
loading
:
false
,
previewDownload
:
true
})
res
.
map
((
item
,
index
)
=>
{
}
else
{
dataTable
.
push
([
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
item
.
type_report_id
,
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
item
.
id
,
setTimeout
(()
=>
{
item
.
parent
,
localStorage
.
removeItem
(
Constant
.
TOKEN
)
item
.
formula
,
window
.
location
.
reload
();
item
.
level
,
},
1000
);
item
.
description
,
item
.
oum
,
item
.
ratio
.
total_actual_before
===
null
?
"0.0"
:
item
.
ratio
.
total_actual_before
===
""
?
"0.0"
:
item
.
ratio
.
total_actual_before
,
Number
(
item
.
ratio
.
january
).
toFixed
(
1
),
Number
(
item
.
ratio
.
february
).
toFixed
(
1
),
Number
(
item
.
ratio
.
march
).
toFixed
(
1
),
Number
(
item
.
ratio
.
april
).
toFixed
(
1
),
Number
(
item
.
ratio
.
may
).
toFixed
(
1
),
Number
(
item
.
ratio
.
june
).
toFixed
(
1
),
Number
(
item
.
ratio
.
july
).
toFixed
(
1
),
Number
(
item
.
ratio
.
august
).
toFixed
(
1
),
Number
(
item
.
ratio
.
september
).
toFixed
(
1
),
Number
(
item
.
ratio
.
october
).
toFixed
(
1
),
Number
(
item
.
ratio
.
november
).
toFixed
(
1
),
Number
(
item
.
ratio
.
december
).
toFixed
(
1
),
Number
(
item
.
ratio
.
total_next_year
).
toFixed
(
1
),
Number
(
item
.
ratio
.
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
,
previewTable
:
true
,
loading
:
false
,
previewDownload
:
true
})
}
else
{
}
else
{
this
.
setState
({
dataTable
:
[],
previewTable
:
false
,
loading
:
false
,
previewDownload
:
false
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
})
})
}
}
...
@@ -639,6 +665,10 @@ export default class SubHolding extends Component {
...
@@ -639,6 +665,10 @@ export default class SubHolding extends Component {
}
}
}
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
render
()
{
render
()
{
const
loadingComponent
=
(
const
loadingComponent
=
(
<
div
style
=
{{
position
:
'fixed'
,
zIndex
:
110
,
top
:
0
,
left
:
0
,
width
:
'100%'
,
height
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
background
:
'rgba(255,255,255,0.8)'
}}
>
<
div
style
=
{{
position
:
'fixed'
,
zIndex
:
110
,
top
:
0
,
left
:
0
,
width
:
'100%'
,
height
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
background
:
'rgba(255,255,255,0.8)'
}}
>
...
@@ -656,6 +686,11 @@ export default class SubHolding extends Component {
...
@@ -656,6 +686,11 @@ export default class SubHolding extends Component {
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Sub
Holding
Report
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Sub
Holding
Report
<
/Typography
>
<
/div
>
<
/div
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
<
div
style
=
{{
padding
:
20
,
width
:
'100%'
}}
>
<
div
style
=
{{
padding
:
20
,
width
:
'100%'
}}
>
<
Paper
style
=
{{
paddingTop
:
10
}}
>
<
Paper
style
=
{{
paddingTop
:
10
}}
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
...
...
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