Commit 02230345 authored by r.kurnia's avatar r.kurnia

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into rifka

parents de017dec 9ee57b0f
...@@ -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
...@@ -537,7 +574,7 @@ export default class SubHolding extends Component { ...@@ -537,7 +574,7 @@ export default class SubHolding extends Component {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false }) this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
} }
}) })
} }
} }
async downloadAllData() { async downloadAllData() {
......
This diff is collapsed.
...@@ -45,7 +45,7 @@ export default class BalanceSheetMR extends Component { ...@@ -45,7 +45,7 @@ export default class BalanceSheetMR extends Component {
this.getItemHierarki() this.getItemHierarki()
} }
async getItemHierarki() { getItemHierarki() {
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
"revision": Number(this.props.revision), "revision": Number(this.props.revision),
......
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