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
6bb591a3
Commit
6bb591a3
authored
Nov 25, 2020
by
Riri Novita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
operating indicator
parent
093072c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
569 additions
and
78 deletions
+569
-78
OperatingIndicatorMR.js
src/container/MonthlyReport/OperatingIndicatorMR.js
+569
-78
No files found.
src/container/MonthlyReport/OperatingIndicatorMR.js
View file @
6bb591a3
import
{
createMuiTheme
,
MuiThemeProvider
,
Paper
,
TableCell
,
Tooltip
,
Typography
,
withStyles
}
from
'@material-ui/core'
;
import
{
createMuiTheme
,
FormControlLabel
,
Input
,
MuiThemeProvider
,
Paper
,
TableCell
,
Tooltip
,
Typography
,
withStyles
}
from
'@material-ui/core'
;
import
MUIDataTable
from
'mui-datatables'
;
import
React
,
{
Component
}
from
'react'
;
import
NumberFormat
from
'react-number-format'
;
import
{
PropagateLoader
}
from
'react-spinners'
;
import
ReactTooltip
from
'react-tooltip'
;
import
api
from
'../../api'
;
import
Images
from
'../../assets/Images'
;
...
...
@@ -47,12 +49,12 @@ export default class OperatingIndicatorMR extends Component {
getItemHierarki
()
{
let
payload
=
{
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"report_id"
:
this
.
props
.
report_id
,
"revision"
:
Number
(
this
.
props
.
revision
),
"periode"
:
this
.
props
.
periode
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"month"
:
this
.
props
.
month
.
month_id
"periode"
:
this
.
props
.
periode
,
"revision"
:
Number
(
this
.
props
.
revision
),
"months"
:
this
.
props
.
month
.
month_id
}
api
.
create
().
getHierarkiMontlyReportOI
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
...
...
@@ -71,24 +73,15 @@ export default class OperatingIndicatorMR extends Component {
item
.
description
,
item
.
operating_indicator
.
uom
,
item
.
operating_indicator
.
rolling_outlook
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
,
{
mb
:
item
.
operating_indicator
.
master_budget
===
""
?
"0.0"
:
item
.
operating_indicator
.
master_budget
,
rb
:
item
.
operating_indicator
.
rolling_budget
===
""
?
"0.0"
:
item
.
operating_indicator
.
rolling_budget
,
actual
:
item
.
operating_indicator
.
actual
===
""
?
"0.0"
:
item
.
operating_indicator
.
actual
},
item
.
operating_indicator
.
actual_previous_month
===
null
?
"0.0"
:
item
.
operating_indicator
.
actual_previous_month
===
""
?
"0.0"
:
item
.
operating_indicator
.
actual_previous_month
,
{
aavpm
:
item
.
operating_indicator
.
amount_act_vs_previous_month
===
""
?
"0.0"
:
item
.
operating_indicator
.
amount_act_vs_previous_month
,
pavpm
:
item
.
operating_indicator
.
percent_act_vs_previous_month
===
""
?
"0.0"
:
item
.
operating_indicator
.
percent_act_vs_previous_month
,
aavmb
:
item
.
operating_indicator
.
amount_act_vs_mb
===
""
?
"0.0"
:
item
.
operating_indicator
.
amount_act_vs_mb
,
pavmb
:
item
.
operating_indicator
.
percent_act_vs_mb
===
""
?
"0.0"
:
item
.
operating_indicator
.
percent_act_vs_mb
,
aavrb
:
item
.
operating_indicator
.
amount_act_vs_rb
===
""
?
"0.0"
:
item
.
operating_indicator
.
amount_act_vs_rb
,
pavrb
:
item
.
operating_indicator
.
percent_act_vs_rb
===
""
?
"0.0"
:
item
.
operating_indicator
.
percent_act_vs_rb
,
},
{
mtdvmb
:
item
.
operating_indicator
.
mtd_vs_mb
===
""
?
"0.0"
:
item
.
operating_indicator
.
mtd_vs_mb
,
mtdvrb
:
item
.
operating_indicator
.
mtd_vs_rb
===
""
?
"0.0"
:
item
.
operating_indicator
.
mtd_vs_rb
,
}
item
.
operating_indicator
.
master_budget
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
master_budget
,
item
.
operating_indicator
.
rolling_budget
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
rolling_budget
,
item
.
operating_indicator
.
actual
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
actual
,
item
.
operating_indicator
.
amount_act_vs_mb
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
amount_act_vs_mb
,
item
.
operating_indicator
.
percent_act_vs_mb
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
percent_act_vs_mb
,
item
.
operating_indicator
.
amount_act_vs_rb
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
amount_act_vs_rb
,
item
.
operating_indicator
.
percent_act_vs_rb
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
percent_act_vs_rb
,
item
.
operating_indicator
.
mtd_vs_mb
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
mtd_vs_mb
,
item
.
operating_indicator
.
mtd_vs_rb
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
mtd_vs_rb
,
])
}
if
(
item
.
children
!==
null
)
{
...
...
@@ -109,22 +102,15 @@ export default class OperatingIndicatorMR extends Component {
item
.
description
,
item
.
operating_indicator
.
uom
,
item
.
operating_indicator
.
rolling_outlook
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
,
{
mb
:
item
.
operating_indicator
.
master_budget
===
""
?
"0.0"
:
item
.
operating_indicator
.
master_budget
,
rb
:
item
.
operating_indicator
.
rolling_budget
===
""
?
"0.0"
:
item
.
operating_indicator
.
rolling_budget
,
actual
:
item
.
operating_indicator
.
actual
===
""
?
"0.0"
:
item
.
operating_indicator
.
actual
},
{
aavmb
:
item
.
operating_indicator
.
amount_act_vs_mb
===
""
?
"0.0"
:
item
.
operating_indicator
.
amount_act_vs_mb
,
pavmb
:
item
.
operating_indicator
.
percent_act_vs_mb
===
""
?
"0.0"
:
item
.
operating_indicator
.
percent_act_vs_mb
,
aavrb
:
item
.
operating_indicator
.
amount_act_vs_rb
===
""
?
"0.0"
:
item
.
operating_indicator
.
amount_act_vs_rb
,
pavrb
:
item
.
operating_indicator
.
percent_act_vs_rb
===
""
?
"0.0"
:
item
.
operating_indicator
.
percent_act_vs_rb
,
},
{
mtdvpm
:
item
.
operating_indicator
.
mtd_vs_previous_month
===
""
?
"0.0"
:
item
.
operating_indicator
.
mtd_vs_previous_month
,
mtdvmb
:
item
.
operating_indicator
.
mtd_vs_mb
===
""
?
"0.0"
:
item
.
operating_indicator
.
mtd_vs_mb
,
mtdvrb
:
item
.
operating_indicator
.
mtd_vs_rb
===
""
?
"0.0"
:
item
.
operating_indicator
.
mtd_vs_rb
,
}
item
.
operating_indicator
.
master_budget
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
master_budget
,
item
.
operating_indicator
.
rolling_budget
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
rolling_budget
,
item
.
operating_indicator
.
actual
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
actual
,
item
.
operating_indicator
.
amount_act_vs_mb
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
amount_act_vs_mb
,
item
.
operating_indicator
.
percent_act_vs_mb
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
percent_act_vs_mb
,
item
.
operating_indicator
.
amount_act_vs_rb
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
amount_act_vs_rb
,
item
.
operating_indicator
.
percent_act_vs_rb
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
percent_act_vs_rb
,
item
.
operating_indicator
.
mtd_vs_mb
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
mtd_vs_mb
,
item
.
operating_indicator
.
mtd_vs_rb
===
null
?
"0.0"
:
item
.
operating_indicator
.
rolling_outlook
===
""
?
"0.0"
:
item
.
operating_indicator
.
mtd_vs_rb
,
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
...
...
@@ -134,12 +120,102 @@ export default class OperatingIndicatorMR extends Component {
}
}
})
console
.
log
(
dataTable
);
this
.
setState
({
dataTable
,
loading
:
false
})
}
})
}
downloadTemplate
=
async
()
=>
{
let
res
=
await
fetch
(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_oi/download_template?report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
`
)
res
=
await
res
.
blob
()
// console.log(res)
if
(
res
.
size
>
0
)
{
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
a
.
href
=
url
;
a
.
download
=
'Template Monthly Report Operating Indicator.xlsx'
;
a
.
click
();
}
}
async
downloadAllData
()
{
let
url
=
`https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_oi/export_monthly_report?monthly_report_id=
${
this
.
props
.
monthlyReportId
}
&&report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
&&revision=
${
this
.
props
.
revision
}
&&months=
${
this
.
props
.
month
.
month_id
}
`
console
.
log
(
url
);
let
res
=
await
fetch
(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_oi/export_monthly_report?monthly_report_id=
${
this
.
props
.
monthlyReportId
===
null
?
""
:
this
.
props
.
monthlyReportId
}
&&report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
&&revision=
${
this
.
props
.
revision
}
&&months=
${
this
.
props
.
month
.
month_id
}
`
)
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
=
'Monthly Report Operating Indicator.xlsx'
;
a
.
click
();
}
}
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
const
handleValue
=
(
data
,
type
)
=>
{
let
total
=
0
dataTable2
.
map
((
item
,
index
)
=>
{
if
(
data
.
rowData
[
1
]
===
item
[
2
])
{
let
itemVal
=
item
[
data
.
columnIndex
+
type
].
value
!==
undefined
?
Number
(
item
[
data
.
columnIndex
+
type
].
value
)
:
Number
(
item
[
data
.
columnIndex
+
type
])
total
=
item
[
data
.
columnIndex
+
type
]
===
undefined
?
Number
(
total
)
+
0
:
Number
(
total
)
+
itemVal
}
})
let
indexParent
=
dataTable2
.
findIndex
((
val
)
=>
val
[
1
]
===
dataTable2
[
data
.
rowIndex
][
2
])
dataTable2
[
data
.
rowIndex
][
data
.
columnIndex
+
type
]
=
Number
(
total
).
toFixed
(
1
)
// console.log(indexParent);
return
total
}
const
handleChange
=
(
value
,
tableMeta
,
type
)
=>
{
console
.
log
(
dataTable2
);
let
val
=
String
(
value
).
split
(
","
).
join
(
""
)
if
(
type
===
"actual"
)
{
dataTable2
[
tableMeta
.
rowIndex
][
10
]
=
Number
(
val
).
toFixed
(
1
)
}
else
{
let
indexParent
=
dataTable2
.
findIndex
((
val
)
=>
val
[
1
]
===
dataTable2
[
tableMeta
.
rowIndex
][
2
])
if
(
indexParent
>
0
)
{
dataTable2
[
tableMeta
.
rowIndex
][
10
]
=
Number
(
val
).
toFixed
(
1
)
let
jagain
=
Number
(
dataTable2
[
indexParent
][
10
]).
toFixed
(
1
)
dataTable2
[
indexParent
][
10
]
=
jagain
===
undefined
?
(
0
+
Number
(
val
)).
toFixed
(
1
)
:
Number
(
Number
(
jagain
)
+
Number
(
val
)).
toFixed
(
1
)
}
else
{
dataTable2
[
tableMeta
.
rowIndex
][
10
]
=
Number
(
val
).
toFixed
(
1
)
}
}
}
const
handleVariance
=
(
tableMeta
,
dex
,
type
)
=>
{
let
total
=
0
if
(
dex
===
1
)
{
total
=
Number
(
tableMeta
.
rowData
[
10
])
-
Number
(
tableMeta
.
rowData
[
8
])
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
+
type
]
=
Number
(
total
).
toFixed
(
1
)
}
else
if
(
dex
===
2
)
{
total
=
Number
(
tableMeta
.
rowData
[
10
])
-
Number
(
tableMeta
.
rowData
[
9
])
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
+
type
]
=
Number
(
total
).
toFixed
(
1
)
}
return
total
}
const
handleVariancePercent
=
(
tableMeta
,
dex
,
type
)
=>
{
let
total
=
0
if
(
dex
===
1
)
{
total
=
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
11
])
/
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
8
])
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
+
type
]
=
Number
(
total
).
toFixed
(
2
)
}
else
if
(
dex
===
2
)
{
total
=
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
13
])
/
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
9
])
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
+
type
]
=
Number
(
total
).
toFixed
(
2
)
}
return
total
}
let
columns
=
[
{
name
:
""
,
...
...
@@ -217,9 +293,29 @@ export default class OperatingIndicatorMR extends Component {
customBodyRender
:
(
val
,
tableMeta
,
updateValue
)
=>
{
return
(
<
div
style
=
{{
textAlign
:
'right'
,
width
:
90
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
val
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
// value={val}
control
=
{
<
Input
disableUnderline
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'left'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
defaultValue
=
{
"Ton"
}
// onBlur={(event) => {
// // updateValue(event.target.value)
// handleNotes(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
/
>
}
/
>
<
/div
>
}
<
/div
>
)
...
...
@@ -237,9 +333,35 @@ export default class OperatingIndicatorMR extends Component {
customBodyRender
:
(
val
,
tableMeta
,
updateValue
)
=>
{
return
(
<
div
style
=
{{
textAlign
:
'right'
,
width
:
90
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
val
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValue
(
tableMeta
,
0
)).
toFixed
(
1
)}
/
>
<
/span>
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
val
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
val
).
toFixed
(
1
)}
/
>
}
/
>
<
/div
>
}
<
/div
>
)
...
...
@@ -275,31 +397,133 @@ export default class OperatingIndicatorMR extends Component {
}
}),
customBodyRender
:
(
val
,
tableMeta
,
updateValue
)
=>
{
console
.
log
(
tableMeta
);
//
console.log(tableMeta);
return
(
<
div
>
<
div
className
=
"grid grid-3x content-center"
>
<
div
className
=
"col-1"
>
<
div
style
=
{{
textAlign
:
'right'
,
width
:
90
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
val
.
mb
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValue
(
tableMeta
,
0
)).
toFixed
(
1
)}
/
>
<
/span>
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
tableMeta
.
rowData
[
8
]}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
tableMeta
.
rowData
[
8
]}
/
>
}
/
>
<
/div
>
}
<
/div
>
<
/div
>
<
div
className
=
"col-2"
>
<
div
style
=
{{
textAlign
:
'right'
,
width
:
90
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
val
.
rb
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValue
(
tableMeta
,
1
)).
toFixed
(
1
)}
/
>
<
/span>
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
tableMeta
.
rowData
[
9
]}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
tableMeta
.
rowData
[
9
]}
/
>
}
/
>
<
/div
>
}
<
/div
>
<
/div
>
<
div
className
=
"col-3"
>
<
div
style
=
{{
textAlign
:
'right'
,
width
:
90
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
null
:
val
.
actual
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValue
(
tableMeta
,
2
)).
toFixed
(
1
)}
/
>
<
/span>
:
tableMeta
.
rowData
[
0
]
===
3
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
tableMeta
.
rowData
[
10
]}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
false
}
value
=
{
Number
(
tableMeta
.
rowData
[
10
]).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
handleChange
(
event
.
target
.
value
,
tableMeta
)
}}
/
>
}
/
>
<
/div>
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
tableMeta
.
rowData
[
10
]}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
value
=
{
Number
(
tableMeta
.
rowData
[
10
]).
toFixed
(
1
)}
/
>
}
/
>
<
/div
>
}
<
/div
>
<
/div
>
...
...
@@ -309,6 +533,18 @@ export default class OperatingIndicatorMR extends Component {
}
}
},
{
name
:
""
,
options
:
{
display
:
false
}
},
{
name
:
""
,
options
:
{
display
:
false
}
},
{
name
:
`Variance`
,
options
:
{
...
...
@@ -358,18 +594,51 @@ export default class OperatingIndicatorMR extends Component {
<
div
className
=
"column-1"
>
<
div
className
=
"grid grid-2x content-center"
>
<
div
className
=
"column-1"
>
<
div
style
=
{{
textAlign
:
'right'
,
width
:
90
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
null
:
val
.
aavmb
<
div
style
=
{{
textAlign
:
'right'
,
width
:
120
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
val
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleVariance
(
tableMeta
,
1
,
0
)).
toFixed
(
1
)}
/
>
}
/
>
<
/div
>
}
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
style
=
{{
textAlign
:
'right'
,
width
:
90
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
null
:
val
.
pavmb
<
div
style
=
{{
textAlign
:
'right'
,
width
:
120
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
val
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
suffix
=
{
'%'
}
disabled
=
{
true
}
value
=
{
Number
(
handleVariancePercent
(
tableMeta
,
1
,
1
)).
toFixed
(
2
)}
/
>
}
/
>
<
/div
>
}
<
/div
>
<
/div
>
...
...
@@ -378,18 +647,51 @@ export default class OperatingIndicatorMR extends Component {
<
div
className
=
"column-2"
>
<
div
className
=
"grid grid-2x content-center"
>
<
div
className
=
"column-1"
>
<
div
style
=
{{
textAlign
:
'right'
,
width
:
9
0
}}
>
<
div
style
=
{{
textAlign
:
'right'
,
width
:
12
0
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
null
:
val
.
aavrb
null
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
val
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleVariance
(
tableMeta
,
2
,
2
)).
toFixed
(
1
)}
/
>
}
/
>
<
/div
>
}
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
style
=
{{
textAlign
:
'right'
,
width
:
9
0
}}
>
<
div
style
=
{{
textAlign
:
'right'
,
width
:
12
0
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
null
:
val
.
pavrb
null
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
val
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
suffix
=
{
'%'
}
value
=
{
Number
(
handleVariancePercent
(
tableMeta
,
2
,
3
)).
toFixed
(
2
)}
/
>
}
/
>
<
/div
>
}
<
/div
>
<
/div
>
...
...
@@ -401,6 +703,24 @@ export default class OperatingIndicatorMR extends Component {
}
}
},
{
name
:
""
,
options
:
{
display
:
false
}
},
{
name
:
""
,
options
:
{
display
:
false
}
},
{
name
:
""
,
options
:
{
display
:
false
}
},
{
name
:
`MTD Explanation`
,
options
:
{
...
...
@@ -432,17 +752,73 @@ export default class OperatingIndicatorMR extends Component {
<
div
className
=
"grid grid-2x content-center"
>
<
div
className
=
"col-1"
>
<
div
style
=
{{
textAlign
:
'right'
,
width
:
90
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
null
:
val
.
mtdvmb
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValue
(
tableMeta
,
0
)).
toFixed
(
1
)}
/
>
<
/span>
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
val
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
tableMeta
.
rowData
[
15
]).
toFixed
(
1
)}
/
>
}
/
>
<
/div
>
}
<
/div
>
<
/div
>
<
div
className
=
"col-2"
>
<
div
style
=
{{
textAlign
:
'right'
,
width
:
90
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
null
:
val
.
mtdvrb
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValue
(
tableMeta
,
0
)).
toFixed
(
1
)}
/
>
<
/span>
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
val
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
tableMeta
.
rowData
[
16
]).
toFixed
(
1
)}
/
>
}
/
>
<
/div
>
}
<
/div
>
<
/div
>
...
...
@@ -452,19 +828,33 @@ export default class OperatingIndicatorMR extends Component {
}
}
},
{
name
:
""
,
options
:
{
display
:
false
}
}
]
let
dataDummy
=
[
[
""
,
""
,
""
,
""
,
""
,
"acc"
,
"uom"
,
"rolling"
,
{
mb
:
""
,
rb
:
""
,
actual
:
""
},
{
aavmb
:
""
,
pavmb
:
""
,
aavrb
:
""
,
pavrb
:
""
},
{
mtdvmb
:
""
,
mtdvrb
:
""
}]
]
const
loadingComponent
=
(
<
div
style
=
{{
position
:
'fixed'
,
zIndex
:
110
,
top
:
0
,
left
:
0
,
width
:
'100%'
,
height
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
background
:
'rgba(255,255,255,0.8)'
}}
>
<
PropagateLoader
// css={override}
size
=
{
20
}
color
=
{
"#274B80"
}
loading
=
{
this
.
state
.
loading
}
/
>
<
/div
>
);
return
(
<
div
style
=
{{
height
:
this
.
props
.
height
,
backgroundColor
:
'#f8f8f8'
,
marginBottom
:
100
,
minHeight
:
1000
}}
>
{
this
.
state
.
loading
&&
loadingComponent
}
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
flex
:
1
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Monthly
Report
<
/Typography
>
<
/div
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
Paper
style
=
{{
paddingTop
:
10
,
paddingBottom
:
20
}}
>
<
Paper
style
=
{{
paddingTop
:
10
}}
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Monthly
Report
-
Operating
Indicator
<
/Typography
>
<
/div
>
...
...
@@ -485,7 +875,7 @@ export default class OperatingIndicatorMR extends Component {
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
null
}
onClick
=
{()
=>
this
.
downloadTemplate
()
}
>
<
img
src
=
{
Images
.
template
}
/
>
<
/button
>
...
...
@@ -513,7 +903,12 @@ export default class OperatingIndicatorMR extends Component {
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
null
}
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
downloadAllData
()
},
100
);
})}
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
...
...
@@ -527,13 +922,109 @@ export default class OperatingIndicatorMR extends Component {
{
!
this
.
state
.
loading
&&
(
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
data
=
{
data
Dummy
}
data
=
{
data
Table2
}
columns
=
{
columns
}
options
=
{
options
}
/
>
<
/MuiThemeProvider
>
)}
<
/div
>
{
/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */
}
<
div
className
=
"grid grid-2x"
style
=
{{
marginTop
:
20
}}
>
<
div
className
=
"col-1"
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
props
.
onClickClose
()
},
100
);
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
}}
>
<
div
style
=
{{
backgroundColor
:
'#019ce5'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Back
<
/Typography
>
<
/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
.
setState
({
loading
:
false
})
// 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
:
this
.
state
.
saveDraft
!==
true
?
'pointer'
:
'default'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
this
.
state
.
saveDraft
===
true
?
null
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
backToMonthlyReport
(
'draft'
)
})
}
>
<
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
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
})
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
backToMonthlyReport
(
'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
>
{
/* : null
} */
}
<
/div
>
<
/Paper
>
<
/div
>
...
...
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