Commit 88e8e450 authored by Faisal Hamdi's avatar Faisal Hamdi

Merge branch 'faisal' into 'master'

update!

See merge request !1335
parents 4de9dcb5 7c972419
......@@ -70,11 +70,6 @@ export default class CatRevision extends Component {
updateBy: '',
handleTekTekTek: 0,
editable: false,
dataCustomerPrs: [],
dataInternalBsn: [],
dataFin: [],
dataLearn: [],
// handleDataSalah: false,
get_for: 'view',
viewOnly: true,
......@@ -136,10 +131,6 @@ export default class CatRevision extends Component {
console.log(payload);
api.create().getRollingOutlookCAT(payload).then(response => {
let dataTable = []
let dataCustomerPrs = []
let dataInternalBsn = []
let dataFin = []
let dataLearn = []
console.log(response)
if (response.data) {
if (response.ok) {
......@@ -150,46 +141,6 @@ export default class CatRevision extends Component {
if (indexIDzz === -1) {
let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE'
if (item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
if (item.type_report_id !== 4) {
dataInternalBsn.push({
id: item.id,
name: item.description,
check: false
})
}
}
if (item.parent_name == 'CUSTOMER PERSPECTIVE') {
if (item.type_report_id !== 4) {
dataCustomerPrs.push({
id: item.id,
name: item.description,
check: false
})
}
}
if (item.parent_name == 'FINANCIAL PERSPECTIVE') {
if (item.type_report_id !== 4) {
dataFin.push({
id: item.id,
name: item.description,
check: false
})
}
}
if (item.parent_name == 'LEARNING & GROWTH PERSPECTIVE') {
if (item.type_report_id !== 4) {
dataLearn.push({
id: item.id,
name: item.description,
check: false
})
}
}
dataTable.push([
item.type_report_id,
item.id,
......@@ -267,7 +218,7 @@ export default class CatRevision extends Component {
}
})
console.log(dataTable)
this.setState({ dataTable, loading: false, dataReal: res, editable: true, dataCustomerPrs, dataInternalBsn, dataFin, dataLearn }, () => {
this.setState({ dataTable, loading: false, dataReal: res, editable: true }, () => {
// // // console.log(dataCustomerPrs)
})
} else {
......@@ -461,7 +412,7 @@ export default class CatRevision extends Component {
"october": i[5] === 'ROIC' ? String(Number(i[20]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[20]) : String(Number(i[20].value).toFixed(1)) : String(i[20]),
"november": i[5] === 'ROIC' ? String(Number(i[21]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[21]) : String(Number(i[21].value).toFixed(1)) : String(i[21]),
"december": i[5] === 'ROIC' ? String(Number(i[22]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[22]) : String(Number(i[22].value).toFixed(1)) : String(i[22]),
"total_current_year": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(1)) : String(Number(i[23]).toFixed(1)) == "" ? "0.0" : String(Number(i[23]).toFixed(1)),
"current_year_total": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(1)) : String(Number(i[23]).toFixed(1)) == "" ? "0.0" : String(Number(i[23]).toFixed(1)),
"strategic_initiative": String(i[24]),
"pic": String(i[25])
})
......@@ -561,52 +512,7 @@ export default class CatRevision extends Component {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleCATRO: false })
let dataTable = []
// let custoId = 0
// let bisnsId = 0
// let dataDelete = this.state.dataDelete
// let dataFin = this.state.dataFin
// let dataLearn = this.state.dataLearn
// let newValidate = false
response.data.data.map((item, index) => {
// if (item.item_report == 'CUSTOMER PERSPECTIVE') {
// custoId = item.item_report_id
// }
// if (item.item_report == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
// bisnsId = item.item_report_id
// }
// if (String(item.item_report).trim().toLocaleUpperCase() == "CUSTOMER PERSPECTIVE") {
// newValidate = true
// }
// if (String(item.item_report).trim().toLocaleUpperCase() == "LEARNING & GROWTH PERSPECTIVE") {
// newValidate = false
// }
// if (item.type_report_id !== 4 && item.parent !== null && (item.parent == custoId || item.parent == bisnsId)) {
// let indexCust = this.state.dataCustomerPrs.findIndex((val) => val.name == item.item_report)
// let indexBisn = this.state.dataInternalBsn.findIndex((val) => val.name == item.item_report)
// if (indexCust !== -1 && item.item_report_id == 0) {
// dataDelete.push(this.state.dataCustomerPrs[indexCust].id)
// }
// if (indexBisn !== -1 && item.item_report_id == 0) {
// dataDelete.push(this.state.dataInternalBsn[indexBisn].id)
// }
// }
// if (newValidate == false) {
// let indexIDx = dataFin.findIndex((val) => String(val.name).toLocaleLowerCase() == String(item.item_report).toLocaleLowerCase())
// let indexIDz = dataLearn.findIndex((val) => String(val.name).toLocaleLowerCase() == String(item.item_report).toLocaleLowerCase())
// if (indexIDx != -1) {
// dataFin[indexIDx].check = true
// }
// if (indexIDz != -1) {
// dataLearn[indexIDz].check = true
// }
// }
dataTable.push([
item.type_report_id,
item.item_report_id,
......@@ -638,13 +544,6 @@ export default class CatRevision extends Component {
item.error
])
})
// let checkDataFin = dataFin.filter((val) => val.check == false)
// let checkDataLearn = dataLearn.filter((val) => val.check == false)
// let handleDataSalah = this.state.handleDataSalah
// if (checkDataFin.length > 0 || checkDataLearn.length > 0) {
// handleDataSalah = true
// }
// console.log(indexCheck)
// console.log(this.state.buttonError)
console.log(dataTable)
......@@ -714,7 +613,7 @@ export default class CatRevision extends Component {
"october": i[5] === 'ROIC' ? String(Number(i[20]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[20]) : String(Number(i[20].value).toFixed(1)) : String(i[20]),
"november": i[5] === 'ROIC' ? String(Number(i[21]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[21]) : String(Number(i[21].value).toFixed(1)) : String(i[21]),
"december": i[5] === 'ROIC' ? String(Number(i[22]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[22]) : String(Number(i[22].value).toFixed(1)) : String(i[22]),
"total_current_year": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(1)) : String(Number(i[23]).toFixed(1)) == "" ? "0.0" : String(Number(i[23]).toFixed(1)),
"total_current_year": i[5] === 'ROIC' ? String(Number(i[23]).toFixed(1)) : String(Number(i[23]).toFixed(1)) == "" ? "0.0" : String(Number(i[23]).toFixed(1)),
"strategic": String(i[24]),
"pic": String(i[25])
})
......@@ -737,9 +636,9 @@ export default class CatRevision extends Component {
if (response.ok) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.getReport()
this.props.refresh()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleTekTekTek: 0 }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......@@ -749,10 +648,10 @@ export default class CatRevision extends Component {
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false, handleTekTekTek: 0 })
}
} else {
this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false })
this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false, handleTekTekTek: 0 })
}
})
}
......@@ -1024,22 +923,6 @@ export default class CatRevision extends Component {
}
}
})
// if (dataTable2[tableMeta.rowIndex][6] == "NPAT" && forecast !== undefined) {
// // // console.log(tableMeta.rowData[3])
// // // console.log(splitFormula)
// // // console.log(baru)
// // // console.log(anjay)
// // // // console.log(item1)
// // // console.log(anjay2)
// // // console.log(total)
// }
// // // console.log(tableMeta.rowData[3])
// // // console.log(splitFormula)
// // // console.log(baru)
// // // console.log(anjay)
// // // console.log(item1)
// // // console.log(anjay2)
// // // console.log(total)
total = dataTable2[tableMeta.rowIndex][5] == "ROIC" ? "0" : R.equals(total, NaN) ? "0.0" : total
if (dataTable2[tableMeta.rowIndex][5] == "ROIC") {
......@@ -1159,56 +1042,6 @@ export default class CatRevision extends Component {
}
}
const handleTambah = (data, rowIndex) => {
// // // console.log(dataTable2)
let newData = []
dataTable2.map((item, index) => {
newData.push(item)
if (index == rowIndex) {
newData.push([
null,
"",
item[2] == null || item[2] == "" ? item[1] : item[2],
item[3],
item[4],
"",
"",
"",
"",
null,
null,
null,
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
])
}
})
dataTable2 = newData
this.setState({ dataTable: dataTable2 }, () => {
setTimeout(() => {
this.setState({ loading: false })
// // // console.log(dataTable2)
}, 500)
})
}
const handleTotal = (tableMeta, type) => {
// let val = String(value).split(",").join("")
let total = 0
......@@ -1269,28 +1102,6 @@ export default class CatRevision extends Component {
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
return (
// handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta) && (tableMeta.rowData[1] == "" || String(this.props.status).toLocaleLowerCase() == 'draft' || String(this.props.status).toLocaleLowerCase() == 'submitted' || String(this.props.status).toLocaleLowerCase() == 'revision') ?
// <div style={{ textAlign: 'left', paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
// {!this.state.loading && <FormControlLabel
// style={{ margin: 0 }}
// control={
// <Input
// disableUnderline={true}
// style={{ color: tableMeta.rowData[1] == "" ? "#5198ea" : "black", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// defaultValue={val}
// // disabled={!handleAction(tableMeta.rowData[2])}
// onBlur={(event) => {
// // // // // console.log(event.target.value)
// handleChangeText(event.target.value, tableMeta)
// // // // console.log(dataTable2)
// }}
// />
// }
// />}
// </div>
// :
<div style={{ width: 300 }}>
{tableMeta.rowData[32] ?
tableMeta.rowData[32].length > 0 ?
......@@ -1332,7 +1143,7 @@ export default class CatRevision extends Component {
name: "Weight",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1373,7 +1184,7 @@ export default class CatRevision extends Component {
name: "UOM",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8' }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1433,7 +1244,7 @@ export default class CatRevision extends Component {
name: "KPI Type",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1467,7 +1278,7 @@ export default class CatRevision extends Component {
name: "Max Ach.",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1501,7 +1312,7 @@ export default class CatRevision extends Component {
name: "Formula YTD",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1539,7 +1350,7 @@ export default class CatRevision extends Component {
name: `Jan ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1585,7 +1396,7 @@ export default class CatRevision extends Component {
name: `Feb ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1631,7 +1442,7 @@ export default class CatRevision extends Component {
name: `Mar ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1677,7 +1488,7 @@ export default class CatRevision extends Component {
name: `Apr ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1777,7 +1588,7 @@ export default class CatRevision extends Component {
name: `May ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1877,7 +1688,7 @@ export default class CatRevision extends Component {
name: `Jun ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1977,7 +1788,7 @@ export default class CatRevision extends Component {
name: `Jul ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -2077,7 +1888,7 @@ export default class CatRevision extends Component {
name: `Aug ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -2177,7 +1988,7 @@ export default class CatRevision extends Component {
name: `Sep ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -2277,7 +2088,7 @@ export default class CatRevision extends Component {
name: `Oct ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -2377,7 +2188,7 @@ export default class CatRevision extends Component {
name: `Nov ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -2477,7 +2288,7 @@ export default class CatRevision extends Component {
name: `Dec ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -2577,7 +2388,7 @@ export default class CatRevision extends Component {
name: `${this.props.periode} Total`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -2677,7 +2488,7 @@ export default class CatRevision extends Component {
name: "Strategic Initiative",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -2727,7 +2538,7 @@ export default class CatRevision extends Component {
name: "PIC",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......
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