Commit c763231c authored by d.arizona's avatar d.arizona

done update

parent c88c2078
......@@ -478,10 +478,10 @@ const create = (type = "") => {
const deleteDocument = (id) => api.post(`document/delete_document/${id}`)
// Monitoring
const getMonitoringMB = (body) => api.get(`transaction/monitoring/master_budget?year=${body.year}`)
const getMonitoringMB = (body) => api.get(`transaction/monitoring/master_budget`, body)
const getMonitoringMR = (body) => api.get(`transaction/monitoring/monthly_report/${body.year}/${body.month}`)
const getMonitoringRO = (body) => api.get(`transaction/monitoring/rolling_outlook/${body.year}/${body.quarter}`)
const getMonitoringOLPA = (body) => api.get(`transaction/monitoring/outlook_pa?year=${body.year}`)
const getMonitoringOLPA = (body) => api.get(`transaction/monitoring/outlook_pa`, body)
// Superadmin Approve
const getListApprover = (report, monthlyReportId) => api.get(`transaction/${report}/get_approver/${monthlyReportId}`)
......
......@@ -326,17 +326,17 @@ export default class BalanceSheetOLPA extends Component {
console.log(data);
this.setState({ loading: false })
if (type == 'submitted') {
this.props.saveToOLPA(payload)
let bodyRatioOLPA = {
"report": 'ratio',
"outlookPaId": this.props.outlook_pa_id,
"companyId": this.props.company.company_id,
"periode": this.props.periode
}
api.create().triggerRatioOLPA(bodyRatioOLPA).then((res) => {
console.log(res)
this.setState({ loading: false })
})
this.props.saveToOLPA(payload, 'BS')
// let bodyRatioOLPA = {
// "report": 'ratio',
// "outlookPaId": this.props.outlook_pa_id,
// "companyId": this.props.company.company_id,
// "periode": this.props.periode
// }
// api.create().triggerRatioOLPA(bodyRatioOLPA).then((res) => {
// console.log(res)
// this.setState({ loading: false })
// })
this.props.onClickClose()
} else {
this.props.saveToOLPA(payload)
......
......@@ -13,6 +13,7 @@ import Autocomplete from '@material-ui/lab/Autocomplete';
import ReactSpeedometer from 'react-d3-speedometer';
import TableProgressReport from './TableProgressReport'
import { Alert } from '@material-ui/lab';
import ReactTooltip from "react-tooltip";
class ReportProgress extends Component {
constructor(props) {
......@@ -170,21 +171,37 @@ class ReportProgress extends Component {
let data = response.data.data
data.map((item,index) => {
let report = []
item.report.map((items,indexs) => {
if (!String(items.report_name).includes('Indicator') && !String(items.report_name).includes('OLPA')) {
if (String(items.report_name).includes('Fixed')) {
report.push({...items, status_report: (items.report_date == null? items.status_report : items.status_report + ' - ' + items.report_date), report_name: 'Fixed Assets Movement'})
} else {
report.push({...items, status_report: (items.report_date == null? items.status_report : items.status_report + ' - ' + items.report_date)})
}
}
let statusSubmission = String(item.submissionStatus).toLocaleUpperCase()
let statusOI = String(item.operatingIndicator).toLocaleUpperCase()
item.report.map((items,index) => {
let statusReport = String(items.status_report).toLocaleUpperCase()
report.push({report_name: items.report_name, status_report: (statusReport == 'APPROVED' || statusReport == 'REVISION' || statusReport == 'COMPLETED') ? (statusReport + ' - ' + items.report_date) : statusReport })
})
report.push({report_name: 'Operating Indicator', status_report: item.operatingIndicator}, {report_name: 'Submission Status', status_report: (item.submissionStatusDate == null? item.submissionStatus : item.submissionStatus + ' - ' + item.submissionStatusDate)})
report.push(
{report_name: 'Operating Indicator', status_report: statusOI},
{report_name: 'Submission Status', status_report: (statusSubmission == 'APPROVED' || statusSubmission == 'REVISION' || statusSubmission == 'COMPLETED') ? (statusSubmission + ' - ' + item.submissionStatusDate) : statusSubmission})
dataTable.push([
item.companyName,
report
])
})
// data.map((item,index) => {
// let report = []
// item.report.map((items,indexs) => {
// if (!String(items.report_name).includes('Indicator') && !String(items.report_name).includes('OLPA')) {
// if (String(items.report_name).includes('Fixed')) {
// report.push({...items, status_report: (items.report_date == null? items.status_report : items.status_report + ' - ' + items.report_date), report_name: 'Fixed Assets Movement'})
// } else {
// report.push({...items, status_report: (items.report_date == null? items.status_report : items.status_report + ' - ' + items.report_date)})
// }
// }
// })
// report.push({report_name: 'Operating Indicator', status_report: item.operatingIndicator}, {report_name: 'Submission Status', status_report: (item.submissionStatusDate == null? item.submissionStatus : item.submissionStatus + ' - ' + item.submissionStatusDate)})
// dataTable.push([
// item.companyName,
// report
// ])
// })
console.log(dataTable)
this.setState({dataTable, loading: false})
} else {
......@@ -276,27 +293,43 @@ class ReportProgress extends Component {
let data = response.data.data
data.map((item,index) => {
let report = []
item.report.map((items,indexs) => {
if (!String(items.report_name).includes('Indicator') && !String(items.report_name).includes('OLPA')) {
if (String(items.report_name).includes('Fixed')) {
report.push({...items, status_report: (items.report_date == null? items.status_report : items.status_report + ' - ' + items.report_date), report_name: 'Fixed Assets Movement'})
} else {
report.push({...items, status_report: (items.report_date == null? items.status_report : items.status_report + ' - ' + items.report_date)})
}
}
let statusSubmission = String(item.submissionStatus).toLocaleUpperCase()
let statusOI = String(item.operatingIndicator).toLocaleUpperCase()
item.report.map((items,index) => {
let statusReport = String(items.status_report).toLocaleUpperCase()
report.push({report_name: items.report_name, status_report: (statusReport == 'APPROVED' || statusReport == 'REVISION' || statusReport == 'COMPLETED') ? (statusReport + ' - ' + items.report_date) : statusReport })
})
report.push({report_name: 'Operating Indicator', status_report: item.operatingIndicator}, {report_name: 'OLPA Status', status_report: (item.submissionStatusDate == null? item.submissionStatus : item.submissionStatus + ' - ' + item.submissionStatusDate)})
report.push(
{report_name: 'Operating Indicator', status_report: statusOI},
{report_name: 'OLPA Status', status_report: (statusSubmission == 'APPROVED' || statusSubmission == 'REVISION' || statusSubmission == 'COMPLETED') ? (statusSubmission + ' - ' + item.submissionStatusDate) : statusSubmission})
dataTable.push([
item.companyName,
report
])
})
// data.map((item,index) => {
// let report = []
// item.report.map((items,indexs) => {
// if (!String(items.report_name).includes('Indicator') && !String(items.report_name).includes('OLPA')) {
// if (String(items.report_name).includes('Fixed')) {
// report.push({...items, status_report: (items.report_date == null? items.status_report : items.status_report + ' - ' + items.report_date), report_name: 'Fixed Assets Movement'})
// } else {
// report.push({...items, status_report: (items.report_date == null? items.status_report : items.status_report + ' - ' + items.report_date)})
// }
// }
// })
// report.push({report_name: 'Operating Indicator', status_report: item.operatingIndicator}, {report_name: 'OLPA Status', status_report: (item.submissionStatusDate == null? item.submissionStatus : item.submissionStatus + ' - ' + item.submissionStatusDate)})
// dataTable.push([
// item.companyName,
// report
// ])
// let report = item.report
// report.push({report_name: 'Operating Indicator', status_report: item.operating_indicator}, {report_name: 'OLPA Status', status_report: item.olpa_status})
// dataTable.push([
// item.company_name,
// report
// ])
})
// })
this.setState({dataTable, loading: false})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
......@@ -318,6 +351,42 @@ class ReportProgress extends Component {
this.setState({ alert: false })
}
downloadData() {
let path = ''
let type = ''
if (String(this.state.reportType.name).toLocaleUpperCase().includes('MASTER')) {
path = `public/transaction/export_monitoring/master_budget?periode=${this.state.periodeMB.name}`
type = 'Master Budget'
} else if (String(this.state.reportType.name).toLocaleUpperCase().includes('MONTHLY')) {
path = `public/transaction/export_monitoring/monthly_report?months=${this.state.month.month_id}&&periode=${this.state.periodeMB.name}`
type = `Monthly Report (${this.state.month.month_value})`
} else if (String(this.state.reportType.name).toLocaleUpperCase().includes('ROLLING')) {
path = `public/transaction/export_monitoring/rolling_outlook?quartals=${this.state.quarter.value}&&periode=${this.state.periodeMB.name}`
type = `Rolling Outlook ${this.state.quarter.name}`
} else {
path = `public/transaction/export_monitoring/outlook_pa?periode=${this.state.periodeMB.name}`
type = 'Outlook PA'
}
this.downloadAllData(path, type)
}
async downloadAllData(path, type) {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/${path}`
console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/${path}`
)
res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = `Progress Report - ${type}.xlsx`;
a.click();
}
}
render() {
const dataTableMB = [
......@@ -441,9 +510,9 @@ class ReportProgress extends Component {
</div>
</div>
<div style={{ marginTop: 20, marginBottom: 20 }}>
{/* <div style={{ display: 'flex', justifyContent: 'space-between', padding: '0px 20px 10px 20px' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0px 20px 10px 20px' }}>
<div></div>
{this.state.previewDownload && (
{/* {this.state.previewDownload && ( */}
<div style={{ width: '50%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
......@@ -456,7 +525,7 @@ class ReportProgress extends Component {
}}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
this.downloadData()
}, 100);
})}
>
......@@ -465,8 +534,8 @@ class ReportProgress extends Component {
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
)}
</div> */}
{/* )} */}
</div>
{this.state.loading && loadingComponent}
{this.state.reportType != null && !this.state.loading && (
<TableProgressReport
......
......@@ -36,7 +36,7 @@ export default class TableProgressReport extends Component {
// console.log(itemName)
// console.log(tableMeta.rowData)
// console.log(value)
return value[0].status_report == null || value[0].status_report == ''? 'N/A' : value[0].status_report
return value[0].status_report == null || value[0].status_report == '' ? 'N/A' : value[0].status_report
}
const columnMB = [
{
......@@ -49,7 +49,7 @@ export default class TableProgressReport extends Component {
),
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
return <div style={{ width: 300, textAlign: 'left' }}>{val}</div>;
return <div style={{ width: 300, textAlign: 'left', paddingLeft: 20 }}>{val}</div>;
},
},
},
......@@ -141,7 +141,7 @@ export default class TableProgressReport extends Component {
),
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
return <div style={{ width: 300, textAlign: 'left' }}>{val}</div>;
return <div style={{ width: 300, textAlign: 'left', paddingLeft: 20 }}>{val}</div>;
},
},
},
......@@ -243,7 +243,7 @@ export default class TableProgressReport extends Component {
),
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
return <div style={{ width: 300, textAlign: 'left' }}>{val}</div>;
return <div style={{ width: 300, textAlign: 'left', paddingLeft: 20 }}>{val}</div>;
},
},
},
......@@ -329,7 +329,7 @@ export default class TableProgressReport extends Component {
),
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
return <div style={{ width: 300, textAlign: 'left' }}>{val}</div>;
return <div style={{ width: 300, textAlign: 'left', paddingLeft: 20 }}>{val}</div>;
},
},
},
......@@ -340,7 +340,7 @@ export default class TableProgressReport extends Component {
<th style={{ ...style, top: 0, zIndex: 103, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#37b5e6', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 40, fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="grid grid-2x">
<div className="column-1 grid grid-4x" style={{ color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1 grid grid-3x" style={{ color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"Profit Loss"}</span>
</div>
......@@ -350,20 +350,20 @@ export default class TableProgressReport extends Component {
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"Balance Sheet"}</span>
</div>
<div className="column-4" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"Cash Flow"}</span>
</div>
</div>
<div className="column-2 grid grid-3x" style={{ color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"Cash Flow"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"CAT"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#cc2929', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#cc2929', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"OLPA Status"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
{/* <div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"Operating Indicator"}</span>
</div>
</div> */}
</div>
</div>
</th>
......@@ -372,7 +372,7 @@ export default class TableProgressReport extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div className="grid grid-2x">
<div className="column-1 grid grid-4x" style={{ ...style2, fontSize: 12, position: "sticky" }}>
<div className="column-1 grid grid-3x" style={{ ...style2, fontSize: 12, position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<div style={{ textAlign: 'center' }}>{handleValue(tableMeta, 'Profit Loss')}</div>
</div>
......@@ -382,20 +382,20 @@ export default class TableProgressReport extends Component {
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<div style={{ textAlign: 'center' }}>{handleValue(tableMeta, 'Balance Sheet')}</div>
</div>
<div className="column-4" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<div style={{ textAlign: 'center' }}>{handleValue(tableMeta, 'Cash Flow')}</div>
</div>
</div>
<div className="column-2 grid grid-3x" style={{ ...style2, fontSize: 12, position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<div style={{ textAlign: 'center' }}>{handleValue(tableMeta, 'CAT')}</div>
<div style={{ textAlign: 'center' }}>{handleValue(tableMeta, 'Cash Flow')}</div>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<div style={{ textAlign: 'center' }}>{handleValue(tableMeta, 'OLPA Status')}</div>
<div style={{ textAlign: 'center' }}>{handleValue(tableMeta, 'CAT')}</div>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<div style={{ textAlign: 'center' }}>{handleValue(tableMeta, 'Operating Indicator')}</div>
<div style={{ textAlign: 'center' }}>{handleValue(tableMeta, 'OLPA Status')}</div>
</div>
{/* <div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<div style={{ textAlign: 'center' }}>{handleValue(tableMeta, 'Operating Indicator')}</div>
</div> */}
</div>
</div>
)
......
......@@ -374,18 +374,18 @@ export default class BalanceSheetRO extends Component {
if (response.data.status === "success") {
if (type == 'submitted') {
this.props.onClickClose()
this.props.refresh()
let bodyRatioRO = {
"report": 'ratio',
"rollingOutlookId": this.props.rollingOutlookID,
"periode": this.props.periode,
"companyId": this.props.company.company_id,
"quartal": this.props.quarter
}
api.create().triggerRatioRO(bodyRatioRO).then((res) => {
console.log(res)
this.setState({ loading: false })
})
this.props.refresh('BS')
// let bodyRatioRO = {
// "report": 'ratio',
// "rollingOutlookId": this.props.rollingOutlookID,
// "periode": this.props.periode,
// "companyId": this.props.company.company_id,
// "quartal": this.props.quarter
// }
// api.create().triggerRatioRO(bodyRatioRO).then((res) => {
// console.log(res)
// this.setState({ loading: false })
// })
} else {
this.props.onClickClose()
this.props.refresh()
......@@ -600,18 +600,18 @@ export default class BalanceSheetRO extends Component {
if (response.data.status === "success") {
if (type == 'submitted') {
this.props.onClickClose()
this.props.refresh()
let bodyRatioRO = {
"report": 'ratio',
"rollingOutlookId": this.props.rollingOutlookID,
"periode": this.props.periode,
"companyId": this.props.company.company_id,
"quartal": this.props.quarter
}
api.create().triggerRatioRO(bodyRatioRO).then((res) => {
console.log(res)
this.setState({ loading: false })
})
this.props.refresh('BS')
// let bodyRatioRO = {
// "report": 'ratio',
// "rollingOutlookId": this.props.rollingOutlookID,
// "periode": this.props.periode,
// "companyId": this.props.company.company_id,
// "quartal": this.props.quarter
// }
// api.create().triggerRatioRO(bodyRatioRO).then((res) => {
// console.log(res)
// this.setState({ loading: false })
// })
} else {
this.props.onClickClose()
this.props.refresh()
......
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