Commit bf22876c authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

Didam

See merge request !951
parents 38f11939 141b24be
......@@ -371,7 +371,7 @@ export default class CorporateAnnualTargetMR extends Component {
item.formula,
item.level,
item.item_report,
item.weight,
String(item.weight).includes("%") ? String(item.weight).substr(0, String(item.weight).length - 1) : item.weight,
item.uom,
item.jenis_kpi,
item.max_ach,
......@@ -633,6 +633,7 @@ export default class CorporateAnnualTargetMR extends Component {
}
handleBackgroundPerf(total) {
console.log(total)
let color = 'white'
if ( total >= 1.00 && total <= 2.00) {
color = 'red'
......@@ -913,49 +914,6 @@ export default class CorporateAnnualTargetMR extends Component {
return total
}
const handleChangeDropdown = (value, tableMeta) => {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
let valz = value.value
let total = 0
let lastValz = 0
if (valz == 'SUM' || valz == 'AVG' || valz == 'LAST') {
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 13 && index <= 24) {
let valItem = item == undefined || item == "" ? 0 : item
total += Number(valItem)
if (index == 24) {
lastValz += Number(valItem)
}
}
})
dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz))
}
}
const handleValueDropdown = (value, type, tableMeta) => {
// console.log(value,type, tableMeta);
// console.log(this.state.maxAchList.options);
let data = type == 'KPI' ? this.state.kpiTypeList.options : (type == 'MAX' ? this.state.maxAchList.options : this.state.formulaYtdList.options)
// console.log(data);
let index = 0
if (value == null) {
// console.log("masuk");
index = -1
} else {
index = data.findIndex((val) => val.value == value.value)
}
// console.log(value)
// console.log(data)
// console.log(index)
if (index == -1) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = null
return null
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
return value
}
}
const handleChangeText = (value, tableMeta) => {
// // console.log(value)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
......@@ -1086,7 +1044,7 @@ export default class CorporateAnnualTargetMR extends Component {
let listParameterFilter = listParameter.filter((val) => val.setting_type == String(parameterMix).toLocaleUpperCase())
let listParameterFilterCompany = listParameterFilter.filter((val) => val.company_id == this.props.company.company_id)
let totalScore = 0
let achx100 = tableMeta.rowData[9] == '100%'? 1 : Number(tableMeta.rowData[13])/100
let achx100 = tableMeta.rowData[9] == '100%'? Number(tableMeta.rowData[13])/100 > 1? 1 : Number(tableMeta.rowData[13])/100 : Number(tableMeta.rowData[13])/100
if (listParameterFilterCompany.length == 0) {
listParameterFilter.map((item,index) => {
if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) {
......@@ -1118,6 +1076,37 @@ export default class CorporateAnnualTargetMR extends Component {
// console.log(total)
}
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(2)
if (tableMeta.rowIndex == dataTable2.length -1) {
let totals = 0
let perfomanceScoreX = ''
dataTable2.map((item,index) => {
let value = String(item[15]) == 'NaN' || String(item[15]) == ''? 0 : Number(item[15])
totals += value
})
totals = Number(totals).toFixed(2)
if ( totals >= 1.00 && totals <= 2.00) {
perfomanceScoreX = 'K'
} else if ( totals >= 2.01 && totals <= 2.75) {
perfomanceScoreX = 'C'
} else if ( totals >= 2.76 && totals <= 3.00) {
perfomanceScoreX = 'B-'
} else if ( totals >= 3.01 && totals <= 3.75) {
perfomanceScoreX = 'B'
} else if ( totals >= 3.76 && totals <= 4.00) {
perfomanceScoreX = 'B+'
} else if ( totals >= 4.01 && totals <= 4.75) {
perfomanceScoreX = 'BS'
} else if ( totals >= 4.76 && totals <= 5.00) {
perfomanceScoreX = 'IST'
}
totalScoreXXX = totals
perfomanceScore = perfomanceScoreX
setTimeout(() => {
console.log(totalScoreXXX)
console.log(perfomanceScore)
}, 300);
}
return total
}
......
......@@ -380,7 +380,7 @@ export default class ListOfCreditFacilities extends Component {
)
}
console.log(dataTable)
this.setState({ dataTable, loading: false, visibleLOCFMR: true, totalOutStand: 0, diff: 0 }, () => {
this.setState({ dataTable, loading: false, visibleLOCFMR: true }, () => {
this.handleCalculate()
})
}
......@@ -940,13 +940,17 @@ export default class ListOfCreditFacilities extends Component {
}
api.create().getPerBSiMontlyReportLOCF(payload).then((response) => {
console.log(response)
if (this.state.get_for == 'view') {
this.setState({perBS: "0.0"})
} else {
// if (this.state.get_for == 'view') {
// this.setState({perBS: "0.0"})
// } else {
if (response.data.status == "success") {
this.setState({perBS: response.data.data.per_bs == null || response.data.data.per_bs == ''? Number(0).toFixed(1) : Number(response.data.data.per_bs).toFixed(1)})
this.setState({
perBS: response.data.data.per_bs == null || response.data.data.per_bs == ''? Number(0).toFixed(1) : Number(response.data.data.per_bs).toFixed(1),
totalOutStand: response.data.data.total_loan,
diff: response.data.data.diff
})
}
}
// }
})
}
......@@ -1365,12 +1369,22 @@ export default class ListOfCreditFacilities extends Component {
// console.log(dataTampungBank)
console.log(totalLoan);
console.log(this.state.perBS)
console.log(this.state.diff)
// console.log(bankNameEmpty)
// dataTable: newData, totalOutStand: newData[newData.length-1][22]
if (bankNameEmpty) {
this.setState({ loading: false, dataTable: this.state.dataTable, totalOutStand: 0, diff: Number(0 - this.state.perBS).toFixed(1), saveDraft: false, saveComp: true})
if (this.state.get_for == 'view') {
this.setState({ loading: false, dataTable: this.state.dataTable, diff: this.state.diff == null? "0.0" : Number(0 - this.state.perBS).toFixed(1), perBS: this.state.totalOutStand == null? "0.0" : this.state.totalOutStand, saveDraft: false, saveComp: true})
} else {
this.setState({ loading: false, dataTable: this.state.dataTable, diff: Number(0 - this.state.perBS).toFixed(1), saveDraft: false, saveComp: true})
}
} else {
this.setState({ loading: false, dataTable: newData, totalOutStand: Number(totalLoan).toFixed(1), diff: Number(totalLoan - this.state.perBS).toFixed(1), saveDraft: false, saveComp: Number(totalLoan - this.state.perBS) == 0? false : true })
if (this.state.get_for == 'view') {
this.setState({ loading: false, dataTable: newData, diff: this.state.diff == null? "0.0" : Number(totalLoan - this.state.perBS).toFixed(1), perBS: this.state.totalOutStand == null? "0.0" : this.state.totalOutStand })
} else {
this.setState({ loading: false, dataTable: newData, diff: Number(totalLoan - this.state.perBS).toFixed(1), saveDraft: false, saveComp: Number(totalLoan - this.state.perBS) == 0? false : true })
}
}
}, 100);
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment