Commit d6a7e902 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'riri' into 'master'

puyeng

See merge request !329
parents 1aa4afec 280ff81e
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input } from '@material-ui/core'; import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input, Tooltip, withStyles } from '@material-ui/core';
import MUIDataTable from 'mui-datatables'; import MUIDataTable from 'mui-datatables';
import NumberFormat from 'react-number-format'; import NumberFormat from 'react-number-format';
import api from '../../api'; import api from '../../api';
...@@ -11,6 +11,15 @@ import ReactTooltip from 'react-tooltip'; ...@@ -11,6 +11,15 @@ import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
const LightTooltip = withStyles((theme) => ({
tooltip: {
backgroundColor: theme.palette.common.white,
color: 'rgba(0, 0, 0, 0.87)',
boxShadow: theme.shadows[1],
fontSize: 11,
},
}))(Tooltip);
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3()); const getMuiTheme = () => createMuiTheme(ct.customTable3());
...@@ -34,7 +43,8 @@ export default class ProfitLoss extends Component { ...@@ -34,7 +43,8 @@ export default class ProfitLoss extends Component {
dataTable: [], dataTable: [],
visibleProfitLoss: true, visibleProfitLoss: true,
disabledSave: true, disabledSave: true,
editable: false editable: false,
buttonError: false
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -130,7 +140,7 @@ export default class ProfitLoss extends Component { ...@@ -130,7 +140,7 @@ export default class ProfitLoss extends Component {
} }
} }
}) })
this.setState({ dataTable, loading: false }) this.setState({ dataTable, loading: false, buttonError: true })
}) })
} }
...@@ -225,28 +235,29 @@ export default class ProfitLoss extends Component { ...@@ -225,28 +235,29 @@ export default class ProfitLoss extends Component {
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
console.log(isi); console.log(isi);
let payload = [] let payload = []
let reg = /^\d+$/;
isi.map((i, index) => { isi.map((i, index) => {
if (i.length > 0) { if (i.length > 0) {
payload.push({ payload.push({
item_report_id: i[0] === undefined ? "" : String(i[0]).trim(), item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(), item_report: i[1] === undefined ? "" : String(i[1]).trim(),
notes: i[2] === undefined ? "" : String(i[2]).trim(), notes: i[2] === undefined ? "" : reg.test(String(i[2])) === false ? "" : String(i[2]).trim(),
total_actual_before: i[3] === undefined ? "" : String(i[3]).trim(), total_actual_before: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
january: i[4] === undefined ? "" : String(i[4]).trim(), january: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
february: i[5] === undefined ? "" : String(i[5]).trim(), february: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
march: i[6] === undefined ? "" : String(i[6]).trim(), march: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
april: i[7] === undefined ? "" : String(i[7]).trim(), april: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
may: i[8] === undefined ? "" : String(i[8]).trim(), may: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
june: i[9] === undefined ? "" : String(i[9]).trim(), june: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
july: i[10] === undefined ? "" : String(i[10]).trim(), july: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
august: i[11] === undefined ? "" : String(i[11]).trim(), august: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
september: i[12] === undefined ? "" : String(i[12]).trim(), september: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
october: i[13] === undefined ? "" : String(i[13]).trim(), october: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
november: i[14] === undefined ? "" : String(i[14]).trim(), november: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
december: i[15] === undefined ? "" : String(i[15]).trim(), december: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
total_current_year: i[16] === undefined ? "" : String(i[16]).trim(), total_current_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
total_next_year: i[17] === undefined ? "" : String(i[17]).trim(), total_next_year: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(),
total_more_year: i[17] === undefined ? "" : String(i[18]).trim() total_more_year: i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim()
}) })
} }
}) })
...@@ -256,15 +267,15 @@ export default class ProfitLoss extends Component { ...@@ -256,15 +267,15 @@ export default class ProfitLoss extends Component {
report_id: this.props.report_id, report_id: this.props.report_id,
profit_loss: payload profit_loss: payload
} }
// console.log(JSON.stringify(body)) console.log(body)
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] }) this.setState({ payload: body, judul: resp.rows[1][0] })
} }
}); });
} }
checkUpload() { checkUpload() {
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') {
...@@ -297,20 +308,16 @@ export default class ProfitLoss extends Component { ...@@ -297,20 +308,16 @@ export default class ProfitLoss extends Component {
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }) this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
if (this.state.dataTable[23].length > 0) {
this.setState({ buttonError: true, errorPreview: true })
}
})
} }
} }
}) })
} }
checkError(tableMeta) {
if (tableMeta.rowData[23]) {
if (tableMeta.rowData[23][0] === 'item') {
this.setState({ buttonError: true })
}
}
}
uploadProfitLoss() { uploadProfitLoss() {
let data = [] let data = []
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
...@@ -348,7 +355,6 @@ export default class ProfitLoss extends Component { ...@@ -348,7 +355,6 @@ export default class ProfitLoss extends Component {
if (response.data.status === "success") { if (response.data.status === "success") {
this.props.onClickClose() this.props.onClickClose()
this.props.getReport() this.props.getReport()
this.props.getReportAttachment()
} else { } else {
alert(response.data.status) alert(response.data.status)
} }
...@@ -489,26 +495,11 @@ export default class ProfitLoss extends Component { ...@@ -489,26 +495,11 @@ export default class ProfitLoss extends Component {
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{tableMeta.rowData[23] ? {tableMeta.rowData[23] ?
tableMeta.rowData[23].length > 0 ? tableMeta.rowData[23].length > 0 ?
tableMeta.rowData[23][0].field === 'item' ? <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
tableMeta.rowData[4] == 0 ? <LightTooltip title={"Report Items Not Registered"} arrow>
<a data-tip={tableMeta.rowData[23][0].message} data-for="account"> <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
<span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span> </LightTooltip>
{this.checkError(tableMeta)} </div>
</a>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<a data-tip={tableMeta.rowData[23][0].message} data-for="account">
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
{this.checkError(tableMeta)}
</a>
</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 ? tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span> <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
...@@ -524,7 +515,6 @@ export default class ProfitLoss extends Component { ...@@ -524,7 +515,6 @@ export default class ProfitLoss extends Component {
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div> </div>
} }
<ReactTooltip border={true} id="account" place="bottom" type="light" effect="solid" />
</div> </div>
) )
} }
...@@ -637,18 +627,19 @@ export default class ProfitLoss extends Component { ...@@ -637,18 +627,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -679,7 +670,6 @@ export default class ProfitLoss extends Component { ...@@ -679,7 +670,6 @@ export default class ProfitLoss extends Component {
placeholder="" placeholder=""
value={value} value={value}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) console.log(dataTable2)
}} }}
...@@ -725,18 +715,19 @@ export default class ProfitLoss extends Component { ...@@ -725,18 +715,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -813,18 +804,19 @@ export default class ProfitLoss extends Component { ...@@ -813,18 +804,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -901,18 +893,19 @@ export default class ProfitLoss extends Component { ...@@ -901,18 +893,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -989,18 +982,19 @@ export default class ProfitLoss extends Component { ...@@ -989,18 +982,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -1077,18 +1071,19 @@ export default class ProfitLoss extends Component { ...@@ -1077,18 +1071,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -1165,18 +1160,19 @@ export default class ProfitLoss extends Component { ...@@ -1165,18 +1160,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -1253,18 +1249,19 @@ export default class ProfitLoss extends Component { ...@@ -1253,18 +1249,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -1341,18 +1338,19 @@ export default class ProfitLoss extends Component { ...@@ -1341,18 +1338,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -1429,18 +1427,19 @@ export default class ProfitLoss extends Component { ...@@ -1429,18 +1427,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -1502,7 +1501,6 @@ export default class ProfitLoss extends Component { ...@@ -1502,7 +1501,6 @@ export default class ProfitLoss extends Component {
// placeholder="" // placeholder=""
// disabled={true} // disabled={true}
// value={handleFormula(value, tableMeta)} // value={handleFormula(value, tableMeta)}
// /> // />
null null
: :
...@@ -1514,23 +1512,23 @@ export default class ProfitLoss extends Component { ...@@ -1514,23 +1512,23 @@ export default class ProfitLoss extends Component {
// placeholder="" // placeholder=""
// disabled={true} // disabled={true}
// value={handleFormula(value, tableMeta)} // value={handleFormula(value, tableMeta)}
// /> // />
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -1607,18 +1605,19 @@ export default class ProfitLoss extends Component { ...@@ -1607,18 +1605,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -1695,18 +1694,19 @@ export default class ProfitLoss extends Component { ...@@ -1695,18 +1694,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -1783,18 +1783,19 @@ export default class ProfitLoss extends Component { ...@@ -1783,18 +1783,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -1871,25 +1872,26 @@ export default class ProfitLoss extends Component { ...@@ -1871,25 +1872,26 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
} }
} }
}, { }, {
name: "31 Dec 2023 Total", name: "31 Dec 2022 Total",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
...@@ -1959,18 +1961,19 @@ export default class ProfitLoss extends Component { ...@@ -1959,18 +1961,19 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
value === "" ? // value === "" ?
null : // null :
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ 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={true} // disabled={true}
value={Number(value)} // value={Number(value)}
/> // />
null
: :
<span>validasi</span> null
} }
</div> </div>
) )
...@@ -2005,13 +2008,13 @@ export default class ProfitLoss extends Component { ...@@ -2005,13 +2008,13 @@ export default class ProfitLoss extends Component {
{this.state.visibleProfitLoss === true ? {this.state.visibleProfitLoss === true ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Profit & Loss</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Profit & Loss </Typography>
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}> <div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
...@@ -2067,7 +2070,7 @@ export default class ProfitLoss extends Component { ...@@ -2067,7 +2070,7 @@ export default class ProfitLoss extends Component {
</div> </div>
</div> </div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150)}}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}> {!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
...@@ -2114,40 +2117,40 @@ export default class ProfitLoss extends Component { ...@@ -2114,40 +2117,40 @@ export default class ProfitLoss extends Component {
</div> </div>
</button> </button>
<button <button
className="button"
type="button" type="button"
disabled={this.state.disabledSave}
onClick={() => this.backToMasterBudget('submitted')}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.disabledSave === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false, editable: true })
}, 100);
})
}}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
</div> </div>
</button> </button>
<button <button
className="button"
type="button" type="button"
disabled={this.state.buttonError}
onClick={() => this.backToMasterBudget('submitted')}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none',
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, disabledSave: false, editable: true })
}, 100);
})
}} }}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography>
</div> </div>
</button> </button>
</div> </div>
...@@ -2184,33 +2187,20 @@ export default class ProfitLoss extends Component { ...@@ -2184,33 +2187,20 @@ export default class ProfitLoss extends Component {
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
</div> </div>
</button> </button>
<button
type="button"
disabled={this.state.buttonError == true ? true : false}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadProfitLoss()
}, 100);
})}
style={{ marginRight: 20 }}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography>
</div>
</button>
<button <button
className="button" className="button"
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none',
marginRight: 20
}} }}
onClick={() => { onClick={() => {
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false }) this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false })
}, 100); }, 100);
}) })
}} }}
...@@ -2219,6 +2209,19 @@ export default class ProfitLoss extends Component { ...@@ -2219,6 +2209,19 @@ export default class ProfitLoss extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
</div> </div>
</button> </button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadProfitLoss()
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography>
</div>
</button>
</div> </div>
</div> </div>
</Paper>} </Paper>}
......
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