Commit 1bb99888 authored by Riri Novita's avatar Riri Novita

save oi

parent 784dbe20
......@@ -269,6 +269,7 @@ const create = (type = "") => {
const createMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/create_monthly_report', body)
const createMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/create_monthly_report', body)
const createMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/create_monthly_report', body)
const createMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/create_monthly_report', body)
const checkUploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/check_import', body)
......@@ -410,6 +411,7 @@ const create = (type = "") => {
createMonthlyReportTP,
createMonthlyReportPL,
createMonthlyReportFAM,
createMonthlyReportOI,
getSubmission,
checkUploadMB,
getAllOperatingInd,
......
......@@ -158,6 +158,53 @@ export default class OperatingIndicatorMR extends Component {
}
}
backToMonthlyReport(type) {
// console.log(this.state.dataTable);
let data = []
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[1],
"uom": i[6],
"rolling_outlook": i[7],
"master_budget": i[8],
"rolling_budget": i[9],
"actual": i[10],
"amount_act_vs_mb": i[11],
"percent_act_vs_mb": i[12],
"amount_act_vs_rb": i[13],
"percent_act_vs_rb": i[14],
"mtd_vs_mb": i[15],
"mtd_vs_rb": i[16]
})
})
let payload = {
"monthly_report_id": this.props.submissionID,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": type,
"months": this.props.month.month_id,
"operating_indicator": data
}
api.create('UPLOAD').createMonthlyReportOI(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.props.saveToMonthlyReport()
} else {
this.setState({ loading: false }, () => {
this.props.saveToMonthlyReport()
})
}
} else {
this.setState({ loading: false }, () => {
this.getSubmission()
document.body.style.overflow = 'unset';
})
}
})
}
render() {
let dataTable2 = this.state.dataTable
const handleValue = (data, type) => {
......
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