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
601b72ac
Commit
601b72ac
authored
Jan 06, 2021
by
rifkaki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://103.44.149.204/d.arizona/tia-dev
into rifka
parents
0d1f7686
db7865a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
189 additions
and
106 deletions
+189
-106
OperatingIndicatorMR.js
src/container/MonthlyReport/OperatingIndicatorMR.js
+175
-105
OperatingIndicator.js
src/container/OprIndicator/OperatingIndicator.js
+14
-1
No files found.
src/container/MonthlyReport/OperatingIndicatorMR.js
View file @
601b72ac
...
...
@@ -64,6 +64,7 @@ export default class OperatingIndicatorMR extends Component {
emptyData: false,
templateNull: true,
judulColumn: null,
saveDraft: true,
get_for: 'view'
}
this.fileHandler = this.fileHandler.bind(this);
...
...
@@ -185,13 +186,24 @@ export default class OperatingIndicatorMR extends Component {
}
// console.log(payload);
api.create().getHierarkiMontlyReportOI(payload).then(response => {
//
console.log(response);
console.log(response);
let dataTable = []
let err = false
if (response.data) {
let res = response.data.data
// console.log(res);
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (item.type_report_id === 3) {
if (item.monthly_report.mtd_vs_mb === "" && (Number(item.monthly_report.percent_act_vs_mb) < this.state.minValue || Number(item.monthly_report.percent_act_vs_mb) > this.state.maxValue)) {
err = true
}
if (item.monthly_report.mtd_vs_rb === "" && (Number(item.monthly_report.percent_act_vs_rb) < this.state.minValue || Number(item.monthly_report.percent_act_vs_rb) > this.state.maxValue)) {
console.log('msk 2');
err = true
}
}
if (indexIDzz === -1) {
dataTable.push([
item.type_report_id,
...
...
@@ -223,6 +235,16 @@ export default class OperatingIndicatorMR extends Component {
}
}
res.map((item, index) => {
if (item.type_report_id === 3) {
if (item.monthly_report.mtd_vs_mb === "" && (Number(item.monthly_report.percent_act_vs_mb) < this.state.minValue || Number(item.monthly_report.percent_act_vs_mb) > this.state.maxValue)) {
err = true
}
if (item.monthly_report.mtd_vs_rb === "" && (Number(item.monthly_report.percent_act_vs_rb) < this.state.minValue || Number(item.monthly_report.percent_act_vs_rb) > this.state.maxValue)) {
console.log('msk 2');
err = true
}
}
dataTable.push([
item.type_report_id,
item.id,
...
...
@@ -251,13 +273,16 @@ export default class OperatingIndicatorMR extends Component {
}
}
})
this
.
setState
({
dataTable
,
loading
:
false
},
()
=>
{
if (err === true) {
this.setState({ bebas: true })
}
this.setState({ dataTable, loading: false, buttonError: true, saveDraft: true }, () => {
if (this.state.dataTable.length == 0) {
this.setState({ emptyData: true })
}
})
}
//
console.log(dataTable);
console.log(dataTable);
})
}
...
...
@@ -460,6 +485,15 @@ export default class OperatingIndicatorMR extends Component {
let data = []
let err = false
this.state.dataTable.map((i, index) => {
if (i[0] === 3) {
if (i[15] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) {
console.log('msk 1');
err = true
} else if (i[16] === "" && (Number(i[14]) < this.state.minValue || Number(i[14]) > this.state.maxValue)) {
console.log('msk 2');
err = true
}
}
data.push({
"item_report_id": i[1],
"uom": i[6],
...
...
@@ -475,16 +509,6 @@ export default class OperatingIndicatorMR extends Component {
"mtd_vs_rb": i[16]
})
})
// console.log(JSON.stringify(data));
data
.
map
(
i
=>
{
if
(
i
.
mtd_vs_mb
===
""
&&
(
Number
(
i
.
percent_act_vs_mb
)
<
this
.
state
.
minValue
||
Number
(
i
.
percent_act_vs_mb
)
>
this
.
state
.
maxValue
))
{
console
.
log
(
'msk 1'
);
err
=
true
}
else
if
(
i
.
mtd_vs_rb
===
""
&&
(
Number
(
i
.
percent_act_vs_rb
)
<
this
.
state
.
minValue
||
Number
(
i
.
percent_act_vs_rb
)
>
this
.
state
.
maxValue
))
{
console
.
log
(
'msk 2'
);
err
=
true
}
})
// console.log(JSON.stringify(data))
let payload = {
...
...
@@ -1177,6 +1201,7 @@ export default class OperatingIndicatorMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={'%'}
disabled={true}
value={Number(tableMeta.rowData[12]).toFixed(1)}
/>
...
...
@@ -1250,6 +1275,7 @@ export default class OperatingIndicatorMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={'%'}
disabled={true}
value={Number(tableMeta.rowData[14]).toFixed(1)}
/>
...
...
@@ -1330,108 +1356,163 @@ export default class OperatingIndicatorMR extends Component {
<div>
<div className="grid grid-2x content-center">
<div className="col-1">
<
div
style
=
{{
textAlign
:
'right'
,
width
:
90
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
this
.
state
.
get_for
==
'view'
?
tableMeta
.
rowData
[
15
]
:
<
FormControlLabel
style
=
{{
margin
:
0
}}
// value={value}
control
=
{
tableMeta
.
rowData
[
15
]
===
""
&&
(
Number
(
tableMeta
.
rowData
[
12
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
12
])
>
this
.
state
.
maxValue
)
?
<
LightTooltipError
title
=
{
"MTD Explanation vs Prev Month is Reqiured"
}
arrow
>
<div style={{ textAlign: 'left', width: 90 }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 3 ?
this.state.get_for == 'view' ?
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
multiline={true}
disabled={true}
defaultValue={tableMeta.rowData[15]}
inputProps={{
style: {
color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'left'
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 0)
}}
/>
:
<FormControlLabel
style={{ margin: 0 }}
// value={tableMeta.rowData[15]}
control={
tableMeta.rowData[15] === "" && (Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue) ?
<LightTooltipError title={"MTD Explanation vs MB is Reqiured"} arrow>
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', minHeight: 30 , padding: 0 }}
type="text"
placeholder=""
multiline={true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
// value={tableMeta.rowData[15]}
defaultValue={tableMeta.rowData[15]}
inputProps={{
style: {
color: "#5198ea",
textAlign: 'left',
backgroundColor: '#ffac99',
minHeight: 30,
padding: 0
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 0)
}}
/>
</LightTooltipError>
:
<Input
disableUnderline={true}
style
=
{{
fontSize
:
12
,
textAlign
:
'
righ
t'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
style={{ fontSize: 12, textAlign: '
lef
t', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={fals
e}
disabled
=
{
this
.
state
.
get_for
==
'view'
}
multiline={tru
e}
disabled={this.
props.isApprover? true : (this.state.get_for == 'view'? true : false)
}
defaultValue={tableMeta.rowData[15]}
inputProps={{
style: {
color
:
this
.
state
.
get_for
==
'view'
?
"black"
:
"#5198ea"
,
textAlign
:
'right'
,
backgroundColor
:
'#ffac99'
color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'left'
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 0)
}}
/>
<
/LightTooltipError
>
:
<
Input
disableUnderline
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
this
.
state
.
get_for
==
'view'
}
defaultValue
=
{
tableMeta
.
rowData
[
15
]}
inputProps
=
{{
style
:
{
color
:
Number
(
tableMeta
.
rowData
[
12
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
12
])
>
this
.
state
.
maxValue
?
"#5198ea"
:
'#5198ea'
,
textAlign
:
'right'
}
}}
onBlur
=
{(
event
)
=>
{
handleText
(
event
.
target
.
value
,
tableMeta
,
0
)
}}
/
>
}
/
>
}
}
/>
:
null
}
</div>
</div>
</div>
<div className="col-2">
<
div
style
=
{{
textAlign
:
'right'
,
width
:
90
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
this
.
state
.
get_for
==
'view'
?
tableMeta
.
rowData
[
16
]
:
<
FormControlLabel
style
=
{{
margin
:
0
}}
// value={value}
control
=
{
tableMeta
.
rowData
[
16
]
===
""
&&
(
Number
(
tableMeta
.
rowData
[
14
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
14
])
>
this
.
state
.
maxValue
)
?
<
LightTooltipError
title
=
{
"MTD Explanation vs Prev Month is Reqiured"
}
arrow
>
<div style={{ textAlign: 'left', width: 90 }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 3 ?
this.state.get_for == 'view' ?
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
multiline={true}
disabled={true}
defaultValue={tableMeta.rowData[16]}
inputProps={{
style: {
color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'left'
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 0)
}}
/>
:
<FormControlLabel
style={{ margin: 0 }}
// value={tableMeta.rowData[16]}
control={
tableMeta.rowData[16] === "" && (Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue) ?
<LightTooltipError title={"MTD Explanation vs RB is Reqiured"} arrow>
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', minHeight: 30 , padding: 0 }}
type="text"
placeholder=""
multiline={true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
// value={tableMeta.rowData[16]}
defaultValue={tableMeta.rowData[16]}
inputProps={{
style: {
color: "#5198ea",
textAlign: 'left',
backgroundColor: '#ffac99',
minHeight: 30,
padding: 0
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 0)
}}
/>
</LightTooltipError>
:
<Input
disableUnderline={true}
style
=
{{
fontSize
:
12
,
textAlign
:
'
righ
t'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
style={{ fontSize: 12, textAlign: '
lef
t', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled
=
{
this
.
state
.
get_for
==
'view'
}
multiline={true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[16]}
inputProps={{
style: {
color
:
this
.
state
.
get_for
==
'view'
?
"black"
:
"#5198ea"
,
textAlign
:
'right'
,
backgroundColor
:
'#ffac99'
color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'left'
}
}}
onBlur={(event) => {
handleText
(
event
.
target
.
value
,
tableMeta
,
1
)
handleText(event.target.value, tableMeta,
0
)
}}
/>
<
/LightTooltipError
>
:
<
Input
disableUnderline
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
defaultValue
=
{
tableMeta
.
rowData
[
16
]}
disabled
=
{
this
.
state
.
get_for
==
'view'
}
inputProps
=
{{
style
:
{
color
:
Number
(
tableMeta
.
rowData
[
14
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
14
])
>
this
.
state
.
maxValue
?
"#5198ea"
:
'#5198ea'
,
textAlign
:
'right'
}
}}
onBlur
=
{(
event
)
=>
{
handleText
(
event
.
target
.
value
,
tableMeta
,
1
)
}}
/
>
}
/
>
}
}
/>
:
null
}
</div>
</div>
</div>
</div>
...
...
@@ -1599,7 +1680,7 @@ export default class OperatingIndicatorMR extends Component {
this.setState({ loading: true, editable: false }, () => {
setTimeout(() => {
this.handleValidate()
this
.
setState
({
loading
:
false
,
buttonError
:
false
})
//
this.setState({ loading: false, buttonError: false })
}, 100);
})
}
...
...
@@ -1621,7 +1702,7 @@ export default class OperatingIndicatorMR extends Component {
marginRight: 20
}}
onClick={() =>
this
.
state
.
editable
===
true
?
this.state.
saveDraft
=== true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.setState({ loading: true }, () => {
...
...
@@ -1631,13 +1712,7 @@ export default class OperatingIndicatorMR extends Component {
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
{
this
.
state
.
editable
===
true
?
<
LightTooltip
title
=
{
"Data Incomplete"
}
arrow
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
as
Draft
<
/Typography
>
<
/LightTooltip
>
:
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
as
Draft
<
/Typography
>
}
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>}
{this.state.get_for == 'edit' && <button
...
...
@@ -1661,13 +1736,7 @@ export default class OperatingIndicatorMR extends Component {
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
{
this
.
state
.
editable
===
true
?
<
LightTooltip
title
=
{
"Data Incomplete"
}
arrow
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
&
Complete
<
/Typography
>
<
/LightTooltip
>
:
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
&
Complete
<
/Typography
>
}
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>}
</div>}
...
...
@@ -1737,7 +1806,8 @@ export default class OperatingIndicatorMR extends Component {
onClick={() =>
this.setState({ loading: true, editable: false }, () => {
setTimeout(() => {
this
.
setState
({
loading
:
false
,
buttonError
:
false
})
this.handleValidate()
// this.setState({ loading: false, buttonError: false })
}, 100);
})
}
...
...
src/container/OprIndicator/OperatingIndicator.js
View file @
601b72ac
...
...
@@ -111,6 +111,7 @@ export default class OperatingIndicator extends Component {
"periode"
:
this
.
state
.
periode
.
periode
,
"report_type"
:
"operating indicator"
,
}
console
.
log
(
payload
);
api
.
create
().
getAllOperatingInd
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
...
...
@@ -312,6 +313,18 @@ export default class OperatingIndicator extends Component {
})
}
else
if
(
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
"monthly report"
))
{
console
.
log
(
item
);
let
month
=
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
'jan'
)
?
1
:
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
'feb'
)
?
2
:
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
'mar'
)
?
3
:
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
'apr'
)
?
4
:
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
'may'
)
?
5
:
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
'jun'
)
?
6
:
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
'jul'
)
?
7
:
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
'aug'
)
?
8
:
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
'sep'
)
?
9
:
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
'oct'
)
?
10
:
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
'nov'
)
?
11
:
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
'dec'
)
?
12
:
null
this
.
setState
({
statusDetail
:
String
(
item
[
2
]).
toLocaleLowerCase
(),
dataDetail
:
{
...
this
.
state
.
dataReport
[
index
],
periode
:
this
.
state
.
periode
.
periode
,
operatingIndID
:
this
.
state
.
operatingIndID
,
company
:
this
.
state
.
company
},
...
...
@@ -319,7 +332,7 @@ export default class OperatingIndicator extends Component {
visibleDetailOpt
:
false
,
visibleDetailMonthly
:
true
,
visibleDetailRolling
:
false
,
months
:
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
:
month
})
...
...
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