Commit c86ea362 authored by qorri_di's avatar qorri_di Committed by ardyardyaaan

penambahan Tombol coloum :

- Download version Native Query
- Download SetForwardOnly
parent f8285d07
......@@ -510,6 +510,40 @@ export default class ProfitLossOLPA extends Component {
a.click();
}
}
async downloadAllData2() {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa2/export_outlook_pa?outlook_pa_id=${this.props.outlook_pa_id}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let sub_null = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa2/export_outlook_pa?outlook_pa_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
console.log(url);
let res = await fetch(
this.props.outlook_pa_id == null ? sub_null : url
)
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 = 'Outlook Performance Appraisal Profit & Loss.xlsx';
a.click();
}
}
async downloadAllData3() {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa3/export_outlook_pa?outlook_pa_id=${this.props.outlook_pa_id}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let sub_null = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa3/export_outlook_pa?outlook_pa_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
console.log(url);
let res = await fetch(
this.props.outlook_pa_id == null ? sub_null : url
)
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 = 'Outlook Performance Appraisal Profit & Loss.xlsx';
a.click();
}
}
handleValidate() {
let data = []
......@@ -1764,7 +1798,7 @@ export default class ProfitLossOLPA extends Component {
<div style={{ width: '50%' }}>
{this.props.isApprover == true || this.state.get_for == 'view' ?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<a data-tip={'Download V1'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
......@@ -1783,9 +1817,7 @@ export default class ProfitLossOLPA extends Component {
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> :
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<a data-tip={'Download V2'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
......@@ -1793,27 +1825,18 @@ export default class ProfitLossOLPA extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadTemplate()}
>
<img src={Images.template} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData2()
}, 100);
})}
>
<img src={Images.upload} />
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
<a data-tip={'Download V3'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
......@@ -1824,7 +1847,7 @@ export default class ProfitLossOLPA extends Component {
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
this.downloadAllData3()
}, 100);
})}
>
......@@ -1833,6 +1856,8 @@ export default class ProfitLossOLPA extends Component {
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
:
null
}
</div>
</div>
......
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