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
0e6848c6
Commit
0e6848c6
authored
Dec 04, 2020
by
Riri Novita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oi++
parent
79c67efb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
433 additions
and
192 deletions
+433
-192
OperatingIndicatorMR.js
src/container/MonthlyReport/OperatingIndicatorMR.js
+424
-162
ProfitLossMR.js
src/container/MonthlyReport/ProfitLossMR.js
+1
-1
OperatingIndicator.js
src/container/OprIndicator/OperatingIndicator.js
+8
-29
No files found.
src/container/MonthlyReport/OperatingIndicatorMR.js
View file @
0e6848c6
import
{
createMuiTheme
,
FormControlLabel
,
Input
,
MuiThemeProvider
,
Paper
,
TableCell
,
Tooltip
,
Typography
,
withStyles
}
from
'@material-ui/core'
;
import
{
createMuiTheme
,
FormControlLabel
,
Input
,
MuiThemeProvider
,
Paper
,
Snackbar
,
TableCell
,
Tooltip
,
Typography
,
withStyles
}
from
'@material-ui/core'
;
import
MUIDataTable
from
'mui-datatables'
;
import
React
,
{
Component
}
from
'react'
;
import
NumberFormat
from
'react-number-format'
;
...
...
@@ -8,6 +8,9 @@ import api from '../../api';
import
*
as
R
from
'ramda'
;
import
Images
from
'../../assets/Images'
;
import
Constant
from
'../../library/Constant'
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
UploadFile
from
"../../library/Upload"
;
import
{
Alert
}
from
'@material-ui/lab'
;
const
LightTooltip
=
withStyles
((
theme
)
=>
({
tooltip
:
{
...
...
@@ -42,6 +45,7 @@ export default class OperatingIndicatorMR extends Component {
this
.
state
=
{
dataTable
:
[],
loading
:
true
,
visibleOI
:
true
,
minValue
:
0
,
maxValue
:
0
}
...
...
@@ -92,7 +96,7 @@ export default class OperatingIndicatorMR extends Component {
"report_id"
:
this
.
props
.
data
.
report_id
,
"company_id"
:
this
.
props
.
data
.
company
.
company_id
,
"periode"
:
this
.
props
.
data
.
periode
,
"months"
:
this
.
props
.
data
.
report_id
===
22
?
1
:
23
?
2
:
24
?
3
:
25
?
4
:
27
?
5
:
28
?
6
:
29
?
7
:
31
?
8
:
32
?
9
:
33
?
10
:
35
?
11
:
36
?
12
:
0
"months"
:
this
.
props
.
data
.
report_id
===
22
?
1
:
23
?
2
:
24
?
3
:
25
?
4
:
27
?
5
:
28
?
6
:
29
?
7
:
31
?
8
:
32
?
9
:
33
?
10
:
35
?
11
:
36
?
12
:
null
}
api
.
create
().
getHierarkiMontlyReportOI
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
...
...
@@ -110,7 +114,7 @@ export default class OperatingIndicatorMR extends Component {
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
uom
?
""
:
item
.
uom
===
null
?
""
:
item
.
uom
,
item
.
uom
===
""
?
null
:
item
.
uom
,
item
.
monthly_report
.
rolling_outlook
===
null
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
===
""
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
,
item
.
monthly_report
.
master_budget
===
null
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
===
""
?
"0.0"
:
item
.
monthly_report
.
master_budget
,
item
.
monthly_report
.
rolling_budget
===
null
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
===
""
?
"0.0"
:
item
.
monthly_report
.
rolling_budget
,
...
...
@@ -121,6 +125,7 @@ export default class OperatingIndicatorMR extends Component {
item
.
monthly_report
.
percent_act_vs_rb
===
null
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
===
""
?
"0.0"
:
item
.
monthly_report
.
percent_act_vs_rb
,
item
.
monthly_report
.
mtd_vs_mb
===
null
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
===
""
?
"0.0"
:
item
.
monthly_report
.
mtd_vs_mb
,
item
.
monthly_report
.
mtd_vs_rb
===
null
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
===
""
?
"0.0"
:
item
.
monthly_report
.
mtd_vs_rb
,
item
.
order
,
])
}
if
(
item
.
children
!==
null
)
{
...
...
@@ -139,7 +144,7 @@ export default class OperatingIndicatorMR extends Component {
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
uom
?
""
:
item
.
uom
===
null
?
""
:
item
.
uom
,
item
.
uom
===
""
?
null
:
item
.
uom
,
item
.
monthly_report
.
rolling_outlook
===
null
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
===
""
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
,
item
.
monthly_report
.
master_budget
===
null
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
===
""
?
"0.0"
:
item
.
monthly_report
.
master_budget
,
item
.
monthly_report
.
rolling_budget
===
null
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
===
""
?
"0.0"
:
item
.
monthly_report
.
rolling_budget
,
...
...
@@ -150,6 +155,7 @@ export default class OperatingIndicatorMR extends Component {
item
.
monthly_report
.
percent_act_vs_rb
===
null
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
===
""
?
"0.0"
:
item
.
monthly_report
.
percent_act_vs_rb
,
item
.
monthly_report
.
mtd_vs_mb
===
null
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
===
""
?
"0.0"
:
item
.
monthly_report
.
mtd_vs_mb
,
item
.
monthly_report
.
mtd_vs_rb
===
null
?
"0.0"
:
item
.
monthly_report
.
rolling_outlook
===
""
?
"0.0"
:
item
.
monthly_report
.
mtd_vs_rb
,
item
.
order
,
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
...
...
@@ -167,10 +173,10 @@ export default class OperatingIndicatorMR extends Component {
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
}
`
`https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_oi/download_template?report_id=
${
this
.
props
.
data
.
report_id
}
&&company_id=
${
this
.
props
.
data
.
company
.
company_id
}
&&year=
${
this
.
props
.
data
.
periode
}
`
)
res
=
await
res
.
blob
()
// console.log(res)
//
//
console.log(res)
if
(
res
.
size
>
0
)
{
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
...
...
@@ -181,10 +187,10 @@ export default class OperatingIndicatorMR extends Component {
}
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
}
`
let
url
=
`https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_oi/export_monthly_report?
operating_indicator_id=
${
this
.
props
.
data
.
operatingIndID
==
null
?
""
:
this
.
props
.
data
.
operatingIndID
}
&&report_id=
${
this
.
props
.
data
.
report_id
}
&&company_id=
${
this
.
props
.
data
.
company
.
company_id
}
&&year=
${
this
.
props
.
data
.
periode
}
&&months=
${
this
.
props
.
data
.
report_id
===
22
?
1
:
23
?
2
:
24
?
3
:
25
?
4
:
27
?
5
:
28
?
6
:
29
?
7
:
31
?
8
:
32
?
9
:
33
?
10
:
35
?
11
:
36
?
12
:
null
}
`
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
}
`
`https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_oi/export_monthly_report?
operating_indicator_id=
${
this
.
props
.
data
.
operatingIndID
===
null
?
""
:
this
.
props
.
data
.
operatingIndID
}
&&report_id=
${
this
.
props
.
data
.
report_id
}
&&company_id=
${
this
.
props
.
data
.
company
.
company_id
}
&&year=
${
this
.
props
.
data
.
periode
}
&&months=
${
this
.
props
.
data
.
report_id
===
22
?
1
:
23
?
2
:
24
?
3
:
25
?
4
:
27
?
5
:
28
?
6
:
29
?
7
:
31
?
8
:
32
?
9
:
33
?
10
:
35
?
11
:
36
?
12
:
null
}
`
)
res
=
await
res
.
blob
()
this
.
setState
({
loading
:
false
})
...
...
@@ -197,8 +203,7 @@ export default class OperatingIndicatorMR extends Component {
}
}
backToMonthlyReport
(
type
)
{
// console.log(this.state.dataTable);
createData
(
type
)
{
let
data
=
[]
this
.
state
.
dataTable
.
map
(
i
=>
{
data
.
push
({
...
...
@@ -217,31 +222,19 @@ export default class OperatingIndicatorMR extends Component {
})
})
let
payload
=
{
"
monthly_report_id"
:
this
.
props
.
submission
ID
,
"
company_id"
:
this
.
props
.
company
.
company
_id
,
"
periode"
:
this
.
props
.
periode
,
"
report_id"
:
this
.
props
.
report_id
,
"
operating_indicator_id"
:
this
.
props
.
data
.
operatingInd
ID
,
"
report_id"
:
this
.
props
.
data
.
report
_id
,
"
company_id"
:
this
.
props
.
data
.
company
.
company_id
,
"
periode"
:
this
.
props
.
data
.
periode
,
"status"
:
type
,
"months"
:
this
.
props
.
month
.
month_id
,
"
operating_indicator
"
:
data
"months"
:
this
.
props
.
data
.
report_id
===
22
?
1
:
23
?
2
:
24
?
3
:
25
?
4
:
27
?
5
:
28
?
6
:
29
?
7
:
31
?
8
:
32
?
9
:
33
?
10
:
35
?
11
:
36
?
12
:
null
,
"
monthly_report
"
:
data
}
api
.
create
(
'UPLOAD'
).
createMonthlyReportOI
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
saveToMonthlyReport
()
}
else
{
this
.
setState
({
loading
:
false
},
()
=>
{
this
.
props
.
saveToMonthlyReport
()
})
}
}
else
{
this
.
setState
({
loading
:
false
},
()
=>
{
this
.
getSubmission
()
document
.
body
.
style
.
overflow
=
'unset'
;
})
}
})
console
.
log
(
payload
);
// // console.log('=========================')
// // console.log(JSON.stringify(payload))
this
.
props
.
saveMonthlyOI
(
payload
)
this
.
props
.
onClickClose
()
}
render
()
{
...
...
@@ -281,10 +274,10 @@ export default class OperatingIndicatorMR extends Component {
const
handleVariance
=
(
tableMeta
,
dex
,
type
)
=>
{
let
total
=
0
if
(
dex
===
1
)
{
total
=
Number
(
tableMeta
.
rowData
[
10
])
-
Number
(
tableMeta
.
rowData
[
8
])
total
=
Number
(
tableMeta
.
rowData
[
10
])
-
Number
(
tableMeta
.
rowData
[
8
])
.
toFixed
(
1
)
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
+
type
]
=
Number
(
total
).
toFixed
(
1
)
}
else
if
(
dex
===
2
)
{
total
=
Number
(
tableMeta
.
rowData
[
10
])
-
Number
(
tableMeta
.
rowData
[
9
])
total
=
Number
(
tableMeta
.
rowData
[
10
])
-
Number
(
tableMeta
.
rowData
[
9
])
.
toFixed
(
1
)
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
+
type
]
=
Number
(
total
).
toFixed
(
1
)
}
return
total
...
...
@@ -304,6 +297,75 @@ export default class OperatingIndicatorMR extends Component {
return
total
}
const
handleFormula
=
(
data
,
tableMeta
,
type
)
=>
{
let
arrayFormula
=
tableMeta
.
rowData
[
3
].
match
(
/
[
a-zA-Z
]
+|
[
0-9
]
+|
[
-!$%^&*()_+|~=`{}
\[\]
:";'<>?,.
\/]
+
(?:\.[
0-9
]
+@|
)
/g
)
let
arrayJumlah
=
[]
let
tambahan
=
false
let
opet
=
""
arrayFormula
.
map
((
item
,
indexs
)
=>
{
if
(
item
==
'X'
)
{
tambahan
=
true
}
else
if
(
item
==
'-'
||
item
==
'+'
||
item
==
'/'
||
item
==
'*'
)
{
arrayJumlah
.
push
(
item
)
}
else
{
let
index
=
dataTable2
.
findIndex
((
val
)
=>
val
[
17
]
==
item
)
if
(
tambahan
)
{
if
(
item
==
'-'
||
item
==
'+'
||
item
==
'/'
||
item
==
'*'
)
{
opet
=
item
}
else
{
arrayJumlah
.
push
(
opet
==
''
?
Number
(
item
)
:
Number
(
String
(
opet
+
String
(
item
))))
tambahan
=
false
opet
=
""
}
}
else
{
if
(
index
!=
-
1
)
{
arrayJumlah
.
push
(
dataTable2
[
index
][
tableMeta
.
columnIndex
+
type
])
}
}
}
})
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
)
// if (tableMeta.rowData[22] === 3) {
// console.log(dataTable2[tableMeta.rowIndex]);
// console.log(total);
// console.log(item);
// console.log(arrayJumlah);
// }
}
else
if
(
opt
==
"bagi"
)
{
total
=
R
.
equals
((
Number
(
total
)
/
Number
(
item
)),
NaN
)
?
'0'
:
Number
(
total
)
/
Number
(
item
)
}
else
{
total
+=
Number
(
item
)
}
}
})
let
a
=
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
+
type
]
=
Number
(
total
)
return
a
}
let
columns
=
[
{
name
:
""
,
...
...
@@ -434,6 +496,24 @@ export default class OperatingIndicatorMR extends Component {
value
=
{
Number
(
handleValue
(
tableMeta
,
0
)).
toFixed
(
1
)}
/
>
<
/span>
:
tableMeta
.
rowData
[
0
]
===
6
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
tableMeta
.
rowData
[
7
]}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleFormula
(
val
,
tableMeta
,
0
)).
toFixed
(
1
)}
/
>
}
/
>
<
/div>
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
@@ -505,6 +585,24 @@ export default class OperatingIndicatorMR extends Component {
/
>
<
/span>
:
tableMeta
.
rowData
[
0
]
===
6
?
<
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
=
{
Number
(
handleFormula
(
val
,
tableMeta
,
1
)).
toFixed
(
1
)}
/
>
}
/
>
<
/div>
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
@@ -540,6 +638,24 @@ export default class OperatingIndicatorMR extends Component {
/
>
<
/span>
:
tableMeta
.
rowData
[
0
]
===
6
?
<
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
=
{
Number
(
handleFormula
(
val
,
tableMeta
,
1
)).
toFixed
(
1
)}
/
>
}
/
>
<
/div>
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
@@ -977,91 +1093,91 @@ export default class OperatingIndicatorMR extends Component {
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
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
Paper
style
=
{{
paddingTop
:
10
}}
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Monthly
Report
-
Operating
Indicator
<
/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
.
data
.
report_id
===
22
?
'Jan'
:
this
.
props
.
data
.
report_id
===
23
?
'Feb'
:
this
.
props
.
data
.
report_id
===
24
?
'Mar'
:
this
.
props
.
data
.
report_id
===
23
?
'Apr'
:
this
.
props
.
data
.
report_id
===
23
?
'May'
:
this
.
props
.
data
.
report_id
===
23
?
'Jun'
:
this
.
props
.
data
.
report_id
===
23
?
'Jul'
:
this
.
props
.
data
.
report_id
===
23
?
'Aug'
:
this
.
props
.
data
.
report_id
===
23
?
'Sep'
:
this
.
props
.
data
.
report_id
===
23
?
'Oct'
:
this
.
props
.
data
.
report_id
===
23
?
'Nov'
:
this
.
props
.
data
.
report_id
===
23
?
'Dec'
:
""
}
{
this
.
props
.
data
.
periode
}
<
/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
=
{()
=>
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
=
{()
=>
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
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
downloadAllData
()
},
100
);
})}
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"download"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
{
this
.
state
.
visibleOI
===
true
?
<
Paper
style
=
{{
paddingTop
:
10
,
paddingBottom
:
20
}}
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Monthly
Report
-
Operating
Indicator
<
/Typography
>
<
/div
>
<
div
style
=
{{
padding
:
20
}}
>
{
!
this
.
state
.
emptyData
&&
<
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
.
data
.
report_id
===
22
?
'Jan'
:
this
.
props
.
data
.
report_id
===
23
?
'Feb'
:
this
.
props
.
data
.
report_id
===
24
?
'Mar'
:
this
.
props
.
data
.
report_id
===
23
?
'Apr'
:
this
.
props
.
data
.
report_id
===
23
?
'May'
:
this
.
props
.
data
.
report_id
===
23
?
'Jun'
:
this
.
props
.
data
.
report_id
===
23
?
'Jul'
:
this
.
props
.
data
.
report_id
===
23
?
'Aug'
:
this
.
props
.
data
.
report_id
===
23
?
'Sep'
:
this
.
props
.
data
.
report_id
===
23
?
'Oct'
:
this
.
props
.
data
.
report_id
===
23
?
'Nov'
:
this
.
props
.
data
.
report_id
===
23
?
'Dec'
:
""
}
{
this
.
props
.
data
.
periode
}
<
/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'
}}
>
{(
this
.
props
.
permission
.
create
||
this
.
props
.
permission
.
edit
)
&&
this
.
props
.
isSubmit
&&
<
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"
/>
{(
this
.
props
.
permission
.
create
||
this
.
props
.
permission
.
edit
)
&&
this
.
props
.
isSubmit
&&
<
a
data
-
tip
=
{
'Upload'
}
data
-
for
=
"upload"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
true
,
editable
:
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
.
downloadAllData
()}
>
<
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
&&
(
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
{
this
.
state
.
loading
&&
loadingComponent
}
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
data
=
{
dataTable2
}
...
...
@@ -1069,50 +1185,41 @@ export default class OperatingIndicatorMR extends Component {
options
=
{
options
}
/
>
<
/MuiThemeProvider
>
)}
<
/div
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
,
marginTop
:
20
}}
>
Last
Updated
by
:
{
this
.
state
.
updateBy
}
<
/Typography
>
<
/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
=
"grid grid-2x"
>
<
div
className
=
"col-1"
>
<
button
className
=
"button"
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
props
.
onClickClose
()
},
100
);
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
}}
onClick
=
{()
=>
{
this
.
props
.
onClickClose
()
this
.
props
.
getReport
()
}
}
>
<
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%'
}}
>
{
!
this
.
state
.
emptyData
&&
(
this
.
props
.
permission
.
create
||
this
.
props
.
permission
.
edit
)
&&
this
.
props
.
isSubmit
&&
<
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
},
()
=>
{
onClick
=
{()
=>
this
.
setState
({
loading
:
true
,
editable
:
false
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
})
// this.handleValidate()
this
.
setState
({
loading
:
false
,
buttonError
:
false
})
},
100
);
})
}}
}
style
=
{{
marginRight
:
20
}}
>
<
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
>
...
...
@@ -1121,21 +1228,19 @@ export default class OperatingIndicatorMR extends Component {
<
button
className
=
"button"
type
=
"button"
disabled
=
{
this
.
state
.
editable
}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
saveDraft
!==
true
?
'pointer'
:
'default
'
,
cursor
:
this
.
state
.
editable
===
true
?
'default'
:
'pointer
'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
this
.
state
.
saveDraft
===
true
?
null
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
backToMonthlyReport
(
'draft'
)
})
}
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
createData
(
"draft"
)
},
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
>
...
...
@@ -1143,34 +1248,191 @@ export default class OperatingIndicatorMR extends Component {
<
/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'
)
})}
disabled
=
{
this
.
state
.
editable
}
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
createData
(
"submitted"
)
},
100
);
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
cursor
:
this
.
state
.
editable
===
true
?
'default'
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
>
<
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
>
:
<
Paper
style
=
{{
paddingTop
:
10
,
paddingBottom
:
20
}}
>
<
div
>
<
div
style
=
{{
padding
:
25
}}
>
<
div
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
{
this
.
props
.
company
.
company_name
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
Period
:
{
this
.
props
.
data
.
report_id
===
22
?
'Jan'
:
this
.
props
.
data
.
report_id
===
23
?
'Feb'
:
this
.
props
.
data
.
report_id
===
24
?
'Mar'
:
this
.
props
.
data
.
report_id
===
23
?
'Apr'
:
this
.
props
.
data
.
report_id
===
23
?
'May'
:
this
.
props
.
data
.
report_id
===
23
?
'Jun'
:
this
.
props
.
data
.
report_id
===
23
?
'Jul'
:
this
.
props
.
data
.
report_id
===
23
?
'Aug'
:
this
.
props
.
data
.
report_id
===
23
?
'Sep'
:
this
.
props
.
data
.
report_id
===
23
?
'Oct'
:
this
.
props
.
data
.
report_id
===
23
?
'Nov'
:
this
.
props
.
data
.
report_id
===
23
?
'Dec'
:
""
}
{
this
.
props
.
data
.
periode
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
in
IDR
mn
<
/Typography
>
<
/div
>
{
this
.
state
.
dataLoaded
&&
(
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
{
this
.
state
.
loading
&&
loadingComponent
}
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
data
=
{
dataTable2
}
columns
=
{
columns
}
options
=
{
options
}
/
>
<
/MuiThemeProvider
>
<
/div
>
)}
<
/div
>
<
div
className
=
"grid grid-2x"
>
<
div
className
=
"col-1"
>
<
button
className
=
"button"
type
=
"button"
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
}}
onClick
=
{()
=>
this
.
setState
({
loading
:
true
,
visibleOI
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
getDataDetail
()
},
100
)
})}
>
<
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
>
{
!
this
.
state
.
emptyData
&&
this
.
state
.
templateNull
&&
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
loading
:
true
,
editable
:
false
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
,
buttonError
:
false
})
},
100
);
})
}
style
=
{{
marginRight
:
20
}}
>
<
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
?
'default'
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
disabled
=
{
this
.
state
.
editable
}
onClick
=
{()
=>
this
.
state
.
editable
===
true
?
null
:
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
uploadOI
(
"draft"
)
},
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"
onClick
=
{()
=>
this
.
state
.
editable
===
true
?
null
:
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
uploadOI
(
"submitted"
)
},
100
);
})}
disabled
=
{
this
.
state
.
editable
}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
editable
===
true
?
'default'
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
>
<
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
>
<
/div
>
{
/* : null
} */
}
<
/div
>
<
/Paper
>
<
/Paper>
}
<
/div
>
{
this
.
state
.
visibleUpload
&&
(
<
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'
}}
>
Upload
File
<
/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
({
visibleUpload
:
false
})}
>
<
img
src
=
{
Images
.
close
}
/
>
<
/button
>
<
/div
>
<
/div
>
<
UploadFile
type
=
{
this
.
state
.
uploadStatus
}
percentage
=
{
this
.
state
.
percentage
}
result
=
{
this
.
state
.
result
}
acceptedFiles
=
{[
"xlsx"
]}
onHandle
=
{(
dt
)
=>
{
this
.
fileHandler
(
dt
)
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
}}
onUpload
=
{()
=>
{
this
.
state
.
judul
===
"MONTHLY REPORT - OPERATING INDICATOR"
?
this
.
checkUpload
()
:
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
}}
/
>
<
/div
>
<
/div
>
)}
<
/div
>
)
)
;
}
}
src/container/MonthlyReport/ProfitLossMR.js
View file @
0e6848c6
...
...
@@ -698,7 +698,7 @@ export default class ProfitLossMR extends Component {
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
tableMeta
.
rowData
[
9
]}
value
=
{
tableMeta
.
rowData
[
7
]}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
...
...
src/container/OprIndicator/OperatingIndicator.js
View file @
0e6848c6
...
...
@@ -255,34 +255,6 @@ export default class OperatingIndicator extends Component {
})
}
getRevision
()
{
let
payload
=
{
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
}
api
.
create
().
getRevision
(
payload
).
then
(
response
=>
{
// console.log(response);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
data
=
response
.
data
.
data
let
revisionData
=
data
.
map
((
item
)
=>
{
return
{
revision
:
item
,
}
})
let
defaultProps
=
{
options
:
revisionData
,
getOptionLabel
:
(
option
)
=>
option
.
revision
,
};
this
.
setState
({
listRevision
:
defaultProps
,
revision
:
revisionData
[
0
]
},
()
=>
{
this
.
getReport
()
this
.
getReportAttachment
()
})
}
}
})
}
getOperatingID
()
{
let
payload
=
{
"company_id"
:
this
.
state
.
company
.
company_id
,
...
...
@@ -410,6 +382,13 @@ export default class OperatingIndicator extends Component {
})
}
saveMonthlyOI
(
payload
)
{
api
.
create
().
createMonthlyReportOI
(
payload
).
then
((
response
)
=>
{
this
.
getReport
()
this
.
getOperatingID
()
})
}
render
()
{
const
columns
=
[
"#"
,
"Report Type"
,
// {
...
...
@@ -639,7 +618,7 @@ export default class OperatingIndicator extends Component {
this
.
forceUpdate
()
})}
getReport
=
{()
=>
this
.
getOperatingID
()}
save
OperatingInd
=
{
this
.
saveOperatingInd
.
bind
(
this
)}
save
MonthlyOI
=
{
this
.
saveMonthlyOI
.
bind
(
this
)}
isSubmit
=
{
this
.
state
.
statusDetail
==
'closed'
?
false
:
this
.
state
.
isSubmit
}
permission
=
{{
create
:
this
.
state
.
buttonCreate
,
edit
:
this
.
state
.
buttonEdit
,
delete
:
this
.
state
.
buttonDelete
}}
/
>
...
...
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