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)}
/>
)
}
......
This diff is collapsed.
......@@ -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