Commit 9ee57b0f authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-' into 'master'

fixing revisi sub holding

See merge request !639
parents 961ff3f3 86bad43e
......@@ -149,7 +149,8 @@ export default class SubHolding extends Component {
// console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
// this.getDataTable()
this.getSubmission()
// this.getSubmission()
this.getReportType()
// if (this.state.isApprover === true) {
// this.getCompanySubmitted()
// } else {
......@@ -161,6 +162,42 @@ export default class SubHolding extends Component {
})
}
getReportType() {
let payload = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
"report_type": "Master Budget",
}
api.create().getReportTypeBody(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
if (this.state.report.value === 2) {
response.data.data.map((item, index) => {
if (item.report_name === 'Balance Sheet') {
this.setState({ revisionType: item.revision }, ()=> {
this.getSubmission()
})
}
})
} else if (this.state.report.value === 1) {
response.data.data.map((item, index) => {
if (item.report_name === 'Profit Loss') {
this.setState({ revisionType: item.revision }, ()=> {
this.getSubmission()
})
}
})
} else {
this.setState({ revisionType: 0 }, ()=> {
this.getSubmission()
})
}
}
}
})
}
getSubmission() {
this.setState({ loading: true })
let payload = {
......@@ -169,7 +206,7 @@ export default class SubHolding extends Component {
"is_approver": true
}
api.create().getSubmission(payload).then(response => {
// console.log(response)
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
......@@ -188,7 +225,7 @@ export default class SubHolding extends Component {
getDataTable() {
let payload = {
"report_id": this.state.report.value,
"revision": this.state.lastRevision,
"revision": this.state.revisionType,
"periode": this.state.periode.periode,
"company_id": this.state.company.company_id,
"submission_id": this.state.submissionID
......@@ -537,7 +574,7 @@ export default class SubHolding extends Component {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
}
}
async downloadAllData() {
......
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