Commit 499a4366 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

Didam

See merge request !560
parents fc4a97ba 6ced1bc1
......@@ -6,6 +6,7 @@ import ReactTooltip from 'react-tooltip';
import api from '../../api';
import Images from '../../assets/Images';
import * as R from 'ramda'
import { PropagateLoader } from 'react-spinners';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3());
......@@ -35,7 +36,8 @@ export default class CashFlow extends Component {
constructor(props) {
super(props)
this.state = {
dataTable: []
dataTable: [],
loading: false
}
}
......@@ -142,22 +144,19 @@ export default class CashFlow extends Component {
// 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 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(
this.props.submissionID == null ? resNull : resReal
)
res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Master Budget Cash Flow.xlsx';
a.click();
this.setState({loading: false})
} else {
this.setState({loading: false})
}
}
......@@ -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 (
<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 }}>
......@@ -2170,7 +2181,12 @@ export default class CashFlow extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadAllData()}
onClick={() => this.setState({ loading: true }, () => {
this.downloadAllData()
// setTimeout(() => {
// this.setState({loading: false})
// }, 500);
})}
>
<img src={Images.download} />
</button>
......@@ -2181,13 +2197,14 @@ export default class CashFlow extends Component {
</div>
<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
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</MuiThemeProvider>
</div>
</div>
</Paper>
......
......@@ -90,6 +90,7 @@ export default class CorporateAnnualTarget extends Component {
this.getKPIType()
this.getMaxAch()
this.getLatestUpdate()
// console.log(this.props.status)
// // console.log(this.props.lastStatus);
}
......@@ -1119,7 +1120,7 @@ export default class CorporateAnnualTarget extends Component {
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
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]) }}>
{!this.state.loading && <FormControlLabel
style={{ margin: 0 }}
......
......@@ -1989,7 +1989,7 @@ export default class BalanceSheet extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
{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}
<MuiThemeProvider theme={getMuiTheme()}>
<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