Commit b684c83c authored by Riri Novita's avatar Riri Novita

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

parents 0153d656 99c11cb8
......@@ -683,7 +683,7 @@ class HomePage extends Component {
return (
<div>
<Typography style={{ color: '#656565', fontSize: '16px', marginTop: 20 }}>{item.item_business}</Typography>
<div style={{ display: 'flex', overflowX: 'scroll', width: this.props.width * 0.9 }}>
<div style={{ display: 'flex', overflowX: 'scroll', width: this.props.width * 0.95 }}>
{item.category.map((items, indexs) => {
return (
<Link to={{
......@@ -957,7 +957,7 @@ class HomePage extends Component {
return (
<div>
<Typography style={{ color: '#656565', fontSize: '16px', marginTop: 20 }}>{item.item_business}</Typography>
<div style={{ display: 'flex', overflowX: 'scroll', width: this.props.width * 0.9 }}>
<div style={{ display: 'flex', overflowX: 'scroll', width: this.props.width * 0.95 }}>
{item.category.map((items, indexs) => {
return (
<Link to={{
......
......@@ -63,6 +63,7 @@ export default class BalanceSheetRO extends Component {
componentDidMount() {
// this.getItemHierarki()
this.getLatestUpdate()
this.getSettingControl()
this.handleViewOnly()
}
......@@ -141,6 +142,39 @@ export default class BalanceSheetRO extends Component {
})
}
getLatestUpdate() {
let payload = {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"rolling_outlook_id": this.props.rollingOutlookID,
"quartal": this.props.quarter
}
api.create().getRollingOutlookLastUpdate(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update,
notes: response.data.data.notes_update === null ? "" : response.data.data.notes_update
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
getItemHierarki() {
this.setState({ loading: true, judulColumn: null })
let payload = {
......@@ -291,7 +325,7 @@ export default class BalanceSheetRO extends Component {
console.log(type)
this.setState({get_for: type}, () => {
// this.getSettingControl()
// this.getLatestUpdate()
this.getLatestUpdate()
this.getItemHierarki()
})
}
......
......@@ -64,7 +64,6 @@ export default class CatRevision extends Component {
maxAchList: [],
visibleCATRO: true,
buttonError: true,
// formulaYTDList: null,,
dataDelete: [],
dataReal: [],
buttonDraft: true,
......@@ -77,7 +76,7 @@ export default class CatRevision extends Component {
dataLearn: [],
handleDataSalah: false,
get_for: 'view',
viewOnly : true,
viewOnly: true,
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -198,23 +197,23 @@ export default class CatRevision extends Component {
item.formula,
item.level,
item.description,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(Number(String(item.corporate_annual_target.weight).substr(0,String(item.corporate_annual_target.weight).length-1)).toFixed(1)) + '%'),
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(Number(String(item.corporate_annual_target.weight).substr(0, String(item.corporate_annual_target.weight).length - 1)).toFixed(1)) + '%'),
parentTrue ? item.corporate_annual_target.uom : item.uom,
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.max_ach == "" ? null : { value: titleCase(item.corporate_annual_target.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
parentTrue ? item.corporate_annual_target.formula == "" ? null : { value: item.corporate_annual_target.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd },
item.description === 'ROIC' ? Number(item.corporate_annual_target.january).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.corporate_annual_target.january == "" ? item.corporate_annual_target.january : String(item.corporate_annual_target.january).indexOf(".") == -1 ? Number(item.corporate_annual_target.january) : Number(item.corporate_annual_target.january).toFixed(1)) : { value: item.corporate_annual_target.january, formula: item.corporate_annual_target.january_formula } : (item.corporate_annual_target.january == "" ? item.corporate_annual_target.january : String(item.corporate_annual_target.january).indexOf(".") == -1 ? Number(item.corporate_annual_target.january) : Number(item.corporate_annual_target.january).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.february).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.corporate_annual_target.february == "" ? item.corporate_annual_target.february : String(item.corporate_annual_target.february).indexOf(".") == -1 ? Number(item.corporate_annual_target.february) : Number(item.corporate_annual_target.february).toFixed(1)) : { value: item.corporate_annual_target.february, formula: item.corporate_annual_target.february_formula } : (item.corporate_annual_target.february == "" ? item.corporate_annual_target.february : String(item.corporate_annual_target.february).indexOf(".") == -1 ? Number(item.corporate_annual_target.february) : Number(item.corporate_annual_target.february).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.march).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.corporate_annual_target.march == "" ? item.corporate_annual_target.march : String(item.corporate_annual_target.march).indexOf(".") == -1 ? Number(item.corporate_annual_target.march) : Number(item.corporate_annual_target.march).toFixed(1)) : { value: item.corporate_annual_target.march, formula: item.corporate_annual_target.march_formula } : (item.corporate_annual_target.march == "" ? item.corporate_annual_target.march : String(item.corporate_annual_target.march).indexOf(".") == -1 ? Number(item.corporate_annual_target.march) : Number(item.corporate_annual_target.march).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.april).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.corporate_annual_target.april == "" ? item.corporate_annual_target.april : String(item.corporate_annual_target.april).indexOf(".") == -1 ? Number(item.corporate_annual_target.april) : Number(item.corporate_annual_target.april).toFixed(1)) : { value: item.corporate_annual_target.april, formula: item.corporate_annual_target.april_formula } : (item.corporate_annual_target.april == "" ? item.corporate_annual_target.april : String(item.corporate_annual_target.april).indexOf(".") == -1 ? Number(item.corporate_annual_target.april) : Number(item.corporate_annual_target.april).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.corporate_annual_target.may == "" ? item.corporate_annual_target.may : String(item.corporate_annual_target.may).indexOf(".") == -1 ? Number(item.corporate_annual_target.may) : Number(item.corporate_annual_target.may).toFixed(1)) : { value: item.corporate_annual_target.may, formula: item.corporate_annual_target.may_formula } : (item.corporate_annual_target.may == "" ? item.corporate_annual_target.may : String(item.corporate_annual_target.may).indexOf(".") == -1 ? Number(item.corporate_annual_target.may) : Number(item.corporate_annual_target.may).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.june).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.corporate_annual_target.june == "" ? item.corporate_annual_target.june : String(item.corporate_annual_target.june).indexOf(".") == -1 ? Number(item.corporate_annual_target.june) : Number(item.corporate_annual_target.june).toFixed(1)) : { value: item.corporate_annual_target.june, formula: item.corporate_annual_target.june_formula } : item.description === 'ROIC' ? Number(item.corporate_annual_target.june).toFixed(1) : (item.corporate_annual_target.june == "" ? item.corporate_annual_target.june : String(item.corporate_annual_target.june).indexOf(".") == -1 ? Number(item.corporate_annual_target.june) : Number(item.corporate_annual_target.june).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.july).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.corporate_annual_target.july == "" ? item.corporate_annual_target.july : String(item.corporate_annual_target.july).indexOf(".") == -1 ? Number(item.corporate_annual_target.july) : Number(item.corporate_annual_target.july).toFixed(1)) : { value: item.corporate_annual_target.july, formula: item.corporate_annual_target.july_formula } : item.description === 'ROIC' ? Number(item.corporate_annual_target.july).toFixed(1) : (item.corporate_annual_target.july == "" ? item.corporate_annual_target.july : String(item.corporate_annual_target.july).indexOf(".") == -1 ? Number(item.corporate_annual_target.july) : Number(item.corporate_annual_target.july).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.august).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.corporate_annual_target.august == "" ? item.corporate_annual_target.august : String(item.corporate_annual_target.august).indexOf(".") == -1 ? Number(item.corporate_annual_target.august) : Number(item.corporate_annual_target.august).toFixed(1)) : { value: item.corporate_annual_target.august, formula: item.corporate_annual_target.august_formula } : (item.corporate_annual_target.august == "" ? item.corporate_annual_target.august : String(item.corporate_annual_target.august).indexOf(".") == -1 ? Number(item.corporate_annual_target.august) : Number(item.corporate_annual_target.august).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.september).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.corporate_annual_target.september == "" ? item.corporate_annual_target.september : String(item.corporate_annual_target.september).indexOf(".") == -1 ? Number(item.corporate_annual_target.september) : Number(item.corporate_annual_target.september).toFixed(1)) : { value: item.corporate_annual_target.september, formula: item.corporate_annual_target.september_formula } : (item.corporate_annual_target.september == "" ? item.corporate_annual_target.september : String(item.corporate_annual_target.september).indexOf(".") == -1 ? Number(item.corporate_annual_target.september) : Number(item.corporate_annual_target.september).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.october).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.corporate_annual_target.october == "" ? item.corporate_annual_target.october : String(item.corporate_annual_target.october).indexOf(".") == -1 ? Number(item.corporate_annual_target.october) : Number(item.corporate_annual_target.october).toFixed(1)) : { value: item.corporate_annual_target.october, formula: item.corporate_annual_target.october_formula } : (item.corporate_annual_target.october == "" ? item.corporate_annual_target.october : String(item.corporate_annual_target.october).indexOf(".") == -1 ? Number(item.corporate_annual_target.october) : Number(item.corporate_annual_target.october).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.november).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.corporate_annual_target.november == "" ? item.corporate_annual_target.november : String(item.corporate_annual_target.november).indexOf(".") == -1 ? Number(item.corporate_annual_target.november) : Number(item.corporate_annual_target.november).toFixed(1)) : { value: item.corporate_annual_target.november, formula: item.corporate_annual_target.november_formula } : (item.corporate_annual_target.november == "" ? item.corporate_annual_target.november : String(item.corporate_annual_target.november).indexOf(".") == -1 ? Number(item.corporate_annual_target.november) : Number(item.corporate_annual_target.november).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.december).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.corporate_annual_target.december == "" ? item.corporate_annual_target.december : String(item.corporate_annual_target.december).indexOf(".") == -1 ? Number(item.corporate_annual_target.december) : Number(item.corporate_annual_target.december).toFixed(1)) : { value: item.corporate_annual_target.december, formula: item.corporate_annual_target.december_formula } : (item.corporate_annual_target.december == "" ? item.corporate_annual_target.december : String(item.corporate_annual_target.december).indexOf(".") == -1 ? Number(item.corporate_annual_target.december) : Number(item.corporate_annual_target.december).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.january).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.january == "" ? item.corporate_annual_target.january : String(item.corporate_annual_target.january).indexOf(".") == -1 ? Number(item.corporate_annual_target.january) : Number(item.corporate_annual_target.january).toFixed(1)) : { value: item.corporate_annual_target.january, formula: item.corporate_annual_target.january_formula } : (item.corporate_annual_target.january == "" ? item.corporate_annual_target.january : String(item.corporate_annual_target.january).indexOf(".") == -1 ? Number(item.corporate_annual_target.january) : Number(item.corporate_annual_target.january).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.february).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.february == "" ? item.corporate_annual_target.february : String(item.corporate_annual_target.february).indexOf(".") == -1 ? Number(item.corporate_annual_target.february) : Number(item.corporate_annual_target.february).toFixed(1)) : { value: item.corporate_annual_target.february, formula: item.corporate_annual_target.february_formula } : (item.corporate_annual_target.february == "" ? item.corporate_annual_target.february : String(item.corporate_annual_target.february).indexOf(".") == -1 ? Number(item.corporate_annual_target.february) : Number(item.corporate_annual_target.february).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.march).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.march == "" ? item.corporate_annual_target.march : String(item.corporate_annual_target.march).indexOf(".") == -1 ? Number(item.corporate_annual_target.march) : Number(item.corporate_annual_target.march).toFixed(1)) : { value: item.corporate_annual_target.march, formula: item.corporate_annual_target.march_formula } : (item.corporate_annual_target.march == "" ? item.corporate_annual_target.march : String(item.corporate_annual_target.march).indexOf(".") == -1 ? Number(item.corporate_annual_target.march) : Number(item.corporate_annual_target.march).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.april).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.april == "" ? item.corporate_annual_target.april : String(item.corporate_annual_target.april).indexOf(".") == -1 ? Number(item.corporate_annual_target.april) : Number(item.corporate_annual_target.april).toFixed(1)) : { value: item.corporate_annual_target.april, formula: item.corporate_annual_target.april_formula } : (item.corporate_annual_target.april == "" ? item.corporate_annual_target.april : String(item.corporate_annual_target.april).indexOf(".") == -1 ? Number(item.corporate_annual_target.april) : Number(item.corporate_annual_target.april).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.may == "" ? item.corporate_annual_target.may : String(item.corporate_annual_target.may).indexOf(".") == -1 ? Number(item.corporate_annual_target.may) : Number(item.corporate_annual_target.may).toFixed(1)) : { value: item.corporate_annual_target.may, formula: item.corporate_annual_target.may_formula } : (item.corporate_annual_target.may == "" ? item.corporate_annual_target.may : String(item.corporate_annual_target.may).indexOf(".") == -1 ? Number(item.corporate_annual_target.may) : Number(item.corporate_annual_target.may).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.june).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.june == "" ? item.corporate_annual_target.june : String(item.corporate_annual_target.june).indexOf(".") == -1 ? Number(item.corporate_annual_target.june) : Number(item.corporate_annual_target.june).toFixed(1)) : { value: item.corporate_annual_target.june, formula: item.corporate_annual_target.june_formula } : item.description === 'ROIC' ? Number(item.corporate_annual_target.june).toFixed(1) : (item.corporate_annual_target.june == "" ? item.corporate_annual_target.june : String(item.corporate_annual_target.june).indexOf(".") == -1 ? Number(item.corporate_annual_target.june) : Number(item.corporate_annual_target.june).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.july).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.july == "" ? item.corporate_annual_target.july : String(item.corporate_annual_target.july).indexOf(".") == -1 ? Number(item.corporate_annual_target.july) : Number(item.corporate_annual_target.july).toFixed(1)) : { value: item.corporate_annual_target.july, formula: item.corporate_annual_target.july_formula } : item.description === 'ROIC' ? Number(item.corporate_annual_target.july).toFixed(1) : (item.corporate_annual_target.july == "" ? item.corporate_annual_target.july : String(item.corporate_annual_target.july).indexOf(".") == -1 ? Number(item.corporate_annual_target.july) : Number(item.corporate_annual_target.july).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.august).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.august == "" ? item.corporate_annual_target.august : String(item.corporate_annual_target.august).indexOf(".") == -1 ? Number(item.corporate_annual_target.august) : Number(item.corporate_annual_target.august).toFixed(1)) : { value: item.corporate_annual_target.august, formula: item.corporate_annual_target.august_formula } : (item.corporate_annual_target.august == "" ? item.corporate_annual_target.august : String(item.corporate_annual_target.august).indexOf(".") == -1 ? Number(item.corporate_annual_target.august) : Number(item.corporate_annual_target.august).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.september).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.september == "" ? item.corporate_annual_target.september : String(item.corporate_annual_target.september).indexOf(".") == -1 ? Number(item.corporate_annual_target.september) : Number(item.corporate_annual_target.september).toFixed(1)) : { value: item.corporate_annual_target.september, formula: item.corporate_annual_target.september_formula } : (item.corporate_annual_target.september == "" ? item.corporate_annual_target.september : String(item.corporate_annual_target.september).indexOf(".") == -1 ? Number(item.corporate_annual_target.september) : Number(item.corporate_annual_target.september).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.october).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.october == "" ? item.corporate_annual_target.october : String(item.corporate_annual_target.october).indexOf(".") == -1 ? Number(item.corporate_annual_target.october) : Number(item.corporate_annual_target.october).toFixed(1)) : { value: item.corporate_annual_target.october, formula: item.corporate_annual_target.october_formula } : (item.corporate_annual_target.october == "" ? item.corporate_annual_target.october : String(item.corporate_annual_target.october).indexOf(".") == -1 ? Number(item.corporate_annual_target.october) : Number(item.corporate_annual_target.october).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.november).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.november == "" ? item.corporate_annual_target.november : String(item.corporate_annual_target.november).indexOf(".") == -1 ? Number(item.corporate_annual_target.november) : Number(item.corporate_annual_target.november).toFixed(1)) : { value: item.corporate_annual_target.november, formula: item.corporate_annual_target.november_formula } : (item.corporate_annual_target.november == "" ? item.corporate_annual_target.november : String(item.corporate_annual_target.november).indexOf(".") == -1 ? Number(item.corporate_annual_target.november) : Number(item.corporate_annual_target.november).toFixed(1)),
item.description === 'ROIC' ? Number(item.corporate_annual_target.december).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.december == "" ? item.corporate_annual_target.december : String(item.corporate_annual_target.december).indexOf(".") == -1 ? Number(item.corporate_annual_target.december) : Number(item.corporate_annual_target.december).toFixed(1)) : { value: item.corporate_annual_target.december, formula: item.corporate_annual_target.december_formula } : (item.corporate_annual_target.december == "" ? item.corporate_annual_target.december : String(item.corporate_annual_target.december).indexOf(".") == -1 ? Number(item.corporate_annual_target.december) : Number(item.corporate_annual_target.december).toFixed(1)),
item.corporate_annual_target.total_current_year == "" ? 0 : String(item.corporate_annual_target.total_current_year).indexOf(".") == -1 ? Number(item.corporate_annual_target.total_current_year) : Number(item.corporate_annual_target.total_current_year).toFixed(1),
item.corporate_annual_target.strategic,
item.corporate_annual_target.pic,
......@@ -237,7 +236,7 @@ export default class CatRevision extends Component {
item.formula,
item.level,
item.description,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(Number(String(item.corporate_annual_target.weight).substr(0,String(item.corporate_annual_target.weight).length-1)).toFixed(1)) + '%'),
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(Number(String(item.corporate_annual_target.weight).substr(0, String(item.corporate_annual_target.weight).length - 1)).toFixed(1)) + '%'),
item.corporate_annual_target.uom,
item.kpi_type == "" ? null : { value: item.kpi_type },
item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
......@@ -268,7 +267,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, dataCustomerPrs, dataInternalBsn, dataFin, dataLearn }, () => {
// // // console.log(dataCustomerPrs)
})
} else {
......@@ -293,8 +292,7 @@ export default class CatRevision extends Component {
}
handleGetFor(type) {
console.log(type)
this.setState({get_for: type}, () => {
this.setState({ get_for: type }, () => {
// this.getSettingControl()
// this.getLatestUpdate()
this.getItemHierarki()
......@@ -502,115 +500,54 @@ export default class CatRevision extends Component {
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// // // // // console.log(resp)
// console.log(resp)
if (err) {
// // // // console.log(err);
// console.log(err);
}
else {
let isi = resp.rows.slice(3)
// // console.log(isi);
// console.log(isi);
let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
let newValidate = false
isi.map((i, index) => {
if (i.length > 0) {
let total = 0
let lastValz = 0
let nilaiTotal = 0
if (i[6] !== undefined) {
if (i[6] == 'SUM' || i[6] == 'AVG' || i[6] == 'LAST') {
i.map((items, indexs) => {
if (indexs >= 8 && indexs <= 19) {
let valItem = items == undefined || items == "" ? 0 : items
total += Number(valItem)
if (index == 19) {
lastValz += Number(valItem)
}
}
})
}
nilaiTotal = i[6] == 'SUM' ? total : i[6] == 'AVG' ? total / 12 : lastValz
}
if (String(i[1]).trim().toLocaleUpperCase() == "CUSTOMER PERSPECTIVE") {
newValidate = true
}
if (String(i[1]).trim().toLocaleUpperCase() == "LEARNING & GROWTH PERSPECTIVE") {
newValidate = false
}
if (i[0] === undefined || i[0] === null) {
if (newValidate) {
payload.push({
item_report_id: i[0] === undefined ? 0 : reg.test(String(i[0])) === false ? 0 : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
weight: i[2] === undefined ? "" : String(Number(i[2] * 100).toFixed(1)) + '%',
uom: i[3] === undefined ? "" : String(i[3]).trim(),
kpi_type: i[4] === undefined ? "" : String(i[4]).trim(),
max_ach: i[5] === undefined ? "" : String(i[5]).toLocaleLowerCase() !== 'unlimited' ? (String(i[5]).includes('%')? String(i[5].trim()) : String(Number(i[5] * 100) + '%')) : String(i[5]).trim(),
formula: i[6] === undefined ? "" : String(i[6]).trim(),
january: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(Number(i[8]).toFixed(1)).trim(),
february: i[9] === undefined ? "0.0" : reg.test(String(i[9])) === false ? "0.0" : String(Number(i[9]).toFixed(1)).trim(),
march: i[10] === undefined ? "0.0" : reg.test(String(i[10])) === false ? "0.0" : String(Number(i[10]).toFixed(1)).trim(),
april: i[11] === undefined ? "0.0" : reg.test(String(i[11])) === false ? "0.0" : String(Number(i[11]).toFixed(1)).trim(),
may: i[12] === undefined ? "0.0" : reg.test(String(i[12])) === false ? "0.0" : String(Number(i[12]).toFixed(1)).trim(),
june: i[13] === undefined ? "0.0" : reg.test(String(i[13])) === false ? "0.0" : String(Number(i[13]).toFixed(1)).trim(),
july: i[14] === undefined ? "0.0" : reg.test(String(i[14])) === false ? "0.0" : String(Number(i[14]).toFixed(1)).trim(),
august: i[15] === undefined ? "0.0" : reg.test(String(i[15])) === false ? "0.0" : String(Number(i[15]).toFixed(1)).trim(),
september: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(Number(i[16]).toFixed(1)).trim(),
october: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(Number(i[17]).toFixed(1)).trim(),
november: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(Number(i[18]).toFixed(1)).trim(),
december: i[19] === undefined ? "0.0" : reg.test(String(i[19])) === false ? "0.0" : String(Number(i[19]).toFixed(1)).trim(),
total_current_year: i[20] == 0 ? "0.0" : String(Number(nilaiTotal).toFixed(1)).trim(),
strategic: i[23] === undefined ? "" : String(i[23]).trim(),
pic: i[24] === undefined ? "" : String(i[24]).trim()
item_report_id: i[1] === undefined ? 0 : reg.test(String(i[1])) === false ? 0 : String(i[1]).trim(),
item_report: i[2] === undefined ? "" : String(i[2]).trim(),
weight: i[3] === undefined ? "" : String(Number(i[3] * 100).toFixed(1)) + '%',
uom: i[4] === undefined ? "" : String(i[4]).trim(),
kpi_type: i[5] === undefined ? "" : String(i[5]).trim(),
max_ach: i[6] === undefined ? "" : String(i[6]).toLocaleLowerCase() !== 'unlimited' ? (String(i[6]).includes('%') ? String(i[6].trim()) : String(Number(i[6] * 100) + '%')) : String(i[6]).trim(),
january: i[7] === undefined ? "0.0" : reg.test(String(i[7])) === false ? "0.0" : String(Number(i[7]).toFixed(1)).trim(),
february: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(Number(i[8]).toFixed(1)).trim(),
march: i[9] === undefined ? "0.0" : reg.test(String(i[9])) === false ? "0.0" : String(Number(i[9]).toFixed(1)).trim(),
april: i[10] === undefined ? "0.0" : reg.test(String(i[10])) === false ? "0.0" : String(Number(i[10]).toFixed(1)).trim(),
may: i[11] === undefined ? "0.0" : reg.test(String(i[11])) === false ? "0.0" : String(Number(i[11]).toFixed(1)).trim(),
june: i[12] === undefined ? "0.0" : reg.test(String(i[12])) === false ? "0.0" : String(Number(i[12]).toFixed(1)).trim(),
july: i[13] === undefined ? "0.0" : reg.test(String(i[13])) === false ? "0.0" : String(Number(i[13]).toFixed(1)).trim(),
august: i[14] === undefined ? "0.0" : reg.test(String(i[14])) === false ? "0.0" : String(Number(i[14]).toFixed(1)).trim(),
september: i[15] === undefined ? "0.0" : reg.test(String(i[15])) === false ? "0.0" : String(Number(i[15]).toFixed(1)).trim(),
october: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(Number(i[16]).toFixed(1)).trim(),
november: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(Number(i[17]).toFixed(1)).trim(),
december: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(Number(i[18]).toFixed(1)).trim(),
total_current_year: i[19] == 0 ? "0.0" : String(Number(i[19]).toFixed(1)).trim(),
strategic: i[20] === undefined ? "" : String(i[20]).trim(),
pic: i[21] === undefined ? "" : String(i[21]).trim()
})
}
} else {
payload.push({
item_report_id: i[0] === undefined ? 0 : reg.test(String(i[0])) === false ? 0 : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
weight: i[2] === undefined ? "" : String(Number(i[2] * 100).toFixed(1)) + '%',
uom: i[3] === undefined ? "" : String(i[3]).trim(),
kpi_type: i[4] === undefined ? "" : String(i[4]).trim(),
max_ach: i[5] === undefined ? "" : String(i[5]).toLocaleLowerCase() !== 'unlimited' ? (String(i[5]).includes('%')? String(i[5].trim()) : String(Number(i[5] * 100) + '%')) : String(i[5]).trim(),
formula: i[6] === undefined ? "" : String(i[6]).trim(),
january: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(Number(i[8]).toFixed(1)).trim(),
february: i[9] === undefined ? "0.0" : reg.test(String(i[9])) === false ? "0.0" : String(Number(i[9]).toFixed(1)).trim(),
march: i[10] === undefined ? "0.0" : reg.test(String(i[10])) === false ? "0.0" : String(Number(i[10]).toFixed(1)).trim(),
april: i[11] === undefined ? "0.0" : reg.test(String(i[11])) === false ? "0.0" : String(Number(i[11]).toFixed(1)).trim(),
may: i[12] === undefined ? "0.0" : reg.test(String(i[12])) === false ? "0.0" : String(Number(i[12]).toFixed(1)).trim(),
june: i[13] === undefined ? "0.0" : reg.test(String(i[13])) === false ? "0.0" : String(Number(i[13]).toFixed(1)).trim(),
july: i[14] === undefined ? "0.0" : reg.test(String(i[14])) === false ? "0.0" : String(Number(i[14]).toFixed(1)).trim(),
august: i[15] === undefined ? "0.0" : reg.test(String(i[15])) === false ? "0.0" : String(Number(i[15]).toFixed(1)).trim(),
september: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(Number(i[16]).toFixed(1)).trim(),
october: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(Number(i[17]).toFixed(1)).trim(),
november: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(Number(i[18]).toFixed(1)).trim(),
december: i[19] === undefined ? "0.0" : reg.test(String(i[19])) === false ? "0.0" : String(Number(i[19]).toFixed(1)).trim(),
total_current_year: i[20] == 0 ? "0.0" : String(Number(nilaiTotal).toFixed(1)).trim(),
strategic: i[23] === undefined ? "" : String(i[23]).trim(),
pic: i[24] === undefined ? "" : String(i[24]).trim()
})
}
// // console.log(i[2])
// // // console.log(Number(i[2] * 100))
// // // // // console.log(i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%')
}
})
// // console.log(payload)
// console.log(payload)
let body = {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
status: '',
cat: payload,
rolling_outlook_id: this.props.rollingOutlookID,
quartal: this.props.quarter,
status: 'submitted'
}
// // // // console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0] })
console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
}
});
}
......@@ -618,13 +555,12 @@ export default class CatRevision extends Component {
checkUpload() {
this.setState({ loading: true, dataTable: [] })
api.create().checkImportRollingOutlookCAT(this.state.payload).then(response => {
// // console.log(JSON.stringify(this.state.payload));
// console.log(response)
// console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
// this.setState({ visibleUpload: false, visibleCAT: false })
this.setState({ visibleUpload: false, visibleCAT: false })
this.setState({ visibleUpload: false, visibleCATRO: false })
let dataTable = []
let custoId = 0
let bisnsId = 0
......@@ -678,13 +614,11 @@ export default class CatRevision extends Component {
item.parent,
item.formula,
item.level == null ? 1 : item.level,
"",
item.item_report,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(item.weight)),
item.uom,
item.kpi_type == "" || item.kpi_type == null ? null : { value: item.kpi_type },
item.max_ach == "" || item.max_ach == null ? null : { value: titleCase(item.max_ach) },
item.formula_ytd == "" || item.formula_ytd == null ? null : { value: item.formula_ytd },
item.item_report === 'ROIC' ? Number(item.january).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.january).toFixed(1) : { value: item.january, formula: item.january_formula } : item.january == "" ? item.january : String(item.january).indexOf(".") == -1 ? Number(item.january) : Number(item.january).toFixed(1),
item.item_report === 'ROIC' ? Number(item.february).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.february).toFixed(1) : { value: item.february, formula: item.february_formula } : item.february == "" ? item.february : String(item.february).indexOf(".") == -1 ? Number(item.february) : Number(item.february).toFixed(1),
item.item_report === 'ROIC' ? Number(item.march).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.march).toFixed(1) : { value: item.march, formula: item.march_formula } : item.march == "" ? item.march : String(item.march).indexOf(".") == -1 ? Number(item.march) : Number(item.march).toFixed(1),
......@@ -711,17 +645,17 @@ export default class CatRevision extends Component {
if (checkDataFin.length > 0 || checkDataLearn.length > 0) {
handleDataSalah = true
}
// // console.log(indexCheck)
// // // // console.log(this.state.buttonError)
// // console.log(dataTable)
// console.log(indexCheck)
// console.log(this.state.buttonError)
// console.log(dataTable)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, dataDelete, handleDataSalah }, () => {
this.state.dataTable.map(item => {
if (item[30].length > 0) {
// // // // console.log('masuk')
if (item[27].length > 0) {
console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
})
// // // // // console.log(this.state.dataTable);
console.log(this.state.dataTable);
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
......@@ -1339,18 +1273,6 @@ export default class CatRevision extends Component {
})
}
const handleDelete = (index) => {
if (dataTable2[index][1] !== "") {
dataDelete.push(dataTable2[index][1])
}
dataTable2.splice(index, 1)
this.setState({ dataTable: dataTable2, dataDelete }, () => {
setTimeout(() => {
this.setState({ loading: false })
}, 100)
})
}
const handleTotal = (tableMeta, type) => {
// let val = String(value).split(",").join("")
let total = 0
......@@ -1895,11 +1817,11 @@ export default class CatRevision extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.quarter == 'q1'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quarter == 'q1' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.quarter == 'q1'? false : true}
disabled={this.props.quarter == 'q1' ? false : true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1995,11 +1917,11 @@ export default class CatRevision extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.quarter == 'q1'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quarter == 'q1' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.quarter == 'q1'? false : true}
disabled={this.props.quarter == 'q1' ? false : true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -2095,11 +2017,11 @@ export default class CatRevision extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.quarter == 'q1'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quarter == 'q1' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.quarter == 'q1'? false : true}
disabled={this.props.quarter == 'q1' ? false : true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -2195,11 +2117,11 @@ export default class CatRevision extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.quarter == 'q1'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quarter == 'q1' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.quarter == 'q1'? false : true}
disabled={this.props.quarter == 'q1' ? false : true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -2295,11 +2217,11 @@ export default class CatRevision extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.quarter == 'q1'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quarter == 'q1' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.quarter == 'q1'? false : true}
disabled={this.props.quarter == 'q1' ? false : true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -2395,11 +2317,11 @@ export default class CatRevision extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.quarter == 'q1'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quarter == 'q1' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.quarter == 'q1'? false : true}
disabled={this.props.quarter == 'q1' ? false : true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -2495,11 +2417,11 @@ export default class CatRevision extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.quarter == 'q1'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quarter == 'q1' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.quarter == 'q1'? false : true}
disabled={this.props.quarter == 'q1' ? false : true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -2595,11 +2517,11 @@ export default class CatRevision extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.quarter == 'q1'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quarter == 'q1' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.quarter == 'q1'? false : true}
disabled={this.props.quarter == 'q1' ? false : true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -2695,11 +2617,11 @@ export default class CatRevision extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.quarter == 'q1'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quarter == 'q1' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.quarter == 'q1'? false : true}
disabled={this.props.quarter == 'q1' ? false : true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -2848,7 +2770,7 @@ export default class CatRevision extends Component {
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginBottom: -5 }}
type="text"
placeholder=""
disabled={this.props.quarter == 'q1'? false : true}
disabled={this.props.quarter == 'q1' ? false : true}
disable={true}
defaultValue={value}
onBlur={(event) => {
......@@ -2899,7 +2821,7 @@ export default class CatRevision extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginBottom: -5 }}
type="text"
placeholder=""
disabled={this.props.quarter == 'q1'? false : true}
disabled={this.props.quarter == 'q1' ? false : true}
disable={true}
defaultValue={value}
onBlur={(event) => {
......@@ -2965,7 +2887,7 @@ export default class CatRevision extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true || this.state.get_for == 'view'?
{this.props.isApprover === true || this.state.get_for == 'view' ?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
......@@ -3091,7 +3013,7 @@ export default class CatRevision extends Component {
// marginRight: 20
}}
onClick={() => {
this.setState({loading: true}, () => {
this.setState({ loading: true }, () => {
this.handleGetFor('edit')
})
}}
......@@ -3185,7 +3107,7 @@ export default class CatRevision extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}/>
<div style={{ width: '50%' }} />
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
......@@ -3207,7 +3129,9 @@ export default class CatRevision extends Component {
type="button"
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
this.setState({ visibleCATRO: true, visibleUpload: false }, () => {
this.handleGetFor('edit')
})
}, 100);
})}
style={{
......@@ -3329,7 +3253,7 @@ export default class CatRevision extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("CAT") && String(this.state.judul).includes("SHEET") ?
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("CAT") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
......
......@@ -101,7 +101,7 @@ export default class ProfitLossROO extends Component {
componentDidMount() {
this.getItemHierarki()
// this.getLatestUpdate()
this.getLatestUpdate()
// this.getSettingControl()
this.handleViewOnly()
}
......@@ -182,38 +182,38 @@ export default class ProfitLossROO extends Component {
// })
// }
// getLatestUpdate() {
// let payload = {
// "report_id": this.props.report_id,
// "revision": Number(this.props.revision),
// "periode": this.props.periode,
// "company_id": this.props.company.company_id,
// "monthly_report_id": this.props.monthlyReportId,
// // "months": this.props.month.month_id
// }
// api.create().getLastestUpdateMR(payload).then(response => {
// console.log(response)
// if (response.data) {
// if (response.data.status === "success") {
// this.setState({
// updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update,
// notesUpdate: response.data.data.notes_update === null ? '-' : response.data.data.notes_update
// })
// } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
// if (response.data.message.includes("Someone Logged In")) {
// setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN)
// window.location.reload();
// }, 1000);
// }
// })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
// }
// })
// }
getLatestUpdate() {
let payload = {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"rolling_outlook_id": this.props.rollingOutlookID,
"quartal": this.props.quarter
}
api.create().getRollingOutlookLastUpdate(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update,
notes: response.data.data.notes_update === null ? "" : response.data.data.notes_update
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
getItemHierarki() {
let payload = {
......
......@@ -136,13 +136,16 @@ export default class TaxPlanning extends Component {
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID
"rolling_outlook_id": this.props.rollingOutlookID,
"quartal": this.props.quarter
}
api.create().getLastestUpdateMB(payload).then(response => {
api.create().getRollingOutlookLastUpdate(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update,
notes: response.data.data.notes_update === null ? "" : response.data.data.notes_update
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
......
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