Commit 72ae8b97 authored by rifkaki's avatar rifkaki

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into rifka

parents 6951473d e4fda636
......@@ -97,6 +97,7 @@ export default class CorporateAnnualTargetMR extends Component {
api.create().getParameterByGroupName({
"group_name" : 'ACHIEVEMENT_KPI'
}).then((response) => {
console.log(response.data.data)
if (response.data) {
this.setState({parameterScore: response.data.data})
}
......@@ -160,6 +161,8 @@ export default class CorporateAnnualTargetMR extends Component {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE'
let weight = String(item.corporate_annual_target.weight).substr(0,String(item.corporate_annual_target.weight).length-1)
console.log(weight)
dataTable.push([
item.type_report_id,
item.id,
......@@ -167,7 +170,7 @@ export default class CorporateAnnualTargetMR extends Component {
item.formula,
item.level,
item.description,
item.corporate_annual_target.weight == ""? "0%" : item.corporate_annual_target.weight,
item.corporate_annual_target.weight == ""? Number(0).toFixed(1) : Number(weight).toFixed(1),
parentTrue ? item.corporate_annual_target.uom : item.uom,
parentTrue ? item.corporate_annual_target.jenis_kpi == "" ? null : item.corporate_annual_target.jenis_kpi : item.jenis_kpi == "" ? null : item.kpi_type,
// parentTrue ? item.corporate_annual_target.kpi_type == "" ? null : { value: item.corporate_annual_target.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type },
......@@ -201,7 +204,7 @@ export default class CorporateAnnualTargetMR extends Component {
item.formula,
item.level,
item.description,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : item.weight,
item.weight == ''? Number(0).toFixed(1) : Number(Number(item.weight) * 100).toFixed(1),
item.uom,
item.kpi_type == "" ? null : item.kpi_type,
// item.kpi_type == "" ? null : { value: item.kpi_type },
......@@ -1044,15 +1047,25 @@ export default class CorporateAnnualTargetMR extends Component {
let parameterAch = String(tableMeta.rowData[9]).includes('%')? `MAX${String(tableMeta.rowData[9]).substr(0,String(tableMeta.rowData[9]).length - 1)}` : String(tableMeta.rowData[9])
let parameterMix = `${parameterKpi}_${parameterAch}`
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 = Number(tableMeta.rowData[13])/100
let achx100 = tableMeta.rowData[9] == '100%'? 1 : 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)) {
totalScore = Number(item.value)
}
})
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(1)
return Number(totalScore).toFixed(1)
} else {
listParameterFilterCompany.map((item,index) => {
if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) {
totalScore = Number(item.value)
}
})
}
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(0)
return Number(totalScore).toFixed(0)
}
const handleTotal = (tableMeta) => {
......@@ -1196,7 +1209,7 @@ export default class CorporateAnnualTargetMR extends Component {
type="text"
placeholder=""
suffix={"%"}
value={Number(value).toFixed(1)}
value={value}
disabled={true}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
......@@ -1404,6 +1417,7 @@ export default class CorporateAnnualTargetMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={"%"}
value={handleAchiement(tableMeta).toFixed(1)}
decimalScale={1}
disabled={true}
......@@ -1442,7 +1456,7 @@ export default class CorporateAnnualTargetMR extends Component {
:
<FormControlLabel
style={{ margin: 0 }}
value={Number(value).toFixed(1)}
value={Number(value).toFixed(0)}
control={
<NumberFormat
thousandSeparator={true}
......@@ -1450,7 +1464,7 @@ export default class CorporateAnnualTargetMR extends Component {
type="text"
placeholder=""
value={handleScore(tableMeta)}
decimalScale={1}
decimalScale={0}
disabled={true}
// onBlur={(event) => {
// // updateValue(event.target.value)
......@@ -1495,7 +1509,7 @@ export default class CorporateAnnualTargetMR extends Component {
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={handleTotal(tableMeta).toFixed(1)}
value={handleTotal(tableMeta).toFixed(2)}
decimalScale={2}
disabled={true}
/>
......
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