Commit 1e34ff86 authored by Riri Novita's avatar Riri Novita

Merge branch 'ENV-DEV' into 'ENV-DEPLOYMENT'

issue download

See merge request !1712
parents d1f9e498 4252239d
......@@ -2451,35 +2451,47 @@ export default class BudgetTahunan extends Component {
if (selectReport.length > 0) {
let result = []
console.log('mulai hit')
for(const items of selectReport) {
for (const items of selectReport) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
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 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 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 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) {
result = [...result, res];
}
} 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 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 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 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) {
result = [...result, res];
}
}
}
console.log('ini result',result);
console.log('ini result', result);
// 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();
}
// Promise untuk ngumpulin semua result yg statusnya 200
......
......@@ -173,7 +173,6 @@ class DownloadReport extends Component {
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/download/zip-files?downloadedFileReportId=${idFile}`
)
console.log(res);
res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) {
......@@ -283,7 +282,7 @@ class DownloadReport extends Component {
<img src={Images.zip} style={{ width: 80, margin: 9 }} />
</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 }}>
<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>
......
......@@ -4007,7 +4007,9 @@ export default class SubHolding extends Component {
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}`
)
console.log(res);
res = await res.blob()
console.log(res);
this.setState({ loading: false })
if (res.size > 0) {
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