Commit 2586bfde authored by Riri Novita's avatar Riri Novita

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

perkara download report

See merge request !1708
parents 5bd9ed0c 05c9bab0
...@@ -2437,117 +2437,91 @@ export default class BudgetTahunan extends Component { ...@@ -2437,117 +2437,91 @@ export default class BudgetTahunan extends Component {
}) })
} }
componentDidUpdate = (prevProps, prevState) => { // componentDidUpdate = (prevProps, prevState) => {
if (this.state.selectReport.length > 0 && (this.state.arrayReport.length == this.state.selectReport.length)) { // console.log(this.state.arrayReport);
setTimeout(() => { // if (this.state.selectReport.length > 0 && (this.state.arrayReport.length == this.state.selectReport.length)) {
this.handleZip() // setTimeout(() => {
}, 200); // this.handleZip()
} // }, 200);
} // }
// }
handleGenerateReport(data) {
async handleGenerateReport(data) {
let { selectReport, submissionID, company, periode, month, downloadedFileReportId } = this.state let { selectReport, submissionID, company, periode, month, downloadedFileReportId } = this.state
let a = []
if (selectReport.length > 0) { if (selectReport.length > 0) {
selectReport.map(async (items) => { let result = []
console.log('mulai hit')
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 this.props.submissionID == null ? resNull : resReal
) )
console.log(res);
if (res.status === 200) { if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] }) 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 this.props.submissionID == null ? resNull : resReal
) )
console.log(res);
if (res.status === 200) { if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] }) result = [...result, res];
} }
} }
}
// if (items === 1) { console.log('ini result',result);
// let datas = data.findIndex((val) => val[4] == items) // every untuk cek ke setiap result di dalam array
// let report = data[datas] if(result.every((e) => e.status == 200)) {
// let url = `${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}` this.handleZip();
// let res = await fetch( }
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID === null ? "" : submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}` // Promise untuk ngumpulin semua result yg statusnya 200
// ) // const result = await Promise.all(selectReport.map(async (items) => {
// console.log(res); // let datas = data.findIndex((val) => val[4] == items)
// if (res.status === 200) { // let report = data[datas]
// this.setState({ arrayReport: [...this.state.arrayReport, items] }) // 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}`
// } else if (items === 5) { // 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 datas = data.findIndex((val) => val[4] == items) // // console.log('cash_flow start', Date.now())
// let report = data[datas] // let res = await fetch(
// let url = `${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}` // this.props.submissionID == null ? resNull : resReal
// let res = await fetch( // )
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID === null ? "" : submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}` // // console.log('cash_flow end', Date.now())
// ) // // console.log(res);
// console.log(res); // if (res.status === 200) {
// if (res.status === 200) { // // this.setState({ arrayReport: [...this.state.arrayReport, items] })
// this.setState({ arrayReport: [...this.state.arrayReport, items] }) // return res;
// } // }
// } else if (items === 2) { // } else {
// let datas = data.findIndex((val) => val[4] == items) // 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 report = data[datas] // 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 url = `${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 res = await fetch( // // console.log('master_budget start', Date.now())
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID === null ? "" : submissionID}&&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
// console.log(res); // )
// if (res.status === 200) { // // console.log('master_budget end', Date.now())
// this.setState({ arrayReport: [...this.state.arrayReport, items] }) // // console.log(res);
// } // if (res.status === 200) {
// } else if (items === 3) { // // this.setState({ arrayReport: [...this.state.arrayReport, items] })
// let datas = data.findIndex((val) => val[4] == items) // return res;
// let report = data[datas] // }
// let url = `${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 res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID === null ? "" : submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
// )
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 6) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${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 res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID === null ? "" : submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
// )
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 4) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${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 res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID === null ? "" : submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
// )
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// }
})
} else { } else {
alert("Anda harus memilih report yang ingin di download terlebih dahulu!") alert("Anda harus memilih report yang ingin di download terlebih dahulu!")
} }
} }
async handleZip() { async handleZip() {
console.log('mulai zip')
api.create().createZipReport(this.state.downloadedFileReportId).then((response) => { api.create().createZipReport(this.state.downloadedFileReportId).then((response) => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
...@@ -3603,7 +3577,7 @@ export default class BudgetTahunan extends Component { ...@@ -3603,7 +3577,7 @@ export default class BudgetTahunan extends Component {
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 609, height: 276 }}> <div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 609, height: 276 }}>
<div> <div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#33508B', margin: '70px 20px' }}>Master Budget {this.state.company.company_name} {this.state.periode.periode} In Progress Download, silahkan cek status di menu <b>Progress Download</b></div> <div style={{ justifyContent: 'center', fontSize: 20, color: '#33508B', margin: '70px 20px' }}>Master Budget {this.state.company.company_name} {this.state.periode.periode} In Progress Download, silahkan cek status di menu <b>Download Report</b></div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button <button
className="button" className="button"
......
...@@ -180,7 +180,7 @@ class MaintenanceMode extends Component { ...@@ -180,7 +180,7 @@ class MaintenanceMode extends Component {
"mail_type": "MAINTENANCE_MODE_INACTIVE", "mail_type": "MAINTENANCE_MODE_INACTIVE",
"mail_subject": "TIA 4.0 is Back", "mail_subject": "TIA 4.0 is Back",
"mail_body": "", "mail_body": "",
"mail_status": 0 "mail_status": 1
} }
] ]
// "maintenance_mail": [ // "maintenance_mail": [
...@@ -234,34 +234,34 @@ class MaintenanceMode extends Component { ...@@ -234,34 +234,34 @@ class MaintenanceMode extends Component {
"maintenance_headline": this.state.headline, "maintenance_headline": this.state.headline,
"maintenance_content": this.state.maintenanceContent, "maintenance_content": this.state.maintenanceContent,
"maintenance_status": this.state.maintenanceStatus, "maintenance_status": this.state.maintenanceStatus,
"maintenance_mail": [
{
"mail_type": "MAINTENANCE_MODE_ACTIVE",
"mail_subject": "TIA 4.0 Is Under Maintenance",
"mail_body": "",
"mail_status": 0
},
{
"mail_type": "MAINTENANCE_MODE_INACTIVE",
"mail_subject": "TIA 4.0 is Back",
"mail_body": "",
"mail_status": 0
}
]
// "maintenance_mail": [ // "maintenance_mail": [
// { // {
// "mail_type": "MAINTENANCE_MODE_ACTIVE", // "mail_type": "MAINTENANCE_MODE_ACTIVE",
// "mail_subject": this.state.subjectMailActive, // "mail_subject": "TIA 4.0 Is Under Maintenance",
// "mail_body": this.state.mailcontentModeActive, // "mail_body": "",
// "mail_status": this.state.mailStatusActive // "mail_status": 0
// }, // },
// { // {
// "mail_type": "MAINTENANCE_MODE_INACTIVE", // "mail_type": "MAINTENANCE_MODE_INACTIVE",
// "mail_subject": this.state.subjectMailNonActive, // "mail_subject": "TIA 4.0 is Back",
// "mail_body": this.state.mailcontentModeNonActive, // "mail_body": "",
// "mail_status": this.state.mailStatusNonActive // "mail_status": 1
// } // }
// ] // ]
"maintenance_mail": [
{
"mail_type": "MAINTENANCE_MODE_ACTIVE",
"mail_subject": this.state.subjectMailActive,
"mail_body": this.state.mailcontentModeActive,
"mail_status": this.state.mailStatusActive
},
{
"mail_type": "MAINTENANCE_MODE_INACTIVE",
"mail_subject": this.state.subjectMailNonActive,
"mail_body": this.state.mailcontentModeNonActive,
"mail_status": this.state.mailStatusNonActive
}
]
} }
console.log(payload); console.log(payload);
api.create().updateMaintenanceMode(payload).then((response) => { api.create().updateMaintenanceMode(payload).then((response) => {
......
...@@ -2255,118 +2255,127 @@ export default class MonthlyReport extends Component { ...@@ -2255,118 +2255,127 @@ export default class MonthlyReport extends Component {
}) })
} }
componentDidUpdate = (prevProps, prevState) => { // componentDidUpdate = (prevProps, prevState) => {
if (this.state.selectReport.length > 0 && (this.state.arrayReport.length == this.state.selectReport.length)) { // if (this.state.selectReport.length > 0 && (this.state.arrayReport.length == this.state.selectReport.length)) {
setTimeout(() => { // setTimeout(() => {
this.handleZip() // this.handleZip()
}, 200); // }, 200);
} // }
} // }
handleGenerateReport(data) { async handleGenerateReport(data) {
let { selectReport, monthlyReportId, company, periode, revisionTable, month, downloadedFileReportId } = this.state let { selectReport, monthlyReportId, company, periode, revisionTable, month, downloadedFileReportId } = this.state
console.log(selectReport);
if (selectReport.length > 0) { if (selectReport.length > 0) {
selectReport.map(async (items) => { let result = []
console.log('mulai hit')
for (const items of selectReport) {
let urlReport = items === 8 ? "profit_loss" : items === 12 ? "tax_planning" : items === 7 ? "balance_sheet" : items === 9 ? "fam" : items === 13 ? "cash_flow" : items === 11 ? "locf" : items === 10 ? "cat" : null let urlReport = items === 8 ? "profit_loss" : items === 12 ? "tax_planning" : items === 7 ? "balance_sheet" : items === 9 ? "fam" : items === 13 ? "cash_flow" : items === 11 ? "locf" : items === 10 ? "cat" : null
let datas = data.findIndex((val) => val[4] == items) let datas = data.findIndex((val) => val[4] == items)
let report = data[datas] let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
console.log(url);
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
) )
console.log(res);
if (res.status === 200) { if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] }) result = [...result, res];
} }
// if (items === 8) { }
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/profit_loss/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/profit_loss/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 12) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 7) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 9) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/fam/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/fam/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 13) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 11) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/locf/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/locf/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 10) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// }
}) console.log('ini result', result);
// every untuk cek ke setiap result di dalam array
if (result.every((e) => e.status == 200)) {
this.handleZip();
}
// selectReport.map(async (items) => {
// if (items === 8) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/profit_loss/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/profit_loss/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 12) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 7) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 9) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/fam/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/fam/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 13) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 11) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/locf/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/locf/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 10) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// console.log(url);
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// }
// })
} else { } else {
alert("Anda harus memilih report yang ingin di download terlebih dahulu!") alert("Anda harus memilih report yang ingin di download terlebih dahulu!")
this.setState({ popupDownload: false }) this.setState({ popupDownload: false })
...@@ -2374,6 +2383,7 @@ export default class MonthlyReport extends Component { ...@@ -2374,6 +2383,7 @@ export default class MonthlyReport extends Component {
} }
async handleZip() { async handleZip() {
console.log('mulai zip')
api.create().createZipReport(this.state.downloadedFileReportId).then((response) => { api.create().createZipReport(this.state.downloadedFileReportId).then((response) => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
...@@ -3589,7 +3599,7 @@ export default class MonthlyReport extends Component { ...@@ -3589,7 +3599,7 @@ export default class MonthlyReport extends Component {
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 609, height: 276 }}> <div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 609, height: 276 }}>
<div> <div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#33508B', margin: '70px 20px' }}>Monthly Report {this.state.company.company_name} {this.state.month.month_value} {this.state.periode.periode} In Progress Download, silahkan cek status di menu <b>Progress Download</b></div> <div style={{ justifyContent: 'center', fontSize: 20, color: '#33508B', margin: '70px 20px' }}>Monthly Report {this.state.company.company_name} {this.state.month.month_value} {this.state.periode.periode} In Progress Download, silahkan cek status di menu <b>Download Report</b></div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button <button
className="button" className="button"
......
...@@ -567,19 +567,20 @@ export default class OperatingIndicator extends Component { ...@@ -567,19 +567,20 @@ export default class OperatingIndicator extends Component {
}) })
} }
componentDidUpdate = (prevProps, prevState) => { // componentDidUpdate = (prevProps, prevState) => {
if (this.state.selectReport.length > 0 && (this.state.arrayReport.length == this.state.selectReport.length)) { // if (this.state.selectReport.length > 0 && (this.state.arrayReport.length == this.state.selectReport.length)) {
setTimeout(() => { // setTimeout(() => {
this.handleZip() // this.handleZip()
}, 200); // }, 200);
} // }
} // }
handleGenerateReport(data) { async handleGenerateReport(data) {
let { selectReport, operatingIndID, company, periode, downloadedFileReportId } = this.state let { selectReport, operatingIndID, company, periode, downloadedFileReportId } = this.state
if (selectReport.length > 0) { if (selectReport.length > 0) {
selectReport.map(async (items) => { let result = []
console.log('mulai hit')
for (const items of selectReport) {
let datas = data.findIndex((val) => val[3] == items) let datas = data.findIndex((val) => val[3] == items)
let report = data[datas] let report = data[datas]
let quarter = String(report[1]).toLocaleLowerCase().includes('q1') ? "q1" : let quarter = String(report[1]).toLocaleLowerCase().includes('q1') ? "q1" :
...@@ -599,47 +600,106 @@ export default class OperatingIndicator extends Component { ...@@ -599,47 +600,106 @@ export default class OperatingIndicator extends Component {
String(report[1]).toLocaleLowerCase().includes('nov') ? 11 : String(report[1]).toLocaleLowerCase().includes('nov') ? 11 :
String(report[1]).toLocaleLowerCase().includes('dec') ? 12 : null String(report[1]).toLocaleLowerCase().includes('dec') ? 12 : null
// console.log(report);
if (String(report[1]).toLocaleLowerCase().includes('master budget')) { if (String(report[1]).toLocaleLowerCase().includes('master budget')) {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}`
) )
// console.log(url);
console.log(res);
if (res.status === 200) { if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] }) result = [...result, res];
} }
} else if (String(report[1]).toLocaleLowerCase().includes('monthly report')) { } else if (String(report[1]).toLocaleLowerCase().includes('monthly report')) {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}`
) )
// console.log(url);
console.log(res);
if (res.status === 200) { if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] }) result = [...result, res];
} }
} else if (String(report[1]).toLocaleLowerCase().includes('rolling outlook')) { } else if (String(report[1]).toLocaleLowerCase().includes('rolling outlook')) {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}`
) )
// console.log(url);
console.log(res);
if (res.status === 200) { if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] }) result = [...result, res];
} }
} }
}
}) console.log('ini result', result);
// every untuk cek ke setiap result di dalam array
if (result.every((e) => e.status == 200)) {
this.handleZip();
}
// selectReport.map(async (items) => {
// let datas = data.findIndex((val) => val[3] == items)
// let report = data[datas]
// let quarter = String(report[1]).toLocaleLowerCase().includes('q1') ? "q1" :
// String(report[1]).toLocaleLowerCase().includes('q2') ? "q2" :
// String(report[1]).toLocaleLowerCase().includes('q3') ? "q3" : null
// let month = String(report[1]).toLocaleLowerCase().includes('jan') ? 1 :
// String(report[1]).toLocaleLowerCase().includes('feb') ? 2 :
// String(report[1]).toLocaleLowerCase().includes('mar') ? 3 :
// String(report[1]).toLocaleLowerCase().includes('apr') ? 4 :
// String(report[1]).toLocaleLowerCase().includes('may') ? 5 :
// String(report[1]).toLocaleLowerCase().includes('jun') ? 6 :
// String(report[1]).toLocaleLowerCase().includes('jul') ? 7 :
// String(report[1]).toLocaleLowerCase().includes('aug') ? 8 :
// String(report[1]).toLocaleLowerCase().includes('sep') ? 9 :
// String(report[1]).toLocaleLowerCase().includes('oct') ? 10 :
// String(report[1]).toLocaleLowerCase().includes('nov') ? 11 :
// String(report[1]).toLocaleLowerCase().includes('dec') ? 12 : null
// // console.log(report);
// if (String(report[1]).toLocaleLowerCase().includes('master budget')) {
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}`
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}`
// )
// // console.log(url);
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (String(report[1]).toLocaleLowerCase().includes('monthly report')) {
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}`
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}`
// )
// // console.log(url);
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (String(report[1]).toLocaleLowerCase().includes('rolling outlook')) {
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}`
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}`
// )
// // console.log(url);
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// }
// })
} else { } else {
// alert("Anda harus memilih report yang ingin di download terlebih dahulu!") // alert("Anda harus memilih report yang ingin di download terlebih dahulu!")
} }
} }
async handleZip() { async handleZip() {
console.log('mulai zip')
api.create().createZipReport(this.state.downloadedFileReportId).then((response) => { api.create().createZipReport(this.state.downloadedFileReportId).then((response) => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
...@@ -1006,7 +1066,7 @@ export default class OperatingIndicator extends Component { ...@@ -1006,7 +1066,7 @@ export default class OperatingIndicator extends Component {
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 609, height: 276 }}> <div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 609, height: 276 }}>
<div> <div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#33508B', margin: '70px 20px' }}>Operating Indicator {this.state.company.company_name} {this.state.periode.periode} In Progress Download, silahkan cek status di menu <b>Progress Download</b></div> <div style={{ justifyContent: 'center', fontSize: 20, color: '#33508B', margin: '70px 20px' }}>Operating Indicator {this.state.company.company_name} {this.state.periode.periode} In Progress Download, silahkan cek status di menu <b>Download Report</b></div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button <button
className="button" className="button"
......
...@@ -1483,91 +1483,56 @@ export default class OutlookPA extends Component { ...@@ -1483,91 +1483,56 @@ export default class OutlookPA extends Component {
}) })
} }
componentDidUpdate = (prevProps, prevState) => { // componentDidUpdate = (prevProps, prevState) => {
if (this.state.selectReport.length > 0 && (this.state.arrayReport.length == this.state.selectReport.length)) { // if (this.state.selectReport.length > 0 && (this.state.arrayReport.length == this.state.selectReport.length)) {
setTimeout(() => { // setTimeout(() => {
this.handleZip() // this.handleZip()
}, 200); // }, 200);
} // }
} // }
handleGenerateReport(data) { async handleGenerateReport(data) {
let { selectReport, outlook_pa_id, company, periode, month, downloadedFileReportId, quarter } = this.state let { selectReport, outlook_pa_id, company, periode, month, downloadedFileReportId, quarter } = this.state
let a = []
if (selectReport.length > 0) { if (selectReport.length > 0) {
selectReport.map(async (items) => { let result = []
console.log('mulai hit')
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]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_id}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}` if (items === 38) {
let res = await fetch( let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_id}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_id === null ? "" : outlook_pa_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(
) `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_id === null ? "" : outlook_pa_id}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
console.log(res); )
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] }) if (res.status === 200) {
result = [...result, res];
}
} else {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_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(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_id === null ? "" : outlook_pa_id}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
result = [...result, res];
}
} }
}
// if (items === 18) { console.log('ini result', result);
// let datas = data.findIndex((val) => val[4] == items) // every untuk cek ke setiap result di dalam array
// let report = data[datas] if (result.every((e) => e.status == 200)) {
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_id}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}` this.handleZip();
// let res = await fetch( }
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_id === null ? "" : outlook_pa_id}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
// )
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 19) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_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(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_id === null ? "" : outlook_pa_id}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 20) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_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(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_id === null ? "" : outlook_pa_id}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 38) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_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(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_id === null ? "" : outlook_pa_id}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
// )
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 39) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_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(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${outlook_pa_id === null ? "" : outlook_pa_id}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
// )
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// }
})
} else { } else {
alert("Anda harus memilih report yang ingin di download terlebih dahulu!") alert("Anda harus memilih report yang ingin di download terlebih dahulu!")
} }
} }
async handleZip() { async handleZip() {
console.log('mulai zip')
api.create().createZipReport(this.state.downloadedFileReportId).then((response) => { api.create().createZipReport(this.state.downloadedFileReportId).then((response) => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
...@@ -2613,7 +2578,7 @@ export default class OutlookPA extends Component { ...@@ -2613,7 +2578,7 @@ export default class OutlookPA extends Component {
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 609, height: 276 }}> <div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 609, height: 276 }}>
<div> <div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#33508B', margin: '70px 20px' }}>Outlook Performance Appraisal {this.state.company.company_name} {this.state.periode.periode} In Progress Download, silahkan cek status di menu <b>Progress Download</b></div> <div style={{ justifyContent: 'center', fontSize: 20, color: '#33508B', margin: '70px 20px' }}>Outlook Performance Appraisal {this.state.company.company_name} {this.state.periode.periode} In Progress Download, silahkan cek status di menu <b>Download Report</b></div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button <button
className="button" className="button"
......
...@@ -1461,7 +1461,7 @@ export default class RollingOutlook extends Component { ...@@ -1461,7 +1461,7 @@ export default class RollingOutlook extends Component {
if (!this.state.selectReport.includes(item[4])) { if (!this.state.selectReport.includes(item[4])) {
checkAll.push(item[4]) checkAll.push(item[4])
} }
} }
}) })
console.log(checkAll); console.log(checkAll);
this.setState({ selectReport: checkAll, isCheckAll: true }) this.setState({ selectReport: checkAll, isCheckAll: true })
...@@ -1522,19 +1522,12 @@ export default class RollingOutlook extends Component { ...@@ -1522,19 +1522,12 @@ export default class RollingOutlook extends Component {
}) })
} }
componentDidUpdate = (prevProps, prevState) => { async handleGenerateReport(data) {
if (this.state.selectReport.length > 0 && (this.state.arrayReport.length == this.state.selectReport.length)) {
setTimeout(() => {
this.handleZip()
}, 200);
}
}
handleGenerateReport(data) {
let { selectReport, rollingOutlookID, company, periode, month, downloadedFileReportId, quarter } = this.state let { selectReport, rollingOutlookID, company, periode, month, downloadedFileReportId, quarter } = this.state
let a = []
if (selectReport.length > 0) { if (selectReport.length > 0) {
selectReport.map(async (items) => { let result = []
console.log('mulai hit')
for (const items of selectReport) {
let urlReport = items === 14 ? "profit_loss" : items === 15 ? "tax_planning" : items === 16 ? "balance_sheet" : items === 17 ? "cash_flow" : items === 37 ? "cat" : null let urlReport = items === 14 ? "profit_loss" : items === 15 ? "tax_planning" : items === 16 ? "balance_sheet" : items === 17 ? "cash_flow" : items === 37 ? "cat" : null
let datas = data.findIndex((val) => val[4] == items) let datas = data.findIndex((val) => val[4] == items)
let report = data[datas] let report = data[datas]
...@@ -1542,72 +1535,25 @@ export default class RollingOutlook extends Component { ...@@ -1542,72 +1535,25 @@ export default class RollingOutlook extends Component {
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID === null ? "" : rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID === null ? "" : rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}`
) )
console.log(res);
if (res.status === 200) { if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] }) result = [...result, res];
} }
}
// if (items === 14) { console.log('ini result', result);
// let datas = data.findIndex((val) => val[4] == items) // every untuk cek ke setiap result di dalam array
// let report = data[datas] if (result.every((e) => e.status == 200)) {
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/profit_loss/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}` this.handleZip();
// let res = await fetch( }
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/profit_loss/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID === null ? "" : rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}`
// )
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 15) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}`
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID === null ? "" : rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 16) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}`
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID === null ? "" : rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 17) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}`
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID === null ? "" : rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}`
// )
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 37) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}`
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID === null ? "" : rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}`
// )
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// }
})
} else { } else {
alert("Anda harus memilih report yang ingin di download terlebih dahulu!") alert("Anda harus memilih report yang ingin di download terlebih dahulu!")
} }
} }
async handleZip() { async handleZip() {
console.log('mulai zip')
api.create().createZipReport(this.state.downloadedFileReportId).then((response) => { api.create().createZipReport(this.state.downloadedFileReportId).then((response) => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
...@@ -2656,7 +2602,7 @@ export default class RollingOutlook extends Component { ...@@ -2656,7 +2602,7 @@ export default class RollingOutlook extends Component {
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 609, height: 276 }}> <div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 609, height: 276 }}>
<div> <div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#33508B', margin: '70px 20px' }}>Rolling Outlook {this.state.company.company_name} {this.state.periode.periode} In Progress Download, silahkan cek status di menu <b>Progress Download</b></div> <div style={{ justifyContent: 'center', fontSize: 20, color: '#33508B', margin: '70px 20px' }}>Rolling Outlook {this.state.company.company_name} {this.state.periode.periode} In Progress Download, silahkan cek status di menu <b>Download Report</b></div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button <button
className="button" className="button"
......
...@@ -152,8 +152,8 @@ const arraySide = [ ...@@ -152,8 +152,8 @@ const arraySide = [
}, },
{ {
img: Images.outlookperformance, img: Images.outlookperformance,
label: 'Download Files', label: 'Download Report',
path: 'download-files', path: 'download-report',
subItem: null subItem: null
}, },
] ]
......
...@@ -136,7 +136,7 @@ const routes = [ ...@@ -136,7 +136,7 @@ const routes = [
main: MaintenanceMode main: MaintenanceMode
}, },
{ {
path: "/home/download-files", path: "/home/download-report",
main: DownloadReport main: DownloadReport
}, },
{ {
......
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