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
44860c47
Commit
44860c47
authored
Sep 22, 2020
by
Rifka Kurnia Irfiana
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://103.44.149.204/d.arizona/tia-dev
into rifka
parents
7501ca6e
842274e1
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
496 additions
and
121 deletions
+496
-121
BudgetTahunan.js
src/container/BudgetTahunan.js
+36
-4
BalanceSheet.js
src/container/BudgetTahunan/BalanceSheet.js
+74
-11
CashFlow.js
src/container/BudgetTahunan/CashFlow.js
+88
-0
CorporateAnnualTarget.js
src/container/BudgetTahunan/CorporateAnnualTarget.js
+175
-93
FixedAssetsMovement.js
src/container/BudgetTahunan/FixedAssetsMovement.js
+68
-8
ProfitLoss.js
src/container/BudgetTahunan/ProfitLoss.js
+55
-5
No files found.
src/container/BudgetTahunan.js
View file @
44860c47
...
@@ -16,6 +16,7 @@ import UploadFile from "../library/Upload";
...
@@ -16,6 +16,7 @@ import UploadFile from "../library/Upload";
import
{
format
}
from
'date-fns'
;
import
{
format
}
from
'date-fns'
;
import
Constant
from
'../library/Constant'
;
import
Constant
from
'../library/Constant'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
import
PropagateLoader
from
"react-spinners/PropagateLoader"
import
CashFlow
from
'./BudgetTahunan/CashFlow'
;
var
ct
=
require
(
"../library/CustomTable"
);
var
ct
=
require
(
"../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
...
@@ -40,6 +41,7 @@ export default class BudgetTahunan extends Component {
...
@@ -40,6 +41,7 @@ export default class BudgetTahunan extends Component {
visiblePL
:
false
,
visiblePL
:
false
,
visibleFAM
:
false
,
visibleFAM
:
false
,
visibleCAT
:
false
,
visibleCAT
:
false
,
visibleCF
:
false
,
listAttachment
:
[],
listAttachment
:
[],
visibleUpload
:
false
,
visibleUpload
:
false
,
revisionTable
:
null
,
revisionTable
:
null
,
...
@@ -220,6 +222,7 @@ export default class BudgetTahunan extends Component {
...
@@ -220,6 +222,7 @@ export default class BudgetTahunan extends Component {
visibleCAT
:
false
,
visibleCAT
:
false
,
visibleFAM
:
false
,
visibleFAM
:
false
,
visibleTP
:
false
,
visibleTP
:
false
,
visibleCF
:
false
,
})
})
}
else
if
(
item
===
'Profit Loss'
)
{
}
else
if
(
item
===
'Profit Loss'
)
{
this
.
setState
({
this
.
setState
({
...
@@ -228,7 +231,8 @@ export default class BudgetTahunan extends Component {
...
@@ -228,7 +231,8 @@ export default class BudgetTahunan extends Component {
visiblePL
:
true
,
visiblePL
:
true
,
visibleCAT
:
false
,
visibleCAT
:
false
,
visibleFAM
:
false
,
visibleFAM
:
false
,
visibleTP
:
false
visibleTP
:
false
,
visibleCF
:
false
,
})
})
}
else
if
(
item
===
'Tax Planning'
)
{
}
else
if
(
item
===
'Tax Planning'
)
{
this
.
setState
({
this
.
setState
({
...
@@ -237,7 +241,8 @@ export default class BudgetTahunan extends Component {
...
@@ -237,7 +241,8 @@ export default class BudgetTahunan extends Component {
visiblePL
:
false
,
visiblePL
:
false
,
visibleCAT
:
false
,
visibleCAT
:
false
,
visibleFAM
:
false
,
visibleFAM
:
false
,
visibleTP
:
true
visibleTP
:
true
,
visibleCF
:
false
,
})
})
}
else
if
(
item
===
'Fixed Assets Movement'
)
{
}
else
if
(
item
===
'Fixed Assets Movement'
)
{
this
.
setState
({
this
.
setState
({
...
@@ -246,7 +251,8 @@ export default class BudgetTahunan extends Component {
...
@@ -246,7 +251,8 @@ export default class BudgetTahunan extends Component {
visiblePL
:
false
,
visiblePL
:
false
,
visibleCAT
:
false
,
visibleCAT
:
false
,
visibleFAM
:
true
,
visibleFAM
:
true
,
visibleTP
:
false
visibleTP
:
false
,
visibleCF
:
false
,
})
})
}
else
if
(
item
===
'CAT'
)
{
}
else
if
(
item
===
'CAT'
)
{
this
.
setState
({
this
.
setState
({
...
@@ -255,7 +261,18 @@ export default class BudgetTahunan extends Component {
...
@@ -255,7 +261,18 @@ export default class BudgetTahunan extends Component {
visiblePL
:
false
,
visiblePL
:
false
,
visibleCAT
:
true
,
visibleCAT
:
true
,
visibleFAM
:
false
,
visibleFAM
:
false
,
visibleTP
:
false
visibleTP
:
false
,
visibleCF
:
false
,
})
}
else
if
(
item
===
"Cash Flow"
){
this
.
setState
({
visibleBudgetTahunan
:
false
,
visibleBS
:
false
,
visiblePL
:
false
,
visibleCAT
:
false
,
visibleFAM
:
false
,
visibleTP
:
false
,
visibleCF
:
true
,
})
})
}
}
})
})
...
@@ -684,6 +701,21 @@ export default class BudgetTahunan extends Component {
...
@@ -684,6 +701,21 @@ export default class BudgetTahunan extends Component {
getReport
=
{
this
.
getCompanyActive
.
bind
(
this
)}
getReport
=
{
this
.
getCompanyActive
.
bind
(
this
)}
/
>
/
>
)}
)}
{
this
.
state
.
visibleCF
&&
(
<
CashFlow
open
=
{
this
.
props
.
open
}
report_id
=
{
this
.
state
.
report_id
}
height
=
{
this
.
props
.
height
}
width
=
{
this
.
props
.
width
}
company
=
{
this
.
state
.
company
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
submissionID
=
{
this
.
state
.
submissionID
}
saveToMasterBudget
=
{
this
.
saveToMasterBudget
.
bind
(
this
)}
onClickClose
=
{()
=>
this
.
setState
({
visibleCF
:
false
,
visibleBudgetTahunan
:
true
})}
getReport
=
{
this
.
getCompanyActive
.
bind
(
this
)}
/
>
)}
<
/div
>
<
/div
>
);
);
}
}
...
...
src/container/BudgetTahunan/BalanceSheet.js
View file @
44860c47
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
Typography
,
Paper
,
createMuiTheme
,
MuiThemeProvider
,
TableCell
,
FormControlLabel
,
TextField
,
Input
,
Tooltip
,
withStyles
}
from
'@material-ui/core'
;
import
{
Typography
,
Paper
,
createMuiTheme
,
MuiThemeProvider
,
TableCell
,
FormControlLabel
,
TextField
,
Input
,
Tooltip
,
withStyles
,
Snackbar
}
from
'@material-ui/core'
;
import
MUIDataTable
from
'mui-datatables'
;
import
MUIDataTable
from
'mui-datatables'
;
import
NumberFormat
from
'react-number-format'
;
import
NumberFormat
from
'react-number-format'
;
import
api
from
'../../api'
;
import
api
from
'../../api'
;
import
AddIcon
from
'@material-ui/icons/Add'
;
import
{
values
}
from
'ramda'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
import
PropagateLoader
from
"react-spinners/PropagateLoader"
import
Images
from
'../../assets/Images'
;
import
Images
from
'../../assets/Images'
;
import
ReactTooltip
from
'react-tooltip'
;
import
ReactTooltip
from
'react-tooltip'
;
import
UploadFile
from
"../../library/Upload"
;
import
UploadFile
from
"../../library/Upload"
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
{
Alert
}
from
'@material-ui/lab'
;
const
LightTooltip
=
withStyles
((
theme
)
=>
({
const
LightTooltip
=
withStyles
((
theme
)
=>
({
tooltip
:
{
tooltip
:
{
...
@@ -367,6 +366,8 @@ export default class BalanceSheet extends Component {
...
@@ -367,6 +366,8 @@ export default class BalanceSheet extends Component {
}
}
async
downloadAllData
()
{
async
downloadAllData
()
{
let
url
=
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=
${
this
.
props
.
submissionID
}
&&report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
&&revision=
${
this
.
props
.
revision
}
`
console
.
log
(
url
);
let
res
=
await
fetch
(
let
res
=
await
fetch
(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=
${
this
.
props
.
submissionID
}
&&report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
&&revision=
${
this
.
props
.
revision
}
`
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=
${
this
.
props
.
submissionID
}
&&report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
&&revision=
${
this
.
props
.
revision
}
`
)
)
...
@@ -381,6 +382,53 @@ export default class BalanceSheet extends Component {
...
@@ -381,6 +382,53 @@ export default class BalanceSheet extends Component {
}
}
}
}
handleValidate
()
{
let
data
=
[]
console
.
log
(
this
.
state
.
dataTable
)
this
.
state
.
dataTable
.
map
(
i
=>
{
data
.
push
({
item_report_id
:
i
[
1
],
total_actual_before
:
String
(
i
[
6
]),
january
:
String
(
i
[
7
]),
february
:
String
(
i
[
8
]),
march
:
String
(
i
[
9
]),
april
:
String
(
i
[
10
]),
may
:
String
(
i
[
11
]),
june
:
String
(
i
[
12
]),
july
:
String
(
i
[
13
]),
august
:
String
(
i
[
14
]),
september
:
String
(
i
[
15
]),
october
:
String
(
i
[
16
]),
november
:
String
(
i
[
17
]),
december
:
String
(
i
[
18
]),
total_current_year
:
String
(
i
[
19
]),
total_next_year
:
String
(
i
[
20
]),
total_more_year
:
String
(
i
[
21
])
})
})
console
.
log
(
JSON
.
stringify
(
data
))
let
payload
=
{
"submission_id"
:
this
.
props
.
submissionID
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
this
.
props
.
report_id
,
"balance_sheet"
:
data
,
"status"
:
"submitted"
}
api
.
create
().
validateSubmitReport
(
payload
).
then
((
response
)
=>
{
console
.
log
(
response
)
if
(
response
.
data
.
data
.
result
)
{
this
.
setState
({
loading
:
false
,
buttonError
:
false
,
editable
:
true
})
}
else
{
this
.
setState
({
loading
:
false
,
buttonError
:
true
,
editable
:
true
})
}
})
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
render
()
{
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
let
dataTable2
=
this
.
state
.
dataTable
const
handleChange
=
(
value
,
tableMeta
,
type
)
=>
{
const
handleChange
=
(
value
,
tableMeta
,
type
)
=>
{
...
@@ -1847,7 +1895,12 @@ export default class BalanceSheet extends Component {
...
@@ -1847,7 +1895,12 @@ export default class BalanceSheet extends Component {
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
flex
:
1
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
flex
:
1
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Pengajuan
Budget
Tahunan
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Pengajuan
Budget
Tahunan
<
/Typography
>
<
/div
>
<
/div
>
{
this
.
state
.
loading
&&
loadingComponent
}
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
{
/* {this.state.loading && loadingComponent} */
}
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
{
this
.
state
.
visibleBalanceSheet
===
true
?
{
this
.
state
.
visibleBalanceSheet
===
true
?
<
Paper
style
=
{{
paddingTop
:
10
,
paddingBottom
:
20
}}
>
<
Paper
style
=
{{
paddingTop
:
10
,
paddingBottom
:
20
}}
>
...
@@ -1915,13 +1968,14 @@ export default class BalanceSheet extends Component {
...
@@ -1915,13 +1968,14 @@ export default class BalanceSheet extends Component {
<
/div
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
{
!
this
.
state
.
loading
&&
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
{
this
.
state
.
loading
&&
loadingComponent
}
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
<
MUIDataTable
data
=
{
dataTable2
}
data
=
{
dataTable2
}
columns
=
{
columns
}
columns
=
{
columns
}
options
=
{
options
}
options
=
{
options
}
/
>
/
>
<
/MuiThemeProvider>
}
<
/MuiThemeProvider
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"grid grid-2x"
style
=
{{
marginTop
:
20
}}
>
<
div
className
=
"grid grid-2x"
style
=
{{
marginTop
:
20
}}
>
...
@@ -1985,7 +2039,7 @@ export default class BalanceSheet extends Component {
...
@@ -1985,7 +2039,7 @@ export default class BalanceSheet extends Component {
onClick
=
{()
=>
{
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
,
buttonError
:
false
,
editable
:
true
}
)
this
.
handleValidate
(
)
},
100
);
},
100
);
})
})
}}
}}
...
@@ -1996,8 +2050,16 @@ export default class BalanceSheet extends Component {
...
@@ -1996,8 +2050,16 @@ export default class BalanceSheet extends Component {
<
/button
>
<
/button
>
<
button
<
button
type
=
"button"
type
=
"button"
disabled
=
{
this
.
state
.
buttonError
}
// disabled={this.state.buttonError}
onClick
=
{()
=>
this
.
backToMasterBudget
(
'submitted'
)}
onClick
=
{()
=>
{
this
.
state
.
buttonError
?
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
,
loading
:
false
})
},
100
);
})
:
this
.
backToMasterBudget
(
'submitted'
)
}}
style
=
{{
style
=
{{
backgroundColor
:
'transparent'
,
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
...
@@ -2023,13 +2085,14 @@ export default class BalanceSheet extends Component {
...
@@ -2023,13 +2085,14 @@ export default class BalanceSheet extends Component {
<
/div
>
<
/div
>
{
this
.
state
.
dataLoaded
&&
(
{
this
.
state
.
dataLoaded
&&
(
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
{
!
this
.
state
.
loading
&&
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
{
this
.
state
.
loading
&&
loadingComponent
}
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
<
MUIDataTable
data
=
{
dataTable2
}
data
=
{
dataTable2
}
columns
=
{
columns
}
columns
=
{
columns
}
options
=
{
options
}
options
=
{
options
}
/
>
/
>
<
/MuiThemeProvider>
}
<
/MuiThemeProvider
>
<
/div
>
<
/div
>
)}
)}
<
/div
>
<
/div
>
...
...
src/container/BudgetTahunan/CashFlow.js
0 → 100644
View file @
44860c47
import
{
Paper
,
Typography
}
from
'@material-ui/core'
import
React
,
{
Component
}
from
'react'
import
ReactTooltip
from
'react-tooltip'
;
import
Images
from
'../../assets/Images'
;
export
default
class
CashFlow
extends
Component
{
render
()
{
return
(
<
div
style
=
{{
height
:
this
.
props
.
height
,
backgroundColor
:
'#f8f8f8'
,
marginBottom
:
100
,
minHeight
:
1000
}}
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
flex
:
1
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Pengajuan
Budget
Tahunan
<
/Typography
>
<
/div
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
Paper
style
=
{{
paddingTop
:
10
,
paddingBottom
:
20
}}
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Budget
Tahunan
-
Cash
Flow
<
/Typography
>
<
/div
>
<
div
style
=
{{
padding
:
20
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'space-between'
}}
>
<
div
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
{
this
.
props
.
company
.
company_name
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
Period
:
{
this
.
props
.
periode
}
(
rev
.{
this
.
props
.
revision
})
<
/Typography
>
<
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
=
{()
=>
null
}
>
<
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
=
{()
=>
null
}
>
<
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
=
{()
=>
null
}
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"download"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
<
/div
>
{
/* <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</div> */
}
<
/div
>
<
/Paper
>
<
/div
>
<
/div
>
)
}
}
src/container/BudgetTahunan/CorporateAnnualTarget.js
View file @
44860c47
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
Typography
,
Paper
,
createMuiTheme
,
MuiThemeProvider
,
TableCell
,
FormControlLabel
,
TextField
,
Input
,
withStyles
,
makeStyles
,
Snackbar
}
from
'@material-ui/core'
;
import
{
Typography
,
Paper
,
createMuiTheme
,
ThemeProvider
,
MuiThemeProvider
,
TableCell
,
FormControlLabel
,
TextField
,
Input
,
withStyles
,
makeStyles
,
Snackbar
}
from
'@material-ui/core'
;
import
MUIDataTable
from
'mui-datatables'
;
import
MUIDataTable
from
'mui-datatables'
;
import
NumberFormat
from
'react-number-format'
;
import
NumberFormat
from
'react-number-format'
;
import
api
from
'../../api'
;
import
api
from
'../../api'
;
...
@@ -39,6 +39,17 @@ const style2 = {
...
@@ -39,6 +39,17 @@ const style2 = {
zIndex
:
100
zIndex
:
100
};
};
const
theme
=
createMuiTheme
({
overrides
:
{
// Style sheet name ⚛️
MuiInputBase
:
{
input
:
{
color
:
'#5198ea'
}
}
},
});
export
default
class
CorporateAnnualTarget
extends
Component
{
export
default
class
CorporateAnnualTarget
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
...
@@ -54,7 +65,7 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -54,7 +65,7 @@ export default class CorporateAnnualTarget extends Component {
loading
:
false
,
loading
:
false
,
uomList
:
[],
uomList
:
[],
formulaYtdList
:
{
formulaYtdList
:
{
options
:
[{
value
:
'SUM'
},
{
value
:
'AVG'
},
{
value
:
'
MIN'
},
{
value
:
'MAX
'
}],
options
:
[{
value
:
'SUM'
},
{
value
:
'AVG'
},
{
value
:
'
LAST
'
}],
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
value
),
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
value
),
},
},
kpiTypeList
:
[],
kpiTypeList
:
[],
...
@@ -62,7 +73,8 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -62,7 +73,8 @@ export default class CorporateAnnualTarget extends Component {
visibleCAT
:
true
,
visibleCAT
:
true
,
buttonError
:
true
,
buttonError
:
true
,
// formulaYTDList: null,,
// formulaYTDList: null,,
dataDelete
:
[]
dataDelete
:
[],
dataReal
:
[]
}
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
@@ -101,7 +113,7 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -101,7 +113,7 @@ export default class CorporateAnnualTarget extends Component {
item
.
level
,
item
.
level
,
""
,
""
,
item
.
description
,
item
.
description
,
item
.
cat
.
weight
,
item
.
type_report_id
==
1
?
`
${
Number
(
item
.
weight
)
*
100
}
%`
:
(
String
(
item
.
cat
.
weight
).
includes
(
'%'
)?
`
${
Number
(
String
(
item
.
cat
.
weight
).
replace
(
'%'
,
''
))
*
100
}
%`
:
`
${
Number
(
item
.
cat
.
weight
)
*
100
}
%`
)
,
item
.
cat
.
uom
,
item
.
cat
.
uom
,
item
.
cat
.
kpi_type
==
""
?
null
:
{
value
:
item
.
cat
.
kpi_type
},
item
.
cat
.
kpi_type
==
""
?
null
:
{
value
:
item
.
cat
.
kpi_type
},
item
.
cat
.
max_ach
==
""
?
null
:
{
value
:
item
.
cat
.
max_ach
},
item
.
cat
.
max_ach
==
""
?
null
:
{
value
:
item
.
cat
.
max_ach
},
...
@@ -143,7 +155,7 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -143,7 +155,7 @@ export default class CorporateAnnualTarget extends Component {
item
.
level
,
item
.
level
,
""
,
""
,
item
.
description
,
item
.
description
,
item
.
cat
.
weight
,
item
.
type_report_id
==
1
?
`
${
Number
(
item
.
weight
)
*
100
}
%`
:
(
String
(
item
.
cat
.
weight
).
includes
(
'%'
)?
`
${
Number
(
String
(
item
.
cat
.
weight
).
replace
(
'%'
,
''
))
*
100
}
%`
:
`
${
Number
(
item
.
cat
.
weight
)
*
100
}
%`
)
,
item
.
cat
.
uom
,
item
.
cat
.
uom
,
item
.
cat
.
kpi_type
==
""
?
null
:
{
value
:
item
.
cat
.
kpi_type
},
item
.
cat
.
kpi_type
==
""
?
null
:
{
value
:
item
.
cat
.
kpi_type
},
item
.
cat
.
max_ach
==
""
?
null
:
{
value
:
item
.
cat
.
max_ach
},
item
.
cat
.
max_ach
==
""
?
null
:
{
value
:
item
.
cat
.
max_ach
},
...
@@ -175,7 +187,7 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -175,7 +187,7 @@ export default class CorporateAnnualTarget extends Component {
}
}
}
}
})
})
this
.
setState
({
dataTable
,
loading
:
false
})
this
.
setState
({
dataTable
,
loading
:
false
,
dataReal
:
res
})
})
})
}
}
...
@@ -189,7 +201,7 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -189,7 +201,7 @@ export default class CorporateAnnualTarget extends Component {
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
let
a
=
document
.
createElement
(
'a'
);
a
.
href
=
url
;
a
.
href
=
url
;
a
.
download
=
'Template
Balance Sheet
.xlsx'
;
a
.
download
=
'Template
Master Budget CAT
.xlsx'
;
a
.
click
();
a
.
click
();
}
}
}
}
...
@@ -427,6 +439,17 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -427,6 +439,17 @@ export default class CorporateAnnualTarget extends Component {
"status"
:
"submitted"
,
"status"
:
"submitted"
,
"cat"
:
data
"cat"
:
data
}
}
let
totalWeight
=
0
this
.
state
.
dataTable
.
map
((
items
,
indexs
)
=>
{
if
(
items
[
0
]
==
3
)
{
console
.
log
(
items
[
7
])
totalWeight
+=
Number
(
items
[
7
].
replace
(
'%'
,
''
))
}
})
console
.
log
(
totalWeight
)
if
(
totalWeight
<
100
)
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'Total weight less than 100%'
,
tipeAlert
:
'warning'
,
loading
:
false
,
buttonError
:
true
,
editable
:
true
})
}
else
{
api
.
create
().
validateSubmitReport
(
payload
).
then
((
response
)
=>
{
api
.
create
().
validateSubmitReport
(
payload
).
then
((
response
)
=>
{
console
.
log
(
response
)
console
.
log
(
response
)
if
(
response
.
data
.
data
.
result
)
{
if
(
response
.
data
.
data
.
result
)
{
...
@@ -436,6 +459,7 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -436,6 +459,7 @@ export default class CorporateAnnualTarget extends Component {
}
}
})
})
}
}
}
closeAlert
()
{
closeAlert
()
{
this
.
setState
({
alert
:
false
})
this
.
setState
({
alert
:
false
})
...
@@ -608,23 +632,72 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -608,23 +632,72 @@ export default class CorporateAnnualTarget extends Component {
const
handleChange
=
(
value
,
tableMeta
)
=>
{
const
handleChange
=
(
value
,
tableMeta
)
=>
{
let
val
=
String
(
value
).
split
(
","
).
join
(
""
)
let
val
=
String
(
value
).
split
(
","
).
join
(
""
)
let
total
=
0
let
total
=
0
let
lastValz
=
0
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
dataTable2
[
tableMeta
.
rowIndex
].
map
((
item
,
index
)
=>
{
dataTable2
[
tableMeta
.
rowIndex
].
map
((
item
,
index
)
=>
{
if
(
index
>=
13
&&
index
<=
24
)
{
if
(
index
>=
13
&&
index
<=
24
)
{
let
valItem
=
item
==
undefined
||
item
==
""
?
0
:
item
let
valItem
=
item
==
undefined
||
item
==
""
?
0
:
item
total
+=
Number
(
valItem
)
total
+=
Number
(
valItem
)
if
(
index
==
24
)
{
lastValz
+=
Number
(
valItem
)
}
}
}
})
})
dataTable2
[
tableMeta
.
rowIndex
][
25
]
=
total
let
valz
=
dataTable2
[
tableMeta
.
rowIndex
][
11
]
==
null
?
'SUM'
:
dataTable2
[
tableMeta
.
rowIndex
][
11
].
value
dataTable2
[
tableMeta
.
rowIndex
][
25
]
=
(
valz
==
'SUM'
?
total
:
(
valz
==
'AVG'
?
(
total
/
12
)
:
lastValz
))
console
.
log
(
dataTable2
[
tableMeta
.
rowIndex
])
console
.
log
(
dataTable2
[
tableMeta
.
rowIndex
])
}
}
const
handleChangeDropdown
=
(
value
,
tableMeta
)
=>
{
const
handleChangeDropdown
=
(
value
,
tableMeta
)
=>
{
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
value
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
value
let
valz
=
value
.
value
let
total
=
0
let
lastValz
=
0
if
(
valz
==
'SUM'
||
valz
==
'AVG'
||
valz
==
'LAST'
)
{
dataTable2
[
tableMeta
.
rowIndex
].
map
((
item
,
index
)
=>
{
if
(
index
>=
13
&&
index
<=
24
)
{
let
valItem
=
item
==
undefined
||
item
==
""
?
0
:
item
total
+=
Number
(
valItem
)
if
(
index
==
24
)
{
lastValz
+=
Number
(
valItem
)
}
}
})
dataTable2
[
tableMeta
.
rowIndex
][
25
]
=
(
valz
==
'SUM'
?
total
:
(
valz
==
'AVG'
?
(
total
/
12
)
:
lastValz
))
}
}
}
const
handleChangePercentage
=
(
value
,
tableMeta
)
=>
{
const
handleChangePercentage
=
(
value
,
tableMeta
)
=>
{
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
value
let
valueReal
=
value
.
replace
(
'%'
,
''
)
let
indexParentDatatable
=
dataTable2
.
findIndex
((
val
)
=>
val
[
1
]
==
tableMeta
.
rowData
[
2
])
let
indexParentReal
=
this
.
state
.
dataReal
.
findIndex
((
val
)
=>
val
.
id
==
tableMeta
.
rowData
[
2
])
// console.log(indexParentDatatable)
// console.log(indexParentReal)
let
valParent
=
dataTable2
[
indexParentDatatable
][
7
]
valParent
.
replace
(
'%'
,
''
)
let
valChild
=
0
dataTable2
.
map
((
item
,
index
)
=>
{
if
(
item
[
2
]
==
dataTable2
[
indexParentDatatable
][
1
]
&&
item
[
1
]
!==
tableMeta
.
rowData
[
1
])
{
let
weightItem
=
item
[
7
]
==
""
?
0
:
item
[
7
].
replace
(
'%'
,
''
)
console
.
log
(
weightItem
)
valChild
+=
Number
(
weightItem
)
}
})
let
endVal
=
''
// console.log(Number(valueReal) + Number(valChild))
// console.log(valueReal)
// console.log(Number(valParent.replace('%', '')))
if
((
Number
(
valueReal
)
+
Number
(
valChild
))
>
Number
(
valParent
.
replace
(
'%'
,
''
)))
{
endVal
=
`
${
Number
(
valParent
.
replace
(
'%'
,
''
))
-
(
Number
(
valChild
))}
%`
console
.
log
(
endVal
)
}
else
{
endVal
=
`
${
Number
(
valueReal
)}
%`
console
.
log
(
endVal
)
}
// console.log(endVal)
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
endVal
}
}
const
handleChangeText
=
(
value
,
tableMeta
)
=>
{
const
handleChangeText
=
(
value
,
tableMeta
)
=>
{
...
@@ -681,6 +754,7 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -681,6 +754,7 @@ export default class CorporateAnnualTarget extends Component {
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
""
])
])
...
@@ -872,8 +946,11 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -872,8 +946,11 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
return
(
return
(
<
div
style
=
{{
textAlign
:
'right'
}}
>
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
tableMeta
.
rowData
[
0
]
===
1
||
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
null
:
null
:
tableMeta
.
rowData
[
0
]
===
1
?
value
:
<
div
style
=
{{
flex
:
1
}}
>
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
<
FormControlLabel
style
=
{{
margin
:
0
}}
style
=
{{
margin
:
0
}}
...
@@ -888,14 +965,6 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -888,14 +965,6 @@ export default class CorporateAnnualTarget extends Component {
value
=
{
value
}
value
=
{
value
}
maxLength
=
{
4
}
maxLength
=
{
4
}
onBlur
=
{(
event
)
=>
{
onBlur
=
{(
event
)
=>
{
let
valueReal
=
event
.
target
.
value
.
replace
(
'%'
,
''
)
let
some
=
''
console
.
log
(
Number
(
valueReal
)
>
100
)
if
(
Number
(
valueReal
)
>
100
)
{
some
=
'100%'
}
else
{
some
=
event
.
target
.
value
}
// updateValue(some)
// updateValue(some)
handleChangePercentage
(
event
.
target
.
value
,
tableMeta
)
handleChangePercentage
(
event
.
target
.
value
,
tableMeta
)
}}
}}
...
@@ -925,19 +994,31 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -925,19 +994,31 @@ export default class CorporateAnnualTarget extends Component {
style
=
{{
margin
:
0
}}
style
=
{{
margin
:
0
}}
// value={value}
// value={value}
control
=
{
control
=
{
!
handleAction
(
tableMeta
.
rowData
[
2
])?
<
Input
<
Input
disableUnderline
=
{
true
}
disableUnderline
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
style
=
{{
fontSize
:
12
,
textAlign
:
'center'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
,
marginTop
:
-
10
}}
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
defaultValue
=
{
value
}
defaultValue
=
{
value
}
color
=
{
"#5198ea"
}
disabled
=
{
!
handleAction
(
tableMeta
.
rowData
[
2
])}
disabled
=
{
!
handleAction
(
tableMeta
.
rowData
[
2
])}
on
Change
=
{(
event
)
=>
{
on
Blur
=
{(
event
)
=>
{
//
console.log(event.target.value)
console
.
log
(
event
.
target
.
value
)
//
//
updateValue(event.target.value)
// updateValue(event.target.value)
//
handleChangeText(event.target.value, tableMeta)
handleChangeText
(
event
.
target
.
value
,
tableMeta
)
//
console.log(dataTable2)
console
.
log
(
dataTable2
)
}}
}}
/>
:
<
ThemeProvider
theme
=
{
theme
}
>
<
Input
disableUnderline
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'center'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
,
marginBottom
:
-
5
}}
type
=
"text"
placeholder
=
""
defaultValue
=
{
value
}
color
=
{
"#5198ea"
}
disabled
=
{
!
handleAction
(
tableMeta
.
rowData
[
2
])}
onBlur
=
{(
event
)
=>
{
onBlur
=
{(
event
)
=>
{
console
.
log
(
event
.
target
.
value
)
console
.
log
(
event
.
target
.
value
)
// updateValue(event.target.value)
// updateValue(event.target.value)
...
@@ -945,6 +1026,7 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -945,6 +1026,7 @@ export default class CorporateAnnualTarget extends Component {
console
.
log
(
dataTable2
)
console
.
log
(
dataTable2
)
}}
}}
/
>
/
>
<
/ThemeProvider
>
}
}
/
>
/
>
}
}
...
@@ -953,7 +1035,7 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -953,7 +1035,7 @@ export default class CorporateAnnualTarget extends Component {
}
}
}
}
},
{
},
{
name
:
"
Jenis KPI
"
,
name
:
"
KPI Type
"
,
options
:
{
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
@@ -1689,30 +1771,29 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -1689,30 +1771,29 @@ export default class CorporateAnnualTarget extends Component {
),
),
customBodyRender
:
(
value
,
tableMeta
)
=>
{
customBodyRender
:
(
value
,
tableMeta
)
=>
{
return
(
return
(
<
div
style
=
{{
width
:
96
}}
>
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
tableMeta
.
rowData
[
0
]
===
1
||
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
1
||
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
null
null
:
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
<
FormControlLabel
style
=
{{
margin
:
0
}}
style
=
{{
margin
:
0
}}
value
=
{
value
}
control
=
{
control
=
{
<
NumberFormat
<
ThemeProvider
theme
=
{
theme
}
>
thousandSeparator
=
{
true
}
<
Input
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
disableUnderline
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'center'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
,
marginBottom
:
-
5
}}
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
v
alue
=
{
value
}
defaultV
alue
=
{
value
}
onBlur
=
{(
event
)
=>
{
onBlur
=
{(
event
)
=>
{
// updateValue
(event.target.value)
console
.
log
(
event
.
target
.
value
)
handleChange
(
event
.
target
.
value
,
tableMeta
)
handleChange
Text
(
event
.
target
.
value
,
tableMeta
)
console
.
log
(
dataTable2
)
console
.
log
(
dataTable2
)
}}
}}
/
>
/
>
<
/ThemeProvider
>
}
}
/
>
/
>
<
/div>
}
}
<
/div
>
<
/div
>
)
)
...
@@ -1728,30 +1809,31 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -1728,30 +1809,31 @@ export default class CorporateAnnualTarget extends Component {
),
),
customBodyRender
:
(
value
,
tableMeta
)
=>
{
customBodyRender
:
(
value
,
tableMeta
)
=>
{
return
(
return
(
<
div
style
=
{{
width
:
96
}}
>
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
tableMeta
.
rowData
[
0
]
===
1
||
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
1
||
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
null
null
:
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
<
FormControlLabel
style
=
{{
margin
:
0
}}
style
=
{{
margin
:
0
}}
value
=
{
value
}
//
value={value}
control
=
{
control
=
{
<
NumberFormat
<
ThemeProvider
theme
=
{
theme
}
>
thousandSeparator
=
{
true
}
<
Input
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
disableUnderline
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'center'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
,
marginBottom
:
-
5
}}
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
v
alue
=
{
value
}
defaultV
alue
=
{
value
}
onBlur
=
{(
event
)
=>
{
onBlur
=
{(
event
)
=>
{
console
.
log
(
event
.
target
.
value
)
// updateValue(event.target.value)
// updateValue(event.target.value)
handleChange
(
event
.
target
.
value
,
tableMeta
)
handleChange
Text
(
event
.
target
.
value
,
tableMeta
)
console
.
log
(
dataTable2
)
console
.
log
(
dataTable2
)
}}
}}
/
>
/
>
<
/ThemeProvider
>
}
}
/
>
/
>
<
/div>
}
}
<
/div
>
<
/div
>
)
)
...
@@ -1790,7 +1872,7 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -1790,7 +1872,7 @@ export default class CorporateAnnualTarget extends Component {
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'space-between'
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'space-between'
}}
>
<
div
>
<
div
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
{
this
.
props
.
company
.
company_name
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
{
this
.
props
.
company
.
company_name
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
Period
e
:
{
this
.
props
.
periode
}
(
rev
.{
this
.
props
.
revision
})
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
Period
:
{
this
.
props
.
periode
}
(
rev
.{
this
.
props
.
revision
})
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
in
IDR
mn
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
in
IDR
mn
<
/Typography
>
<
/div
>
<
/div
>
<
div
style
=
{{
width
:
'50%'
}}
>
<
div
style
=
{{
width
:
'50%'
}}
>
...
@@ -1906,7 +1988,7 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -1906,7 +1988,7 @@ export default class CorporateAnnualTarget extends Component {
marginRight
:
20
marginRight
:
20
}}
}}
onClick
=
{()
=>
{
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
this
.
setState
({
loading
:
true
,
dataTable
:
dataTable2
},
()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
handleValidate
()
this
.
handleValidate
()
},
100
);
},
100
);
...
@@ -1943,11 +2025,11 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -1943,11 +2025,11 @@ export default class CorporateAnnualTarget extends Component {
<
div
style
=
{{
padding
:
25
}}
>
<
div
style
=
{{
padding
:
25
}}
>
<
div
>
<
div
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
{
this
.
props
.
company
.
company_name
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
{
this
.
props
.
company
.
company_name
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
Period
e
:
{
this
.
props
.
periode
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
Period
:
{
this
.
props
.
periode
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
in
IDR
mn
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
in
IDR
mn
<
/Typography
>
<
/div
>
<
/div
>
{
this
.
state
.
dataLoaded
&&
(
{
this
.
state
.
dataLoaded
&&
(
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
,
height
:
this
.
props
.
height
-
400
}}
>
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
{
!
this
.
state
.
loading
&&
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
{
!
this
.
state
.
loading
&&
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
<
MUIDataTable
data
=
{
dataTable2
}
data
=
{
dataTable2
}
...
...
src/container/BudgetTahunan/FixedAssetsMovement.js
View file @
44860c47
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
Typography
,
Paper
,
createMuiTheme
,
MuiThemeProvider
,
TableCell
,
FormControlLabel
,
TextField
,
Input
,
Tooltip
,
withStyles
}
from
'@material-ui/core'
;
import
{
Typography
,
Paper
,
createMuiTheme
,
MuiThemeProvider
,
TableCell
,
FormControlLabel
,
TextField
,
Input
,
Tooltip
,
withStyles
,
Snackbar
}
from
'@material-ui/core'
;
import
MUIDataTable
from
'mui-datatables'
;
import
MUIDataTable
from
'mui-datatables'
;
import
NumberFormat
from
'react-number-format'
;
import
NumberFormat
from
'react-number-format'
;
import
api
from
'../../api'
;
import
api
from
'../../api'
;
...
@@ -10,6 +10,7 @@ import Images from '../../assets/Images';
...
@@ -10,6 +10,7 @@ import Images from '../../assets/Images';
import
ReactTooltip
from
'react-tooltip'
;
import
ReactTooltip
from
'react-tooltip'
;
import
UploadFile
from
"../../library/Upload"
;
import
UploadFile
from
"../../library/Upload"
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
{
Alert
}
from
'@material-ui/lab'
;
const
LightTooltip
=
withStyles
((
theme
)
=>
({
const
LightTooltip
=
withStyles
((
theme
)
=>
({
tooltip
:
{
tooltip
:
{
...
@@ -346,6 +347,7 @@ export default class FixedAssetsMovement extends Component {
...
@@ -346,6 +347,7 @@ export default class FixedAssetsMovement extends Component {
})
})
})
})
let
body
=
{
let
body
=
{
submission_id
:
this
.
props
.
submissionID
,
company_id
:
this
.
props
.
company
.
company_id
,
company_id
:
this
.
props
.
company
.
company_id
,
periode
:
this
.
props
.
periode
,
periode
:
this
.
props
.
periode
,
report_id
:
this
.
props
.
report_id
,
report_id
:
this
.
props
.
report_id
,
...
@@ -383,6 +385,54 @@ export default class FixedAssetsMovement extends Component {
...
@@ -383,6 +385,54 @@ export default class FixedAssetsMovement extends Component {
}
}
}
}
handleValidate
()
{
let
data
=
[]
// console.log(this.state.dataTable)
this
.
state
.
dataTable
.
map
(
i
=>
{
data
.
push
({
item_report_id
:
i
[
1
],
total_actual_before
:
String
(
i
[
6
]),
january
:
String
(
i
[
7
]),
february
:
String
(
i
[
8
]),
march
:
String
(
i
[
9
]),
april
:
String
(
i
[
10
]),
may
:
String
(
i
[
11
]),
june
:
String
(
i
[
12
]),
july
:
String
(
i
[
13
]),
august
:
String
(
i
[
14
]),
september
:
String
(
i
[
15
]),
october
:
String
(
i
[
16
]),
november
:
String
(
i
[
17
]),
december
:
String
(
i
[
18
]),
total_current_year
:
String
(
i
[
19
]),
total_next_year
:
String
(
i
[
20
]),
total_more_year
:
String
(
i
[
21
])
})
})
// console.log(JSON.stringify(data))
let
payload
=
{
submission_id
:
this
.
props
.
submissionID
,
company_id
:
this
.
props
.
company
.
company_id
,
periode
:
this
.
props
.
periode
,
report_id
:
this
.
props
.
report_id
,
fixed_asset_movement
:
data
,
status
:
"submitted"
}
console
.
log
(
payload
)
api
.
create
().
validateSubmitReport
(
payload
).
then
((
response
)
=>
{
console
.
log
(
response
)
if
(
response
.
data
.
data
.
result
)
{
this
.
setState
({
loading
:
false
,
buttonError
:
false
,
editable
:
true
})
}
else
{
this
.
setState
({
loading
:
false
,
buttonError
:
true
,
editable
:
true
})
}
})
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
render
()
{
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
let
dataTable2
=
this
.
state
.
dataTable
const
handleChange
=
(
value
,
tableMeta
,
type
)
=>
{
const
handleChange
=
(
value
,
tableMeta
,
type
)
=>
{
...
@@ -507,8 +557,6 @@ export default class FixedAssetsMovement extends Component {
...
@@ -507,8 +557,6 @@ export default class FixedAssetsMovement extends Component {
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
return
(
return
(
<
div
style
=
{{
width
:
300
}}
>
<
div
style
=
{{
width
:
300
}}
>
{
/* {console.log(val)} */
}
{
/* {console.log(tableMeta)} */
}
{
tableMeta
.
rowData
[
22
]
?
{
tableMeta
.
rowData
[
22
]
?
tableMeta
.
rowData
[
22
].
length
>
0
?
tableMeta
.
rowData
[
22
].
length
>
0
?
<
div
style
=
{{
paddingLeft
:
20
*
Number
(
tableMeta
.
rowData
[
4
])
}}
>
<
div
style
=
{{
paddingLeft
:
20
*
Number
(
tableMeta
.
rowData
[
4
])
}}
>
...
@@ -547,8 +595,6 @@ export default class FixedAssetsMovement extends Component {
...
@@ -547,8 +595,6 @@ export default class FixedAssetsMovement extends Component {
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
return
(
return
(
<
div
style
=
{{
textAlign
:
'right'
}}
>
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
console
.
log
(
tableMeta
)}
{
console
.
log
(
value
)}
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
4
?
null
null
:
:
...
@@ -1874,6 +1920,11 @@ export default class FixedAssetsMovement extends Component {
...
@@ -1874,6 +1920,11 @@ export default class FixedAssetsMovement extends Component {
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
flex
:
1
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
flex
:
1
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Pengajuan
Budget
Tahunan
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Pengajuan
Budget
Tahunan
<
/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
>
{
this
.
state
.
loading
&&
loadingComponent
}
{
this
.
state
.
loading
&&
loadingComponent
}
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
{
this
.
state
.
visibleFixedAssetsMovement
===
true
?
{
this
.
state
.
visibleFixedAssetsMovement
===
true
?
...
@@ -2012,7 +2063,8 @@ export default class FixedAssetsMovement extends Component {
...
@@ -2012,7 +2063,8 @@ export default class FixedAssetsMovement extends Component {
onClick
=
{()
=>
{
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
,
buttonError
:
false
,
editable
:
true
})
// this.setState({ loading: false, buttonError: false, editable: true })
this
.
handleValidate
()
},
100
);
},
100
);
})
})
}}
}}
...
@@ -2023,8 +2075,16 @@ export default class FixedAssetsMovement extends Component {
...
@@ -2023,8 +2075,16 @@ export default class FixedAssetsMovement extends Component {
<
/button
>
<
/button
>
<
button
<
button
type
=
"button"
type
=
"button"
disabled
=
{
this
.
state
.
buttonError
}
// disabled={this.state.buttonError}
onClick
=
{()
=>
this
.
backToMasterBudget
(
'submitted'
)}
onClick
=
{()
=>
{
this
.
state
.
buttonError
?
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
,
loading
:
false
})
},
100
);
})
:
this
.
backToMasterBudget
(
'submitted'
)
}}
style
=
{{
style
=
{{
backgroundColor
:
'transparent'
,
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
...
...
src/container/BudgetTahunan/ProfitLoss.js
View file @
44860c47
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
Typography
,
Paper
,
createMuiTheme
,
MuiThemeProvider
,
TableCell
,
FormControlLabel
,
TextField
,
Input
,
Tooltip
,
withStyles
}
from
'@material-ui/core'
;
import
{
Typography
,
Paper
,
createMuiTheme
,
MuiThemeProvider
,
TableCell
,
FormControlLabel
,
TextField
,
Input
,
Tooltip
,
withStyles
,
Snackbar
}
from
'@material-ui/core'
;
import
MUIDataTable
from
'mui-datatables'
;
import
MUIDataTable
from
'mui-datatables'
;
import
NumberFormat
from
'react-number-format'
;
import
NumberFormat
from
'react-number-format'
;
import
api
from
'../../api'
;
import
api
from
'../../api'
;
...
@@ -10,6 +10,7 @@ import Images from '../../assets/Images';
...
@@ -10,6 +10,7 @@ import Images from '../../assets/Images';
import
ReactTooltip
from
'react-tooltip'
;
import
ReactTooltip
from
'react-tooltip'
;
import
UploadFile
from
"../../library/Upload"
;
import
UploadFile
from
"../../library/Upload"
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
{
Alert
}
from
'@material-ui/lab'
;
const
LightTooltip
=
withStyles
((
theme
)
=>
({
const
LightTooltip
=
withStyles
((
theme
)
=>
({
tooltip
:
{
tooltip
:
{
...
@@ -393,6 +394,48 @@ export default class ProfitLoss extends Component {
...
@@ -393,6 +394,48 @@ export default class ProfitLoss extends Component {
}
}
}
}
handleValidate
()
{
let
data
=
[]
this
.
state
.
dataTable
.
map
(
i
=>
{
data
.
push
({
item_report_id
:
i
[
1
],
notes
:
i
[
6
]
==
null
||
i
[
6
]
==
""
?
""
:
String
(
i
[
6
]),
total_actual_before
:
String
(
i
[
7
]),
january
:
String
(
i
[
8
]),
february
:
String
(
i
[
9
]),
march
:
String
(
i
[
10
]),
april
:
String
(
i
[
11
]),
may
:
String
(
i
[
12
]),
june
:
String
(
i
[
13
]),
july
:
String
(
i
[
14
]),
august
:
String
(
i
[
15
]),
september
:
String
(
i
[
16
]),
october
:
String
(
i
[
17
]),
november
:
String
(
i
[
18
]),
december
:
String
(
i
[
19
]),
total_current_year
:
String
(
i
[
20
]),
total_next_year
:
String
(
i
[
21
]),
total_more_year
:
String
(
i
[
22
])
})
})
let
payload
=
{
"submission_id"
:
this
.
props
.
submissionID
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
this
.
props
.
report_id
,
"status"
:
type
,
"profit_loss"
:
data
}
api
.
create
().
validateSubmitReport
(
payload
).
then
((
response
)
=>
{
console
.
log
(
response
)
if
(
response
.
data
.
data
.
result
)
{
this
.
setState
({
loading
:
false
,
buttonError
:
false
,
editable
:
true
})
}
else
{
this
.
setState
({
loading
:
false
,
buttonError
:
true
,
editable
:
true
})
}
})
}
render
()
{
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
let
dataTable2
=
this
.
state
.
dataTable
const
handleChange
=
(
value
,
tableMeta
,
type
)
=>
{
const
handleChange
=
(
value
,
tableMeta
,
type
)
=>
{
...
@@ -1930,6 +1973,11 @@ export default class ProfitLoss extends Component {
...
@@ -1930,6 +1973,11 @@ export default class ProfitLoss extends Component {
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
flex
:
1
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
flex
:
1
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Pengajuan
Budget
Tahunan
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Pengajuan
Budget
Tahunan
<
/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
>
{
this
.
state
.
loading
&&
loadingComponent
}
{
this
.
state
.
loading
&&
loadingComponent
}
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
{
this
.
state
.
visibleProfitLoss
===
true
?
{
this
.
state
.
visibleProfitLoss
===
true
?
...
@@ -2066,9 +2114,9 @@ export default class ProfitLoss extends Component {
...
@@ -2066,9 +2114,9 @@ export default class ProfitLoss extends Component {
marginRight
:
20
marginRight
:
20
}}
}}
onClick
=
{()
=>
{
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
,
buttonError
:
false
,
editable
:
true
}
)
this
.
handleValidate
(
)
},
100
);
},
100
);
})
})
}}
}}
...
@@ -2079,8 +2127,10 @@ export default class ProfitLoss extends Component {
...
@@ -2079,8 +2127,10 @@ export default class ProfitLoss extends Component {
<
/button
>
<
/button
>
<
button
<
button
type
=
"button"
type
=
"button"
disabled
=
{
this
.
state
.
buttonError
}
// disabled={this.state.buttonError}
onClick
=
{()
=>
this
.
backToMasterBudget
(
'submitted'
)}
onClick
=
{()
=>
this
.
state
.
buttonError
?
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
})
:
this
.
backToMasterBudget
(
'submitted'
)}
style
=
{{
style
=
{{
backgroundColor
:
'transparent'
,
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
...
...
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