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
c9efa218
Commit
c9efa218
authored
Dec 01, 2020
by
Riri Novita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
82c45a31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
109 additions
and
10 deletions
+109
-10
OperatingIndicator.js
src/container/OprIndicator/OperatingIndicator.js
+109
-10
No files found.
src/container/OprIndicator/OperatingIndicator.js
View file @
c9efa218
...
...
@@ -11,6 +11,7 @@ import { ExcelRenderer } from 'react-excel-renderer';
import
UploadFile
from
"../../library/Upload"
;
import
{
format
}
from
'date-fns'
;
import
Constant
from
'../../library/Constant'
;
import
OperatingIndicatorMR
from
'../MonthlyReport/OperatingIndicatorMR'
;
var
ct
=
require
(
"../../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
...
...
@@ -27,8 +28,11 @@ export default class OperatingIndicator extends Component {
revision
:
null
,
visibleOperatingIndicator
:
true
,
visibleDetailOpt
:
false
,
visibleDetailMonthly
:
false
,
visibleDetailRolling
:
false
,
listPeriode
:
null
,
periode
:
null
,
month
:
null
,
listCompany
:
null
,
company
:
null
,
report_id
:
null
,
...
...
@@ -75,7 +79,7 @@ export default class OperatingIndicator extends Component {
}
getLastPeriod
()
{
api
.
create
().
getLastPeriodOI
(
this
.
state
.
company
.
company_id
).
then
(
response
=>
{
api
.
create
().
getLastPeriodOI
(
this
.
state
.
company
.
company_id
).
then
(
response
=>
{
// console.log(response);
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
lastPeriod
:
response
.
data
.
data
.
last_periode
,
latestPeriode
:
response
.
data
.
data
.
latest_periode
},
()
=>
{
...
...
@@ -85,6 +89,46 @@ export default class OperatingIndicator extends Component {
})
}
getMonth
()
{
api
.
create
().
getMonthTransaction
().
then
(
response
=>
{
console
.
log
(
response
);
let
dateNow
=
new
Date
let
month
=
format
(
dateNow
,
'MMMM'
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
console
.
log
(
response
);
let
data
=
response
.
data
.
data
let
monthData
=
data
.
map
((
item
)
=>
{
return
{
month_id
:
item
.
id
,
month_value
:
String
(
item
.
month_name
).
substr
(
0
,
3
)
}
})
let
defaultProps
=
{
options
:
monthData
,
getOptionLabel
:
(
option
)
=>
option
.
month_value
,
};
let
index
=
data
.
sort
((
a
,
b
)
=>
a
-
b
).
findIndex
((
val
)
=>
val
.
month_name
==
month
)
console
.
log
(
index
);
this
.
setState
({
listMonth
:
defaultProps
,
month
:
index
==
-
1
?
monthData
[
0
]
:
monthData
[
index
]
},
()
=>
{
this
.
getLastPeriod
()
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
})
}
getReportAttachment
()
{
let
payload
=
{
"company_id"
:
this
.
state
.
company
.
company_id
,
...
...
@@ -108,7 +152,7 @@ export default class OperatingIndicator extends Component {
"report_type"
:
"operating indicator"
,
}
api
.
create
().
getAllOperatingInd
(
payload
).
then
(
response
=>
{
//
console.log(response);
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
dataTable
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
...
...
@@ -189,7 +233,7 @@ export default class OperatingIndicator extends Component {
};
this
.
setState
({
listCompany
:
defaultProps
,
company
:
arrayBaru
.
length
<
1
?
companyData
[
0
]
:
arrayBaru
[
0
]
},
()
=>
{
this
.
get
LastPeriod
()
this
.
get
Month
()
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
...
...
@@ -318,12 +362,46 @@ export default class OperatingIndicator extends Component {
clickDetail
(
item
,
id
)
{
let
index
=
this
.
state
.
dataReport
.
findIndex
((
val
)
=>
val
.
report_name
==
item
[
1
])
if
(
index
!==
-
1
)
{
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
},
visibleOperatingIndicator
:
false
,
visibleDetailOpt
:
true
,
})
// 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 },
// visibleOperatingIndicator: false,
// visibleDetailOpt: true,
// })
if
(
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
"master budget"
))
{
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
},
visibleOperatingIndicator
:
false
,
visibleDetailOpt
:
true
,
visibleDetailMonthly
:
false
,
visibleDetailRolling
:
false
})
}
else
if
(
String
(
item
[
1
]).
toLocaleLowerCase
().
includes
(
"monthly report"
))
{
console
.
log
(
item
);
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
},
visibleOperatingIndicator
:
false
,
visibleDetailOpt
:
false
,
visibleDetailMonthly
:
true
,
visibleDetailRolling
:
false
},
()
=>
console
.
log
(
this
.
state
.
dataDetail
))
}
else
{
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
},
visibleOperatingIndicator
:
false
,
visibleDetailOpt
:
false
,
visibleDetailMonthly
:
false
,
visibleDetailRolling
:
true
})
}
}
}
...
...
@@ -447,7 +525,10 @@ export default class OperatingIndicator extends Component {
borderColor
:
'transparent'
}}
onClick
=
{()
=>
tableMeta
.
rowData
[
4
]
?
this
.
clickDetail
(
tableMeta
.
rowData
,
tableMeta
.
rowData
[
1
],
tableMeta
.
rowData
[
3
],
tableMeta
.
rowData
[
2
])
:
null
// tableMeta.rowData[4] ?
this
.
clickDetail
(
tableMeta
.
rowData
,
tableMeta
.
rowData
[
1
],
tableMeta
.
rowData
[
3
],
tableMeta
.
rowData
[
2
])
// :
// null
}
>
<
Typography
style
=
{{
color
:
tableMeta
.
rowData
[
4
]
?
'#5198ea'
:
'GrayText'
,
fontSize
:
12
,
}}
>
Detail
<
/Typography
>
...
...
@@ -584,6 +665,24 @@ export default class OperatingIndicator extends Component {
permission
=
{{
create
:
this
.
state
.
buttonCreate
,
edit
:
this
.
state
.
buttonEdit
,
delete
:
this
.
state
.
buttonDelete
}}
/
>
}
{
this
.
state
.
visibleDetailMonthly
&&
<
OperatingIndicatorMR
open
=
{
this
.
props
.
open
}
data
=
{
this
.
state
.
dataDetail
}
height
=
{
this
.
props
.
height
}
width
=
{
this
.
props
.
width
}
month
=
{
this
.
state
.
month
}
company
=
{
this
.
state
.
company
}
onClickClose
=
{()
=>
this
.
setState
({
visibleDetailMonthly
:
false
,
visibleOperatingIndicator
:
true
},
()
=>
{
this
.
getOperatingID
()
this
.
forceUpdate
()
})}
getReport
=
{()
=>
this
.
getOperatingID
()}
saveOperatingInd
=
{
this
.
saveOperatingInd
.
bind
(
this
)}
isSubmit
=
{
this
.
state
.
statusDetail
==
'closed'
?
false
:
this
.
state
.
isSubmit
}
permission
=
{{
create
:
this
.
state
.
buttonCreate
,
edit
:
this
.
state
.
buttonEdit
,
delete
:
this
.
state
.
buttonDelete
}}
/
>
}
{
this
.
state
.
visibleUpload
&&
(
<
div
className
=
"test app-popup-show"
>
...
...
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