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
bc515672
Commit
bc515672
authored
Sep 29, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'deni-dev(pc)' into 'master'
+++ See merge request
!391
parents
bc7aa7ec
a41156ea
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
411 additions
and
299 deletions
+411
-299
index.js
src/api/index.js
+3
-1
BudgetTahunan.js
src/container/BudgetTahunan.js
+200
-15
BalanceSheet.js
src/container/BudgetTahunan/BalanceSheet.js
+153
-135
ProfitLoss.js
src/container/BudgetTahunan/ProfitLoss.js
+37
-138
HomePage.js
src/container/HomePage.js
+18
-10
No files found.
src/api/index.js
View file @
bc515672
...
...
@@ -202,6 +202,7 @@ const create = (type = "") => {
const
submitMasterBudget
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/submit_master_budget'
,
body
)
const
checkIsSubmit
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/is_can_submit'
,
body
)
const
checkApprover
=
()
=>
api
.
get
(
'transaction/master_budget/is_approver'
)
const
approvalSubmission
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/approval_submission'
,
body
)
const
getIdDeleteFromExcel
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/delete_from_excel'
,
body
)
const
getOpetratingIndID
=
(
body
)
=>
api
.
post
(
'transaction/get_operating_indicator_id'
,
body
)
...
...
@@ -363,7 +364,8 @@ const create = (type = "") => {
getIdDeleteFromExcel
,
getDashboard
,
historyApproval
,
checkApprover
checkApprover
,
approvalSubmission
}
}
...
...
src/container/BudgetTahunan.js
View file @
bc515672
import
React
,
{
Component
}
from
'react'
;
import
{
Typography
,
Paper
,
TextField
,
MenuItem
,
Select
,
FormControlLabel
,
Snackbar
,
withStyles
,
createMuiTheme
,
MuiThemeProvider
}
from
'@material-ui/core'
;
import
{
Typography
,
Paper
,
TextField
,
MenuItem
,
Select
,
FormControlLabel
,
Snackbar
,
withStyles
,
createMuiTheme
,
MuiThemeProvider
,
Checkbox
}
from
'@material-ui/core'
;
import
MUIDataTable
from
'mui-datatables'
;
import
Images
from
'../assets/Images'
;
import
BalanceSheet
from
'./BudgetTahunan/BalanceSheet'
;
...
...
@@ -17,6 +17,7 @@ import { format } from 'date-fns';
import
Constant
from
'../library/Constant'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
import
CashFlow
from
'./BudgetTahunan/CashFlow'
;
import
{
DatePicker
}
from
'@material-ui/pickers'
;
var
ct
=
require
(
"../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
...
...
@@ -52,7 +53,8 @@ export default class BudgetTahunan extends Component {
isSubmit
:
false
,
visibleTableHistory
:
false
,
isApprover
:
false
,
lastStatus
:
""
lastStatus
:
""
,
intent
:
""
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
...
...
@@ -60,9 +62,13 @@ export default class BudgetTahunan extends Component {
componentDidMount
()
{
this
.
props
.
selectIndex
(
'Master Budget & CAT'
)
if
(
this
.
props
.
location
.
state
!==
undefined
)
{
this
.
setState
({
userType
:
this
.
props
.
location
.
state
.
userType
})
console
.
log
(
this
.
props
);
this
.
setState
({
userType
:
this
.
props
.
location
.
state
.
userType
,
intent
:
'Home'
,
rawData
:
this
.
props
.
location
.
state
.
rawData
},
()
=>
{
this
.
checkApprover
()
})
}
else
{
this
.
checkApprover
()
}
this
.
checkApprover
()
}
checkApprover
()
{
...
...
@@ -115,8 +121,15 @@ export default class BudgetTahunan extends Component {
item
.
revision
]
})
let
dataTableRevision
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
[
""
,
item
.
report_name
,
""
]
})
// console.log(dataTable);
this
.
setState
({
dataTable
,
loading
:
false
})
this
.
setState
({
dataTable
,
loading
:
false
,
dataTableRevision
})
}
}
else
{
this
.
setState
({
loading
:
false
})
...
...
@@ -144,6 +157,7 @@ export default class BudgetTahunan extends Component {
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
,
...
...
@@ -163,8 +177,8 @@ export default class BudgetTahunan extends Component {
options
:
arrayBaru
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
company_name
),
};
this
.
setState
({
listCompany
:
defaultProps
,
company
:
arrayBaru
[
0
]
},
()
=>
{
let
index
=
arrayBaru
.
findIndex
((
val
)
=>
val
.
company_id
==
comID
)
this
.
setState
({
listCompany
:
defaultProps
,
company
:
index
==
-
1
?
arrayBaru
[
0
]
:
arrayBaru
[
index
]
},
()
=>
{
this
.
getPeriode
()
})
}
else
{
...
...
@@ -186,7 +200,7 @@ export default class BudgetTahunan extends Component {
getPeriode
()
{
api
.
create
().
getPeriodeTransaction
().
then
(
response
=>
{
let
dateNow
=
new
Date
let
year
=
format
(
dateNow
,
'yyyy'
)
let
year
=
this
.
state
.
rawData
?
this
.
state
.
rawData
.
periode
:
format
(
dateNow
,
'yyyy'
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
data
=
response
.
data
.
data
...
...
@@ -251,6 +265,7 @@ export default class BudgetTahunan extends Component {
submissionID
:
response
.
data
.
data
.
submission_id
,
isSubmit
:
false
,
lastStatus
:
response
.
data
.
data
.
last_status
===
null
?
'SUBMIT'
:
response
.
data
.
data
.
last_status
},
()
=>
{
this
.
setState
({
loading
:
false
})
this
.
checkIsSubmit
()
this
.
historyApproval
()
})
...
...
@@ -297,6 +312,21 @@ export default class BudgetTahunan extends Component {
// })
}
approvalSubmission
(
type
)
{
let
body
=
{
"approval_id"
:
this
.
state
.
rawData
.
approval_id
,
"status"
:
type
,
"remarks"
:
"tes"
,
"detail"
:
[
{
"report_id"
:
1
,
"remarks"
:
""
}
]
}
api
.
create
().
ApprovalSubmission
(
body
)
}
clickDetail
(
item
,
id
,
revision
,
status
)
{
console
.
log
(
item
);
this
.
setState
({
...
...
@@ -427,7 +457,6 @@ export default class BudgetTahunan extends Component {
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
getCompanyActive
()
this
.
setState
({
loading
:
false
})
}
else
{
this
.
setState
({
loading
:
false
})
}
...
...
@@ -441,7 +470,7 @@ export default class BudgetTahunan extends Component {
let
array
=
[]
let
canSubmit
=
true
this
.
state
.
dataTable
.
map
(
item
=>
{
if
(
item
[
1
]
!==
'Cash Flow'
)
{
if
(
item
[
1
]
!==
'Cash Flow'
&&
item
[
1
]
!==
'CAT'
&&
item
[
1
]
!==
'Tax Planning'
)
{
if
(
item
[
3
]
!==
"submitted"
)
{
canSubmit
=
false
array
.
push
(
item
[
3
])
...
...
@@ -462,6 +491,7 @@ export default class BudgetTahunan extends Component {
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"Success"
)
{
this
.
getCompanyActive
()
this
.
setState
({
loading
:
true
})
}
}
})
...
...
@@ -571,6 +601,33 @@ export default class BudgetTahunan extends Component {
const
columnsHistory
=
[
"Name"
,
"Status"
,
"Remarks"
,
"Revision Item"
,
"Date"
]
const
columnRevisi
=
[
{
name
:
"#"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
,
updateValue
)
=>
{
var
list
=
[];
for
(
var
i
=
0
;
i
<=
tableMeta
.
rowData
[
6
];
i
++
)
{
list
.
push
(
i
);
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
val
}
control
=
{
<
Checkbox
/>
}
/
>
<
/div
>
);
}
}
},
"Report Type"
,
"Remarks"
]
const
options
=
{
filter
:
false
,
sort
:
false
,
...
...
@@ -583,6 +640,17 @@ export default class BudgetTahunan extends Component {
rowsPerPageOptions
:
[
5
,
25
,
100
],
search
:
false
}
const
optionsRevision
=
{
filter
:
false
,
sort
:
false
,
responsive
:
"scroll"
,
print
:
false
,
download
:
false
,
selectableRows
:
false
,
viewColumns
:
false
,
pagination
:
false
,
search
:
false
}
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
...
...
@@ -617,12 +685,13 @@ export default class BudgetTahunan extends Component {
{...
this
.
state
.
listPeriode
}
id
=
"periode"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periode
:
newInputValue
},
()
=>
{
this
.
setState
({
visibleTableHistory
:
false
})
this
.
setState
({
visibleTableHistory
:
false
,
loading
:
true
})
this
.
getRevision
()
this
.
getReport
()
this
.
getReportAttachment
()
this
.
getSubmission
()
})}
disabled
=
{
this
.
state
.
intent
===
'Home'
?
true
:
false
}
disableClearable
style
=
{{
width
:
250
}}
renderInput
=
{(
params
)
=>
...
...
@@ -635,8 +704,9 @@ export default class BudgetTahunan extends Component {
<
Autocomplete
{...
this
.
state
.
listCompany
}
id
=
"company"
disabled
=
{
this
.
state
.
intent
===
'Home'
?
true
:
false
}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
},
()
=>
{
this
.
setState
({
visibleTableHistory
:
false
})
this
.
setState
({
visibleTableHistory
:
false
,
loading
:
true
})
this
.
getRevision
()
this
.
getReport
()
this
.
getReportAttachment
()
...
...
@@ -771,14 +841,14 @@ export default class BudgetTahunan extends Component {
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
onClick
=
{()
=>
null
}
onClick
=
{()
=>
this
.
setState
({
visibleRevision
:
true
})
}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Review
<
/Typography
>
<
/div
>
<
/button
>
<
/div> : this.state.lastStatus === 'WAITING FOR YOUR APPROVAL'
?
<
div
className
=
"grid grid-2x"
style
=
{{
borderTop
:
'solid 1px #c4c4c4'
,
padding
:
10
,
backgroundColor
:
'#f5f5f5'
,
width
:
'100%'
,
}}
>
<
div
className
=
"grid grid-2x"
style
=
{{
borderTop
:
'solid 1px #c4c4c4'
,
padding
:
10
,
backgroundColor
:
'#f5f5f5'
,
width
:
'100%'
,
}}
>
<
div
className
=
"col-1"
>
<
button
style
=
{{
...
...
@@ -795,7 +865,7 @@ export default class BudgetTahunan extends Component {
<
/button
>
<
/div
>
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
...
...
@@ -897,6 +967,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget
=
{
this
.
saveToMasterBudget
.
bind
(
this
)}
onClickClose
=
{()
=>
this
.
setState
({
visibleBS
:
false
,
visibleBudgetTahunan
:
true
})}
getReport
=
{
this
.
getCompanyActive
.
bind
(
this
)}
isApprover
=
{
this
.
state
.
isApprover
}
/
>
)}
{
this
.
state
.
visiblePL
&&
(
...
...
@@ -913,6 +984,7 @@ export default class BudgetTahunan extends Component {
onClickClose
=
{()
=>
this
.
setState
({
visiblePL
:
false
,
visibleBudgetTahunan
:
true
})}
getReport
=
{
this
.
getReport
.
bind
(
this
)}
status
=
{
this
.
state
.
status
}
isApprover
=
{
this
.
state
.
isApprover
}
/
>
)}
...
...
@@ -978,6 +1050,119 @@ export default class BudgetTahunan extends Component {
getReport
=
{
this
.
getCompanyActive
.
bind
(
this
)}
/
>
)}
{
this
.
state
.
visibleRevision
&&
(
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"popup-content background-white border-radius"
style
=
{{
borderRadius
:
8
}}
>
<
div
className
=
"popup-panel grid grid-2x main-color"
style
=
{{
height
:
64
,
borderTopRightRadius
:
8
,
borderTopLeftRadius
:
8
}}
>
<
div
className
=
"col-1"
style
=
{{
maxWidth
:
"inherit"
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
className
=
"popup-title"
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
16
,
fontWeight
:
'bold'
}}
>
Revision
<
/span
>
<
/div
>
<
/div
>
<
div
className
=
"col-2 content-right"
style
=
{{
maxWidth
:
"inherit"
,
alignSelf
:
'center'
}}
>
<
button
type
=
"button"
className
=
"btn btn-circle btn-white"
onClick
=
{()
=>
this
.
setState
({
visibleRevision
:
false
})}
>
<
img
src
=
{
Images
.
close
}
/
>
<
/button
>
<
/div
>
<
/div
>
<
div
className
=
"border-bottom"
style
=
{{
padding
:
20
}}
>
<
span
>
Anda
meminta
anak
perusahaan
untuk
melakukan
revisi
.
<
/span
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
data
=
{
this
.
state
.
dataTableRevision
}
columns
=
{
columnRevisi
}
options
=
{
optionsRevision
}
/
>
<
/MuiThemeProvider
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
span
>
Durasi
waktu
yang
anda
berikan
untuk
revisi
:
<
/span
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'space-between'
,
marginTop
:
20
}}
>
<
div
>
<
DatePicker
margin
=
"normal"
id
=
"startDate"
label
=
"Valid From"
format
=
"dd-MM-yyyy"
onChange
=
{(
e
)
=>
null
}
KeyboardButtonProps
=
{{
'aria-label'
:
'change date'
,
}}
inputProps
=
{{
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
style
=
{{
padding
:
0
,
margin
:
0
,
width
:
'100%'
}}
/
>
<
/div
>
<
span
style
=
{{
alignSelf
:
'center'
}}
>
Sampai
dengan
<
/span
>
<
div
>
<
DatePicker
margin
=
"normal"
id
=
"startDate"
label
=
"Valid To"
format
=
"dd-MM-yyyy"
onChange
=
{(
e
)
=>
null
}
KeyboardButtonProps
=
{{
'aria-label'
:
'change date'
,
}}
inputProps
=
{{
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
style
=
{{
padding
:
0
,
margin
:
0
,
width
:
'100%'
}}
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"border-top grid grid-2x"
style
=
{{
height
:
56
,
backgroundColor
:
'#f5f5f5'
,
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
style
=
{{
alignSelf
:
'center'
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
null
}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
border
:
'solid 1px #354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#354960'
,
fontSize
:
11
}}
>
Cancel
<
/span
>
<
/div
>
<
/button
>
<
/div
>
<
div
className
=
"column-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
alignItems
:
'center'
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
null
}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
11
}}
>
Revision
<
/span
>
<
/div
>
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)}
<
/div
>
);
}
...
...
src/container/BudgetTahunan/BalanceSheet.js
View file @
bc515672
...
...
@@ -227,6 +227,7 @@ export default class BalanceSheet extends Component {
"balance_sheet"
:
data
}
// console.log(data);
this
.
setState
({
loading
:
false
})
this
.
props
.
saveToMasterBudget
(
payload
)
this
.
props
.
onClickClose
()
}
...
...
@@ -613,23 +614,23 @@ export default class BalanceSheet extends Component {
{
tableMeta
.
rowData
[
0
]
===
4
?
null
:
tableMeta
.
rowData
[
0
]
===
1
?
null
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
value
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
/
>
}
/
>
<
/div
>
null
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
value
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
/
>
}
/
>
<
/div
>
}
<
/div
>
)
...
...
@@ -658,6 +659,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
handleChange
(
event
.
target
.
value
,
tableMeta
)
...
...
@@ -744,6 +746,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -831,6 +834,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -918,6 +922,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -1005,6 +1010,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -1092,6 +1098,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -1179,6 +1186,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -1266,6 +1274,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -1353,6 +1362,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -1440,6 +1450,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -1527,6 +1538,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -1614,6 +1626,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -1701,6 +1714,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -1788,6 +1802,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -1875,6 +1890,7 @@ export default class BalanceSheet extends Component {
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
props
.
isApprover
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -1989,55 +2005,57 @@ export default class BalanceSheet extends Component {
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
in
IDR
mn
<
/Typography
>
<
/div
>
<
div
style
=
{{
width
:
'50%'
}}
>
<
div
style
=
{{
justifyContent
:
'flex-end'
,
display
:
'flex'
,
flexFlow
:
'wrap'
}}
>
<
a
data
-
tip
=
{
'Download Template'
}
data
-
for
=
"template"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
downloadTemplate
()}
>
<
img
src
=
{
Images
.
template
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"template"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Upload'
}
data
-
for
=
"upload"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
true
})}
>
<
img
src
=
{
Images
.
upload
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"upload"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Download'
}
data
-
for
=
"download"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
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
>
{
this
.
props
.
isApprover
==
true
?
null
:
<
div
style
=
{{
justifyContent
:
'flex-end'
,
display
:
'flex'
,
flexFlow
:
'wrap'
}}
>
<
a
data
-
tip
=
{
'Download Template'
}
data
-
for
=
"template"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
downloadTemplate
()}
>
<
img
src
=
{
Images
.
template
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"template"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Upload'
}
data
-
for
=
"upload"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
true
})}
>
<
img
src
=
{
Images
.
upload
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"upload"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Download'
}
data
-
for
=
"download"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
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
>
<
/div
>
...
...
@@ -2074,79 +2092,79 @@ export default class BalanceSheet extends Component {
<
/div
>
<
/button
>
<
/div
>
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
className
=
"button"
type
=
"button"
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
handleValidate
()
},
100
);
})
}}
>
<
div
style
=
{{
backgroundColor
:
'#fff'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
border
:
'solid 1px #354960'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#354960'
,
textAlign
:
'center'
}}
>
Calculate
<
/Typography
>
<
/div
>
<
/button
>
<
button
className
=
"button"
type
=
"button"
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
this
.
state
.
editable
===
true
?
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
backToMasterBudget
(
'draft'
)
},
100
);
})
:
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
props
.
onClickClose
()
},
100
);
})}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
as
Draft
<
/Typography
>
<
/div
>
<
/button
>
<
button
type
=
"button"
disabled
=
{
this
.
state
.
buttonError
}
onClick
=
{()
=>
{
this
.
state
.
buttonError
?
{
this
.
props
.
isApprover
===
true
?
null
:
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
className
=
"button"
type
=
"button"
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
,
loading
:
false
}
)
this
.
handleValidate
(
)
},
100
);
})
:
this
.
backToMasterBudget
(
'submitted'
)
}}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
&
Complete
<
/Typography
>
<
/div
>
<
/button
>
<
/div
>
}}
>
<
div
style
=
{{
backgroundColor
:
'#fff'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
border
:
'solid 1px #354960'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#354960'
,
textAlign
:
'center'
}}
>
Calculate
<
/Typography
>
<
/div
>
<
/button
>
<
button
className
=
"button"
type
=
"button"
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
editable
===
true
?
'pointer'
:
'default'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
this
.
state
.
editable
===
true
?
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
backToMasterBudget
(
'draft'
)
},
100
);
})
:
null
}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
as
Draft
<
/Typography
>
<
/div
>
<
/button
>
<
button
type
=
"button"
disabled
=
{
this
.
state
.
buttonError
}
onClick
=
{()
=>
{
this
.
state
.
buttonError
?
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
,
loading
:
false
})
},
100
);
})
:
this
.
setState
({
loading
:
true
},
()
=>
{
this
.
backToMasterBudget
(
'submitted'
)
})
}}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
&
Complete
<
/Typography
>
<
/div
>
<
/button
>
<
/div
>
}
<
/div
>
<
/Paper
>
:
...
...
src/container/BudgetTahunan/ProfitLoss.js
View file @
bc515672
...
...
@@ -521,148 +521,47 @@ export default class ProfitLoss extends Component {
return
a
}
const
handleFormula
=
(
data
,
tableMeta
,
month
)
=>
{
let
rilFormula
=
String
(
tableMeta
.
rowData
[
3
])
if
(
rilFormula
.
includes
(
'#'
))
{
if
(
this
.
props
.
status
===
"not-yet"
)
{
let
splitOrder
=
String
(
tableMeta
.
rowData
[
3
]).
split
(
'@'
)
for
(
let
index
=
0
;
index
<
splitOrder
.
length
;
index
++
)
{
if
(
splitOrder
[
index
]
===
""
)
{
}
else
{
if
(
splitOrder
[
index
].
includes
(
'#'
))
{
}
else
{
let
splitOperator
=
splitOrder
[
index
].
match
(
/
[
a-zA-Z
]
+|
[
0-9
]
+|
[
-!$%^&*()_+|~=`{}
\[\]
:";'<>?,.
\/]
+
(?:\.[
0-9
]
+@|
)
/g
)
let
reg
=
/^
\d
+$/
splitOperator
.
map
((
item
)
=>
{
if
(
reg
.
test
(
item
)
===
true
)
{
let
i
=
dataTable2
.
findIndex
((
val
)
=>
val
[
23
]
==
item
)
if
(
i
>
0
)
{
rilFormula
=
rilFormula
.
replace
(
item
,
dataTable2
[
i
][
tableMeta
.
columnIndex
]
===
""
?
"0"
:
dataTable2
[
i
][
tableMeta
.
columnIndex
])
}
}
})
}
}
}
let
body
=
{
"submission_id"
:
null
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"report_id"
:
this
.
props
.
report_id
,
"year"
:
this
.
props
.
periode
,
"month"
:
month
,
"formula"
:
rilFormula
}
api
.
create
().
countingFormula
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
// if (response.data) {
// if (response.data.status === "success") {
// return response.data.data.result
// }
// }
})
let
arrayFormula
=
tableMeta
.
rowData
[
3
].
match
(
/
[
a-zA-Z
]
+|
[
0-9
]
+|
[
-!$%^&*()_+|~=`{}
\[\]
:";'<>?,.
\/]
+
(?:\.[
0-9
]
+@|
)
/g
)
let
arrayJumlah
=
[]
arrayFormula
.
map
((
item
,
indexs
)
=>
{
let
index
=
dataTable2
.
findIndex
((
val
)
=>
val
[
23
]
==
item
)
if
(
index
>
0
)
{
arrayJumlah
.
push
(
dataTable2
[
index
][
tableMeta
.
columnIndex
])
}
else
{
let
body
=
{
"submission_id"
:
this
.
props
.
submissionID
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"report_id"
:
this
.
props
.
report_id
,
"year"
:
this
.
props
.
periode
,
"month"
:
month
,
"formula"
:
rilFormula
}
api
.
create
().
countingFormula
(
body
).
then
(
response
=>
{
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
return
response
.
data
.
data
.
result
}
}
})
arrayJumlah
.
push
(
item
)
}
}
else
{
let
arrayFormula
=
tableMeta
.
rowData
[
3
].
match
(
/
[
a-zA-Z
]
+|
[
0-9
]
+|
[
-!$%^&*()_+|~=`{}
\[\]
:";'<>?,.
\/]
+
(?:\.[
0-9
]
+@|
)
/g
)
let
arrayJumlah
=
[]
arrayFormula
.
map
((
item
,
indexs
)
=>
{
let
index
=
dataTable2
.
findIndex
((
val
)
=>
val
[
23
]
==
item
)
if
(
index
>
0
)
{
arrayJumlah
.
push
(
dataTable2
[
index
][
tableMeta
.
columnIndex
])
}
else
{
arrayJumlah
.
push
(
item
)
}
// if (indexs % 2 !== 0) {
// operator.push(item)
// }
})
let
array
=
arrayJumlah
let
total
=
0
let
opt
=
""
array
.
map
((
item
,
index
)
=>
{
if
(
item
==
"+"
)
{
opt
=
"tambah"
}
else
if
(
item
==
"-"
)
{
opt
=
"kurang"
}
else
if
(
item
==
"*"
)
{
opt
=
"kali"
}
else
if
(
item
==
"/"
)
{
opt
=
"bagi"
// if (indexs % 2 !== 0) {
// operator.push(item)
// }
})
let
array
=
arrayJumlah
let
total
=
0
let
opt
=
""
array
.
map
((
item
,
index
)
=>
{
if
(
item
==
"+"
)
{
opt
=
"tambah"
}
else
if
(
item
==
"-"
)
{
opt
=
"kurang"
}
else
if
(
item
==
"*"
)
{
opt
=
"kali"
}
else
if
(
item
==
"/"
)
{
opt
=
"bagi"
}
else
{
if
(
opt
==
"tambah"
)
{
total
=
Number
(
total
)
+
Number
(
item
)
}
else
if
(
opt
==
"kurang"
)
{
total
=
Number
(
total
)
-
Number
(
item
)
}
else
if
(
opt
==
"kali"
)
{
total
=
Number
(
total
)
*
Number
(
item
)
}
else
if
(
opt
==
"bagi"
)
{
total
=
Number
(
total
)
/
Number
(
item
)
}
else
{
if
(
opt
==
"tambah"
)
{
total
=
Number
(
total
)
+
Number
(
item
)
}
else
if
(
opt
==
"kurang"
)
{
total
=
Number
(
total
)
-
Number
(
item
)
}
else
if
(
opt
==
"kali"
)
{
total
=
Number
(
total
)
*
Number
(
item
)
}
else
if
(
opt
==
"bagi"
)
{
total
=
Number
(
total
)
/
Number
(
item
)
}
else
{
total
+=
item
}
total
+=
item
}
})
let
a
=
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
total
)
return
a
}
// console.log(rilFormula);
// let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
// let arrayJumlah = []
// arrayFormula.map((item, indexs) => {
// let index = dataTable2.findIndex((val) => val[1] == item)
// if (index > 0) {
// arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
// } else {
// arrayJumlah.push(item)
// }
// // if (indexs % 2 !== 0) {
// // operator.push(item)
// // }
// })
// let array = arrayJumlah
// let total = 0
// let opt = ""
// array.map((item, index) => {
// if (item == "+") {
// opt = "tambah"
// } else if (item == "-") {
// opt = "kurang"
// } else if (item == "*") {
// opt = "kali"
// } else if (item == "/") {
// opt = "bagi"
// } else {
// if (opt == "tambah") {
// total = Number(total) + Number(item)
// } else if (opt == "kurang") {
// total = Number(total) - Number(item)
// } else if (opt == "kali") {
// total = Number(total) * Number(item)
// } else if (opt == "bagi") {
// total = Number(total) / Number(item)
// } else {
// total += item
// }
// }
// })
// let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
// return a
}
})
let
a
=
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
total
)
return
a
}
...
...
src/container/HomePage.js
View file @
bc515672
...
...
@@ -24,7 +24,7 @@ class HomePage extends Component {
api
.
create
().
getDetailUser
(
userId
).
then
((
response
)
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
userData
:
response
.
data
.
data
},
()
=>
{
this
.
setState
({
userData
:
response
.
data
.
data
},
()
=>
{
console
.
log
(
this
.
state
.
userData
)
})
}
...
...
@@ -33,22 +33,23 @@ class HomePage extends Component {
this
.
getDashboard
()
}
componentDidUpdate
()
{
componentDidUpdate
()
{
window
.
onpopstate
=
e
=>
{
//your code...
this
.
props
.
selectIndex
(
'Home'
)
//your code...
this
.
props
.
selectIndex
(
'Home'
)
}
}
getDashboard
()
{
let
listDashboard
=
[]
api
.
create
().
getDashboard
().
then
((
response
)
=>
{
console
.
log
(
response
);
if
(
String
(
response
.
data
.
status
).
toLocaleLowerCase
()
==
'success'
)
{
let
data
=
response
.
data
.
data
data
.
map
((
item
,
index
)
=>
{
listDashboard
.
push
([
index
+
1
,
item
.
approval_id
,
item
.
company_name
,
`
${
item
.
type_report
}
-
${
item
.
periode
}
`
,
item
.
revision
,
item
.
status
])
data
.
map
((
item
,
index
)
=>
{
listDashboard
.
push
([
index
+
1
,
item
.
approval_id
,
item
.
company_name
,
`
${
item
.
type_report
}
-
${
item
.
periode
}
`
,
item
.
revision
,
item
.
status
])
})
this
.
setState
({
listDashboard
})
this
.
setState
({
listDashboard
,
rawData
:
response
.
data
.
data
})
}
})
}
...
...
@@ -58,9 +59,16 @@ class HomePage extends Component {
name
:
"Action"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
// console.log(tableMeta);
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
Link
to
=
{{
pathname
:
`/home/master-budget/`
,
state
:
{
userType
:
'approver'
}}}
>
<
Link
to
=
{{
pathname
:
`/home/master-budget/`
,
state
:
{
userType
:
'approver'
,
rawData
:
this
.
state
.
rawData
[
tableMeta
.
rowIndex
]
}
}}
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
...
...
@@ -126,7 +134,7 @@ class HomePage extends Component {
return
(
<
div
style
=
{{
flex
:
1
,
backgroundColor
:
'#f8f8f8'
}}
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
flex
:
1
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'24px'
,
color
:
'white'
}}
>
{
this
.
state
.
userData
===
null
?
''
:
`Welcome,
${
this
.
state
.
userData
.
fullname
}
!`
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'24px'
,
color
:
'white'
}}
>
{
this
.
state
.
userData
===
null
?
''
:
`Welcome,
${
this
.
state
.
userData
.
fullname
}
!`
}
<
/Typography
>
<
/div
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
...
...
@@ -138,7 +146,7 @@ class HomePage extends Component {
<
div
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
data
=
{
data
}
data
=
{
this
.
state
.
listDashboard
}
columns
=
{
columns
}
options
=
{
options
}
/
>
...
...
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