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
43b15da9
Commit
43b15da9
authored
Oct 16, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
isu donlot sh
parent
43b20efb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
10 deletions
+71
-10
SubHolding.js
src/container/Laporan/SubHolding.js
+71
-10
No files found.
src/container/Laporan/SubHolding.js
View file @
43b15da9
...
@@ -6,6 +6,8 @@ import { titleCase } from '../../library/Utils'
...
@@ -6,6 +6,8 @@ import { titleCase } from '../../library/Utils'
import
{
Autocomplete
}
from
'@material-ui/lab'
import
{
Autocomplete
}
from
'@material-ui/lab'
import
TableSubHolding
from
'./TableSubHolding'
import
TableSubHolding
from
'./TableSubHolding'
import
{
PropagateLoader
}
from
'react-spinners'
import
{
PropagateLoader
}
from
'react-spinners'
import
ReactTooltip
from
'react-tooltip'
import
Images
from
'../../assets/Images'
export
default
class
SubHolding
extends
Component
{
export
default
class
SubHolding
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -272,9 +274,9 @@ export default class SubHolding extends Component {
...
@@ -272,9 +274,9 @@ export default class SubHolding extends Component {
}
}
}
}
})
})
this
.
setState
({
dataTable
,
previewTable
:
true
,
loading
:
false
})
this
.
setState
({
dataTable
,
previewTable
:
true
,
loading
:
false
,
previewDownload
:
true
})
}
else
{
}
else
{
this
.
setState
({
dataTable
:
[],
previewTable
:
false
,
loading
:
false
})
this
.
setState
({
dataTable
:
[],
previewTable
:
false
,
loading
:
false
,
previewDownload
:
false
})
}
}
}
else
if
(
this
.
state
.
report
.
value
===
2
)
{
}
else
if
(
this
.
state
.
report
.
value
===
2
)
{
if
(
response
.
data
)
{
if
(
response
.
data
)
{
...
@@ -353,16 +355,49 @@ export default class SubHolding extends Component {
...
@@ -353,16 +355,49 @@ export default class SubHolding extends Component {
}
}
})
})
// console.log(dataTable)
// console.log(dataTable)
this
.
setState
({
dataTable
,
previewTable
:
true
,
loading
:
false
})
this
.
setState
({
dataTable
,
previewTable
:
true
,
loading
:
false
,
previewDownload
:
true
})
}
else
{
}
else
{
this
.
setState
({
dataTable
:
[],
previewTable
:
false
,
loading
:
false
})
this
.
setState
({
dataTable
:
[],
previewTable
:
false
,
loading
:
false
,
previewDownload
:
false
})
}
}
}
else
{
}
else
{
this
.
setState
({
dataTable
:
[],
previewTable
:
false
,
loading
:
false
})
this
.
setState
({
dataTable
:
[],
previewTable
:
false
,
loading
:
false
,
previewDownload
:
false
})
}
}
})
})
}
}
async
downloadAllData
()
{
if
(
this
.
state
.
report
.
value
===
1
)
{
let
res
=
await
fetch
(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=
${
this
.
state
.
submissionID
===
null
?
""
:
this
.
state
.
submissionID
}
&&report_id=
${
this
.
state
.
report
.
value
}
&&company_id=
${
this
.
state
.
company
.
company_id
}
&&year=
${
this
.
state
.
periode
.
periode
}
&&revision=
${
this
.
state
.
lastRevision
}
`
)
res
=
await
res
.
blob
()
this
.
setState
({
loading
:
false
})
if
(
res
.
size
>
0
)
{
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
a
.
href
=
url
;
a
.
download
=
'Master Budget Balance Sheet.xlsx'
;
a
.
click
();
}
}
else
if
(
this
.
state
.
report
.
value
===
2
)
{
let
url
=
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=
${
this
.
state
.
submissionID
}
&&report_id=
${
this
.
state
.
report
.
value
}
&&company_id=
${
this
.
state
.
company
.
company_id
}
&&year=
${
this
.
state
.
periode
.
periode
}
&&revision=
${
this
.
state
.
lastRevision
}
`
let
sub_null
=
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=
${
this
.
state
.
report
.
value
}
&&company_id=
${
this
.
state
.
company
.
company_id
}
&&year=
${
this
.
state
.
periode
.
periode
}
&&revision=
${
this
.
state
.
lastRevision
}
`
// console.log(url);
let
res
=
await
fetch
(
this
.
state
.
submissionID
==
null
?
sub_null
:
url
)
res
=
await
res
.
blob
()
this
.
setState
({
loading
:
false
})
if
(
res
.
size
>
0
)
{
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
a
.
href
=
url
;
a
.
download
=
'Master Budget Profit & Loss.xlsx'
;
a
.
click
();
}
}
}
render
()
{
render
()
{
const
loadingComponent
=
(
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)'
}}
>
<
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)'
}}
>
...
@@ -385,8 +420,8 @@ export default class SubHolding extends Component {
...
@@ -385,8 +420,8 @@ export default class SubHolding extends Component {
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Sub
Holding
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Sub
Holding
<
/Typography
>
<
/div
>
<
/div
>
<
div
className
=
"padding-20px"
style
=
{{
minWidth
:
'max-content
'
}}
>
<
div
style
=
{{
minWidth
:
'max-content'
,
padding
:
'20px 20px 0px 20px
'
}}
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
div
style
=
{{
marginTop
:
15
}}
>
<
Autocomplete
<
Autocomplete
options
=
{
this
.
state
.
reportType
}
options
=
{
this
.
state
.
reportType
}
getOptionLabel
=
{(
option
)
=>
titleCase
(
option
.
label
)}
getOptionLabel
=
{(
option
)
=>
titleCase
(
option
.
label
)}
...
@@ -400,7 +435,7 @@ export default class SubHolding extends Component {
...
@@ -400,7 +435,7 @@ export default class SubHolding extends Component {
value
=
{
this
.
state
.
report
}
value
=
{
this
.
state
.
report
}
/
>
/
>
<
/div
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
div
style
=
{{
marginTop
:
15
}}
>
<
Autocomplete
<
Autocomplete
{...
this
.
state
.
listCompany
}
{...
this
.
state
.
listCompany
}
id
=
"company"
id
=
"company"
...
@@ -414,7 +449,7 @@ export default class SubHolding extends Component {
...
@@ -414,7 +449,7 @@ export default class SubHolding extends Component {
value
=
{
this
.
state
.
company
}
value
=
{
this
.
state
.
company
}
/
>
/
>
<
/div
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
div
style
=
{{
marginTop
:
15
}}
>
<
Autocomplete
<
Autocomplete
{...
this
.
state
.
listPeriode
}
{...
this
.
state
.
listPeriode
}
id
=
"periode"
id
=
"periode"
...
@@ -431,7 +466,33 @@ export default class SubHolding extends Component {
...
@@ -431,7 +466,33 @@ export default class SubHolding extends Component {
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
div
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'space-between'
,
padding
:
'0px 20px 10px 20px'
}}
>
<
div
><
/div
>
{
this
.
state
.
previewDownload
&&
(
<
div
style
=
{{
width
:
'50%'
,
justifyContent
:
'flex-end'
,
display
:
'flex'
,
flexFlow
:
'wrap'
}}
>
<
a
data
-
tip
=
{
'Download'
}
data
-
for
=
"download"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
,
outline
:
'none'
}}
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
downloadAllData
()
},
100
);
})}
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"download"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
)}
<
/div
>
{
this
.
state
.
loading
&&
loadingComponent
}
{
this
.
state
.
loading
&&
loadingComponent
}
{
this
.
state
.
previewTable
&&
(
{
this
.
state
.
previewTable
&&
(
<
TableSubHolding
<
TableSubHolding
...
...
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