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

Merge branch 'didam' into 'master'

push dulu

See merge request !920
parents b3a608e9 0e135d8d
...@@ -97,6 +97,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -97,6 +97,7 @@ export default class CorporateAnnualTargetMR extends Component {
api.create().getParameterByGroupName({ api.create().getParameterByGroupName({
"group_name" : 'ACHIEVEMENT_KPI' "group_name" : 'ACHIEVEMENT_KPI'
}).then((response) => { }).then((response) => {
console.log(response.data.data)
if (response.data) { if (response.data) {
this.setState({parameterScore: response.data.data}) this.setState({parameterScore: response.data.data})
} }
...@@ -160,6 +161,8 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -160,6 +161,8 @@ export default class CorporateAnnualTargetMR extends Component {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE' 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([ dataTable.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -167,7 +170,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -167,7 +170,7 @@ export default class CorporateAnnualTargetMR extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, 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.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.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 }, // 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 { ...@@ -201,7 +204,7 @@ export default class CorporateAnnualTargetMR extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, 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.uom,
item.kpi_type == "" ? null : item.kpi_type, item.kpi_type == "" ? null : item.kpi_type,
// item.kpi_type == "" ? null : { value: item.kpi_type }, // item.kpi_type == "" ? null : { value: item.kpi_type },
...@@ -1044,15 +1047,25 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -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 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 parameterMix = `${parameterKpi}_${parameterAch}`
let listParameterFilter = listParameter.filter((val) => val.setting_type == String(parameterMix).toLocaleUpperCase()) 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 totalScore = 0
let achx100 = Number(tableMeta.rowData[13])/100 let achx100 = tableMeta.rowData[9] == '100%'? 1 : Number(tableMeta.rowData[13])/100
listParameterFilter.map((item,index) => { if (listParameterFilterCompany.length == 0) {
if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) { listParameterFilter.map((item,index) => {
totalScore = Number(item.value) 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) => { const handleTotal = (tableMeta) => {
...@@ -1196,7 +1209,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1196,7 +1209,7 @@ export default class CorporateAnnualTargetMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
suffix={"%"} suffix={"%"}
value={Number(value).toFixed(1)} value={value}
disabled={true} 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)} // 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} decimalScale={1}
...@@ -1404,6 +1417,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1404,6 +1417,7 @@ export default class CorporateAnnualTargetMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
suffix={"%"}
value={handleAchiement(tableMeta).toFixed(1)} value={handleAchiement(tableMeta).toFixed(1)}
decimalScale={1} decimalScale={1}
disabled={true} disabled={true}
...@@ -1442,7 +1456,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1442,7 +1456,7 @@ export default class CorporateAnnualTargetMR extends Component {
: :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={Number(value).toFixed(1)} value={Number(value).toFixed(0)}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -1450,7 +1464,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1450,7 +1464,7 @@ export default class CorporateAnnualTargetMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={handleScore(tableMeta)} value={handleScore(tableMeta)}
decimalScale={1} decimalScale={0}
disabled={true} disabled={true}
// onBlur={(event) => { // onBlur={(event) => {
// // updateValue(event.target.value) // // updateValue(event.target.value)
...@@ -1495,7 +1509,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -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' }} style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={handleTotal(tableMeta).toFixed(1)} value={handleTotal(tableMeta).toFixed(2)}
decimalScale={2} decimalScale={2}
disabled={true} 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