Commit 8ce98fd8 authored by Riri Novita's avatar Riri Novita

validasi

parent 41501aaf
...@@ -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) => ({
...@@ -86,10 +87,10 @@ class DownloadReport extends Component { ...@@ -86,10 +87,10 @@ class DownloadReport extends Component {
componentDidMount() { componentDidMount() {
const interval = setInterval(() => { // const interval = setInterval(() => {
this.getListDownload() this.getListDownload()
}, 500); // }, 500);
return () => clearInterval(interval); // return () => clearInterval(interval);
} }
...@@ -111,7 +112,7 @@ class DownloadReport extends Component { ...@@ -111,7 +112,7 @@ class DownloadReport extends Component {
items: groups[key], items: groups[key],
}); });
} }
// console.log(arr, 'ihiw'); console.log(arr, 'ihiw');
// data.map((item) => { // data.map((item) => {
// var reference = moment(item.created_at).format('YYYY-MM-DD'); // var reference = moment(item.created_at).format('YYYY-MM-DD');
...@@ -160,7 +161,8 @@ class DownloadReport extends Component { ...@@ -160,7 +161,8 @@ 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"; console.log(item);
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;
...@@ -221,118 +223,83 @@ class DownloadReport extends Component { ...@@ -221,118 +223,83 @@ 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 ? null :
<div style={{ alignItems: 'center', display: 'flex' }}> <div style={{ display: 'flex' }}>
<img src={Images.zip} style={{ width: 80, margin: 9 }} /> <div style={{ width: '7%', height: 90, background: '#D9D9D9', borderRadius: 10, marginBottom: 15, marginRight: 2, borderBottomRightRadius: 0, borderTopRightRadius: 0 }}>
</div> <div style={{ alignItems: 'center', display: 'flex' }}>
</div> <img src={Images.zip} style={{ width: 80, margin: 9 }} />
<div style={{ display: 'flex', justifyContent: 'space-between', width: '92%', height: 90, background: '#D9D9D9', borderRadius: 10, marginBottom: 15, borderBottomLeftRadius: 0, borderTopLeftRadius: 0 }}> </div>
<div> </div>
<Typography style={{ fontSize: 18, color: '#273B80', fontWeight: 700, marginTop: 10, marginLeft: 10 }}>{item.download_file_report_name}</Typography> <div style={{ display: 'flex', justifyContent: 'space-between', width: '92%', height: 90, background: '#D9D9D9', borderRadius: 10, marginBottom: 15, borderBottomLeftRadius: 0, borderTopLeftRadius: 0 }}>
<Typography style={{ marginLeft: 10, marginTop: 5, fontSize: 11 }}>Last Download by: {item.created_by} - {item.created_at}</Typography> <div>
</div> <Typography style={{ fontSize: 18, color: '#273B80', fontWeight: 700, marginTop: 10, marginLeft: 10 }}>{item.download_file_report_name}</Typography>
<div style={{ display: 'flex', justifyContent: 'center', marginRight: 40 }}> <Typography style={{ marginLeft: 10, marginTop: 5, fontSize: 11 }}>Last Download by: {item.created_by} - {item.created_at}</Typography>
{item.status === 1 ? </div>
<button <div style={{ display: 'flex', justifyContent: 'center', marginRight: 40 }}>
type="button" {item.status === 1 ?
disabled={true} <button
onClick={() => null} type="button"
style={{ disabled={true}
backgroundColor: 'transparent', onClick={() => null}
borderColor: 'transparent', style={{
outline: 'none', 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> <div style={{ backgroundColor: '#939497de', width: 140, height: 40, borderRadius: 10, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
</button> <Typography style={{ fontSize: '16px', color: '#fff', textAlign: 'center' }}>In Progress</Typography>
: </div>
item.status === 2 ? </button>
<button :
type="button" item.status === 2 ?
// disabled={this.state.buttonError} <button
onClick={() => this.handleDownload(item.download_file_report_id, item.download_file_report_name)} type="button"
style={{ // disabled={this.state.buttonError}
backgroundColor: 'transparent', onClick={() => this.handleDownload(item.download_file_report_id, item.download_file_report_name)}
borderColor: 'transparent', style={{
outline: 'none', 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> <div style={{ backgroundColor: '#354960', width: 140, height: 40, borderRadius: 10, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
</button> <Typography style={{ fontSize: '16px', color: '#fff', textAlign: 'center' }}>Download</Typography>
: </div>
null </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: 3, marginLeft: 7 }} /></span></Typography>
</div>
</button>
:
null
}
</div>
</div>
</div> </div>
</div> }
</div> </div>
) )
})} })}
</div> </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>
......
...@@ -584,40 +584,42 @@ export default class MonthlyReport extends Component { ...@@ -584,40 +584,42 @@ 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' })
}
}) })
} }
...@@ -2175,18 +2177,25 @@ export default class MonthlyReport extends Component { ...@@ -2175,18 +2177,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] || 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 })
} }
} }
...@@ -2258,91 +2267,103 @@ export default class MonthlyReport extends Component { ...@@ -2258,91 +2267,103 @@ export default class MonthlyReport extends Component {
let a = [] 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" : 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); console.log(a, selectReport);
...@@ -2352,6 +2373,7 @@ export default class MonthlyReport extends Component { ...@@ -2352,6 +2373,7 @@ export default class MonthlyReport extends Component {
// this.setState({ popupDownload: true }) // 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 +2510,8 @@ export default class MonthlyReport extends Component { ...@@ -2488,7 +2510,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 >
); );
......
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