Commit bec97fe3 authored by Riri Novita's avatar Riri Novita

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

perdownload-an duniawi

See merge request !1689
parents abd6bcb2 4576d810
...@@ -511,40 +511,42 @@ export default class BudgetTahunan extends Component { ...@@ -511,40 +511,42 @@ export default class BudgetTahunan extends Component {
} }
getRevision() { getRevision() {
let payload = { this.setState({ selectReport: [], isCheckAll: false }, () => {
"company_id": this.state.company.company_id, let payload = {
"periode": this.state.periode.periode "company_id": this.state.company.company_id,
} "periode": this.state.periode.periode
api.create().getRevision(payload).then(response => { }
// // // console.log(response); api.create().getRevision(payload).then(response => {
if (response.data) { // // // console.log(response);
if (response.data.status === "success") { if (response.data) {
let data = response.data.data if (response.data.status === "success") {
let revisionData = data.map((item) => { let data = response.data.data
return { let revisionData = data.map((item) => {
revision: item, return {
} revision: item,
}) }
let defaultProps = { })
options: revisionData, let defaultProps = {
getOptionLabel: (option) => option.revision, options: revisionData,
}; getOptionLabel: (option) => option.revision,
this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => { };
this.getSubmission() this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => {
}) this.getSubmission()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', listRevision: null, revision: null })
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { })
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', listRevision: null, revision: null })
}
}) })
} }
...@@ -2365,12 +2367,19 @@ export default class BudgetTahunan extends Component { ...@@ -2365,12 +2367,19 @@ export default class BudgetTahunan extends Component {
this.setState({ selectReport: checkAll, isCheckAll: false }) this.setState({ selectReport: checkAll, isCheckAll: false })
} else { } else {
let checkAll = this.state.selectReport let checkAll = this.state.selectReport
data.map((item) => { let isAllDetail = true
if (!this.state.selectReport.includes(item[4])) { data.map((item, index) => {
checkAll.push(item[4]) if (item[5] === true) {
if (!this.state.selectReport.includes(item[4])) {
checkAll.push(item[4])
}
} else {
isAllDetail = false
checkAll.splice(index, 1)
} }
}) })
this.setState({ selectReport: checkAll, isCheckAll: true }) console.log(checkAll);
this.setState({ selectReport: checkAll, isCheckAll: isAllDetail })
} }
} }
...@@ -2441,70 +2450,80 @@ export default class BudgetTahunan extends Component { ...@@ -2441,70 +2450,80 @@ export default class BudgetTahunan extends Component {
let a = [] let a = []
if (selectReport.length > 0) { if (selectReport.length > 0) {
selectReport.map(async (items) => { selectReport.map(async (items) => {
if (items === 1) { 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/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 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(
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}`
`${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(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] })
}
} else if (items === 5) {
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}`
)
console.log(res);
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 2) {
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}`
)
console.log(res);
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 3) {
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 === 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] })
}
} }
// if (items === 1) {
// 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}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 5) {
// 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}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 2) {
// 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}`
// )
// console.log(res);
// if (res.status === 200) {
// this.setState({ arrayReport: [...this.state.arrayReport, items] })
// }
// } else if (items === 3) {
// 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 === 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 {
...@@ -2644,7 +2663,8 @@ export default class BudgetTahunan extends Component { ...@@ -2644,7 +2663,8 @@ export default class BudgetTahunan extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<CustomCheckbox <CustomCheckbox
checked={this.handleItemChecked(tableMeta)} checked={this.handleItemChecked(tableMeta)}
onChange={() => this.handleItemClick(tableMeta)} onChange={() => tableMeta.rowData[5] == true ? this.handleItemClick(tableMeta) : null}
disabled={tableMeta.rowData[5] == true ? false : true}
/> />
</div > </div >
); );
...@@ -2923,7 +2943,7 @@ export default class BudgetTahunan extends Component { ...@@ -2923,7 +2943,7 @@ export default class BudgetTahunan extends Component {
<button <button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => this.handleDownloadReport(this.state.dataTable)} onClick={() => this.state.selectReport.length > 0 ? this.handleDownloadReport(this.state.dataTable) : alert("Anda harus memilih report yang ingin di download terlebih dahulu!")}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
borderColor: 'transparent', borderColor: 'transparent',
......
...@@ -12,7 +12,8 @@ import SunEditor, { buttonList } from "suneditor-react"; ...@@ -12,7 +12,8 @@ import SunEditor, { buttonList } from "suneditor-react";
import 'suneditor/dist/css/suneditor.min.css'; // Import Sun Editor's CSS File import 'suneditor/dist/css/suneditor.min.css'; // Import Sun Editor's CSS File
import CloudDownloadIcon from '@material-ui/icons/CloudDownload'; import CloudDownloadIcon from '@material-ui/icons/CloudDownload';
import moment from 'moment'; import moment from 'moment';
import CheckCircleOutlineIcon from '@material-ui/icons/CheckCircleOutline';
import CheckCircleIcon from '@material-ui/icons/CheckCircle';
const IOSSwitch = withStyles((theme) => ({ const IOSSwitch = withStyles((theme) => ({
...@@ -80,7 +81,7 @@ class DownloadReport extends Component { ...@@ -80,7 +81,7 @@ class DownloadReport extends Component {
this.state = { this.state = {
load: false, load: false,
loading: false, loading: false,
listDownload: [], listDownload: []
} }
} }
...@@ -95,12 +96,10 @@ class DownloadReport extends Component { ...@@ -95,12 +96,10 @@ class DownloadReport extends Component {
getListDownload() { getListDownload() {
api.create().getListDownload().then((response) => { api.create().getListDownload().then((response) => {
// console.log(response);
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let listDate = []
let arr = []; let arr = [];
var groups = this.groupItems(data, "created_at"); // array will be grouped by 'date' property var groups = this.groupItems(data, "created_at"); // array will be grouped by 'date' property
...@@ -111,29 +110,6 @@ class DownloadReport extends Component { ...@@ -111,29 +110,6 @@ class DownloadReport extends Component {
items: groups[key], items: groups[key],
}); });
} }
// console.log(arr, 'ihiw');
// data.map((item) => {
// var reference = moment(item.created_at).format('YYYY-MM-DD');
// var today = moment().subtract(0, "days").format("YYYY-MM-DD");
// var yesterday = moment().subtract(1, "days").format("YYYY-MM-DD");
// let dateType = ""
// if (reference === today) {
// listDate.push({
// dateType: 'today'
// })
// } else if (reference === yesterday) {
// listDate.push({
// dateType: 'yesterday'
// })
// } else {
// listDate.push({
// dateType: 'daysago'
// })
// }
// console.log(listDate);
// })
this.setState({ listDownload: arr }) this.setState({ listDownload: arr })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -160,7 +136,7 @@ class DownloadReport extends Component { ...@@ -160,7 +136,7 @@ class DownloadReport extends Component {
var pastDate = moment(reference, "DD-MM-YYYY"); var pastDate = moment(reference, "DD-MM-YYYY");
var todayDate = moment(moment().format("DD-MM-YYYY"), "DD-MM-YYYY"); var todayDate = moment(moment().format("DD-MM-YYYY"), "DD-MM-YYYY");
let dDiff = todayDate.diff(pastDate, "days"); let dDiff = todayDate.diff(pastDate, "days");
var name = dDiff === 0 ? "Today" : dDiff === 1 ? "Yesterday" : "Days Ago"; var name = item.status === 0 ? "" : (dDiff === 0 ? "Today" : dDiff === 1 ? "Yesterday" : "Days Ago");
var group = groups[name] || (groups[name] = []); var group = groups[name] || (groups[name] = []);
group.push(item); group.push(item);
return groups; return groups;
...@@ -185,7 +161,7 @@ class DownloadReport extends Component { ...@@ -185,7 +161,7 @@ class DownloadReport extends Component {
} }
render() { render() {
let { listDownload, messageAlert } = this.state let { listDownload, messageAlert, pageEmpty } = this.state
const loadingComponent = ( 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)' }}> <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 <PropagateLoader
...@@ -221,118 +197,86 @@ class DownloadReport extends Component { ...@@ -221,118 +197,86 @@ class DownloadReport extends Component {
{listItem.items.length > 0 && {listItem.items.length > 0 &&
listItem.items.map((item) => { listItem.items.map((item) => {
return ( return (
<div style={{ display: 'flex' }}> <div>
<div style={{ width: '7%', height: 90, background: '#D9D9D9', borderRadius: 10, marginBottom: 15, marginRight: 2, borderBottomRightRadius: 0, borderTopRightRadius: 0 }}> {item.status == 0 ?
<div style={{ alignItems: 'center', display: 'flex' }}> null
<img src={Images.zip} style={{ width: 80, margin: 9 }} /> :
</div> <div style={{ display: 'flex' }}>
</div> <div style={{ width: '7%', height: 90, background: '#D9D9D9', borderRadius: 10, marginBottom: 15, marginRight: 2, borderBottomRightRadius: 0, borderTopRightRadius: 0 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', width: '92%', height: 90, background: '#D9D9D9', borderRadius: 10, marginBottom: 15, borderBottomLeftRadius: 0, borderTopLeftRadius: 0 }}> <div style={{ alignItems: 'center', display: 'flex' }}>
<div> <img src={Images.zip} style={{ width: 80, margin: 9 }} />
<Typography style={{ fontSize: 18, color: '#273B80', fontWeight: 700, marginTop: 10, marginLeft: 10 }}>{item.download_file_report_name}</Typography> </div>
<Typography style={{ marginLeft: 10, marginTop: 5, fontSize: 11 }}>Last Download by: {item.created_by} - {item.created_at}</Typography> </div>
</div> <div style={{ display: 'flex', justifyContent: 'space-between', width: '92%', height: 90, background: '#D9D9D9', borderRadius: 10, marginBottom: 15, borderBottomLeftRadius: 0, borderTopLeftRadius: 0 }}>
<div style={{ display: 'flex', justifyContent: 'center', marginRight: 40 }}> <div>
{item.status === 1 ? <Typography style={{ fontSize: 18, color: '#273B80', fontWeight: 700, marginTop: 10, marginLeft: 10 }}>{item.download_file_report_name}</Typography>
<button <Typography style={{ marginLeft: 10, marginTop: 5, fontSize: 11 }}>Last Download by: {item.created_by} - {item.created_at}</Typography>
type="button" </div>
disabled={true} <div style={{ display: 'flex', justifyContent: 'center', marginRight: 40 }}>
onClick={() => null} {item.status === 1 ?
style={{ <button
backgroundColor: 'transparent', type="button"
borderColor: 'transparent', disabled={true}
outline: 'none', onClick={() => null}
}} style={{
> backgroundColor: 'transparent',
<div style={{ backgroundColor: '#939497de', width: 140, height: 40, borderRadius: 10, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> borderColor: 'transparent',
<Typography style={{ fontSize: '16px', color: '#fff', textAlign: 'center' }}>In Progress</Typography> outline: 'none',
</div> }}
</button> >
: <div style={{ backgroundColor: '#939497de', width: 140, height: 40, borderRadius: 10, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
item.status === 2 ? <Typography style={{ fontSize: '16px', color: '#fff', textAlign: 'center' }}>In Progress</Typography>
<button </div>
type="button" </button>
// disabled={this.state.buttonError} :
onClick={() => this.handleDownload(item.download_file_report_id, item.download_file_report_name)} item.status === 2 ?
style={{ <button
backgroundColor: 'transparent', type="button"
borderColor: 'transparent', // disabled={this.state.buttonError}
outline: 'none', onClick={() => this.handleDownload(item.download_file_report_id, item.download_file_report_name)}
}} style={{
> backgroundColor: 'transparent',
<div style={{ backgroundColor: '#354960', width: 140, height: 40, borderRadius: 10, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> borderColor: 'transparent',
<Typography style={{ fontSize: '16px', color: '#fff', textAlign: 'center' }}>Download</Typography> outline: 'none',
</div> }}
</button> >
: <div style={{ backgroundColor: '#354960', width: 140, height: 40, borderRadius: 10, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
null <Typography style={{ fontSize: '16px', color: '#fff', textAlign: 'center' }}>Download</Typography>
} </div>
</button>
:
item.status === 3 ?
<button
type="button"
// disabled={this.state.buttonError}
onClick={() => this.handleDownload(item.download_file_report_id, item.download_file_report_name)}
style={{
backgroundColor: 'transparent',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 140, height: 40, borderRadius: 10, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '16px', color: '#fff', textAlign: 'center' }}>Download <span><CheckCircleIcon fontSize='small' style={{ marginBottom: 1, marginLeft: 7 }} /></span></Typography>
</div>
</button>
:
null
}
</div>
</div>
</div> </div>
</div> }
</div> </div>
) )
})} })}
</div> </div>
) )
})} })}
<div style={{ fontSize: 12, fontWeight: 700, color: 'red', marginLeft: 5, marginBottom: 10 }}>Note : File download akan hilang dalam 3 hari setelah di generate.</div>
{/* {this.state.listDownload.map((item) => (
item.status === 0 ?
null
:
<div style={{ display: 'flex' }}>
<div style={{ width: '7%', height: 90, background: '#D9D9D9', borderRadius: 10, marginBottom: 15, marginRight: 2, borderBottomRightRadius: 0, borderTopRightRadius: 0 }}>
<div style={{ alignItems: 'center', display: 'flex' }}>
<img src={Images.zip} style={{ width: 80, margin: 9 }} />
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', width: '92%', height: 90, background: '#D9D9D9', borderRadius: 10, marginBottom: 15, borderBottomLeftRadius: 0, borderTopLeftRadius: 0 }}>
<div>
<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 }}>Last Download by: {item.created_by} - {item.created_at}</Typography>
</div>
<div style={{ display: 'flex', justifyContent: 'center', marginRight: 40 }}>
{item.status === 1 ?
<button
type="button"
disabled={true}
onClick={() => null}
style={{
backgroundColor: 'transparent',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#939497de', width: 140, height: 40, borderRadius: 10, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '16px', color: '#fff', textAlign: 'center' }}>In Progress</Typography>
</div>
</button>
:
item.status === 2 ?
<button
type="button"
// disabled={this.state.buttonError}
onClick={() => this.handleDownload(item.download_file_report_id, item.download_file_report_name)}
style={{
backgroundColor: 'transparent',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 140, height: 40, borderRadius: 10, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '16px', color: '#fff', textAlign: 'center' }}>Download</Typography>
</div>
</button>
:
null
}
</div>
</div>
</div>
))} */}
</div> </div>
</Paper> </Paper>
</div> </div>
...@@ -341,11 +285,23 @@ class DownloadReport extends Component { ...@@ -341,11 +285,23 @@ class DownloadReport extends Component {
<div style={{ flexDirection: 'column', textAlign: 'center' }}> <div style={{ flexDirection: 'column', textAlign: 'center' }}>
<CloudDownloadIcon style={{ fontSize: 50, color: 'grey' }} /> <CloudDownloadIcon style={{ fontSize: 50, color: 'grey' }} />
<h3 style={{ marginTop: 5, color: 'grey' }}> <h3 style={{ marginTop: 5, color: 'grey' }}>
Download Report Download Report Empty
</h3> </h3>
</div> </div>
</div> </div>
} }
{/* {this.state.pageEmpty &&
<div style={{ flex: 1, height: '100vh', alignItems: 'center', justifyContent: 'center', display: 'flex' }}>
<div style={{ flexDirection: 'column', textAlign: 'center' }}>
<CloudDownloadIcon style={{ fontSize: 50, color: 'grey' }} />
<h3 style={{ marginTop: 5, color: 'grey' }}>
Download Report Empty
</h3>
</div>
</div>
} */}
</div> </div>
</div> </div>
); );
......
...@@ -584,142 +584,146 @@ export default class MonthlyReport extends Component { ...@@ -584,142 +584,146 @@ export default class MonthlyReport extends Component {
} }
getRevision() { getRevision() {
let payload = { this.setState({ selectReport: [], isCheckAll: false }, () => {
"company_id": this.state.company.company_id, let payload = {
"periode": this.state.periode.periode "company_id": this.state.company.company_id,
} "periode": this.state.periode.periode
api.create().getRevision(payload).then(response => { }
console.log(response); api.create().getRevision(payload).then(response => {
if (response.data) { console.log(response);
if (response.data.status === "success") { if (response.data) {
let data = response.data.data if (response.data.status === "success") {
let revisionData = data.map((item) => { let data = response.data.data
return { let revisionData = data.map((item) => {
revision: item, return {
} revision: item,
}) }
let defaultProps = { })
options: revisionData, let defaultProps = {
getOptionLabel: (option) => option.revision, options: revisionData,
}; getOptionLabel: (option) => option.revision,
this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => { };
this.getMonthlyReportID() this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => {
}) this.getMonthlyReportID()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { })
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
}) })
} }
getMonthlyReportID(type) { getMonthlyReportID(type) {
let payload = { this.setState({ selectReport: [], isCheckAll: false }, () => {
"company_id": this.state.company.company_id, let payload = {
"periode": this.state.periode.periode, "company_id": this.state.company.company_id,
"months": this.state.month.month_id, "periode": this.state.periode.periode,
"is_approver": this.state.isAdmin && this.state.lastStatus == 'WAITING FOR APPROVAL' ? false : this.state.isApprover "months": this.state.month.month_id,
} "is_approver": this.state.isAdmin && this.state.lastStatus == 'WAITING FOR APPROVAL' ? false : this.state.isApprover
this.setState({ visibleTableHistory: false }) }
api.create().getMonthlyReportID(payload).then(response => { this.setState({ visibleTableHistory: false })
console.log(response); api.create().getMonthlyReportID(payload).then(response => {
if (response.data) { console.log(response);
if (response.data.status === 'success') { if (response.data) {
this.setState({ if (response.data.status === 'success') {
submitter: response.data.data.submitter, this.setState({
approverID: response.data.data.approve_id, pic: response.data.data.approver == null ? '' : response.data.data.approver, submitter: response.data.data.submitter,
lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status, approverID: response.data.data.approve_id, pic: response.data.data.approver == null ? '' : response.data.data.approver,
lastRevision: response.data.data.last_revision, lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status,
btnApprove: response.data.data.is_submit, lastRevision: response.data.data.last_revision,
monthlyReportId: response.data.data ? response.data.data.monthly_report_id : null, btnApprove: response.data.data.is_submit,
isApprovedMB: response.data.data.is_approved_master_budget, monthlyReportId: response.data.data ? response.data.data.monthly_report_id : null,
textRevision: response.data.data.text_revision isApprovedMB: response.data.data.is_approved_master_budget,
}, () => { textRevision: response.data.data.text_revision
// // console.log(this.state.lastStatus); }, () => {
this.historyApproval() // // console.log(this.state.lastStatus);
this.getLatestPeriodSubmit() this.historyApproval()
if (this.state.isAdmin) { this.getLatestPeriodSubmit()
console.log('masuk') if (this.state.isAdmin) {
api.create().getListApprover('monthly_report', this.state.monthlyReportId).then((response) => { console.log('masuk')
console.log(response) api.create().getListApprover('monthly_report', this.state.monthlyReportId).then((response) => {
if (response.data.data) { console.log(response)
let dataListApprover = [] if (response.data.data) {
response.data.data.map((item, index) => { let dataListApprover = []
dataListApprover.push({ userId: item.user_id, fullname: item.fullname }) response.data.data.map((item, index) => {
}) dataListApprover.push({ userId: item.user_id, fullname: item.fullname })
let defaultProps = { })
options: dataListApprover, let defaultProps = {
getOptionLabel: (option) => option.fullname, options: dataListApprover,
}; getOptionLabel: (option) => option.fullname,
this.setState({ listApprover: defaultProps }) };
} this.setState({ listApprover: defaultProps })
}) }
} })
// this.getPL(type)
if (type != undefined && type == 'PL') {
this.getPL(type)
} else if (type != undefined && type == 'LOCF') {
let bodyRatioLocf = {
"report": 'ratio',
"monthlyReportId": this.state.monthlyReportId,
"periode": this.state.periode.periode,
"companyId": this.state.company.company_id,
"months": this.state.month.month_id
} }
api.create().triggerHistoricalRatio(bodyRatioLocf).then((res) => { // this.getPL(type)
console.log(res) if (type != undefined && type == 'PL') {
this.getPL(type)
} else if (type != undefined && type == 'LOCF') {
let bodyRatioLocf = {
"report": 'ratio',
"monthlyReportId": this.state.monthlyReportId,
"periode": this.state.periode.periode,
"companyId": this.state.company.company_id,
"months": this.state.month.month_id
}
api.create().triggerHistoricalRatio(bodyRatioLocf).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else if (type != undefined && type == 'BS') {
let bodyRatioBs = {
"report": 'ratio',
"monthlyReportId": this.state.monthlyReportId,
"periode": this.state.periode.periode,
"companyId": this.state.company.company_id,
"months": this.state.month.month_id
}
api.create().triggerRatioFromLOCF(bodyRatioBs).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else {
this.setState({ loading: false }) this.setState({ loading: false })
})
} else if (type != undefined && type == 'BS') {
let bodyRatioBs = {
"report": 'ratio',
"monthlyReportId": this.state.monthlyReportId,
"periode": this.state.periode.periode,
"companyId": this.state.company.company_id,
"months": this.state.month.month_id
} }
api.create().triggerRatioFromLOCF(bodyRatioBs).then((res) => { // this.getFR(type)
console.log(res) // this.getReport()
this.setState({ loading: false }) // this.getReportAttachment()
api.create().checkApproverMonthly().then(response => {
console.log(response)
if (this.state.btnCreate === true && this.state.btnEdit === true) {
console.log('editable');
this.setState({ isApprover: this.state.approverTrue ? true : false, checkApprover: this.state.approverTrue ? true : false })
} else {
console.log('just view');
this.setState({ isApprover: true, checkApprover: true })
}
}) })
} else { })
this.setState({ loading: false }) } else {
} this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
// this.getFR(type) if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
// this.getReport() setTimeout(() => {
// this.getReportAttachment() localStorage.removeItem(Constant.TOKEN)
api.create().checkApproverMonthly().then(response => { window.location.reload();
console.log(response) }, 1000);
if (this.state.btnCreate === true && this.state.btnEdit === true) {
console.log('editable');
this.setState({ isApprover: this.state.approverTrue ? true : false, checkApprover: this.state.approverTrue ? true : false })
} else {
console.log('just view');
this.setState({ isApprover: true, checkApprover: true })
} }
}) })
}) }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { })
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
}) })
} }
...@@ -2175,18 +2179,25 @@ export default class MonthlyReport extends Component { ...@@ -2175,18 +2179,25 @@ export default class MonthlyReport extends Component {
} }
handleSelectAll(data) { handleSelectAll(data) {
console.log(this.state.isCheckAll);
if (this.state.isCheckAll) { if (this.state.isCheckAll) {
let checkAll = [] let checkAll = []
this.setState({ selectReport: checkAll, isCheckAll: false }) this.setState({ selectReport: checkAll, isCheckAll: false })
} else { } else {
let checkAll = this.state.selectReport let checkAll = this.state.selectReport
data.map((item) => { let isAllDetail = true
if (!this.state.selectReport.includes(item[4])) { // console.log(checkAll, this.state.selectReport, data);
checkAll.push(item[4]) data.map((item, index) => {
if (item[5] === true || this.state.periode.periode <= 2022) {
if (!this.state.selectReport.includes(item[4])) {
checkAll.push(item[4])
}
} else {
isAllDetail = false
checkAll.splice(index, 1)
} }
}) })
this.setState({ selectReport: checkAll, isCheckAll: true }) console.log(checkAll);
this.setState({ selectReport: checkAll, isCheckAll: isAllDetail })
} }
} }
...@@ -2255,103 +2266,110 @@ export default class MonthlyReport extends Component { ...@@ -2255,103 +2266,110 @@ export default class MonthlyReport extends Component {
handleGenerateReport(data) { 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); console.log(selectReport);
let a = []
if (selectReport.length > 0) { if (selectReport.length > 0) {
selectReport.map(async (items) => { selectReport.map(async (items) => {
if (items === 8) { 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/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}` 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); console.log(url);
let res = await fetch( 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}` `${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); 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] })
}
} 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] })
}
} }
// 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(a, selectReport);
// setTimeout(() => {
// this.handleZip()
// }, 1000);
// this.setState({ popupDownload: true })
} 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 })
} }
} }
...@@ -2488,7 +2506,8 @@ export default class MonthlyReport extends Component { ...@@ -2488,7 +2506,8 @@ export default class MonthlyReport extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<CustomCheckbox <CustomCheckbox
checked={this.handleItemChecked(tableMeta)} checked={this.handleItemChecked(tableMeta)}
onChange={() => this.handleItemClick(tableMeta)} onChange={() => this.state.periode.periode <= 2020 ? this.handleItemClick(tableMeta) : (tableMeta.rowData[5] ? this.handleItemClick(tableMeta) : null)}
disabled={this.state.periode.periode <= 2020 ? false : (tableMeta.rowData[5] ? false : true)}
/> />
</div > </div >
); );
...@@ -2893,7 +2912,7 @@ export default class MonthlyReport extends Component { ...@@ -2893,7 +2912,7 @@ export default class MonthlyReport extends Component {
<button <button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => this.handleDownloadReport(this.state.dataTable)} onClick={() => this.state.selectReport.length > 0 ? this.handleDownloadReport(this.state.dataTable) : alert("Anda harus memilih report yang ingin di download terlebih dahulu!")}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
borderColor: 'transparent', borderColor: 'transparent',
......
...@@ -305,30 +305,32 @@ export default class OperatingIndicator extends Component { ...@@ -305,30 +305,32 @@ export default class OperatingIndicator extends Component {
} }
getOperatingID() { getOperatingID() {
let payload = { this.setState({ selectReport: [], isCheckAll: false }, () => {
"company_id": this.state.company.company_id, let payload = {
"periode": this.state.periode.periode "company_id": this.state.company.company_id,
} "periode": this.state.periode.periode
api.create().getOpetratingIndID(payload).then(response => { }
console.log(response); api.create().getOpetratingIndID(payload).then(response => {
if (response) { console.log(response);
// console.log(response.data.data) if (response) {
this.getLatestPeriodSubmit() // console.log(response.data.data)
if (response.data.data) { this.getLatestPeriodSubmit()
this.setState({ operatingIndID: response.data.data.operating_indicator_id }) if (response.data.data) {
this.setState({ operatingIndID: response.data.data.operating_indicator_id })
} else {
this.setState({ operatingIndID: null })
}
} else { } else {
this.setState({ operatingIndID: null }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { })
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
}) })
} }
...@@ -500,10 +502,13 @@ export default class OperatingIndicator extends Component { ...@@ -500,10 +502,13 @@ export default class OperatingIndicator extends Component {
} else { } else {
let checkAll = this.state.selectReport let checkAll = this.state.selectReport
data.map((item) => { data.map((item) => {
if (!this.state.selectReport.includes(item[3])) { if (item[4]) {
checkAll.push(item[3]) if (!this.state.selectReport.includes(item[3])) {
checkAll.push(item[3])
}
} }
}) })
console.log(checkAll);
this.setState({ selectReport: checkAll, isCheckAll: true }) this.setState({ selectReport: checkAll, isCheckAll: true })
} }
} }
...@@ -575,168 +580,54 @@ export default class OperatingIndicator extends Component { ...@@ -575,168 +580,54 @@ export default class OperatingIndicator extends Component {
if (selectReport.length > 0) { if (selectReport.length > 0) {
selectReport.map(async (items) => { selectReport.map(async (items) => {
if (items === 21) { 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" :
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 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}`
console.log(url);
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); 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] })
} }
} else if (items === 22) { } else if (String(report[1]).toLocaleLowerCase().includes('monthly report')) {
let datas = data.findIndex((val) => val[3] == items) 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 report = data[datas]
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=${1}&&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=${1}&&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); 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] })
} }
} } else if (String(report[1]).toLocaleLowerCase().includes('rolling outlook')) {
else if (items === 23) { 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 datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${2}&&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=${2}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 24) {
let datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${3}&&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=${3}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 25) {
let datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${4}&&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=${4}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 26) {
let datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${"q1"}&&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=${"q1"}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
}
else if (items === 27) {
let datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${5}&&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=${5}&&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}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 28) {
let datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${6}&&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=${6}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 29) {
let datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${7}&&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=${7}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 30) {
let datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${"q2"}&&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=${"q2"}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 31) {
let datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${8}&&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=${8}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 32) {
let datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${9}&&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=${9}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 33) {
let datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${10}&&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=${10}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 34) {
let datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${"q3"}&&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=${"q3"}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 35) {
let datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${11}&&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=${11}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 36) {
let datas = data.findIndex((val) => val[3] == items)
let report = data[datas]
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=${12}&&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=${12}&&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] }) this.setState({ arrayReport: [...this.state.arrayReport, items] })
} }
...@@ -744,7 +635,7 @@ export default class OperatingIndicator extends Component { ...@@ -744,7 +635,7 @@ export default class OperatingIndicator extends Component {
}) })
} else { } else {
alert("Anda harus memilih report yang ingin di download terlebih dahulu!") // alert("Anda harus memilih report yang ingin di download terlebih dahulu!")
} }
} }
...@@ -872,7 +763,8 @@ export default class OperatingIndicator extends Component { ...@@ -872,7 +763,8 @@ export default class OperatingIndicator extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<CustomCheckbox <CustomCheckbox
checked={this.handleItemChecked(tableMeta)} checked={this.handleItemChecked(tableMeta)}
onChange={() => this.handleItemClick(tableMeta)} onChange={() => tableMeta.rowData[4] ? this.handleItemClick(tableMeta) : null}
disabled={tableMeta.rowData[4] ? false : true}
/> />
</div > </div >
); );
......
...@@ -479,29 +479,31 @@ export default class OutlookPA extends Component { ...@@ -479,29 +479,31 @@ export default class OutlookPA extends Component {
} }
getRevision() { getRevision() {
let payload = { this.setState({ selectReport: [], isCheckAll: false }, () => {
"company_id": this.state.company.company_id, let payload = {
"periode": this.state.periode.periode "company_id": this.state.company.company_id,
} "periode": this.state.periode.periode
api.create().getRevision(payload).then(response => {
// console.log(response);
if (response.data) {
if (response.data.status === "success") {
let data = response.data.data
let revisionData = data.map((item) => {
return {
revision: item,
}
})
let defaultProps = {
options: revisionData,
getOptionLabel: (option) => option.revision,
};
this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => {
this.getOutlookPAID()
})
}
} }
api.create().getRevision(payload).then(response => {
// console.log(response);
if (response.data) {
if (response.data.status === "success") {
let data = response.data.data
let revisionData = data.map((item) => {
return {
revision: item,
}
})
let defaultProps = {
options: revisionData,
getOptionLabel: (option) => option.revision,
};
this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => {
this.getOutlookPAID()
})
}
}
})
}) })
} }
...@@ -1417,8 +1419,10 @@ export default class OutlookPA extends Component { ...@@ -1417,8 +1419,10 @@ export default class OutlookPA extends Component {
} else { } else {
let checkAll = this.state.selectReport let checkAll = this.state.selectReport
data.map((item) => { data.map((item) => {
if (!this.state.selectReport.includes(item[4])) { if (item[5] == true || (this.state.periode.periode == '2020' && item[1] == 'Balance Sheet' && item[3] == 'CLOSED')) {
checkAll.push(item[4]) if (!this.state.selectReport.includes(item[4])) {
checkAll.push(item[4])
}
} }
}) })
this.setState({ selectReport: checkAll, isCheckAll: true }) this.setState({ selectReport: checkAll, isCheckAll: true })
...@@ -1492,60 +1496,71 @@ export default class OutlookPA extends Component { ...@@ -1492,60 +1496,71 @@ export default class OutlookPA extends Component {
let a = [] let a = []
if (selectReport.length > 0) { if (selectReport.length > 0) {
selectReport.map(async (items) => { selectReport.map(async (items) => {
if (items === 18) { 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}`
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(
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}`
`${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) { if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] }) 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] })
}
} }
// if (items === 18) {
// 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 === 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!")
...@@ -1684,7 +1699,8 @@ export default class OutlookPA extends Component { ...@@ -1684,7 +1699,8 @@ export default class OutlookPA extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<CustomCheckbox <CustomCheckbox
checked={this.handleItemChecked(tableMeta)} checked={this.handleItemChecked(tableMeta)}
onChange={() => this.handleItemClick(tableMeta)} onChange={() => tableMeta.rowData[5] == true || (this.state.periode.periode == '2020' && tableMeta.rowData[1] == 'Balance Sheet' && tableMeta.rowData[3] == 'CLOSED') ? this.handleItemClick(tableMeta) : null}
disabled={tableMeta.rowData[5] == true || (this.state.periode.periode == '2020' && tableMeta.rowData[1] == 'Balance Sheet' && tableMeta.rowData[3] == 'CLOSED') ? false : true}
/> />
</div > </div >
); );
...@@ -1997,7 +2013,7 @@ export default class OutlookPA extends Component { ...@@ -1997,7 +2013,7 @@ export default class OutlookPA extends Component {
<button <button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => this.handleDownloadReport(this.state.dataTable)} onClick={() => this.state.selectReport.length > 0 ? this.handleDownloadReport(this.state.dataTable) : alert("Anda harus memilih report yang ingin di download terlebih dahulu!")}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
borderColor: 'transparent', borderColor: 'transparent',
......
...@@ -517,30 +517,32 @@ export default class RollingOutlook extends Component { ...@@ -517,30 +517,32 @@ export default class RollingOutlook extends Component {
} }
getRevision() { getRevision() {
let payload = { this.setState({ selectReport: [], isCheckAll: false }, () => {
"company_id": this.state.company.company_id, let payload = {
"periode": this.state.periode.periode, "company_id": this.state.company.company_id,
"quartal": this.state.quarter.value "periode": this.state.periode.periode,
} "quartal": this.state.quarter.value
api.create().getRollingOutlookRevision(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
let data = response.data.data
let revisionData = data.map((item) => {
return {
revision: item,
}
})
let defaultProps = {
options: revisionData,
getOptionLabel: (option) => option.revision,
};
this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => {
this.getRollingOutlookID()
})
}
} }
api.create().getRollingOutlookRevision(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
let data = response.data.data
let revisionData = data.map((item) => {
return {
revision: item,
}
})
let defaultProps = {
options: revisionData,
getOptionLabel: (option) => option.revision,
};
this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => {
this.getRollingOutlookID()
})
}
}
})
}) })
} }
...@@ -1455,10 +1457,13 @@ export default class RollingOutlook extends Component { ...@@ -1455,10 +1457,13 @@ export default class RollingOutlook extends Component {
} else { } else {
let checkAll = this.state.selectReport let checkAll = this.state.selectReport
data.map((item) => { data.map((item) => {
if (!this.state.selectReport.includes(item[4])) { if (item[5]) {
checkAll.push(item[4]) if (!this.state.selectReport.includes(item[4])) {
} checkAll.push(item[4])
}
}
}) })
console.log(checkAll);
this.setState({ selectReport: checkAll, isCheckAll: true }) this.setState({ selectReport: checkAll, isCheckAll: true })
} }
} }
...@@ -1530,60 +1535,72 @@ export default class RollingOutlook extends Component { ...@@ -1530,60 +1535,72 @@ export default class RollingOutlook extends Component {
let a = [] let a = []
if (selectReport.length > 0) { if (selectReport.length > 0) {
selectReport.map(async (items) => { selectReport.map(async (items) => {
if (items === 14) { 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]
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}` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/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( 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}` `${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}`
) )
if (res.status === 200) { console.log(res);
this.setState({ arrayReport: [...this.state.arrayReport, items] }) 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] })
}
} }
// if (items === 14) {
// 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/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/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!")
...@@ -1722,7 +1739,8 @@ export default class RollingOutlook extends Component { ...@@ -1722,7 +1739,8 @@ export default class RollingOutlook extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<CustomCheckbox <CustomCheckbox
checked={this.handleItemChecked(tableMeta)} checked={this.handleItemChecked(tableMeta)}
onChange={() => this.handleItemClick(tableMeta)} onChange={() => tableMeta.rowData[5] == true ? this.handleItemClick(tableMeta) : null}
disabled={tableMeta.rowData[5] == true ? false : true}
/> />
</div > </div >
); );
...@@ -2023,7 +2041,7 @@ export default class RollingOutlook extends Component { ...@@ -2023,7 +2041,7 @@ export default class RollingOutlook extends Component {
<button <button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => this.handleDownloadReport(this.state.dataTable)} onClick={() => this.state.selectReport.length > 0 ? this.handleDownloadReport(this.state.dataTable) : alert("Anda harus memilih report yang ingin di download terlebih dahulu!")}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
borderColor: 'transparent', borderColor: 'transparent',
......
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