Commit 29774163 authored by Deni Rinaldi's avatar Deni Rinaldi

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

++

See merge request !463
parents 9278f9ea 84c32c50
......@@ -218,6 +218,18 @@ const create = (type = "") => {
const getDashboard = (body) => api.get('transaction/get_dashboard')
const historyApproval = (body) => api.post('transaction/master_budget/history_approval', body)
//OUTLOOK PA
const getOutlookPAID = (body) => api.post('transaction/outlook_pa/get_outlook_pa_id', body)
const getLastPeriodOLPA = (idCompany) => api.get(`/transaction/outlook_pa/get_last_periode/${idCompany}`)
const getCompanySubmittedOLPA = (body) => api.post('transaction/outlook_pa/get_company_submitted', body)
const getRevisionOLPA = (body) => api.post('transaction/outlook_pa/get_revision', body)
const historyApprovalOLPA = (body) => api.post('transaction/outlook_pa/history_approval', body)
const getSubmitOLPA = (body) => api.post('transaction/outlook_pa/get_latest_periode_submit', body)
const getOLPAAtt = (body) => api.post('transaction/outlook_pa/get_report_attachment', body)
const submitOLPA = (body) => api.post('transaction/outlook_pa/submit_outlook_pa', body)
const getLastestUpdateOLPA = (body) => api.post('transaction/outlook_pa/get_latest_update', body)
const createReportOLPA = (body) => api.post('transaction/outlook_pa/create_outlook_report', body)
//Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
......@@ -373,7 +385,17 @@ const create = (type = "") => {
getCompanySubmitted,
getLastPeriod,
getSubmitMasterBudget,
createPeriodeRevision
createPeriodeRevision,
getOutlookPAID,
getLastPeriodOLPA,
getCompanySubmittedOLPA,
getRevisionOLPA,
historyApprovalOLPA,
getSubmitOLPA,
getOLPAAtt,
submitOLPA,
getLastestUpdateOLPA,
createReportOLPA
}
}
......
......@@ -43,7 +43,7 @@ export default class OutlookPA extends Component {
alert: false,
tipeAlert: '',
messageAlert: '',
submissionID: null,
outlook_pa_id: null,
isSubmit: false,
visibleTableHistory: false,
isApprover: false,
......@@ -91,7 +91,7 @@ export default class OutlookPA extends Component {
let body = {
"periode": this.state.periode.periode
}
api.create().getCompanySubmitted(body).then(response => {
api.create().getCompanySubmittedOLPA(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === 'success') {
......@@ -138,7 +138,7 @@ export default class OutlookPA extends Component {
"periode": this.state.periode.periode,
"revision": this.state.revision.revision,
}
api.create().getMasterBudgetAtt(payload).then(response => {
api.create().getOLPAAtt(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
......@@ -191,7 +191,7 @@ export default class OutlookPA extends Component {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode
}
api.create().getSubmitMasterBudget(body).then(response => {
api.create().getSubmitOLPA(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
......@@ -266,7 +266,7 @@ export default class OutlookPA extends Component {
}
getLastPeriod() {
api.create().getLastPeriod(this.state.company.company_id).then(response => {
api.create().getLastPeriodOLPA(this.state.company.company_id).then(response => {
console.log(response);
if (response.data.status === "success") {
this.setState({ lastPeriod: response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => {
......@@ -342,26 +342,26 @@ export default class OutlookPA extends Component {
getOptionLabel: (option) => option.revision,
};
this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => {
this.getSubmission()
this.getOutlookPAID()
})
}
}
})
}
getSubmission() {
getOutlookPAID() {
this.setState({ loading: true })
let payload = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
"is_approver": this.state.isApprover
}
api.create().getSubmission(payload).then(response => {
api.create().getOutlookPAID(payload).then(response => {
console.log(response)
if (response) {
if (response.data.status === "success") {
this.setState({
submissionID: response.data.data.submission_id,
outlook_pa_id: response.data.data.outlook_pa_id,
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,
......@@ -382,7 +382,7 @@ export default class OutlookPA extends Component {
})
})
} else {
this.setState({ submissionID: null, loading: false })
this.setState({ outlook_pa_id: null, loading: false })
}
}
})
......@@ -393,7 +393,7 @@ export default class OutlookPA extends Component {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode
}
api.create().historyApproval(body).then(response => {
api.create().historyApprovalOLPA(body).then(response => {
console.log(response);
if (response.data.data.length > 0) {
let dataTableHistory = response.data.data.map(item => {
......@@ -420,7 +420,7 @@ export default class OutlookPA extends Component {
api.create().approvalSubmission(body).then((res) => {
console.log(res)
this.setState({ loading: false }, () => {
this.getSubmission()
this.getOutlookPAID()
})
})
}
......@@ -496,7 +496,7 @@ export default class OutlookPA extends Component {
if (response.data) {
if (response.data.status === "success") {
this.setState({ visibleUpload: false }, () => {
this.getSubmission()
this.getOutlookPAID()
})
}
}
......@@ -507,7 +507,7 @@ export default class OutlookPA extends Component {
api.create().deleteAttachment(item.attachment_id).then(response => {
if (response.data) {
if (response.data.status === "success") {
this.getSubmission()
this.getOutlookPAID()
}
}
})
......@@ -517,22 +517,22 @@ export default class OutlookPA extends Component {
this.setState({ alert: false })
}
saveToMasterBudget(data) {
saveToOLPA(data) {
this.setState({ loading: true })
// console.log(JSON.stringify(data));
api.create('UPLOAD').createSubmitReport(data).then(response => {
api.create('UPLOAD').createReportOLPA(data).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.getSubmission()
this.getOutlookPAID()
} else {
this.setState({ loading: false }, () => {
this.getSubmission()
this.getOutlookPAID()
})
}
} else {
this.setState({ loading: false }, () => {
this.getSubmission()
this.getOutlookPAID()
})
}
})
......@@ -577,13 +577,13 @@ export default class OutlookPA extends Component {
})
if (canSubmit === true) {
let body = {
submission_id: this.state.submissionID
outlook_pa_id: this.state.outlook_pa_id
}
api.create().submitMasterBudget(body).then(response => {
api.create().submitOLPA(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "Success") {
this.getSubmission()
this.getOutlookPAID()
}
}
})
......@@ -1147,10 +1147,10 @@ export default class OutlookPA extends Component {
company={this.state.company}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
submissionID={this.state.submissionID}
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
outlook_pa_id={this.state.outlook_pa_id}
saveToOLPA={this.saveToOLPA.bind(this)}
onClickClose={() => this.setState({ visibleBS: false, visibleOutlookPA: true })}
getReport={this.getSubmission.bind(this)}
getReport={this.getOutlookPAID.bind(this)}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision}
......@@ -1166,10 +1166,10 @@ export default class OutlookPA extends Component {
company={this.state.company}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
submissionID={this.state.submissionID}
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
outlook_pa_id={this.state.outlook_pa_id}
saveToOLPA={this.saveToOLPA.bind(this)}
onClickClose={() => this.setState({ visiblePL: false, visibleOutlookPA: true })}
getReport={this.getSubmission.bind(this)}
getReport={this.getOutlookPAID.bind(this)}
status={this.state.status}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
......@@ -1186,10 +1186,10 @@ export default class OutlookPA extends Component {
company={this.state.company}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
submissionID={this.state.submissionID}
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
outlook_pa_id={this.state.outlook_pa_id}
saveToOLPA={this.saveToOLPA.bind(this)}
onClickClose={() => this.setState({ visibleTP: false, visibleOutlookPA: true })}
getReport={this.getSubmission.bind(this)}
getReport={this.getOutlookPAID.bind(this)}
status={this.state.status}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
......
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