Commit c4c8f448 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

bs

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