Commit 90515b1d authored by Riri Novita's avatar Riri Novita

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

parents a499e6f7 fe33d0dd
......@@ -533,9 +533,10 @@ export default class BudgetTahunan extends Component {
// // console.log(this.state.btnApprove)
this.historyApproval()
this.getLatestPeriodSubmit()
this.getCashFlow(type)
// this.getCashFlow(type)
// this.getPL(type)
if (type != undefined) {
this.getCashFlow(type)
// this.getCashFlow(type)
this.getPL(type)
} else {
this.setState({ loading: false })
......@@ -1032,68 +1033,11 @@ export default class BudgetTahunan extends Component {
listCF.push(item)
})
this.setState({dbCF: listCF}, () => {
this.payloadCFOneMore(listCF, type)
})
}
payloadCFOneMore(list, type) {
let listCF = []
this.state.dbCF.map((item, index) => {
if (item[0] == 5 || item[0] == 6 || item[0] == 7) {
item[7].value = this.handleValueFormula(index, item[7], item, 7)
item[8].value = this.handleValueFormula(index, item[8], item, 8)
item[9].value = this.handleValueFormula(index, item[9], item, 9)
item[10].value = this.handleValueFormula(index, item[10], item, 10)
item[11].value = this.handleValueFormula(index, item[11], item, 11)
item[12].value = this.handleValueFormula(index, item[12], item, 12)
item[13].value = this.handleValueFormula(index, item[13], item, 13)
item[14].value = this.handleValueFormula(index, item[14], item, 14)
item[15].value = this.handleValueFormula(index, item[15], item, 15)
item[16].value = this.handleValueFormula(index, item[16], item, 16)
item[17].value = this.handleValueFormula(index, item[17], item, 17)
item[18].value = this.handleValueFormula(index, item[18], item, 18)
item[19] = this.handleForecast(index, item, `${Number(this.state.periode.periode)}`, 19)
item[20] = this.handleForecast(index, item, `${Number(this.state.periode.periode) + 1}`, 20)
item[21] = this.handleForecast(index, item, `${Number(this.state.periode.periode) + 2}`, 21)
}
listCF.push(item)
})
this.setState({dbCF: listCF}, () => {
this.olahDataCashFlowOneMore(listCF, type)
})
}
// payloadCFOneMoreAgain(list, type) {
// let listCF = []
// this.state.dbCF.map((item, index) => {
// if (item[0] == 5 || item[0] == 6 || item[0] == 7) {
// item[7].value = this.handleValueFormula(index, item[7], item, 7)
// item[8].value = this.handleValueFormula(index, item[8], item, 8)
// item[9].value = this.handleValueFormula(index, item[9], item, 9)
// item[10].value = this.handleValueFormula(index, item[10], item, 10)
// item[11].value = this.handleValueFormula(index, item[11], item, 11)
// item[12].value = this.handleValueFormula(index, item[12], item, 12)
// item[13].value = this.handleValueFormula(index, item[13], item, 13)
// item[14].value = this.handleValueFormula(index, item[14], item, 14)
// item[15].value = this.handleValueFormula(index, item[15], item, 15)
// item[16].value = this.handleValueFormula(index, item[16], item, 16)
// item[17].value = this.handleValueFormula(index, item[17], item, 17)
// item[18].value = this.handleValueFormula(index, item[18], item, 18)
// item[19] = this.handleForecast(index, item, `${Number(this.state.periode.periode)}`, 19)
// item[20] = this.handleForecast(index, item, `${Number(this.state.periode.periode) + 1}`, 20)
// item[21] = this.handleForecast(index, item, `${Number(this.state.periode.periode) + 2}`, 21)
// }
// listCF.push(item)
// })
// this.setState({dbCF: listCF}, () => {
// this.olahDataCashFlowOneMore(listCF, type)
// })
// }
olahDataCashFlowOneMore(list, type) {
console.log(list)
let listCF = []
......@@ -1200,26 +1144,16 @@ export default class BudgetTahunan extends Component {
// if (type != undefined) {
// if (type == 'BS' || type == 'FAM' || type == 'PL') {
console.log('tarik sis')
this.createCashFlow()
// this.createCashFlow()
// }
// }
})
}
createCashFlow() {
let payload = {
"submission_id": this.state.submissionID,
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
"report_id": 6,
"status": "submitted",
"cash_flow": this.state.dbCF
}
console.log(this.state.dbCF)
console.log(JSON.stringify(payload))
createCashFlow(payload) {
api.create().createReportCF(payload).then((res) => {
this.setState({ loading: false })
console.log(res)
this.getSubmission()
// if (response.data) {
// if (response.data.status === "success") {
// this.props.saveToMonthlyReport()
......@@ -1345,7 +1279,7 @@ export default class BudgetTahunan extends Component {
}
}
})
console.log(dataTable)
// console.log(dataTable)
this.setState({ dbPL: dataTable }, () => {
this.olahDataPL(this.state.dbPL, type)
})
......@@ -1558,6 +1492,13 @@ export default class BudgetTahunan extends Component {
}
})
if(String(tableMeta[5]) == "Cost of Goods Sold (COGS)" && column == 20) {
console.log(splitFormula)
console.log(baru)
console.log(anjay)
console.log(anjay2)
console.log(total)
}
total = R.equals(total, NaN) ? "0.0" : total
return total
}
......@@ -1573,7 +1514,7 @@ export default class BudgetTahunan extends Component {
}
})
} else {
total = this.handleValueFormulaDBPL(dataTable2[index][column], tableMeta, column, periode, dataTable2[index][25])
total = this.handleValueFormulaDBPL(dataTable2[index][column], tableMeta[column], tableMeta, column, periode, dataTable2[index][25])
}
return total
......@@ -3069,6 +3010,7 @@ export default class BudgetTahunan extends Component {
lastStatus={this.state.lastStatus}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
PLBSFAMSubmitted={this.state.PLBSFAMSubmitted}
createCashFlow={this.createCashFlow.bind(this)}
/>
)
}
......
......@@ -41,7 +41,8 @@ export default class CashFlow extends Component {
dataTable: [],
loading: false,
minValue: "0",
maxValue: "0"
maxValue: "0",
handleTekTekTek: 0
}
}
......@@ -266,15 +267,15 @@ export default class CashFlow extends Component {
})
console.log(dataTable);
this.setState({ dataTable, loading: false, dataReal: res, editable: true }, () => {
this.setState({loading: true}, () => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({loading: false}, () => {
this.setState({loading: true}, () => {
this.setState({ loading: false }, () => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({loading: false}, () => {
this.setState({loading: true}, () => {
this.setState({ loading: false }, () => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({loading: false})
this.setState({ loading: false })
}, 500);
})
})
......@@ -332,6 +333,61 @@ export default class CashFlow extends Component {
this.setState({ alert: false })
}
olahDataCashFlow(dataTable2) {
console.log(dataTable2)
let listCF = []
dataTable2.map((item,index) => {
listCF.push(
{
"item_report_id": item[1],
"parent": item[2],
"formula": String(item[3]),
"item_name": item[5],
"january": String(item[7].value == undefined ? item[7] : Number(item[7].value).toFixed(1)),
"february": String(item[8].value == undefined ? item[8] : Number(item[8].value).toFixed(1)),
"march": String(item[9].value == undefined ? item[9] : Number(item[9].value).toFixed(1)),
"april": String(item[10].value == undefined ? item[10] : Number(item[10].value).toFixed(1)),
"may": String(item[11].value == undefined ? item[11] : Number(item[11].value).toFixed(1)),
"june": String(item[12].value == undefined ? item[12] : Number(item[12].value).toFixed(1)),
"july": String(item[13].value == undefined ? item[13] : Number(item[13].value).toFixed(1)),
"august": String(item[14].value == undefined ? item[14] : Number(item[14].value).toFixed(1)),
"september": String(item[15].value == undefined ? item[15] : Number(item[15].value).toFixed(1)),
"october": String(item[16].value == undefined ? item[16] : Number(item[16].value).toFixed(1)),
"november": String(item[17].value == undefined ? item[17] : Number(item[17].value).toFixed(1)),
"december": String(item[18].value == undefined ? item[18] : Number(item[18].value).toFixed(1)),
"total_current_year": String(item[19] != '' ? Number(item[19]).toFixed(1) : item[19]),
"total_next_year": String(item[20] != '' ? Number(item[20]).toFixed(1) : item[20]),
"total_more_year": String(item[21] != '' ? Number(item[21]).toFixed(1) : item[21]),
"kpi_type": "",
"max_ach": "",
"pic": "",
"strategic": "",
"total_actual_before": "",
"uom": "",
"weight": ""
}
)
})
console.log(listCF)
this.createCashFlow(listCF)
}
createCashFlow(dbcf) {
let payload = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
"periode": this.props.periode.periode,
"report_id": 6,
"status": "submitted",
"cash_flow": dbcf
}
console.log(dbcf)
console.log(JSON.stringify(payload))
this.props.createCashFlow(payload)
this.props.onClickClose()
}
render() {
let dataTable2 = this.state.dataTable
let loading = false
......@@ -374,7 +430,7 @@ export default class CashFlow extends Component {
if (tableMeta.rowData[5] == "Cash at the beginning period") {
// console.log(dataTable2[tableMeta.rowIndex+1])
// console.log(dataTable2[tableMeta.rowIndex+1][data].value)
let valuezzz = dataTable2[tableMeta.rowIndex+1][data].value
let valuezzz = dataTable2[tableMeta.rowIndex + 1][data].value
forecastt += Number(valuezzz == "" ? 0 : valuezzz)
} else {
forecastt += Number(valuezz == "" ? 0 : valuezz)
......@@ -390,7 +446,7 @@ export default class CashFlow extends Component {
if (indexID !== -1) {
let valuezz = tableMeta.rowData[data].formula[indexID].value
if (tableMeta.rowData[5] == "Cash at the beginning period") {
let valuezzz = dataTable2[tableMeta.rowIndex+1][19]
let valuezzz = dataTable2[tableMeta.rowIndex + 1][19]
forecastt += Number(valuezzz == "" ? 0 : valuezzz)
} else {
forecastt += Number(valuezz == "" ? 0 : valuezz)
......@@ -405,7 +461,7 @@ export default class CashFlow extends Component {
if (indexID !== -1) {
let valuezz = forecast[indexID].value
if (tableMeta.rowData[5] == "Cash at the beginning period") {
let valuezzz = dataTable2[tableMeta.rowIndex+1][20]
let valuezzz = dataTable2[tableMeta.rowIndex + 1][20]
forecastt += Number(valuezzz == "" ? 0 : valuezzz)
} else {
forecastt += Number(valuezz == "" ? 0 : valuezz)
......@@ -429,7 +485,7 @@ export default class CashFlow extends Component {
// console.log(dataTable2[tableMeta.rowIndex-1][data].value)
// console.log(dataTable2[tableMeta.rowIndex][data].value)
// console.log(dataTable2[tableMeta.rowIndex+1][data].value)
let valuezzz = dataTable2[tableMeta.rowIndex+1][data].value
let valuezzz = dataTable2[tableMeta.rowIndex + 1][data].value
anjay.push(valuezzz == "" ? 0 : valuezzz)
} else {
anjay.push(valuezz == "" ? 0 : valuezz)
......@@ -652,7 +708,7 @@ export default class CashFlow extends Component {
// }
// }
if(tableMeta.rowData[5] == '2.1 Additional fixed assets and CIP' && column == 7) {
if (tableMeta.rowData[5] == '2.1 Additional fixed assets and CIP' && column == 7) {
console.log(splitFormula)
console.log(baru)
console.log(anjay)
......@@ -894,7 +950,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[7].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[7], tableMeta, 7)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[7].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[7], tableMeta, 7)).toFixed(1)}
/>
</span>
:
......@@ -908,7 +964,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[7].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[7], tableMeta, 7)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[7].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[7], tableMeta, 7)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -930,7 +986,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[7].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[7], tableMeta, 7)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[7].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[7], tableMeta, 7)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -947,7 +1003,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[7].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[7], tableMeta, 7)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[7].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[7], tableMeta, 7)).toFixed(1)}
/>
</LightTooltip>
:
......@@ -1045,7 +1101,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[8].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[8], tableMeta, 8)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[8].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[8], tableMeta, 8)).toFixed(1)}
/>
</span>
:
......@@ -1060,7 +1116,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[8].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[8], tableMeta, 8)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[8].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[8], tableMeta, 8)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1082,7 +1138,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[8].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[8], tableMeta, 8)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[8].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[8], tableMeta, 8)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -1099,7 +1155,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[8].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[8], tableMeta, 8)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[8].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[8], tableMeta, 8)).toFixed(1)}
/>
</LightTooltip>
:
......@@ -1197,7 +1253,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[9].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[9], tableMeta, 9)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[9].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[9], tableMeta, 9)).toFixed(1)}
/>
</span>
:
......@@ -1212,7 +1268,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[9].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[9], tableMeta, 9)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[9].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[9], tableMeta, 9)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1234,7 +1290,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[9].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[9], tableMeta, 9)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[9].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[9], tableMeta, 9)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -1251,7 +1307,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[9].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[9], tableMeta, 9)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[9].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[9], tableMeta, 9)).toFixed(1)}
/>
</LightTooltip>
:
......@@ -1349,7 +1405,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[10].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[10], tableMeta, 10)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[10].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[10], tableMeta, 10)).toFixed(1)}
/>
</span>
:
......@@ -1364,7 +1420,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[10].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[10], tableMeta, 10)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[10].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[10], tableMeta, 10)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1396,7 +1452,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[10].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[10], tableMeta, 10)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[10].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[10], tableMeta, 10)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -1413,7 +1469,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[10].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[10], tableMeta, 10)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[10].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[10], tableMeta, 10)).toFixed(1)}
/>
</LightTooltip>
:
......@@ -1513,7 +1569,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[11].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[11], tableMeta, 11)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[11].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[11], tableMeta, 11)).toFixed(1)}
/>
</span>
:
......@@ -1528,7 +1584,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[11].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[11], tableMeta, 11)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[11].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[11], tableMeta, 11)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1560,7 +1616,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[11].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[11], tableMeta, 11)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[11].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[11], tableMeta, 11)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -1577,7 +1633,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[11].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[11], tableMeta, 11)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[11].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[11], tableMeta, 11)).toFixed(1)}
/>
</LightTooltip>
:
......@@ -1675,7 +1731,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[12].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[12], tableMeta, 12)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[12].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[12], tableMeta, 12)).toFixed(1)}
/>
</span>
:
......@@ -1690,7 +1746,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[12].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[12], tableMeta, 12)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[12].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[12], tableMeta, 12)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1722,7 +1778,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[12].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[12], tableMeta, 12)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[12].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[12], tableMeta, 12)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -1739,7 +1795,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[12].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[12], tableMeta, 12)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[12].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[12], tableMeta, 12)).toFixed(1)}
/>
</LightTooltip>
:
......@@ -1837,7 +1893,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[13].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[13], tableMeta, 13)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[13].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[13], tableMeta, 13)).toFixed(1)}
/>
</span>
:
......@@ -1852,7 +1908,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[13].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[13], tableMeta, 13)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[13].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[13], tableMeta, 13)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1884,7 +1940,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[13].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[13], tableMeta, 13)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[13].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[13], tableMeta, 13)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -1901,7 +1957,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[13].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[13], tableMeta, 13)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[13].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[13], tableMeta, 13)).toFixed(1)}
/>
</LightTooltip>
:
......@@ -1999,7 +2055,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[14].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[14], tableMeta, 14)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[14].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[14], tableMeta, 14)).toFixed(1)}
/>
</span>
:
......@@ -2014,7 +2070,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[14].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[14], tableMeta, 14)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[14].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[14], tableMeta, 14)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -2046,7 +2102,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[14].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[14], tableMeta, 14)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[14].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[14], tableMeta, 14)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -2063,7 +2119,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[14].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[14], tableMeta, 14)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[14].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[14], tableMeta, 14)).toFixed(1)}
/>
</LightTooltip>
:
......@@ -2163,7 +2219,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[15].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[15], tableMeta, 15)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[15].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[15], tableMeta, 15)).toFixed(1)}
/>
</span>
:
......@@ -2178,7 +2234,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[15].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[15], tableMeta, 15)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[15].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[15], tableMeta, 15)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -2210,7 +2266,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[15].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[15], tableMeta, 15)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[15].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[15], tableMeta, 15)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -2227,7 +2283,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[15].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[15], tableMeta, 15)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[15].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[15], tableMeta, 15)).toFixed(1)}
/>
</LightTooltip>
:
......@@ -2325,7 +2381,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[16].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[16], tableMeta, 16)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[16].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[16], tableMeta, 16)).toFixed(1)}
/>
</span>
:
......@@ -2340,7 +2396,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[16].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[16], tableMeta, 16)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[16].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[16], tableMeta, 16)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -2372,7 +2428,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[16].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[16], tableMeta, 16)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[16].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[16], tableMeta, 16)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -2389,7 +2445,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[16].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[16], tableMeta, 16)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[16].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[16], tableMeta, 16)).toFixed(1)}
/>
</LightTooltip>
:
......@@ -2487,7 +2543,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[17].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[17], tableMeta, 17)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[17].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[17], tableMeta, 17)).toFixed(1)}
/>
</span>
:
......@@ -2502,7 +2558,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[17].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[17], tableMeta, 17)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[17].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[17], tableMeta, 17)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -2534,7 +2590,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[17].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[17], tableMeta, 17)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[17].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[17], tableMeta, 17)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -2551,7 +2607,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[17].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[17], tableMeta, 17)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[17].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[17], tableMeta, 17)).toFixed(1)}
/>
</LightTooltip>
:
......@@ -2649,7 +2705,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[18].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[18], tableMeta, 18)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[18].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[18], tableMeta, 18)).toFixed(1)}
/>
</span>
:
......@@ -2664,7 +2720,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[18].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[18], tableMeta, 18)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[18].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[18], tableMeta, 18)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -2696,7 +2752,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[18].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[18], tableMeta, 18)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[18].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[18], tableMeta, 18)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -2713,7 +2769,7 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.PLBSFAMSubmitted? Number(tableMeta.rowData[18].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[18], tableMeta, 18)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[18].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[18], tableMeta, 18)).toFixed(1)}
/>
</LightTooltip>
:
......@@ -2794,7 +2850,7 @@ export default class CashFlow extends Component {
}, {
name: "",
options: {
// display: false,
display: false,
customHeadRender: (columnMeta) => (
<th style={{ ...style2, color: '#fff', backgroundColor: '#07a7d0', top: 0, zIndex: 102, fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
{/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -3139,6 +3195,33 @@ export default class CashFlow extends Component {
</div>
</button>
</div>
{this.props.isApprover === true || dataTable2.length == 0 ? null :
(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') ?
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
// this.state.buttonError ?
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
// :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.olahDataCashFlow(dataTable2)
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
: null}
</div>
</div>
</Paper>
......
......@@ -132,7 +132,7 @@ class HomePage extends Component {
arrayChild.push({ ...items, current_value: Number(items.current_value).toFixed(2), performanceColor: this.handleBackgroundPerform(Number(items.current_value)) })
}
})
if (arrayChild.length > 0) {
if (arrayChild.length > 0 && String(item.item_business).toLocaleLowerCase() != 'holding') {
data.push({ ...item, category: arrayChild })
}
})
......@@ -913,13 +913,13 @@ class HomePage extends Component {
rawData: {month: this.state.monthCAT.month_id, periode: this.state.periodeCAT.value, companyId: item.company_id}
}
}}>
<div style={{ padding: 10, backgroundColor: '#fff', borderRadius: 6, paddingBottom: 20, margin: 10, boxShadow: '0 1px 4px 0 rgba(0, 0, 0, 0.25)', width: 250, marginRight: index == items.category.length - 1 ? 25 : 0, marginLeft: index == 0 ? 5 : 25 }}>
<div style={{ padding: 10, backgroundColor: '#fff', height: 350, borderRadius: 6, paddingBottom: 20, margin: 10, boxShadow: '0 1px 4px 0 rgba(0, 0, 0, 0.25)', width: 250, marginRight: index == items.category.length - 1 ? 25 : 0, marginLeft: index == 0 ? 5 : 25 }}>
{/* <span style={{ fontSize: '17px', color: this.state.selectIndex === index ? '#fff' : '#7e8085', maxWidth: 100 }}>{item.category_name}</span> */}
<div style={{ fontSize: '17px', width: '100%' }}>
<Typography style={{ textAlign: 'left', color: '#4b4b4b' }}>{titleCase(String(item.category_name).toLocaleLowerCase())}</Typography>
<div style={{ fontSize: '17px', width: '100%', height: 25}}>
<Typography style={{ textAlign: 'left', color: '#4b4b4b' }}>{item.category_name}</Typography>
</div>
{item.total_kpi != null &&
<div style={{ width: '100%', display: 'flex', justifyContent: 'center', marginTop: String(item.category_name).toLocaleLowerCase().includes('internal') ? 0 : 25 }}>
<div style={{ width: '100%', display: 'flex', justifyContent: 'center', marginTop: 10 }}>
<span style={{ textAlign: 'center', fontSize: '18px', color: "#fff" }}>{item.total_kpi}</span>
{/* <span style={{ textAlign: 'center', fontSize: '11px', color: selectIndex === index ? "#fff" : '#4b4b4b' }}>KPIs</span> */}
</div>}
......
......@@ -39,15 +39,16 @@ export default class DashboardCAT extends Component {
componentDidMount() {
console.log(this.props)
// localStorage.removeItem(Constant.DATACAT)
this.props.selectIndex('CAT Dashboard')
let dataStorageCAT = localStorage.getItem(Constant.DATACAT)
if (this.props.location.state !== undefined) {
if (dataStorageCAT != 'datacat' && dataStorageCAT != null) {
this.setState({ selectedKPI: JSON.parse(dataStorageCAT).listKPI }, () => {
console.log(dataStorageCAT)
console.log(this.props.location.state.rawData.companyId)
// console.log(this.props.location.state.rawData.companyId)
console.log(this.state.selectedKPI)
this.setState({ userType: this.props.location.state.userType, intent: 'Home', rawData: this.props.location.state.rawData, selectedKPI: this.state.selectedKPI.length == 0 ? [] : (JSON.parse(dataStorageCAT).companyId == this.props.location.state.rawData.companyId ? JSON.parse(dataStorageCAT).listKPI : []) }, () => {
this.setState({ userType: this.props.location.state.userType, intent: 'Home', rawData: this.props.location.state.rawData}, () => {
this.getDetailUser()
})
})
......@@ -146,9 +147,19 @@ export default class DashboardCAT extends Component {
this.setState({ listCompany: defaultProps, company: arrayBaru.length < 1 ? companyData[0] : (index == -1 ? arrayBaru[0] : arrayBaru[index]) }, () => {
let dataStorageCAT = localStorage.getItem(Constant.DATACAT)
let userID = localStorage.getItem(Constant.USER)
if (dataStorageCAT != 'datacat' && dataStorageCAT != null) {
this.setState({ selectedKPI: JSON.parse(dataStorageCAT).companyId == this.state.company.company_id ? JSON.parse(dataStorageCAT).listKPI : [] })
console.log(dataStorageCAT)
let arrayStorage = JSON.parse(dataStorageCAT)
let indexListKPI = arrayStorage.findIndex((val) => val.userID == userID)
let selectedKPI = []
let indexListKPIDetail = -1
if (indexListKPI != -1) {
indexListKPIDetail = arrayStorage[indexListKPI].listKPI.findIndex((val) => val.companyId == this.state.company.company_id)
if (indexListKPIDetail != -1) {
selectedKPI = arrayStorage[indexListKPI].listKPI[indexListKPIDetail].list
}
}
this.setState({ selectedKPI })
}
this.getLastPeriod()
})
......@@ -312,12 +323,64 @@ export default class DashboardCAT extends Component {
setSelectedKPI(data) {
this.setState({ selectedKPI: data }, () => {
let dataStorageCAT = localStorage.getItem(Constant.DATACAT)
let userID = localStorage.getItem(Constant.USER)
if (dataStorageCAT != 'datacat' && dataStorageCAT != null) {
let arrayStorage = JSON.parse(dataStorageCAT)
if (arrayStorage.length > 0) {
let indexID = arrayStorage.findIndex((val) => val.userID == userID)
if (indexID == -1) {
let listKPI = []
listKPI.push({
list: this.state.selectedKPI,
companyId: this.state.company.company_id
})
let payloadData = {
userID: localStorage.getItem(Constant.USER),
listKPI: this.state.selectedKPI,
userID,
listKPI
}
arrayStorage.push(payloadData)
console.log('1')
console.log(arrayStorage)
} else {
let listKPI = arrayStorage[indexID].listKPI
let indexComp = listKPI.findIndex((val) => val.companyId == this.state.company.company_id)
if (indexComp == -1) {
listKPI.push({
list: this.state.selectedKPI,
companyId: this.state.company.company_id
})
// arrayStorage.push(payloadData)
arrayStorage[indexID].listKPI = listKPI
console.log('2')
console.log(arrayStorage)
} else {
arrayStorage[indexID].listKPI[indexComp].list = this.state.selectedKPI
console.log('3')
console.log(arrayStorage)
}
}
localStorage.setItem(Constant.DATACAT, JSON.stringify(arrayStorage))
console.log(localStorage.getItem(Constant.DATACAT))
}
} else {
let arrayStorage = []
let listKPI = []
listKPI.push({
list: this.state.selectedKPI,
companyId: this.state.company.company_id
})
let payloadData = {
userID: localStorage.getItem(Constant.USER),
listKPI
}
arrayStorage.push(payloadData)
localStorage.setItem(Constant.DATACAT, JSON.stringify(arrayStorage))
console.log('4')
console.log(arrayStorage)
}
localStorage.setItem(Constant.DATACAT, this.state.selectedKPI.length == 0 ? 'datacat' : JSON.stringify(payloadData))
})
}
......@@ -365,11 +428,19 @@ export default class DashboardCAT extends Component {
id="month"
onChange={(event, newInputValue) => this.setState({ company: newInputValue, loading: true }, () => {
let dataStorageCAT = localStorage.getItem(Constant.DATACAT)
let userID = localStorage.getItem(Constant.USER)
if (dataStorageCAT != 'datacat' && dataStorageCAT != null) {
this.setState({ selectedKPI: JSON.parse(dataStorageCAT).companyId == this.state.company.company_id ? JSON.parse(dataStorageCAT).listKPI : [] })
console.log(dataStorageCAT)
} else {
this.setState({selectedKPI: []})
let arrayStorage = JSON.parse(dataStorageCAT)
let indexListKPI = arrayStorage.findIndex((val) => val.userID == userID)
let selectedKPI = []
let indexListKPIDetail = -1
if (indexListKPI != -1) {
indexListKPIDetail = arrayStorage[indexListKPI].listKPI.findIndex((val) => val.companyId == this.state.company.company_id)
if (indexListKPIDetail != -1) {
selectedKPI = arrayStorage[indexListKPI].listKPI[indexListKPIDetail].list
}
}
this.setState({ selectedKPI })
}
this.getDasboardCAT()
})}
......
......@@ -2,6 +2,7 @@ import React, { Component } from 'react'
import { Checkbox, FormControlLabel, Menu, Paper, Typography, Button } from '@material-ui/core'
import LineChart from 'react-linechart';
import Images from '../../assets/Images'
import NumberFormat from 'react-number-format';
export default class StrategiMap extends Component {
constructor(props) {
......@@ -221,7 +222,8 @@ export default class StrategiMap extends Component {
</div>
<div style={{ width: '10%', display: 'grid', alignContent: 'center' }}>
<Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>{item.current_value}</Typography>
<Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}><NumberFormat value={item.current_value} displayType={'text'} thousandSeparator={true} /></Typography>
{/* <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>{item.current_value}</Typography> */}
</div>
<div style={{ width: '10%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', backgroundColor: item.achievement < -10 ? '#333333' : item.achievement < 0 ? '#333333' : '#333333', height: 70, width: 105, marginRight: 20 }}>
......
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