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

cek

parent 48608d55
......@@ -862,10 +862,12 @@ export default class ListOfCreditFacilities extends Component {
}
uploadLOCF(type) {
console.log("masoook");
let dataTable2 = this.state.dataTablelocf == undefined || this.state.tambah == 'tambah' || this.state.tambah == 'upload' ? this.state.dataTableLOCF : this.state.dataTablelocf
let data = []
let error = false
this.deleteReport()
this.state.dataTable.map(i => {
this.state.dataTable2.map(i => {
if (i[0] == 3) {
if (i[6] == null || i[7] == null || i[8] == "" || i[9] == "" || i[10] == "" || i[11] == "") {
error = true
......@@ -989,42 +991,43 @@ export default class ListOfCreditFacilities extends Component {
"diff": this.state.diff,
"total_loan": this.state.perBS
}
console.log(JSON.stringify(body));
if (error && type == 'submitted') {
this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loading: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
} else {
api.create('UPLOAD').uploadMonthlyReportLOCF(body).then(response => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
this.props.saveToMonthlyReport('LOCF')
// this.props.onClickClose()
// this.props.getReport()
} else {
if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
// alert(response.data.status)
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
}
this.setState({ handleDoubleClick: 0 })
})
}
console.log(body);
// if (error && type == 'submitted') {
// this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loading: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
// } else {
// api.create('UPLOAD').uploadMonthlyReportLOCF(body).then(response => {
// console.log(response);
// if (response.data) {
// if (response.ok) {
// if (response.data.status === "success") {
// this.props.saveToMonthlyReport('LOCF')
// // this.props.onClickClose()
// // this.props.getReport()
// } else {
// if (response.data?.message == "Please Set Up Rate Currency First") {
// this.setState({ visibleAlertSave: true })
// } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
// if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
// setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN)
// window.location.reload();
// }, 1000);
// }
// })
// }
// // alert(response.data.status)
// }
// } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
// }
// this.setState({ handleDoubleClick: 0 })
// })
// }
}
// handleCalculateLOV = () => {
......
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