Commit 2f1d1470 authored by EKSAD's avatar EKSAD

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

parents d5e4ba43 8b8854ef
...@@ -7,7 +7,7 @@ import Constant from './library/Constant'; ...@@ -7,7 +7,7 @@ import Constant from './library/Constant';
if (sessionStorage.getItem('reloaded') != null) { if (sessionStorage.getItem('reloaded') != null) {
console.log('page was reloaded'); console.log('page was reloaded');
} else { } else {
localStorage.removeItem(Constant.TOKEN) // localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
} }
sessionStorage.setItem('reloaded', 'yes'); sessionStorage.setItem('reloaded', 'yes');
......
...@@ -210,6 +210,8 @@ const create = (type = "") => { ...@@ -210,6 +210,8 @@ const create = (type = "") => {
const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body) const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body)
const getDashboard = (body) => api.get('transaction/get_dashboard') const getDashboard = (body) => api.get('transaction/get_dashboard')
const historyApproval = (body) => api.post('transaction/master_budget/history_approval', body) const historyApproval = (body) => api.post('transaction/master_budget/history_approval', body)
const getDashboardUser = () => api.get('transaction/get_dashboard_sub_co')
const getDashboardMB = (body) => api.get('transaction/get_dashboard_table')
const getOpetratingIndID = (body) => api.post('transaction/operating_indicator/get_operating_indicator_id', body) const getOpetratingIndID = (body) => api.post('transaction/operating_indicator/get_operating_indicator_id', body)
const getSubmitOI = (body) => api.post('transaction/operating_indicator/get_latest_periode_submit', body) const getSubmitOI = (body) => api.post('transaction/operating_indicator/get_latest_periode_submit', body)
...@@ -393,6 +395,7 @@ const create = (type = "") => { ...@@ -393,6 +395,7 @@ const create = (type = "") => {
getIdDeleteFromExcel, getIdDeleteFromExcel,
getDashboard, getDashboard,
historyApproval, historyApproval,
getDashboardMB,
checkApprover, checkApprover,
approvalSubmission, approvalSubmission,
getCompanySubmitted, getCompanySubmitted,
...@@ -421,7 +424,8 @@ const create = (type = "") => { ...@@ -421,7 +424,8 @@ const create = (type = "") => {
checkApproverOLPA, checkApproverOLPA,
getLastPeriodeOI, getLastPeriodeOI,
getSubmitOI, getSubmitOI,
getLastPeriodOI getLastPeriodOI,
getDashboardUser
} }
} }
......
...@@ -372,7 +372,7 @@ export default class BudgetTahunan extends Component { ...@@ -372,7 +372,7 @@ export default class BudgetTahunan extends Component {
} }
api.create().getSubmission(payload).then(response => { api.create().getSubmission(payload).then(response => {
console.log(response) console.log(response)
if (response) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
submissionID: response.data.data.submission_id, submissionID: response.data.data.submission_id,
...@@ -1345,8 +1345,11 @@ export default class BudgetTahunan extends Component { ...@@ -1345,8 +1345,11 @@ export default class BudgetTahunan extends Component {
periode={this.state.periode.periode} periode={this.state.periode.periode}
submissionID={this.state.submissionID} submissionID={this.state.submissionID}
saveToMasterBudget={this.saveToMasterBudget.bind(this)} saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleCF: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleCAT: false, visibleBudgetTahunan: true })}
getReport={this.getSubmission.bind(this)} getReport={this.getSubmission.bind(this)}
isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true} prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/> />
)} )}
......
import { createMuiTheme, MuiThemeProvider, Paper, TableCell, Typography } from '@material-ui/core' import { createMuiTheme, FormControlLabel, MuiThemeProvider, Paper, TableCell, Tooltip, Typography, withStyles } from '@material-ui/core'
import MUIDataTable from 'mui-datatables'; import MUIDataTable from 'mui-datatables';
import React, { Component } from 'react' import React, { Component } from 'react'
import NumberFormat from 'react-number-format';
import ReactTooltip from 'react-tooltip'; import ReactTooltip from 'react-tooltip';
import api from '../../api';
import Images from '../../assets/Images'; import Images from '../../assets/Images';
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3()); const getMuiTheme = () => createMuiTheme(ct.customTable3());
...@@ -19,21 +21,142 @@ const style2 = { ...@@ -19,21 +21,142 @@ const style2 = {
zIndex: 100 zIndex: 100
}; };
const LightTooltip = withStyles((theme) => ({
tooltip: {
backgroundColor: theme.palette.common.white,
color: 'rgba(0, 0, 0, 0.87)',
boxShadow: theme.shadows[1],
fontSize: 11,
},
}))(Tooltip);
export default class CashFlow extends Component { export default class CashFlow extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
dataTable: ["Cashflow", {title: 'MB 2021', data : {3: '3', 4: '4', 5: '5', 6: '6', 7: '7', 8: '8', 9: '9', 10: '10', 11: '11', 12: '12'}}, null, "2022", "2023" ] dataTable: []
} }
} }
componentDidMount() { componentDidMount() {
this.setState({loading: true}) this.setState({loading: true})
this.getItemHierarki()
}
getItemHierarki() {
this.setState({ loading: true })
let payload = {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID
}
// console.log(JSON.stringify(payload))
api.create().getDetailReportMB(payload).then(response => {
let dataTable = []
console.log(response)
let res = response.data.data
const handlePushChild = (item) => {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.cash_flow.total_actual_before === null ? "0" : item.cash_flow.total_actual_before === "" ? "0" : item.cash_flow.total_actual_before,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.january, formula: item.cash_flow.january_formula } : item.cash_flow.january,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.february, formula: item.cash_flow.february_formula } : item.cash_flow.february,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.march, formula: item.cash_flow.march_formula } : item.cash_flow.march,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.april, formula: item.cash_flow.april_formula } : item.cash_flow.april,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.may, formula: item.cash_flow.may_formula } : item.cash_flow.may,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.june, formula: item.cash_flow.june_formula } : item.cash_flow.june,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.july, formula: item.cash_flow.july_formula } : item.cash_flow.july,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.august, formula: item.cash_flow.august_formula } : item.cash_flow.august,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.september, formula: item.cash_flow.september_formula } : item.cash_flow.september,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.october, formula: item.cash_flow.october_formula } : item.cash_flow.october,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.november, formula: item.cash_flow.november_formula } : item.cash_flow.november,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.december, formula: item.cash_flow.december_formula } : item.cash_flow.december,
item.cash_flow.total_current_year,
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.cash_flow.total_next_year,
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.cash_flow.total_more_year,
item.order
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
res.map((item, index) => {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.cash_flow.total_actual_before === null ? "0" : item.cash_flow.total_actual_before === "" ? "0" : item.cash_flow.total_actual_before,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.january, formula: item.cash_flow.january_formula } : item.cash_flow.january,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.february, formula: item.cash_flow.february_formula } : item.cash_flow.february,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.march, formula: item.cash_flow.march_formula } : item.cash_flow.march,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.april, formula: item.cash_flow.april_formula } : item.cash_flow.april,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.may, formula: item.cash_flow.may_formula } : item.cash_flow.may,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.june, formula: item.cash_flow.june_formula } : item.cash_flow.june,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.july, formula: item.cash_flow.july_formula } : item.cash_flow.july,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.august, formula: item.cash_flow.august_formula } : item.cash_flow.august,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.september, formula: item.cash_flow.september_formula } : item.cash_flow.september,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.october, formula: item.cash_flow.october_formula } : item.cash_flow.october,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.november, formula: item.cash_flow.november_formula } : item.cash_flow.november,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.cash_flow.december, formula: item.cash_flow.december_formula } : item.cash_flow.december,
item.cash_flow.total_current_year,
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.cash_flow.total_next_year,
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.cash_flow.total_more_year,
item.order
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
this.setState({ dataTable, loading: false, dataReal: res, editable: true }, () => console.log(dataTable))
})
} }
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
let columns = [ let columns = [{
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
},
{ {
name: "(In Rupiah million)", name: "(In Rupiah million)",
options: { options: {
...@@ -46,116 +169,238 @@ export default class CashFlow extends Component { ...@@ -46,116 +169,238 @@ export default class CashFlow extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{val} {tableMeta.rowData[24] ?
tableMeta.rowData[24].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</LightTooltip>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
}
</div> </div>
) )
} }
} }
}, },
// {
// name: `MB 2021`,
// options: {
// customHeadRender: (columnMeta) => (
// <th style={{ ...style2, color: '#fff', backgroundColor: '#07a7d0', 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 }}>
// <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
// </TableCell> */}
// <div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
// <div className="grid grid-3x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
// <div className="column-1 grid grid-4x" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0' }}>
// <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
// <span>{"1"}</span>
// </div>
// <div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
// <span>{"2"}</span>
// </div>
// <div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
// <span>{"3"}</span>
// </div>
// <div className="column-4" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
// <span>{"4"}</span>
// </div>
// </div>
// <div className="column-2 grid grid-4x" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0' }}>
// <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
// <span>{"5"}</span>
// </div>
// <div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
// <span>{"6"}</span>
// </div>
// <div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
// <span>{"7"}</span>
// </div>
// <div className="column-4" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
// <span>{"8"}</span>
// </div>
// </div>
// <div className="column-3 grid grid-4x" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0' }}>
// <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
// <span>{"9"}</span>
// </div>
// <div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
// <span>{"10"}</span>
// </div>
// <div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
// <span>{"11"}</span>
// </div>
// <div className="column-4" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#07a7d0' }}>
// <span>{"12"}</span>
// </div>
// </div>
// </div>
// </th>
// ),
// setCellProps: () => ({ style2 }),
// customBodyRender: (val, tableMeta, updateValue) => {
// return (
// <div>
// <div className="grid grid-3x content-center">
// <div className="grid grid-4x content-center">
// <div className="col-1">
// <div style={{ textAlign: 'right', width: 90 }}>
// {/* {val.a} */}
// </div>
// </div>
// <div className="col-2">
// <div style={{ textAlign: 'right', width: 90 }}>
// {/* {val.b} */}
// </div>
// </div>
// <div className="col-3">
// <div style={{ textAlign: 'right', width: 90 }}>
// {/* {val.c} */}
// </div>
// </div>
// <div className="col-4">
// <div style={{ textAlign: 'right', width: 90 }}>
// {/* {val.c} */}
// </div>
// </div>
// </div>
// <div className="grid grid-4x content-center">
// <div className="col-1">
// <div style={{ textAlign: 'right', width: 90 }}>
// {/* {val.a} */}
// </div>
// </div>
// <div className="col-2">
// <div style={{ textAlign: 'right', width: 90 }}>
// {/* {val.b} */}
// </div>
// </div>
// <div className="col-3">
// <div style={{ textAlign: 'right', width: 90 }}>
// {/* {val.c} */}
// </div>
// </div>
// <div className="col-4">
// <div style={{ textAlign: 'right', width: 90 }}>
// {/* {val.c} */}
// </div>
// </div>
// </div>
// <div className="grid grid-4x content-center">
// <div className="col-1">
// <div style={{ textAlign: 'right', width: 90 }}>
// {/* {val.a} */}
// </div>
// </div>
// <div className="col-2">
// <div style={{ textAlign: 'right', width: 90 }}>
// {/* {val.b} */}
// </div>
// </div>
// <div className="col-3">
// <div style={{ textAlign: 'right', width: 90 }}>
// {/* {val.c} */}
// </div>
// </div>
// <div className="col-4">
// <div style={{ textAlign: 'right', width: 90 }}>
// {/* {val.c} */}
// </div>
// </div>
// </div>
// </div>
// </div>
// )
// }
// }
// },
{ {
name: `MB 2021`, name: `${Number(this.props.periode) + 1}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<th style={{ ...style2, color: '#fff', backgroundColor: '#07a7d0', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} > <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 }}> {/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> */} </TableCell> */}
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div> <div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="grid grid-10x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}> <div className="grid grid-1x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}> <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#07a7d0' }}>
<span>{"Master Budget (MB)"}</span> <span>{"ForeCast"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-4" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-5" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-6" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-7" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-8" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-9" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-10" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Rolling Budget (RB)"}</span>
</div> </div>
</div> </div>
</th> </th>
), ),
setCellProps: () => ({ style2 }), setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div> <div style={{ textAlign: 'right' }}>
<div className="grid grid-3x content-center"> {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
<div className="col-1"> null
<div style={{ textAlign: 'right', width: 90 }}> :
{/* {val.a} */} <div style={{ flex: 1 }}>
</div> <FormControlLabel
</div> style={{ margin: 0 }}
<div className="col-2"> value={value}
<div style={{ textAlign: 'right', width: 90 }}> control={
{/* {val.b} */} <NumberFormat
</div> thousandSeparator={true}
</div> style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
<div className="col-3"> type="text"
<div style={{ textAlign: 'right', width: 90 }}> placeholder=""
{/* {val.c} */} value={Number(tableMeta[22]).toFixed(1)}
</div> disabled={true}
</div> decimalScale={1}
</div> onBlur={(event) => {
// updateValue(event.target.value)
// handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
/>
</div>}
</div> </div>
) )
} }
} }
}, },
{ {
name: "YTD Actual", name: `${Number(this.props.periode) + 2}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<th style={{ ...style2, color: '#fff', backgroundColor: '#07a7d0', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} > <th style={{ ...style2, color: '#fff', backgroundColor: '#07a7d0', fontSize: 13, top: 0, zIndex: 102, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
{/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> {/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> */} </TableCell> */}
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div> <div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div> <div className="grid grid-1x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
</th> <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#07a7d0' }}>
), <span>{"ForeCast"}</span>
setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right', width: 90 }}>
{val}
</div> </div>
) </div>
} </th>
}
},
{
name: "Actual Previous Month",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
), ),
setCellProps: () => ({ style2 }), setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => { customBodyRender: (val, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right', width: 90 }}> <div>
{val} {/* {val} */}
</div> </div>
) )
} }
......
...@@ -78,7 +78,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -78,7 +78,9 @@ export default class CorporateAnnualTarget extends Component {
buttonDraft: true, buttonDraft: true,
updateBy: '', updateBy: '',
handleTekTekTek: 0, handleTekTekTek: 0,
editable: false editable: false,
dataCustomerPrs: [],
dataInternalBsn: []
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -88,7 +90,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -88,7 +90,7 @@ export default class CorporateAnnualTarget extends Component {
this.getKPIType() this.getKPIType()
this.getMaxAch() this.getMaxAch()
this.getLatestUpdate() this.getLatestUpdate()
// console.log(this.props.lastStatus); // // console.log(this.props.lastStatus);
} }
...@@ -101,15 +103,38 @@ export default class CorporateAnnualTarget extends Component { ...@@ -101,15 +103,38 @@ export default class CorporateAnnualTarget extends Component {
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"submission_id": this.props.submissionID "submission_id": this.props.submissionID
} }
// console.log(JSON.stringify(payload)) // // console.log(JSON.stringify(payload))
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
let dataTable = [] let dataTable = []
// console.log(response) let dataCustomerPrs = []
let dataInternalBsn = []
// // console.log(response)
let res = response.data.data let res = response.data.data
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE' let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE'
if (item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
if (item.type_report_id !== 4) {
dataInternalBsn.push({
id: item.id,
name: item.description,
check: false
})
}
}
if (item.parent_name == 'CUSTOMER PERSPECTIVE') {
if (item.type_report_id !== 4) {
dataCustomerPrs.push({
id: item.id,
name: item.description,
check: false
})
}
}
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -192,7 +217,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -192,7 +217,9 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}) })
this.setState({ dataTable, loading: false, dataReal: res, editable: true }) this.setState({ dataTable, loading: false, dataReal: res, editable: true, dataCustomerPrs, dataInternalBsn }, () => {
// console.log(dataCustomerPrs)
})
}) })
} }
...@@ -201,7 +228,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -201,7 +228,7 @@ export default class CorporateAnnualTarget extends Component {
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}` `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
) )
res = await res.blob() res = await res.blob()
// console.log(res) // // console.log(res)
if (res.size > 0) { if (res.size > 0) {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
...@@ -212,16 +239,16 @@ export default class CorporateAnnualTarget extends Component { ...@@ -212,16 +239,16 @@ export default class CorporateAnnualTarget extends Component {
} }
async downloadAllData() { async downloadAllData() {
// console.log('masuk') // // console.log('masuk')
let bram = [this.props.submissionID, this.props.report_id, this.props.company.company_id, this.props.periode, this.props.revision] let bram = [this.props.submissionID, this.props.report_id, this.props.company.company_id, this.props.periode, this.props.revision]
// console.log(bram) // // console.log(bram)
let resReal = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` let resReal = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let resNull = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` let resNull = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let res = await fetch( let res = await fetch(
this.props.submissionID == null ? resNull : resReal this.props.submissionID == null ? resNull : resReal
) )
res = await res.blob() res = await res.blob()
// console.log(res) // // console.log(res)
this.setState({ loading: false }) this.setState({ loading: false })
if (res.size > 0) { if (res.size > 0) {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
...@@ -235,13 +262,13 @@ export default class CorporateAnnualTarget extends Component { ...@@ -235,13 +262,13 @@ export default class CorporateAnnualTarget extends Component {
fileHandler = (event) => { fileHandler = (event) => {
let fileObj = event let fileObj = event
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
// // console.log(resp) // // // console.log(resp)
if (err) { if (err) {
// console.log(err); // // console.log(err);
} }
else { else {
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
// console.log(isi); // // console.log(isi);
let payload = [] let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/; let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => { isi.map((i, index) => {
...@@ -263,8 +290,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -263,8 +290,8 @@ export default class CorporateAnnualTarget extends Component {
} }
nilaiTotal = i[6] == 'SUM' ? total : i[6] == 'AVG' ? total / 12 : lastValz nilaiTotal = i[6] == 'SUM' ? total : i[6] == 'AVG' ? total / 12 : lastValz
} }
// console.log(nilaiTotal) // // console.log(nilaiTotal)
// // 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(i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%')
payload.push({ payload.push({
item_report_id: i[0] === undefined ? 0 : reg.test(String(i[0])) === false ? 0 : String(i[0]).trim(), 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(), item_report: i[1] === undefined ? "" : String(i[1]).trim(),
...@@ -301,7 +328,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -301,7 +328,7 @@ export default class CorporateAnnualTarget extends Component {
status: '', status: '',
cat: payload cat: payload
} }
// console.log(body) // // console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0] }) this.setState({ payload: body, judul: resp.rows[1][0] })
} }
}); });
...@@ -312,7 +339,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -312,7 +339,7 @@ export default class CorporateAnnualTarget extends Component {
let dataDelete = this.state.dataDelete let dataDelete = this.state.dataDelete
api.create().getIdDeleteFromExcel(this.state.payload).then((response) => { api.create().getIdDeleteFromExcel(this.state.payload).then((response) => {
if (response.data) { if (response.data) {
// // console.log(response.data) // // // console.log(response.data)
let idDelete = response.data.data.item_report_id let idDelete = response.data.data.item_report_id
if (idDelete.length > 0) { if (idDelete.length > 0) {
idDelete.map((item, index) => { idDelete.map((item, index) => {
...@@ -322,16 +349,40 @@ export default class CorporateAnnualTarget extends Component { ...@@ -322,16 +349,40 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}) })
console.log(JSON.stringify(this.state.payload)) // console.log(JSON.stringify(this.state.payload))
api.create().checkUploadMB(this.state.payload).then(response => { api.create().checkUploadMB(this.state.payload).then(response => {
// // console.log(JSON.stringify(this.state.payload)); // // // console.log(JSON.stringify(this.state.payload));
// console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
// this.setState({ visibleUpload: false, visibleCAT: false }) // this.setState({ visibleUpload: false, visibleCAT: false })
this.setState({ visibleUpload: false, visibleCAT: false }) this.setState({ visibleUpload: false, visibleCAT: false })
let dataTable = response.data.data.map((item, index) => { let dataTable = []
return [ let custoId = 0
let bisnsId = 0
let dataDelete = this.state.dataDelete
response.data.data.map((item, index) => {
if (item.item_report == 'CUSTOMER PERSPECTIVE') {
custoId = item.item_report_id
}
if (item.item_report == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
bisnsId = item.item_report_id
}
if (item.type_report_id !== 4 && item.parent !== null && (item.parent == custoId || item.parent == bisnsId)) {
let indexCust = this.state.dataCustomerPrs.findIndex((val) => val.name == item.item_report)
let indexBisn = this.state.dataInternalBsn.findIndex((val) => val.name == item.item_report)
if (indexCust !== -1 && item.item_report_id == 0) {
dataDelete.push(this.state.dataCustomerPrs[indexCust].id)
}
if (indexBisn !== -1 && item.item_report_id == 0) {
dataDelete.push(this.state.dataInternalBsn[indexBisn].id)
}
}
dataTable.push([
item.type_report_id, item.type_report_id,
item.item_report_id, item.item_report_id,
item.parent, item.parent,
...@@ -363,18 +414,18 @@ export default class CorporateAnnualTarget extends Component { ...@@ -363,18 +414,18 @@ export default class CorporateAnnualTarget extends Component {
item.strategic, item.strategic,
item.pic, item.pic,
item.error item.error
] ])
}) })
// console.log(dataTable) // console.log(dataTable)
// console.log(this.state.buttonError) // // console.log(this.state.buttonError)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, dataDelete }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[30].length > 0) { if (item[30].length > 0) {
// console.log('masuk') // // console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true }) this.setState({ buttonError: true, errorPreview: true, editable: true })
} }
}) })
// // console.log(this.state.dataTable); // // // console.log(this.state.dataTable);
}) })
} }
} }
...@@ -382,8 +433,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -382,8 +433,9 @@ export default class CorporateAnnualTarget extends Component {
} }
uploadCAT(type) { uploadCAT(type) {
// let dataDelete = this.state.dataDelete
// // console.log(dataDelete)
let payload = { "item_report_id": this.state.dataDelete } let payload = { "item_report_id": this.state.dataDelete }
if (this.state.dataDelete.length > 0) { if (this.state.dataDelete.length > 0) {
api.create().deleteAllItemReport(payload).then((response) => { api.create().deleteAllItemReport(payload).then((response) => {
this.functionUpload(type) this.functionUpload(type)
...@@ -396,7 +448,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -396,7 +448,7 @@ export default class CorporateAnnualTarget extends Component {
functionUpload(type) { functionUpload(type) {
let data = [] let data = []
// console.log(this.state.dataTable) // // console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1], "item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
...@@ -435,10 +487,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -435,10 +487,10 @@ export default class CorporateAnnualTarget extends Component {
"status": type, "status": type,
"cat": data "cat": data
} }
// console.log(data); // // console.log(data);
// console.log(JSON.stringify(body)) // console.log(JSON.stringify(body))
api.create('UPLOAD').uploadMasterBudget(body).then(response => { api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// console.log(response); // // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.props.onClickClose() this.props.onClickClose()
...@@ -454,7 +506,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -454,7 +506,7 @@ export default class CorporateAnnualTarget extends Component {
handleValidate() { handleValidate() {
let data = [] let data = []
// console.log(this.state.dataTable) // // console.log(this.state.dataTable)
let totalWeight = 0 let totalWeight = 0
let dataTableBaru = this.state.dataTable let dataTableBaru = this.state.dataTable
let dataTampung = [] let dataTampung = []
...@@ -475,14 +527,14 @@ export default class CorporateAnnualTarget extends Component { ...@@ -475,14 +527,14 @@ export default class CorporateAnnualTarget extends Component {
if (i[2] !== null) { if (i[2] !== null) {
let indexID = this.state.dataTable.findIndex((val) => val[1] == i[2]) let indexID = this.state.dataTable.findIndex((val) => val[1] == i[2])
// console.log(indexID) // // console.log(indexID)
// console.log(i[2]) // // console.log(i[2])
if (indexID !== -1) { if (indexID !== -1) {
// console.log(dataTableBaru[indexID][6]) // // console.log(dataTableBaru[indexID][6])
if (dataTableBaru[indexID][6] == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || dataTableBaru[indexID][6] == 'CUSTOMER PERSPECTIVE') { if (dataTableBaru[indexID][6] == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || dataTableBaru[indexID][6] == 'CUSTOMER PERSPECTIVE') {
if (i[6] == "" || i[7] == "" || i[9] == null || i[10] == null || i[11] == null) { if (i[6] == "" || i[7] == "" || i[9] == null || i[10] == null || i[11] == null) {
handleKosongKPIMAXYTD = true handleKosongKPIMAXYTD = true
// console.log(handleKosongKPIMAXYTD) // // console.log(handleKosongKPIMAXYTD)
} }
} }
} }
...@@ -491,7 +543,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -491,7 +543,7 @@ export default class CorporateAnnualTarget extends Component {
// if (i[0] == null && i[2] == null) { // if (i[0] == null && i[2] == null) {
// if (i[6] == "" || i[7] == "" || i[9] == null || i[10] == null || i[11] == null) { // if (i[6] == "" || i[7] == "" || i[9] == null || i[10] == null || i[11] == null) {
// handleKosongKPIMAXYTD = true // handleKosongKPIMAXYTD = true
// // console.log(handleKosongKPIMAXYTD) // // // console.log(handleKosongKPIMAXYTD)
// } // }
// } // }
...@@ -511,9 +563,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -511,9 +563,9 @@ export default class CorporateAnnualTarget extends Component {
weightReal = i[7] weightReal = i[7]
dataTampung[indexID].valChild = dataTampung[indexID].valChild + Number(i[7] == "" || i[7] == undefined ? 0 : i[7].replace('%', '')) dataTampung[indexID].valChild = dataTampung[indexID].valChild + Number(i[7] == "" || i[7] == undefined ? 0 : i[7].replace('%', ''))
} }
// console.log(weightReal) // // console.log(weightReal)
// console.log(dataTableBaru[index][7]) // // console.log(dataTableBaru[index][7])
// console.log(dataTampung[indexID].valChild) // // console.log(dataTampung[indexID].valChild)
} }
} }
...@@ -547,8 +599,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -547,8 +599,8 @@ export default class CorporateAnnualTarget extends Component {
}) })
}) })
// console.log(dataTableBaru) // // console.log(dataTableBaru)
// console.log(JSON.stringify(data)) // // console.log(JSON.stringify(data))
let payload = { let payload = {
"submission_id": this.props.submissionID, "submission_id": this.props.submissionID,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
...@@ -557,7 +609,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -557,7 +609,7 @@ export default class CorporateAnnualTarget extends Component {
"status": "submitted", "status": "submitted",
"cat": data "cat": data
} }
// console.log(totalWeight) // // console.log(totalWeight)
// this.setState({dataTable: dataTampung}) // this.setState({dataTable: dataTampung})
if (handleKosongKPIMAXYTD) { if (handleKosongKPIMAXYTD) {
this.setState({ alert: true, messageAlert: 'KPI / Weight / KPI Type / Max Ach / Formula YTD / Cannot be Empty', tipeAlert: 'warning', loading: false, editable: true}) this.setState({ alert: true, messageAlert: 'KPI / Weight / KPI Type / Max Ach / Formula YTD / Cannot be Empty', tipeAlert: 'warning', loading: false, editable: true})
...@@ -565,7 +617,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -565,7 +617,7 @@ export default class CorporateAnnualTarget extends Component {
this.setState({ alert: true, messageAlert: 'Total weight less than 100%', tipeAlert: 'warning', loading: false, editable: true}) this.setState({ alert: true, messageAlert: 'Total weight less than 100%', tipeAlert: 'warning', loading: false, editable: true})
} else { } else {
api.create().validateSubmitReport(payload).then((response) => { api.create().validateSubmitReport(payload).then((response) => {
// console.log(response) // // console.log(response)
if (response.data.data.result) { if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false, buttonDraft: false }) this.setState({ loading: false, buttonError: false, editable: false, buttonDraft: false })
} else { } else {
...@@ -581,9 +633,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -581,9 +633,9 @@ export default class CorporateAnnualTarget extends Component {
backToMasterBudget(type) { backToMasterBudget(type) {
let data = [] let data = []
// console.log(this.state.dataTable) // // console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
// // console.log(i[9] == null? "" : i[9].value) // // // console.log(i[9] == null? "" : i[9].value)
data.push({ data.push({
"item_report_id": i[1] == "" || i[1] == null? 0 : i[1], "item_report_id": i[1] == "" || i[1] == null? 0 : i[1],
"item_name": String(i[6]), "item_name": String(i[6]),
...@@ -613,7 +665,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -613,7 +665,7 @@ export default class CorporateAnnualTarget extends Component {
"pic": String(i[29]) "pic": String(i[29])
}) })
}) })
// console.log(JSON.stringify(data)) // // console.log(JSON.stringify(data))
let payload = { let payload = {
"submission_id": this.props.submissionID, "submission_id": this.props.submissionID,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
...@@ -622,7 +674,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -622,7 +674,7 @@ export default class CorporateAnnualTarget extends Component {
"status": type, "status": type,
"cat": data "cat": data
} }
// console.log(JSON.stringify(payload)); // // console.log(JSON.stringify(payload));
this.deleteReport(payload) this.deleteReport(payload)
} }
...@@ -631,10 +683,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -631,10 +683,10 @@ export default class CorporateAnnualTarget extends Component {
if (this.state.dataDelete.length > 0) { if (this.state.dataDelete.length > 0) {
api.create().deleteAllItemReport(payload).then((response) => { api.create().deleteAllItemReport(payload).then((response) => {
// console.log(response) // // console.log(response)
// api.create().validateSubmitReport(payloadBro).then((response) => { // api.create().validateSubmitReport(payloadBro).then((response) => {
// // console.log(response) // // // console.log(response)
// if (response.data.data.result) { // if (response.data.data.result) {
this.props.saveToMasterBudget(payloadBro) this.props.saveToMasterBudget(payloadBro)
this.props.onClickClose() this.props.onClickClose()
...@@ -644,9 +696,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -644,9 +696,9 @@ export default class CorporateAnnualTarget extends Component {
// }) // })
}) })
} else { } else {
// // console.log('sini jing') // // // console.log('sini jing')
// api.create().validateSubmitReport(payloadBro).then((response) => { // api.create().validateSubmitReport(payloadBro).then((response) => {
// // console.log(response) // // // console.log(response)
// if (response.data.data.result) { // if (response.data.data.result) {
this.props.saveToMasterBudget(payloadBro) this.props.saveToMasterBudget(payloadBro)
this.props.onClickClose() this.props.onClickClose()
...@@ -665,12 +717,12 @@ export default class CorporateAnnualTarget extends Component { ...@@ -665,12 +717,12 @@ export default class CorporateAnnualTarget extends Component {
type: 'KPI_TYPE' type: 'KPI_TYPE'
} }
api.create().getAllSettingByType(body).then(response => { api.create().getAllSettingByType(body).then(response => {
// // console.log(response) // // // console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
// console.log(data) // // console.log(data)
let inputKPI = [] let inputKPI = []
data.map((item) => { data.map((item) => {
...@@ -682,7 +734,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -682,7 +734,7 @@ export default class CorporateAnnualTarget extends Component {
options: inputKPI, options: inputKPI,
getOptionLabel: (option) => titleCase(option.value), getOptionLabel: (option) => titleCase(option.value),
}; };
// console.log(defaultProps) // // console.log(defaultProps)
this.setState({ kpiTypeList: defaultProps }) this.setState({ kpiTypeList: defaultProps })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -786,7 +838,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -786,7 +838,7 @@ export default class CorporateAnnualTarget extends Component {
// }) // })
// let valz = dataTable2[tableMeta.rowIndex][11] == null ? 'SUM' : dataTable2[tableMeta.rowIndex][11].value // let valz = dataTable2[tableMeta.rowIndex][11] == null ? 'SUM' : dataTable2[tableMeta.rowIndex][11].value
// dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz)) // dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz))
// // console.log(dataTable2[tableMeta.rowIndex]) // // // console.log(dataTable2[tableMeta.rowIndex])
} }
const handleChangeDropdown = (value, tableMeta) => { const handleChangeDropdown = (value, tableMeta) => {
...@@ -815,9 +867,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -815,9 +867,9 @@ export default class CorporateAnnualTarget extends Component {
} else { } else {
index = data.findIndex((val) => val.value == value.value) index = data.findIndex((val) => val.value == value.value)
} }
// console.log(value) // // console.log(value)
// console.log(data) // // console.log(data)
// console.log(index) // // console.log(index)
if (index == -1) { if (index == -1) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = null dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = null
return null return null
...@@ -838,7 +890,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -838,7 +890,7 @@ export default class CorporateAnnualTarget extends Component {
// dataTable2.map((item, index) => { // dataTable2.map((item, index) => {
// if (item[2] == dataTable2[indexParentDatatable][1] && item[1] !== tableMeta.rowData[1]) { // if (item[2] == dataTable2[indexParentDatatable][1] && item[1] !== tableMeta.rowData[1]) {
// let weightItem = item[7] == "" ? 0 : item[7].replace('%', '') // let weightItem = item[7] == "" ? 0 : item[7].replace('%', '')
// // console.log(weightItem) // // // console.log(weightItem)
// valChild += Number(weightItem) // valChild += Number(weightItem)
// } // }
// }) // })
...@@ -846,24 +898,28 @@ export default class CorporateAnnualTarget extends Component { ...@@ -846,24 +898,28 @@ export default class CorporateAnnualTarget extends Component {
// let endVal = '' // let endVal = ''
// if ((Number(valueReal) + Number(valChild)) > Number(valParent.replace('%', ''))) { // if ((Number(valueReal) + Number(valChild)) > Number(valParent.replace('%', ''))) {
// endVal = `${Number(valParent.replace('%', '')) - (Number(valChild))}%` // endVal = `${Number(valParent.replace('%', '')) - (Number(valChild))}%`
// // console.log(endVal) // // // console.log(endVal)
// } else { // } else {
// endVal = `${Number(valueReal)}%` // endVal = `${Number(valueReal)}%`
// // console.log(endVal)
// }
// // // console.log(endVal) // // // console.log(endVal)
// }
// // // // console.log(endVal)
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = endVal // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = endVal
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
} }
const handleChangeText = (value, tableMeta) => { const handleChangeText = (value, tableMeta) => {
// console.log(value) // // console.log(value)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
// this.setState({dataTable: dataTable2}) // this.setState({dataTable: dataTable2})
} }
const handleAction = (idParent, typeReport, tableMeta) => { const handleAction = (idParent, typeReport, tableMeta) => {
if (this.props.isApprover) {
return false
} else {
if ((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')) {
if (idParent !== null) { if (idParent !== null) {
let indexsss = dataTable2.findIndex((val) => val[1] == idParent) let indexsss = dataTable2.findIndex((val) => val[1] == idParent)
if (dataTable2[indexsss][6] == 'CUSTOMER PERSPECTIVE' || dataTable2[indexsss][6] == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') { if (dataTable2[indexsss][6] == 'CUSTOMER PERSPECTIVE' || dataTable2[indexsss][6] == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
...@@ -885,6 +941,11 @@ export default class CorporateAnnualTarget extends Component { ...@@ -885,6 +941,11 @@ export default class CorporateAnnualTarget extends Component {
return false return false
} }
} }
} else {
return false
}
}
} }
const handleTambah = (data, rowIndex) => { const handleTambah = (data, rowIndex) => {
...@@ -932,6 +993,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -932,6 +993,7 @@ export default class CorporateAnnualTarget extends Component {
this.setState({ dataTable: dataTable2 }, () => { this.setState({ dataTable: dataTable2 }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false }) this.setState({ loading: false })
// console.log(dataTable2)
}, 500) }, 500)
}) })
} }
...@@ -995,7 +1057,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -995,7 +1057,7 @@ export default class CorporateAnnualTarget extends Component {
name: "", name: "",
options: { options: {
filter: false, filter: false,
display: this.props.isApprover ? false : true, display: this.props.isApprover ? false : ((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') ? true : false),
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#dbdbdb' }}> <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#dbdbdb' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
...@@ -1014,7 +1076,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1014,7 +1076,7 @@ export default class CorporateAnnualTarget extends Component {
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
}} }}
// onClick={() => // console.log(tableMeta.rowData[1])} // onClick={() => // // console.log(tableMeta.rowData[1])}
onClick={() => { onClick={() => {
this.setState({ loading: true }) this.setState({ loading: true })
handleTambah(tableMeta.rowData[1], tableMeta.rowIndex) handleTambah(tableMeta.rowData[1], tableMeta.rowIndex)
...@@ -1059,7 +1121,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1059,7 +1121,7 @@ export default class CorporateAnnualTarget extends Component {
return ( return (
tableMeta.rowData[1] == "" ? tableMeta.rowData[1] == "" ?
<div style={{ textAlign: 'left', paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <div style={{ textAlign: 'left', paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<FormControlLabel {!this.state.loading && <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
control={ control={
<Input <Input
...@@ -1070,13 +1132,13 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1070,13 +1132,13 @@ export default class CorporateAnnualTarget extends Component {
defaultValue={val} defaultValue={val}
// disabled={!handleAction(tableMeta.rowData[2])} // disabled={!handleAction(tableMeta.rowData[2])}
onBlur={(event) => { onBlur={(event) => {
// console.log(event.target.value) // // console.log(event.target.value)
handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
/> />}
</div> </div>
: :
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
...@@ -1187,10 +1249,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1187,10 +1249,10 @@ export default class CorporateAnnualTarget extends Component {
color={"#5198ea"} color={"#5198ea"}
disabled={true} disabled={true}
onBlur={(event) => { onBlur={(event) => {
// console.log(event.target.value) // // console.log(event.target.value)
// updateValue(event.target.value) // updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> : /> :
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -1203,10 +1265,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1203,10 +1265,10 @@ export default class CorporateAnnualTarget extends Component {
color={"#5198ea"} color={"#5198ea"}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false ? false : !handleAction(tableMeta.rowData[2]))} // disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false ? false : !handleAction(tableMeta.rowData[2]))}
onBlur={(event) => { onBlur={(event) => {
// console.log(event.target.value) // // console.log(event.target.value)
// updateValue(event.target.value) // updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
</ThemeProvider> </ThemeProvider>
...@@ -1353,7 +1415,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1353,7 +1415,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1373,9 +1435,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1373,9 +1435,10 @@ export default class CorporateAnnualTarget extends Component {
</TableCell> </TableCell>
), ),
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
// // console.log(tableMeta.rowData[0])
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2|| tableMeta.rowData[0] === 4 ?
null null
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
...@@ -1394,7 +1457,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1394,7 +1457,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
...@@ -1435,7 +1498,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1435,7 +1498,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1476,7 +1539,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1476,7 +1539,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1517,7 +1580,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1517,7 +1580,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1558,7 +1621,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1558,7 +1621,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1599,7 +1662,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1599,7 +1662,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1640,7 +1703,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1640,7 +1703,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1681,7 +1744,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1681,7 +1744,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1722,7 +1785,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1722,7 +1785,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1763,7 +1826,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1763,7 +1826,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1804,7 +1867,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1804,7 +1867,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1845,7 +1908,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1845,7 +1908,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1884,7 +1947,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1884,7 +1947,7 @@ export default class CorporateAnnualTarget extends Component {
// onBlur={(event) => { // onBlur={(event) => {
// // updateValue(event.target.value) // // updateValue(event.target.value)
// handleChange(event.target.value, tableMeta) // handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // // console.log(dataTable2)
// }} // }}
/> />
} }
...@@ -1924,7 +1987,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1924,7 +1987,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1965,7 +2028,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1965,7 +2028,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
...@@ -2001,9 +2064,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2001,9 +2064,9 @@ export default class CorporateAnnualTarget extends Component {
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)} disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
defaultValue={value} defaultValue={value}
onBlur={(event) => { onBlur={(event) => {
// console.log(event.target.value) // // console.log(event.target.value)
handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
</ThemeProvider> </ThemeProvider>
...@@ -2041,10 +2104,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2041,10 +2104,10 @@ export default class CorporateAnnualTarget extends Component {
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)} disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
defaultValue={value} defaultValue={value}
onBlur={(event) => { onBlur={(event) => {
// console.log(event.target.value) // // console.log(event.target.value)
// updateValue(event.target.value) // updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
</ThemeProvider> </ThemeProvider>
......
...@@ -394,10 +394,12 @@ export default class FixedAssetsMovement extends Component { ...@@ -394,10 +394,12 @@ export default class FixedAssetsMovement extends Component {
} }
async downloadAllData() { async downloadAllData() {
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` // let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
console.log(url); // console.log(url);
let resReal = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let resNull = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let res = await fetch( let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` this.props.submissionID == null ? resNull : resReal
) )
res = await res.blob() res = await res.blob()
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -512,10 +514,15 @@ export default class FixedAssetsMovement extends Component { ...@@ -512,10 +514,15 @@ export default class FixedAssetsMovement extends Component {
} else { } else {
// console.log(item) // console.log(item)
let indexID = dataTable2.findIndex((val) => val[22] == item) let indexID = dataTable2.findIndex((val) => val[22] == item)
// console.log(dataTable2[indexID][tableMeta.columnIndex]) // console.log(dataTable2[indexID])
if (indexID !== -1) { if (indexID !== -1) {
let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined ? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined ? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value
anjay.push(valuezz == "" ? 0 : valuezz) anjay.push(valuezz == "" ? 0 : valuezz)
} else {
if (item === '(-1)') {
anjay.push(-1)
}
// console.log(item);
} }
} }
} }
......
...@@ -6209,17 +6209,14 @@ export default class TaxPlanning extends Component { ...@@ -6209,17 +6209,14 @@ export default class TaxPlanning extends Component {
name: `${this.props.periode}`, name: `${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<div style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} > <th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
{/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> */}
<div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div> <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
<div style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}> <div className="" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
<div style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}> <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<span>{"Trial Balance (Fiscal)"}</span> <span>{"Trial Balance (Fiscal)"}</span>
</div> </div>
</div> </div>
</div> </th>
), ),
setCellProps: () => ({ style2 }), setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
......
...@@ -6,6 +6,7 @@ import DonutChart from 'react-d3-donut'; ...@@ -6,6 +6,7 @@ import DonutChart from 'react-d3-donut';
import Constant from '../library/Constant'; import Constant from '../library/Constant';
import api from '../api'; import api from '../api';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { PropagateLoader } from 'react-spinners';
var ct = require("../library/CustomTable"); var ct = require("../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
...@@ -22,11 +23,17 @@ class HomePage extends Component { ...@@ -22,11 +23,17 @@ class HomePage extends Component {
{ nama: 'Dharma Group', status: 'overdue' }, { nama: 'Dharma Group', status: 'overdue' },
{ nama: 'Daya Group', status: 'open' }, { nama: 'Daya Group', status: 'open' },
], ],
isApprover: true isApprover: true,
listSubcoMB: [],
valueSubmit: 0,
listdmb: [],
dataTableMB: [],
loading: false
} }
} }
componentDidMount() { componentDidMount() {
this.setState({ loading: true })
let userId = localStorage.getItem(Constant.USER) let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => { api.create().getDetailUser(userId).then((response) => {
if (response.data) { if (response.data) {
...@@ -47,6 +54,9 @@ class HomePage extends Component { ...@@ -47,6 +54,9 @@ class HomePage extends Component {
// } // }
// }) // })
this.getApprMat() this.getApprMat()
this.getListUserSubco()
this.getDashboardMB()
this.getDashboard()
} }
componentDidUpdate() { componentDidUpdate() {
...@@ -56,6 +66,27 @@ class HomePage extends Component { ...@@ -56,6 +66,27 @@ class HomePage extends Component {
} }
} }
getListUserSubco() {
api.create().getDashboardUser().then(response => {
console.log(response);
let valueSubmit = 0
if (response.data) {
if (response.data.status === "success") {
response.data.data.map((item, index) => {
if (item.is_submit === true) {
valueSubmit += 1
}
})
this.setState({
listSubcoMB: response.data.data,
valueSubmit,
loading: false
})
}
}
})
}
getDashboard() { getDashboard() {
let listDashboard = [] let listDashboard = []
api.create().getDashboard().then((response) => { api.create().getDashboard().then((response) => {
...@@ -71,25 +102,46 @@ class HomePage extends Component { ...@@ -71,25 +102,46 @@ class HomePage extends Component {
} }
getApprMat() { getApprMat() {
this.setState({loading: true})
api.create().getAM().then((response) => { api.create().getAM().then((response) => {
console.log(response); console.log(response);
let actAM = response.data.data.map((item, index) => { let actAM = response.data.data.map((item, index) => {
if(String(item.status).toLocaleLowerCase() == 'active'){ if (String(item.status).toLocaleLowerCase() == 'active') {
return item return item
} }
}) })
let userId = localStorage.getItem(Constant.USER) let userId = localStorage.getItem(Constant.USER)
let indexId = actAM.findIndex((val) => val.user_id == userId) let indexId = actAM.findIndex((val) => val.user_id == userId)
if (indexId === -1){ if (indexId === -1) {
this.setState({ isApprover: false }) this.setState({ isApprover: false })
this.getListUserSubco()
} }
this.getDashboardMB()
console.log(actAM) console.log(actAM)
this.setState({loading: false})
})
}
getDashboardMB() {
api.create().getDashboardMB().then((response) => {
console.log(response)
if (String(response.data.status).toLocaleLowerCase() == 'success') {
let data = response.data.data
let listdmb = data.sort((a, b) => a.company_id - b.company_id).map((item, index) => {
return [
item.company_name,
item.master_budget,
item.operating_indicator
]
})
this.setState({ dataTableMB: listdmb, loading: false })
}
}) })
} }
render() { render() {
const columns = ["#", "ID", "Nama Perusahaan", "Jenis Report", "Revisi", "Status", { const columns = ["#", "ID", "Company", "Report Type", "Revision", "Status", {
name: "Action", name: "Action",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
...@@ -138,6 +190,9 @@ class HomePage extends Component { ...@@ -138,6 +190,9 @@ class HomePage extends Component {
rowsPerPage: 5, rowsPerPage: 5,
search: false search: false
} }
const columnsMB = ["Company", "Master Budget & CAT", "Operating Indicator"]
const dataChart = [{ const dataChart = [{
count: 90, count: 90,
color: '#5198ea', color: '#5198ea',
...@@ -165,8 +220,19 @@ class HomePage extends Component { ...@@ -165,8 +220,19 @@ class HomePage extends Component {
color: '#f65a4c', color: '#f65a4c',
name: 'name', name: 'name',
}] }]
const loadingComponent = (
<div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
// css={override}
size={20}
color={"#274B80"}
loading={this.state.loading}
/>
</div>
);
return ( return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }}> <div style={{ flex: 1, backgroundColor: '#f8f8f8' }}>
{this.state.loading && loadingComponent}
{this.state.isApprover === true ? {this.state.isApprover === true ?
<div> <div>
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
...@@ -189,6 +255,18 @@ class HomePage extends Component { ...@@ -189,6 +255,18 @@ class HomePage extends Component {
</MuiThemeProvider> </MuiThemeProvider>
</div> </div>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>Master Budget & CAT</Typography>
<div style={{ marginTop: 10, width: '100%' }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={this.state.dataTableMB}
columns={columnsMB}
options={options}
/>
</MuiThemeProvider>
</div>
</div>
{/* <div style={{ marginTop: 20 }}>
<Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>Status Laporan</Typography> <Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>Status Laporan</Typography>
<div style={{ marginTop: 10, display: 'flex' }}> <div style={{ marginTop: 10, display: 'flex' }}>
<div style={{ width: 280, height: 400, padding: 20, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4', marginRight: 25 }}> <div style={{ width: 280, height: 400, padding: 20, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4', marginRight: 25 }}>
...@@ -315,7 +393,7 @@ class HomePage extends Component { ...@@ -315,7 +393,7 @@ class HomePage extends Component {
</div> </div>
</div> </div>
</div> </div>
</div> </div> */}
</div> </div>
</div> </div>
: :
...@@ -329,16 +407,33 @@ class HomePage extends Component { ...@@ -329,16 +407,33 @@ class HomePage extends Component {
</div> </div>
</div> </div>
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ width: 400, padding: 20, borderRadius: 10 }}> <Paper style={{ width: 450, padding: 20, borderRadius: 10 }}>
<Typography style={{ fontWeight: 'bold', textDecorationLine: 'underline' }}>Master Budget - Oct 2020 (1/4)</Typography> <Typography style={{ fontWeight: 'bold', textDecorationLine: 'underline' }}>{`Master Budget ${this.state.valueSubmit}/${this.state.listSubcoMB.length}`}</Typography>
{this.state.listMasterBudget.map((item, index) => { {this.state.listSubcoMB.map((item, index) => {
return ( return (
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 10, paddingLeft: 10 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 10, paddingLeft: 10 }}>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<img src={item.status === "overdue" ? Images.dotOverdue : item.status === "open" ? Images.dotOpen : Images.dotDone} /> <img src={item.is_submit === true ? Images.dotDone : item.is_overdue === true ? Images.dotOverdue : Images.dotOpen} />
<Typography style={{ marginLeft: 10, color: '#5198ea', fontSize: 13 }}>{item.nama}</Typography> <Link to={{
pathname: `/home/master-budget/`,
state: {
userType: 'user',
rawData: item
}
}}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5,
outline: 'none'
}}>
<Typography style={{ marginLeft: 10, color: '#5198ea', fontSize: 13 }}>{item.company_name}</Typography>
</button>
</Link>
</div> </div>
{item.status === 'overdue' && ( {item.is_overdue && (
<div style={{ backgroundColor: '#f65a4c', paddingRight: 5, paddingLeft: 5, borderRadius: 5, alignSelf: 'center' }}> <div style={{ backgroundColor: '#f65a4c', paddingRight: 5, paddingLeft: 5, borderRadius: 5, alignSelf: 'center' }}>
<Typography style={{ fontSize: 11, color: '#fff' }}>Overdue</Typography> <Typography style={{ fontSize: 11, color: '#fff' }}>Overdue</Typography>
</div> </div>
...@@ -352,6 +447,7 @@ class HomePage extends Component { ...@@ -352,6 +447,7 @@ class HomePage extends Component {
} }
</div> </div>
); );
} }
} }
......
...@@ -61,7 +61,7 @@ export default class BalanceSheet extends Component { ...@@ -61,7 +61,7 @@ export default class BalanceSheet extends Component {
"periode": this.props.data.periode, "periode": this.props.data.periode,
} }
api.create().getLastestUpdateOI(payload).then(response => { api.create().getLastestUpdateOI(payload).then(response => {
console.log(response.data) // console.log(response.data)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
...@@ -76,7 +76,7 @@ export default class BalanceSheet extends Component { ...@@ -76,7 +76,7 @@ export default class BalanceSheet extends Component {
// this.getItemHierarki() // this.getItemHierarki()
this.getDataDetail() this.getDataDetail()
this.getLatestUpdate() this.getLatestUpdate()
console.log(this.props); // console.log(this.props);
} }
getDataDetail() { getDataDetail() {
...@@ -87,12 +87,12 @@ export default class BalanceSheet extends Component { ...@@ -87,12 +87,12 @@ export default class BalanceSheet extends Component {
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode "periode": this.props.data.periode
} }
console.log(payload) // console.log(payload)
api.create().getOperatingIndDetail(payload).then(response => { api.create().getOperatingIndDetail(payload).then(response => {
console.log(response) // console.log(response)
let dataTable = [] let dataTable = []
let res = response.data.data let res = response.data.data
// console.log(res) // // console.log(res)
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
...@@ -118,6 +118,7 @@ export default class BalanceSheet extends Component { ...@@ -118,6 +118,7 @@ export default class BalanceSheet extends Component {
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1), item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1), item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1), item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
item.order
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -151,6 +152,7 @@ export default class BalanceSheet extends Component { ...@@ -151,6 +152,7 @@ export default class BalanceSheet extends Component {
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1), item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1), item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1), item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
item.order
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -198,8 +200,8 @@ export default class BalanceSheet extends Component { ...@@ -198,8 +200,8 @@ export default class BalanceSheet extends Component {
"status": type, "status": type,
"master_budget": payloadMB "master_budget": payloadMB
} }
console.log('=========================') // console.log('=========================')
console.log(JSON.stringify(payload)) // console.log(JSON.stringify(payload))
this.props.saveOperatingInd(payload) this.props.saveOperatingInd(payload)
this.props.onClickClose() this.props.onClickClose()
} }
...@@ -213,7 +215,7 @@ export default class BalanceSheet extends Component { ...@@ -213,7 +215,7 @@ export default class BalanceSheet extends Component {
}) })
let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2]) let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
// console.log(indexParent); // // console.log(indexParent);
return a return a
} }
...@@ -262,7 +264,7 @@ export default class BalanceSheet extends Component { ...@@ -262,7 +264,7 @@ export default class BalanceSheet extends Component {
// "status": type, // "status": type,
// "balance_sheet": data // "balance_sheet": data
// } // }
// // console.log(data); // // // console.log(data);
// this.props.saveToMasterBudget(payload) // this.props.saveToMasterBudget(payload)
this.props.onClickClose() this.props.onClickClose()
} }
...@@ -272,7 +274,7 @@ export default class BalanceSheet extends Component { ...@@ -272,7 +274,7 @@ export default class BalanceSheet extends Component {
`https://tia.eksad.com/tia-reporting-dev/public/transaction/operating_indicator/download_template?report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}` `https://tia.eksad.com/tia-reporting-dev/public/transaction/operating_indicator/download_template?report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
) )
res = await res.blob() res = await res.blob()
console.log(res) // console.log(res)
if (res.size > 0) { if (res.size > 0) {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
...@@ -283,15 +285,15 @@ export default class BalanceSheet extends Component { ...@@ -283,15 +285,15 @@ export default class BalanceSheet extends Component {
} }
async downloadAllData() { async downloadAllData() {
// console.log('masuk') // // console.log('masuk')
let bram = [this.props.data.operatingIndID, this.props.report_id, this.props.data.company.company_id, this.props.data.periode] let bram = [this.props.data.operatingIndID, this.props.report_id, this.props.data.company.company_id, this.props.data.periode]
console.log(bram) // console.log(bram)
let res = await fetch( let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/operating_indicator/export_operating_indicator?operating_indicator_id=${this.props.data.operatingIndID == null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}` `https://tia.eksad.com/tia-reporting-dev/public/transaction/operating_indicator/export_operating_indicator?operating_indicator_id=${this.props.data.operatingIndID == null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
) )
res = await res.blob() res = await res.blob()
console.log(res) // console.log(res)
this.setState({ loading: false }) this.setState({ loading: false })
if (res.size > 0) { if (res.size > 0) {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
...@@ -305,13 +307,13 @@ export default class BalanceSheet extends Component { ...@@ -305,13 +307,13 @@ export default class BalanceSheet extends Component {
fileHandler = (event) => { fileHandler = (event) => {
let fileObj = event let fileObj = event
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp) // // console.log(resp)
if (err) { if (err) {
console.log(err); // console.log(err);
} }
else { else {
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
console.log(isi); // console.log(isi);
let payload = [] let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/; let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => { isi.map((i, index) => {
...@@ -344,18 +346,18 @@ export default class BalanceSheet extends Component { ...@@ -344,18 +346,18 @@ export default class BalanceSheet extends Component {
report_id: this.props.data.report_id, report_id: this.props.data.report_id,
master_budget: payload master_budget: payload
} }
console.log(resp.rows[1][0]) // console.log(resp.rows[1][0])
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] }) this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
} }
}); });
} }
checkUpload() { checkUpload() {
console.log(JSON.stringify(this.state.payload)) // console.log(JSON.stringify(this.state.payload))
api.create().checkUploadOperatingInd(this.state.payload).then(response => { api.create().checkUploadOperatingInd(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload)); // // console.log(JSON.stringify(this.state.payload));
console.log('===============') // console.log('===============')
console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleOI: false, loading: true }) this.setState({ visibleUpload: false, visibleOI: false, loading: true })
...@@ -382,6 +384,7 @@ export default class BalanceSheet extends Component { ...@@ -382,6 +384,7 @@ export default class BalanceSheet extends Component {
item.november, item.november,
item.december, item.december,
item.total_current_year, item.total_current_year,
item.order,
item.error item.error
] ]
}) })
...@@ -393,7 +396,7 @@ export default class BalanceSheet extends Component { ...@@ -393,7 +396,7 @@ export default class BalanceSheet extends Component {
uploadOI(type) { uploadOI(type) {
let data = [] let data = []
console.log(this.state.dataTable) // console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
"item_report_id": i[1], "item_report_id": i[1],
...@@ -422,10 +425,10 @@ export default class BalanceSheet extends Component { ...@@ -422,10 +425,10 @@ export default class BalanceSheet extends Component {
status: type, status: type,
master_budget: data master_budget: data
} }
console.log(data); // console.log(data);
console.log(JSON.stringify(body)) // console.log(JSON.stringify(body))
api.create('UPLOAD').uploadOperatingInd(body).then(response => { api.create('UPLOAD').uploadOperatingInd(body).then(response => {
console.log(response); // console.log(response);
this.setState({loading: false}) this.setState({loading: false})
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
...@@ -457,7 +460,7 @@ export default class BalanceSheet extends Component { ...@@ -457,7 +460,7 @@ export default class BalanceSheet extends Component {
// } // }
// }) // })
// dataTable2[tableMeta.rowIndex][20] = total // dataTable2[tableMeta.rowIndex][20] = total
console.log(dataTable2[tableMeta.rowIndex]) // console.log(dataTable2[tableMeta.rowIndex])
} }
const handleValue = (value, tableMeta) => { const handleValue = (value, tableMeta) => {
...@@ -474,21 +477,41 @@ export default class BalanceSheet extends Component { ...@@ -474,21 +477,41 @@ export default class BalanceSheet extends Component {
return total return total
} }
const handleFormula = (data, tableMeta) => { const handleParent = (tableMeta) => {
// console.log(tableMeta)
let total = 0
dataTable2.map((item, index) => {
if (item[2] == tableMeta.rowData[1]) {
// console.log(total)
// console.log(item[tableMeta.columnIndex])
total += Number(item[tableMeta.columnIndex])
}
})
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
return total
}
const handleFormula = (tableMeta) => {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g) let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = [] let arrayFormulaConvert = []
// // console.log(arrayFormula)
arrayFormula.map((item, indexs) => { arrayFormula.map((item, indexs) => {
let index = dataTable2.findIndex((val) => val[1] == item) if (item == '-' || item == '+' || item == '/' || item == '*') {
if (index > 0) { arrayFormulaConvert.push(item)
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
} else { } else {
arrayJumlah.push(item) let indexID = dataTable2.findIndex((val) => val[21] == item)
if (indexID !== -1) {
let valuezz = dataTable2[indexID][tableMeta.columnIndex]
// // console.log(dataTable2[indexID])
arrayFormulaConvert.push(valuezz == "" ? 0 : valuezz)
}
} }
// if (indexs % 2 !== 0) {
// operator.push(item)
// }
}) })
let array = arrayJumlah // // console.log(arrayFormula)
// // console.log(arrayFormulaConvert)
let array = arrayFormulaConvert
let total = 0 let total = 0
let opt = "" let opt = ""
array.map((item, index) => { array.map((item, index) => {
...@@ -558,9 +581,9 @@ export default class BalanceSheet extends Component { ...@@ -558,9 +581,9 @@ export default class BalanceSheet extends Component {
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null null
: :
tableMeta.rowData[21] ? tableMeta.rowData[22] ?
tableMeta.rowData[21].length > 0 ? tableMeta.rowData[22].length > 0 ?
tableMeta.rowData[21][0].field === 'item' ? tableMeta.rowData[22][0].field === 'item' ?
tableMeta.rowData[4] == 0 ? tableMeta.rowData[4] == 0 ?
<a data-tip={tableMeta.rowData[22][0].message} data-for="account"> <a data-tip={tableMeta.rowData[22][0].message} data-for="account">
<span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span> <span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
...@@ -627,10 +650,10 @@ export default class BalanceSheet extends Component { ...@@ -627,10 +650,10 @@ export default class BalanceSheet extends Component {
value={value} value={value}
disabled={true} disabled={true}
// onBlur={(event) => { // onBlur={(event) => {
// console.log(event.target.value) // // console.log(event.target.value)
// // updateValue(event.target.value) // // updateValue(event.target.value)
// handleChangeText(event.target.value, tableMeta) // handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
// }} // }}
/> />
} }
...@@ -682,6 +705,7 @@ export default class BalanceSheet extends Component { ...@@ -682,6 +705,7 @@ export default class BalanceSheet extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
tableMeta.rowData[0] == 2?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -689,41 +713,40 @@ export default class BalanceSheet extends Component { ...@@ -689,41 +713,40 @@ export default class BalanceSheet extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={Number(value).toFixed(1)} value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
/>
}
/>
</div>
:
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
/> />
</div> </div>
}
</div>
)
}
}
}
, {
name: `Feb ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -736,24 +759,25 @@ export default class BalanceSheet extends Component { ...@@ -736,24 +759,25 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
/> />
</div> </div>)
} }
</div> </div>
) )
} }
} }
}, { }
name: `Mar ${this.props.data.periode}`, , {
name: `Feb ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -767,6 +791,7 @@ export default class BalanceSheet extends Component { ...@@ -767,6 +791,7 @@ export default class BalanceSheet extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
tableMeta.rowData[0] == 2?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -774,41 +799,18 @@ export default class BalanceSheet extends Component { ...@@ -774,41 +799,18 @@ export default class BalanceSheet extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit} value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1} decimalScale={1}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/> />
} }
/> />
</div> </div>
}
</div>
)
}
}
}, {
name: `Apr ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
: :
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -816,40 +818,21 @@ export default class BalanceSheet extends Component { ...@@ -816,40 +818,21 @@ export default class BalanceSheet extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit} value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1} decimalScale={1}
value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
/> />
</div> </div>
}
</div>
)
}
}
}, {
name: `May ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -861,25 +844,25 @@ export default class BalanceSheet extends Component { ...@@ -861,25 +844,25 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit} disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
/> />
</div> </div>)
} }
</div> </div>
) )
} }
} }
}, { }, {
name: `Jun ${this.props.data.periode}`, name: `Mar ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -893,6 +876,7 @@ export default class BalanceSheet extends Component { ...@@ -893,6 +876,7 @@ export default class BalanceSheet extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
tableMeta.rowData[0] == 2?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -900,41 +884,18 @@ export default class BalanceSheet extends Component { ...@@ -900,41 +884,18 @@ export default class BalanceSheet extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit} value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1} decimalScale={1}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/> />
} }
/> />
</div> </div>
}
</div>
)
}
}
}, {
name: `Jul ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
: :
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -942,40 +903,21 @@ export default class BalanceSheet extends Component { ...@@ -942,40 +903,21 @@ export default class BalanceSheet extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
/> />
</div> </div>
}
</div>
)
}
}
}, {
name: `Aug ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -987,25 +929,25 @@ export default class BalanceSheet extends Component { ...@@ -987,25 +929,25 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit} disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
/> />
</div> </div>)
} }
</div> </div>
) )
} }
} }
}, { }, {
name: `Sep ${this.props.data.periode}`, name: `Apr ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1019,6 +961,7 @@ export default class BalanceSheet extends Component { ...@@ -1019,6 +961,7 @@ export default class BalanceSheet extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
tableMeta.rowData[0] == 2?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1026,41 +969,18 @@ export default class BalanceSheet extends Component { ...@@ -1026,41 +969,18 @@ export default class BalanceSheet extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/> />
} }
/> />
</div> </div>
}
</div>
)
}
}
}, {
name: `Oct ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
: :
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1068,40 +988,21 @@ export default class BalanceSheet extends Component { ...@@ -1068,40 +988,21 @@ export default class BalanceSheet extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
/> />
</div> </div>
}
</div>
)
}
}
}, {
name: `Nov ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1113,25 +1014,25 @@ export default class BalanceSheet extends Component { ...@@ -1113,25 +1014,25 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit} disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
/> />
</div> </div>)
} }
</div> </div>
) )
} }
} }
}, { }, {
name: `Dec ${this.props.data.periode}`, name: `May ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1145,6 +1046,7 @@ export default class BalanceSheet extends Component { ...@@ -1145,6 +1046,7 @@ export default class BalanceSheet extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
tableMeta.rowData[0] == 2?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1152,26 +1054,663 @@ export default class BalanceSheet extends Component { ...@@ -1152,26 +1054,663 @@ export default class BalanceSheet extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/> />
} }
/> />
</div> </div>
:
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>)
}
</div>
)
}
}
}, {
name: `Jun ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
tableMeta.rowData[0] == 2?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
/>
}
/>
</div>
:
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>)
}
</div>
)
}
}
}, {
name: `Jul ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
tableMeta.rowData[0] == 2?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
/>
}
/>
</div>
:
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>)
}
</div>
)
}
}
}, {
name: `Aug ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
tableMeta.rowData[0] == 2?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
/>
}
/>
</div>
:
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>)
}
</div>
)
}
}
}, {
name: `Sep ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
tableMeta.rowData[0] == 2?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
/>
}
/>
</div>
:
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>)
}
</div>
)
}
}
}, {
name: `Oct ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
tableMeta.rowData[0] == 2?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
/>
}
/>
</div>
:
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>)
}
</div>
)
}
}
}, {
name: `Nov ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
tableMeta.rowData[0] == 2?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
/>
}
/>
</div>
:
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>)
}
</div>
)
}
}
}, {
name: `Dec ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
tableMeta.rowData[0] == 2?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
/>
}
/>
</div>
:
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>)
}
</div>
)
}
} }
</div>
)
}
}
}, { }, {
name: `31 Dec ${this.props.data.periode}\nTotal`, name: `31 Dec ${this.props.data.periode}\nTotal`,
options: { options: {
...@@ -1187,6 +1726,49 @@ export default class BalanceSheet extends Component { ...@@ -1187,6 +1726,49 @@ export default class BalanceSheet extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
tableMeta.rowData[0] == 2?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
/>
}
/>
</div>
:
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1197,18 +1779,18 @@ export default class BalanceSheet extends Component { ...@@ -1197,18 +1779,18 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit} disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
/> />
</div> </div>)
} }
</div> </div>
) )
......
...@@ -26,6 +26,7 @@ import Constant from "../library/Constant"; ...@@ -26,6 +26,7 @@ import Constant from "../library/Constant";
// work properly. // work properly.
export default function BasicExample() { export default function BasicExample() {
return ( return (
<Router basename={"/tia-web-dev"}> <Router basename={"/tia-web-dev"}>
<Switch> <Switch>
...@@ -57,7 +58,15 @@ export default function BasicExample() { ...@@ -57,7 +58,15 @@ export default function BasicExample() {
} }
function PrivateRoute({ children, ...rest }) { function PrivateRoute({ children, ...rest }) {
// React.useEffect(() => {
// token()
// })
const logged = localStorage.getItem(Constant.TOKEN) !== null? true : false const logged = localStorage.getItem(Constant.TOKEN) !== null? true : false
// const token = async() => {
// let a = await localStorage.getItem(Constant.TOKEN)
// alert(a)
// }
return ( return (
<Route <Route
{...rest} {...rest}
......
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