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 { ...@@ -149,7 +149,8 @@ export default class SubHolding extends Component {
// console.log(index) // console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
// this.getDataTable() // this.getDataTable()
this.getSubmission() // this.getSubmission()
this.getReportType()
// if (this.state.isApprover === true) { // if (this.state.isApprover === true) {
// this.getCompanySubmitted() // this.getCompanySubmitted()
// } else { // } else {
...@@ -161,6 +162,42 @@ export default class SubHolding extends Component { ...@@ -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() { getSubmission() {
this.setState({ loading: true }) this.setState({ loading: true })
let payload = { let payload = {
...@@ -169,7 +206,7 @@ export default class SubHolding extends Component { ...@@ -169,7 +206,7 @@ export default class SubHolding extends Component {
"is_approver": true "is_approver": true
} }
api.create().getSubmission(payload).then(response => { api.create().getSubmission(payload).then(response => {
// console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
...@@ -188,7 +225,7 @@ export default class SubHolding extends Component { ...@@ -188,7 +225,7 @@ export default class SubHolding extends Component {
getDataTable() { getDataTable() {
let payload = { let payload = {
"report_id": this.state.report.value, "report_id": this.state.report.value,
"revision": this.state.lastRevision, "revision": this.state.revisionType,
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"submission_id": this.state.submissionID "submission_id": this.state.submissionID
......
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