Commit 4252239d authored by Riri Novita's avatar Riri Novita

Merge branch 'dev/riri' into 'ENV-DEV'

issue download

See merge request !1711
parents 8c81b2cb dd8fa451
...@@ -2451,35 +2451,47 @@ export default class BudgetTahunan extends Component { ...@@ -2451,35 +2451,47 @@ export default class BudgetTahunan extends Component {
if (selectReport.length > 0) { if (selectReport.length > 0) {
let result = [] let result = []
console.log('mulai hit') console.log('mulai hit')
for(const items of selectReport) { for (const items of selectReport) {
let datas = data.findIndex((val) => val[4] == items) let datas = data.findIndex((val) => val[4] == items)
let report = data[datas] let report = data[datas]
if (items === 6) { if (items === 6) {
let resReal = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/master_budget/export_master_budget?submission_id=${submissionID}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&report_id=${report[4]}&&download_file_report_id=${downloadedFileReportId}` let resReal = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/master_budget/export_master_budget?submission_id=${submissionID}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&report_id=${report[4]}&download_file_report_id=${downloadedFileReportId}`
let resNull = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/master_budget/export_master_budget?submission_id=&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&report_id=${report[4]}&&download_file_report_id=${downloadedFileReportId}` let resNull = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/master_budget/export_master_budget?submission_id=&&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&report_id=${report[4]}&download_file_report_id=${downloadedFileReportId}`
let res = await fetch( let res = await fetch(
this.props.submissionID == null ? resNull : resReal submissionID == null ? resNull : resReal
) )
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
}
console.log(res)
if (res.status === 200) { if (res.status === 200) {
result = [...result, res]; result = [...result, res];
} }
} else { } else {
let resReal = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}` let resReal = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID}&report_id=${report[4]}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&download_file_report_id=${downloadedFileReportId}`
let resNull = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}` let resNull = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=&report_id=${report[4]}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&download_file_report_id=${downloadedFileReportId}`
let res = await fetch( let res = await fetch(
this.props.submissionID == null ? resNull : resReal submissionID == null ? resNull : resReal
) )
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
}
console.log(res)
if (res.status === 200) { if (res.status === 200) {
result = [...result, res]; result = [...result, res];
} }
} }
} }
console.log('ini result',result); console.log('ini result', result);
// every untuk cek ke setiap result di dalam array // every untuk cek ke setiap result di dalam array
if(result.every((e) => e.status == 200)) { if (result.every((e) => e.status == 200)) {
this.handleZip(); this.handleZip();
} }
// Promise untuk ngumpulin semua result yg statusnya 200 // Promise untuk ngumpulin semua result yg statusnya 200
...@@ -2514,7 +2526,7 @@ export default class BudgetTahunan extends Component { ...@@ -2514,7 +2526,7 @@ export default class BudgetTahunan extends Component {
// return res; // return res;
// } // }
// } // }
} else { } else {
alert("Anda harus memilih report yang ingin di download terlebih dahulu!") alert("Anda harus memilih report yang ingin di download terlebih dahulu!")
} }
......
...@@ -173,7 +173,6 @@ class DownloadReport extends Component { ...@@ -173,7 +173,6 @@ class DownloadReport extends Component {
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/download/zip-files?downloadedFileReportId=${idFile}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/download/zip-files?downloadedFileReportId=${idFile}`
) )
console.log(res);
res = await res.blob() res = await res.blob()
this.setState({ loading: false }) this.setState({ loading: false })
if (res.size > 0) { if (res.size > 0) {
...@@ -283,7 +282,7 @@ class DownloadReport extends Component { ...@@ -283,7 +282,7 @@ class DownloadReport extends Component {
<img src={Images.zip} style={{ width: 80, margin: 9 }} /> <img src={Images.zip} style={{ width: 80, margin: 9 }} />
</div> </div>
</div> </div>
<div style={{ display: 'flex', justifyContent: 'space-between', width: '92%', background: '#D9D9D9', borderRadius: 10, marginBottom: 15, borderBottomLeftRadius: 0, borderTopLeftRadius: 0 }}> <div style={{ display: 'flex', justifyContent: 'space-between', width: '100%', background: '#D9D9D9', borderRadius: 10, marginBottom: 15, borderBottomLeftRadius: 0, borderTopLeftRadius: 0 }}>
<div style={{ marginRight: 10 }}> <div style={{ marginRight: 10 }}>
<Typography style={{ fontSize: 18, color: '#273B80', fontWeight: 700, marginTop: 10, marginLeft: 10 }}>{item.download_file_report_name}</Typography> <Typography style={{ fontSize: 18, color: '#273B80', fontWeight: 700, marginTop: 10, marginLeft: 10 }}>{item.download_file_report_name}</Typography>
<Typography style={{ marginLeft: 10, marginTop: 5, fontSize: 11, marginBottom: 10 }}>Last Download by: {item.created_by} - {item.created_at}</Typography> <Typography style={{ marginLeft: 10, marginTop: 5, fontSize: 11, marginBottom: 10 }}>Last Download by: {item.created_by} - {item.created_at}</Typography>
......
...@@ -4007,7 +4007,9 @@ export default class SubHolding extends Component { ...@@ -4007,7 +4007,9 @@ export default class SubHolding extends Component {
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/db_balance_sheet/export_report?submission_id=${this.state.submissionID === null ? "" : this.state.submissionID}&&report_id=${this.state.report.value}&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.revisionType}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/db_balance_sheet/export_report?submission_id=${this.state.submissionID === null ? "" : this.state.submissionID}&&report_id=${this.state.report.value}&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.revisionType}`
) )
console.log(res);
res = await res.blob() res = await res.blob()
console.log(res);
this.setState({ loading: false }) this.setState({ loading: false })
if (res.size > 0) { if (res.size > 0) {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
......
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