Commit abfd6fdb authored by Deni Rinaldi's avatar Deni Rinaldi

balance sheet ++

parent ae8e3a9f
...@@ -56,7 +56,7 @@ export default class BalanceSheet extends Component { ...@@ -56,7 +56,7 @@ export default class BalanceSheet extends Component {
if (response.data.status === "success") { if (response.data.status === "success") {
let dataTable = [] let dataTable = []
response.data.data.map((item, index) => { response.data.data.map((item, index) => {
if (item.children.length > 0) { if (item.children && item.children.length > 0) {
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -122,26 +122,31 @@ export default class BalanceSheet extends Component { ...@@ -122,26 +122,31 @@ export default class BalanceSheet extends Component {
handleValue(data) { handleValue(data) {
let total = 0 let total = 0
this.state.dataTable.map((item,index) => { this.state.dataTable.map((item,index) => {
if (data[1] == item[2]) { if (data.rowData[1] == item[2]) {
total = item[6] == undefined? (total + 0) : (total + item[6]) total = item[6] == undefined? (total + 0) : (total + item[6])
} }
// console.log(data[2])
}) })
let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
return total let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
// console.log(indexParent);
return a
} }
handleChange(value, tableMeta) { handleChange(value, tableMeta) {
let data = this.state.dataTable let data = this.state.dataTable
let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2]) let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(value) // console.log(indexParent);
let jagain = data[indexParent][tableMeta.columnIndex] if (indexParent > 0) {
a = data[indexParent][tableMeta.columnIndex] = jagain == undefined? (0 + Number(value)) : (jagain + Number(value)) let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(value)
this.setState({ let jagain = data[indexParent][tableMeta.columnIndex]
data: a a = data[indexParent][tableMeta.columnIndex] = jagain == undefined? (0 + Number(value)) : (jagain + Number(value))
}, () => console.log(this.state.dataTable)) } else {
// let a = data[0].tableMeta.tableData[tableMeta.rowIndex] === value let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(value)
// console.log(data) }
// this.setState({
// data: a,
// }, () => console.log(this.state.dataTable))
} }
render() { render() {
...@@ -216,25 +221,12 @@ export default class BalanceSheet extends Component { ...@@ -216,25 +221,12 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] !== 2 ? {tableMeta.rowData[0] === 4 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={value} value={value}
control={ control={
// <Input
// value={this.formatValue(value)}
// style={{}}
// inputProps={{
// style: {
// color: "#5198ea",
// fontSize: 12,
// textAlign: 'right'
// }
// }}
// disableUnderline={true}
// inputStyle={{ color: 'red' }}
// />
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
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' }}
...@@ -250,7 +242,13 @@ export default class BalanceSheet extends Component { ...@@ -250,7 +242,13 @@ export default class BalanceSheet extends Component {
} }
/> />
</div> : </div> :
<span style={{ fontSize: 12, textAlign: 'right' }}>{this.handleValue(tableMeta.rowData)}</span> tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>{this.handleValue(tableMeta)}</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
} }
</div> </div>
) )
......
...@@ -183,7 +183,8 @@ export default class Parameter extends Component { ...@@ -183,7 +183,8 @@ export default class Parameter extends Component {
let data = response.data.data let data = response.data.data
let listData = data.map((item, index) => { let listData = data.map((item, index) => {
return [ return [
index, item.setting_id,
item.setting_id,
item.setting_group, item.setting_group,
item.setting_type, item.setting_type,
item.company_name, item.company_name,
......
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