Commit 76e382ce authored by d.arizona's avatar d.arizona

push

parent fc4a97ba
...@@ -6,6 +6,7 @@ import ReactTooltip from 'react-tooltip'; ...@@ -6,6 +6,7 @@ import ReactTooltip from 'react-tooltip';
import api from '../../api'; import api from '../../api';
import Images from '../../assets/Images'; import Images from '../../assets/Images';
import * as R from 'ramda' import * as R from 'ramda'
import { PropagateLoader } from 'react-spinners';
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3()); const getMuiTheme = () => createMuiTheme(ct.customTable3());
...@@ -35,7 +36,8 @@ export default class CashFlow extends Component { ...@@ -35,7 +36,8 @@ export default class CashFlow extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
dataTable: [] dataTable: [],
loading: false
} }
} }
...@@ -142,22 +144,19 @@ export default class CashFlow extends Component { ...@@ -142,22 +144,19 @@ export default class CashFlow extends Component {
// console.log(url); // console.log(url);
let resReal = `https://tia.eksad.com/tia-reporting-dev/public/transaction/cash_flow/export_master_budget?submission_id=${this.props.submissionID}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&report_id=${this.props.report_id}` let resReal = `https://tia.eksad.com/tia-reporting-dev/public/transaction/cash_flow/export_master_budget?submission_id=${this.props.submissionID}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&report_id=${this.props.report_id}`
let resNull = `https://tia.eksad.com/tia-reporting-dev/public/transaction/cash_flow/export_master_budget?submission_id=&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&report_id=${this.props.report_id}` let resNull = `https://tia.eksad.com/tia-reporting-dev/public/transaction/cash_flow/export_master_budget?submission_id=&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&report_id=${this.props.report_id}`
if (this.props.submissionID == null) {
console.log(resNull)
} else {
console.log(resReal)
}
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()
this.setState({ loading: false })
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');
a.href = url; a.href = url;
a.download = 'Master Budget Cash Flow.xlsx'; a.download = 'Master Budget Cash Flow.xlsx';
a.click(); a.click();
this.setState({loading: false})
} else {
this.setState({loading: false})
} }
} }
...@@ -2143,6 +2142,18 @@ export default class CashFlow extends Component { ...@@ -2143,6 +2142,18 @@ export default class CashFlow extends Component {
} }
}, },
] ]
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={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}> <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<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 }}>
...@@ -2170,7 +2181,12 @@ export default class CashFlow extends Component { ...@@ -2170,7 +2181,12 @@ export default class CashFlow extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => this.downloadAllData()} onClick={() => this.setState({ loading: true }, () => {
this.downloadAllData()
// setTimeout(() => {
// this.setState({loading: false})
// }, 500);
})}
> >
<img src={Images.download} /> <img src={Images.download} />
</button> </button>
...@@ -2181,13 +2197,14 @@ export default class CashFlow extends Component { ...@@ -2181,13 +2197,14 @@ export default class CashFlow extends Component {
</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 && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
columns={columns} columns={columns}
options={options} options={options}
/> />
</MuiThemeProvider>} </MuiThemeProvider>
</div> </div>
</div> </div>
</Paper> </Paper>
......
...@@ -90,6 +90,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -90,6 +90,7 @@ export default class CorporateAnnualTarget extends Component {
this.getKPIType() this.getKPIType()
this.getMaxAch() this.getMaxAch()
this.getLatestUpdate() this.getLatestUpdate()
console.log(this.props.status)
// // console.log(this.props.lastStatus); // // console.log(this.props.lastStatus);
} }
...@@ -1119,7 +1120,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1119,7 +1120,7 @@ export default class CorporateAnnualTarget extends Component {
setCellProps: () => ({ style }), setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
tableMeta.rowData[1] == "" ? handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta) && (tableMeta.rowData[1] == "" || String(this.props.status).toLocaleLowerCase() == 'draft' || String(this.props.status).toLocaleLowerCase() == 'submitted' || String(this.props.status).toLocaleLowerCase() == 'revision')?
<div style={{ textAlign: 'left', paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <div style={{ textAlign: 'left', paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
{!this.state.loading && <FormControlLabel {!this.state.loading && <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
......
...@@ -1989,7 +1989,7 @@ export default class BalanceSheet extends Component { ...@@ -1989,7 +1989,7 @@ export default class BalanceSheet extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
{this.state.dataLoaded && ( {this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150)}}>
{this.state.loading && loadingComponent} {this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
......
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