Commit ca744adf authored by Deni Rinaldi's avatar Deni Rinaldi

bs

parent d4cfa24a
......@@ -220,7 +220,6 @@ export default class BudgetTahunan extends Component {
let index = data.sort((a, b) => a - b).findIndex((val) => val === year)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
this.getRevision()
this.getSubmission()
})
}
}
......@@ -247,8 +246,7 @@ export default class BudgetTahunan extends Component {
getOptionLabel: (option) => option.revision,
};
this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => {
this.getReport()
this.getReportAttachment()
this.getSubmission()
})
}
}
......@@ -256,6 +254,7 @@ export default class BudgetTahunan extends Component {
}
getSubmission() {
this.setState({ loading: true })
let payload = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
......@@ -264,20 +263,20 @@ export default class BudgetTahunan extends Component {
api.create().getSubmission(payload).then(response => {
console.log(response)
if (response) {
if (response.data.data) {
if (response.data.status === "success") {
this.setState({
submissionID: response.data.data.submission_id, isSubmit: false,
submitter: response.data.data.submitter,
approverID: response.data.data.approve_id, pic: response.data.data.approver == null ? '' : response.data.data.approver,
lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status
lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status,
loading: false
}, () => {
this.setState({ loading: false })
this.historyApproval()
this.getReport()
this.getReportAttachment()
})
} else {
this.setState({ submissionID: null })
this.setState({ submissionID: null, loading: null })
}
}
})
......@@ -306,7 +305,6 @@ export default class BudgetTahunan extends Component {
}
approvalSubmission(type) {
this.setState({ loading: true })
let body = {
"approval_id": this.props.location.state == undefined ? this.state.approverID : this.state.rawData.approval_id,
"status": type,
......@@ -456,7 +454,7 @@ export default class BudgetTahunan extends Component {
})
}
} else {
this.setState({ loading: false }, ()=> {
this.setState({ loading: false }, () => {
this.getSubmission()
})
}
......@@ -742,9 +740,8 @@ export default class BudgetTahunan extends Component {
{...this.state.listPeriode}
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
this.setState({ visibleTableHistory: false, loading: true })
this.setState({ visibleTableHistory: false })
this.getRevision()
this.getSubmission()
})}
disabled={this.state.intent === 'Home' ? true : false}
disableClearable
......@@ -761,9 +758,8 @@ export default class BudgetTahunan extends Component {
id="company"
disabled={this.state.intent === 'Home' ? true : false}
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.setState({ visibleTableHistory: false, loading: true })
this.setState({ visibleTableHistory: false })
this.getRevision()
this.getSubmission()
})}
disableClearable
style={{ width: 250 }}
......
This diff is collapsed.
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