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
b8a4eceb
Commit
b8a4eceb
authored
Apr 19, 2021
by
faisalhamdi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cat pa!
parent
a51b5177
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
5 deletions
+103
-5
SubHolding.js
src/container/Laporan/SubHolding.js
+1
-0
TableSubHolding.js
src/container/Laporan/TableSubHolding.js
+102
-5
No files found.
src/container/Laporan/SubHolding.js
View file @
b8a4eceb
...
@@ -4133,6 +4133,7 @@ export default class SubHolding extends Component {
...
@@ -4133,6 +4133,7 @@ export default class SubHolding extends Component {
dataTable
=
{
this
.
state
.
dataTable
}
dataTable
=
{
this
.
state
.
dataTable
}
periode
=
{
this
.
state
.
periode
?
this
.
state
.
periode
.
periode
:
null
}
periode
=
{
this
.
state
.
periode
?
this
.
state
.
periode
.
periode
:
null
}
quarter
=
{
this
.
state
.
quarter
.
name
}
quarter
=
{
this
.
state
.
quarter
.
name
}
company
=
{
this
.
state
.
company
}
/
>
/
>
)}
)}
<
/div
>
<
/div
>
...
...
src/container/Laporan/TableSubHolding.js
View file @
b8a4eceb
import { createMuiTheme, FormControlLabel, Input, MuiThemeProvider, TableCell, Typography } from '@material-ui/core'
import { createMuiTheme, FormControlLabel, Input, MuiThemeProvider, TableCell, Typography } from '@material-ui/core'
import MUIDataTable from 'mui-datatables';
import MUIDataTable from 'mui-datatables';
import React, { Component } from 'react'
import React, { Component } from 'react'
import api from '../../api'
import NumberFormat from 'react-number-format';
import NumberFormat from 'react-number-format';
import * as R from 'ramda'
import * as R from 'ramda'
...
@@ -38,13 +39,109 @@ export default class TableSubHolding extends Component {
...
@@ -38,13 +39,109 @@ export default class TableSubHolding extends Component {
constructor(props) {
constructor(props) {
super(props)
super(props)
this.state = {
this.state = {
perfomanceScoreColor: '#fff',
perfo
r
manceScoreColor: '#fff',
parameterScore: [],
parameterScore: [],
totalScore: 0,
totalScore: 0,
perfomanceScore: ''
performanceScore: '',
parameterPerfom: [],
}
}
}
}
componentDidMount() {
if (this.props.type === 10 || this.props.type === 11) {
this.getParameterGroup()
this.getParameterGroupPerfom()
}
}
getParameterGroup() {
api.create().getParameterByGroupName({
"group_name": 'ACHIEVEMENT_KPI'
}).then((response) => {
console.log(response.data)
if (response.data) {
this.setState({ parameterScore: response.data.data })
}
})
}
getParameterGroupPerfom() {
api.create().getParameterByGroupName({
"group_name": "PERFORMANCE_KPI"
}).then((response) => {
console.log(response.data)
if (response.data) {
this.setState({ parameterPerfom: response.data.data }, () => {
this.handleTotalScore(this.props.dataTable)
})
}
})
}
handleTotalScore(dataTable2) {
// console.log(dataTable2);
this.setState({ loading: true }, () => {
let totalWeight = 0
let total = 0
let score = 0
let performanceScore = ''
dataTable2.map((item, index) => {
// console.log(item[6])
//total weight
if (item[0] !== 1 && item[0] !== 4) {
if (item[12] == '' || String(item[12]) == '0' || String(item[12]) == '0.0') {
totalWeight += Number(0)
} else {
totalWeight += Number(item[6])
}
}
if (item[0] !== 1 && item[0] !== 4) {
total += Number(item[15])
}
})
totalWeight = Number(totalWeight) / 100
// console.log(total);
// console.log(totalWeight);
score = Number(Number(total).toFixed(2) / Number(totalWeight)).toFixed(2)
let lastTotal = R.equals(score, NaN) ? 0.0 : score
let indexPerform = this.state.parameterPerfom.findIndex((val) => val.company_id == this.props.company.company_id)
let listPerfomanceDefault = []
if (indexPerform == -1) {
listPerfomanceDefault = this.state.parameterPerfom.filter((val) => String(val.company_name).toLocaleLowerCase() == "default")
} else {
listPerfomanceDefault = this.state.parameterPerfom.filter((val) => val.company_id == this.props.company.company_id)
}
let performanceScoreColor = '#fff'
if (listPerfomanceDefault.length > 0) {
listPerfomanceDefault.map((item, index) => {
// console.log(Number(lastTotal))
// console.log(Number(item.min_value))
// console.log(Number(item.max_value))
if (Number(lastTotal) >= Number(item.min_value) && Number(lastTotal) <= Number(item.max_value)) {
// console.log('masuk')
performanceScore = item.description
performanceScoreColor = item.value
}
})
}
// console.log(performanceScoreColor)
// console.log(this.state.parameterPerfom)
// console.log(listPerfomanceDefault)
// console.log(performanceScore)
// console.log(performanceScoreColor)
setTimeout(() => {
this.setState({ totalScore: lastTotal, performanceScore, loading: false, performanceScoreColor }, () => {
this.setState({ loading: true })
setTimeout(() => {
this.setState({ loading: false })
}, 500);
})
}, 500);
})
}
render() {
render() {
let dataTable2 = this.props.dataTable
let dataTable2 = this.props.dataTable
const handleChangeBS = (value, tableMeta, type) => {
const handleChangeBS = (value, tableMeta, type) => {
...
@@ -27460,7 +27557,7 @@ export default class TableSubHolding extends Component {
...
@@ -27460,7 +27557,7 @@ export default class TableSubHolding extends Component {
/>
/>
</MuiThemeProvider>
</MuiThemeProvider>
</div>
</div>
{this.props.type === 10 ?
{this.props.type === 10
|| this.props.type === 11
?
<div style={{ paddingBottom: 15 }}>
<div style={{ paddingBottom: 15 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5 }}>
<div>
<div>
...
@@ -27488,8 +27585,8 @@ export default class TableSubHolding extends Component {
...
@@ -27488,8 +27585,8 @@ export default class TableSubHolding extends Component {
<div style={{ padding: 5 }}>
<div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography>
</div>
</div>
<div style={{ borderStyle: 'solid', backgroundColor: this.state.perfomanceScoreColor, borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<div style={{ borderStyle: 'solid', backgroundColor: this.state.perfo
r
manceScoreColor, borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.perfomanceScore}</Typography>
<Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.perfo
r
manceScore}</Typography>
</div>
</div>
</div>
</div>
</div>
</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