Commit b8170583 authored by Riri Novita's avatar Riri Novita

Merge branch 'dev/riri' into 'ENV-DEV'

Rollback Code MB Simulasi

See merge request !1924
parents 70228d62 fe5af8aa
This diff is collapsed.
......@@ -614,8 +614,7 @@ export default class BudgetTahunan extends Component {
})
}
getSubmission(type, trigger) {
console.log(trigger);
getSubmission(type) {
this.setState({ loading: true }, () => {
document.body.style.overflow = 'hidden';
})
......@@ -668,22 +667,8 @@ export default class BudgetTahunan extends Component {
}
if (type != undefined && type == 'PL') {
// this.getCashFlow(type)
this.getPL(type, trigger)
this.getPL(type)
} else if (type != undefined && type == 'BS') {
if (trigger === 'simulasiBS') {
let bodyRatioBs = {
"report": 'ratio',
"submissionId": this.state.submissionID,
"periode": this.state.periode.periode,
"companyId": this.state.company.company_id,
"currency_id": this.state.defaultCurrency.id,
}
// console.log(bodyRatioBs);
api.create().triggerRatioMBSimulasi(bodyRatioBs).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else {
let bodyRatioBs = {
"report": 'ratio',
"submissionId": this.state.submissionID,
......@@ -696,7 +681,6 @@ export default class BudgetTahunan extends Component {
console.log(res)
this.setState({ loading: false })
})
}
} else {
this.setState({ loading: false })
}
......@@ -1320,26 +1304,7 @@ export default class BudgetTahunan extends Component {
})
}
createCashFlow(payload, trigger) {
console.log(trigger);
if (trigger === "simulasi") {
api.create().createReportCFSimulasi(payload).then((res) => {
console.log(res)
// this.getSubmission()
if (res.data) {
if (res.data.status === "success") {
this.setState({ visibleCF: false, visibleBudgetTahunan: true })
this.getSubmission()
} else {
if (res.data.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true })
} else {
this.setState({ alert: true, messageAlert: res.data.message, tipeAlert: 'warning', loading: false })
}
}
}
})
} else {
createCashFlow(payload) {
api.create().createReportCF(payload).then((res) => {
console.log(res)
// this.getSubmission()
......@@ -1371,9 +1336,8 @@ export default class BudgetTahunan extends Component {
// }
})
}
}
getPL(type, trigger) {
getPL(type) {
let PLID = null
let payloadID = {
"periode": this.state.periode.periode,
......@@ -1484,7 +1448,7 @@ export default class BudgetTahunan extends Component {
})
// console.log(dataTable)
this.setState({ dbPL: dataTable }, () => {
this.olahDataPL(this.state.dbPL, type, trigger)
this.olahDataPL(this.state.dbPL, type)
})
} else {
this.setState({ dbPL: [], previewTable: false, previewDownload: false })
......@@ -1723,7 +1687,7 @@ export default class BudgetTahunan extends Component {
return total
}
olahDataPL(dbPL, type, trigger) {
olahDataPL(dbPL, type) {
dbPL.map((item, index) => {
if (item[0] == 5 || item[0] == 6 || item[0] == 7) {
item[7].value = this.handleValueFormulaDBPL(index, item[7], item, 7)
......@@ -1743,11 +1707,11 @@ export default class BudgetTahunan extends Component {
}
})
this.setState({ dbPL }, () => {
this.payloadPL(type, trigger)
this.payloadPL(type)
})
}
payloadPL(type, trigger) {
payloadPL(type) {
let listPL = []
// console.log(this.state.dbPL)
this.state.dbPL.map((item, index) => {
......@@ -1842,14 +1806,13 @@ export default class BudgetTahunan extends Component {
if (type != undefined) {
if (type == 'PL') {
// console.log('tarik sis')
this.createDBPL(trigger)
this.createDBPL()
}
}
})
}
createDBPL(trigger) {
console.log(trigger);
createDBPL() {
let payload = {
// "submission_id": this.state.submissionID,
"company_id": this.state.company.company_id,
......@@ -1863,12 +1826,6 @@ export default class BudgetTahunan extends Component {
}
// console.log(this.state.dbCF)
// console.log(JSON.stringify(payload))
if (trigger === "simulasiPL") {
api.create().createReportPLMBSimulasi(payload).then((res) => {
// console.log(res)
this.setState({ loading: false })
})
} else {
api.create().createReportPLMB(payload).then((res) => {
// console.log(res)
this.setState({ loading: false })
......@@ -1888,7 +1845,6 @@ export default class BudgetTahunan extends Component {
// }
})
}
}
getFR(type) {
// console.log("get FR");
......
......@@ -336,7 +336,7 @@ export default class CashFlow extends Component {
this.setState({ alert: false })
}
olahDataCashFlow(dataTable2, trigger) {
olahDataCashFlow(dataTable2) {
console.log(dataTable2)
let listCF = []
dataTable2.map((item, index) => {
......@@ -373,10 +373,10 @@ export default class CashFlow extends Component {
})
console.log(listCF)
this.createCashFlow(listCF, trigger)
this.createCashFlow(listCF)
}
createCashFlow(dbcf, trigger) {
createCashFlow(dbcf) {
let payload = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
......@@ -388,7 +388,7 @@ export default class CashFlow extends Component {
}
console.log(dbcf)
console.log(JSON.stringify(payload))
this.props.createCashFlow(payload, trigger)
this.props.createCashFlow(payload)
// this.props.onClickClose()
}
......@@ -3340,29 +3340,6 @@ export default class CashFlow extends Component {
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
// this.state.buttonError ?
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
// :
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.olahDataCashFlow(dataTable2, "simulasi")
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 15
}}
>
<div style={{ backgroundColor: '#cd5c5c', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save Data Simulasi</Typography>
</div>
</button>
{this.props.isApprover === true || dataTable2.length == 0 ? null :
(!this.props.truelyApprover) && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ?
<button
......
This diff is collapsed.
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