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
668933c4
Commit
668933c4
authored
Apr 20, 2021
by
faisalhamdi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cat pq!
parent
4af02019
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
121 additions
and
21 deletions
+121
-21
TableSubHolding.js
src/container/Laporan/TableSubHolding.js
+121
-21
No files found.
src/container/Laporan/TableSubHolding.js
View file @
668933c4
...
...
@@ -40,9 +40,15 @@ export default class TableSubHolding extends Component {
super(props)
this.state = {
performanceScoreColor: '#fff',
performanceScoreColorQuarterly: '#fff',
performanceScoreColorFy: '#fff',
parameterScore: [],
totalScore: 0,
totalScoreQuarterly: 0,
totalScoreFy: 0,
performanceScore: '',
performanceScoreQuarterly: '',
performanceScoreFy: '',
parameterPerfom: [],
}
}
...
...
@@ -84,26 +90,62 @@ export default class TableSubHolding extends Component {
let totalWeight = 0
let total = 0
let score = 0
let totalWeightQuarterly = 0
let totalWeightFy = 0
let totalQuarterly = 0
let totalFy = 0
let scoreQuarterly = 0
let scoreFy = 0
let performanceScore = ''
let performanceScoreQuarterly = ''
let performanceScoreFy = ''
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 (this.props.type === 10) {
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])
}
} else {
if (item[0] !== 1 && item[0] !== 4) {
// Quarterly
if (item[13] == '' || String(item[13]) == '0' || String(item[13]) == '0.0') {
totalWeightQuarterly += Number(0)
} else {
totalWeightQuarterly += Number(item[6])
}
// FY
if (item[22] == '' || String(item[22]) == '0' || String(item[22]) == '0.0') {
totalWeightFy += Number(0)
} else {
totalWeightFy += Number(item[6])
}
}
if (item[0] !== 1 && item[0] !== 4) {
totalQuarterly += Number(item[18])
totalFy += Number(item[26])
}
}
if (item[0] !== 1 && item[0] !== 4) {
total += Number(item[15])
}
})
totalWeight = Number(totalWeight) / 100
totalWeightQuarterly = Number(totalWeightQuarterly) / 100
totalWeightFy = Number(totalWeightFy) / 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
scoreQuarterly = Number(Number(totalQuarterly).toFixed(2) / Number(totalWeightQuarterly)).toFixed(2)
scoreFy = Number(Number(totalFy).toFixed(2) / Number(totalWeightFy)).toFixed(2)
let lastTotal = isNaN(score) ? "0.0" : score
let lastTotalQuarterly = isNaN(scoreQuarterly) ? "0.0" : scoreQuarterly
let lastTotalFy = isNaN(scoreFy) ? "0.0" : scoreFy
let indexPerform = this.state.parameterPerfom.findIndex((val) => val.company_id == this.props.company.company_id)
let listPerfomanceDefault = []
...
...
@@ -113,16 +155,31 @@ export default class TableSubHolding extends Component {
listPerfomanceDefault = this.state.parameterPerfom.filter((val) => val.company_id == this.props.company.company_id)
}
let performanceScoreColor = '#fff'
let performanceScoreColorQuarterly = '#fff'
let performanceScoreColorFy = '#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
}
if (this.props.type === 10) {
if (Number(lastTotal) >= Number(item.min_value) && Number(lastTotal) <= Number(item.max_value)) {
console.log('masuk appraisal')
performanceScore = item.description
performanceScoreColor = item.value
}
} else {
if (Number(lastTotalQuarterly) >= Number(item.min_value) && Number(lastTotalQuarterly) <= Number(item.max_value)) {
// console.log('masuk quarterly')
performanceScoreQuarterly = item.description
performanceScoreColorQuarterly = item.value
}
if (Number(lastTotalFy) >= Number(item.min_value) && Number(lastTotalFy) <= Number(item.max_value)) {
// console.log('masuk fy')
performanceScoreFy = item.description
performanceScoreColorFy = item.value
}
}
})
}
// console.log(performanceScoreColor)
...
...
@@ -132,7 +189,7 @@ export default class TableSubHolding extends Component {
// console.log(performanceScoreColor)
setTimeout(() => {
this.setState({ totalScore: lastTotal,
performanceScore, loading: false, performanceScoreColor
}, () => {
this.setState({ totalScore: lastTotal,
totalScoreQuarterly: lastTotalQuarterly, totalScoreFy: lastTotalFy, performanceScore, performanceScoreQuarterly, performanceScoreFy, loading: false, performanceScoreColor, performanceScoreColorQuarterly, performanceScoreColorFy
}, () => {
this.setState({ loading: true })
setTimeout(() => {
this.setState({ loading: false })
...
...
@@ -24355,9 +24412,9 @@ export default class TableSubHolding extends Component {
},
]
const totalArray = (item) => {
console.log(item);
}
//
const totalArray = (item) => {
//
console.log(item);
//
}
const columnCatPQ = [
{
name: "",
...
...
@@ -24846,7 +24903,7 @@ export default class TableSubHolding extends Component {
placeholder=""
suffix={`%`}
disabled={true}
value={tableMeta.row
Index
[21]}
value={tableMeta.row
Data
[21]}
/>
}
/>
...
...
@@ -25415,7 +25472,7 @@ export default class TableSubHolding extends Component {
/>
</MuiThemeProvider>
</div>
{this.props.type === 10
|| this.props.type === 11
?
{this.props.type === 10 ?
<div style={{ paddingBottom: 15 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5 }}>
<div>
...
...
@@ -25449,7 +25506,50 @@ export default class TableSubHolding extends Component {
</div>
</div>
</div>
: null
:
this.props.type === 11 ?
<div style={{ paddingBottom: 15 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5 }}>
<div>
<div style={{display: 'flex'}}>
<div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>TOTAL SCORE QUARTERLY</Typography>
</div>
<div style={{ border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.state.totalScoreQuarterly}</Typography>
</div>
</div>
</div>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>TOTAL SCORE FY</Typography>
</div>
<div style={{ border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.state.totalScoreFy}</Typography>
</div>
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15 }}>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{ padding: 5, paddingRight: 66 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography>
</div>
<div style={{ borderStyle: 'solid', backgroundColor: this.state.performanceScoreColorQuarterly, borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.performanceScoreQuarterly}</Typography>
</div>
</div>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography>
</div>
<div style={{ borderStyle: 'solid', backgroundColor: this.state.performanceScoreColorFy, borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.performanceScoreFy}</Typography>
</div>
</div>
</div>
</div>
:
null
}
</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