Commit 353adf0b authored by Riri Novita's avatar Riri Novita

Merge branch 'ENV-DEV' into 'ENV-DEPLOYMENT'

simulasi dah pokoknya

See merge request !1905
parents 3eedc813 4e78b275
...@@ -508,20 +508,38 @@ const create = (type = "") => { ...@@ -508,20 +508,38 @@ const create = (type = "") => {
// const createZipReport = (body) => api.post('transaction/monthly_report/export_selected_report', body) // const createZipReport = (body) => api.post('transaction/monthly_report/export_selected_report', body)
// Simulasi upload data last year // Simulasi upload data last year
// MB
const uploadSimulasiMB = (body) => api.post('transaction/master_budget/import_master_budget/other_currency_existing', body) const uploadSimulasiMB = (body) => api.post('transaction/master_budget/import_master_budget/other_currency_existing', body)
const createReportPLMBSimulasi = (body) => api.post('/transaction/db_profit_loss/master_budget/create_submission_report/other_currency_existing', body) const createReportPLMBSimulasi = (body) => api.post('/transaction/db_profit_loss/master_budget/create_submission_report/other_currency_existing', body)
const triggerRatioMBSimulasi = (body) => api.get(`/transaction/cronjob/create_master_budget_company/other_currency/${body.report}/${body.submissionId}/${body.companyId}/${body.periode}/${body.currency_id}`) const triggerRatioMBSimulasi = (body) => api.get(`/transaction/cronjob/create_master_budget_company/other_currency/${body.report}/${body.submissionId}/${body.companyId}/${body.periode}/${body.currency_id}`)
// MR
const uploadSimulasiMRPL = (body) => api.post('transaction/profit_loss/monthly_report/import_monthly_report/other_currency_existing', body) const uploadSimulasiMRPL = (body) => api.post('transaction/profit_loss/monthly_report/import_monthly_report/other_currency_existing', body)
const uploadSimulasiMRTP = (body) => api.post('transaction/tax_planning/monthly_report/import_monthly_report/other_currency_existing', body) const uploadSimulasiMRTP = (body) => api.post('transaction/tax_planning/monthly_report/import_monthly_report/other_currency_existing', body)
const uploadSimulasiMRBS = (body) => api.post('transaction/balance_sheet/monthly_report/import_monthly_report/other_currency_existing', body) const uploadSimulasiMRBS = (body) => api.post('transaction/balance_sheet/monthly_report/import_monthly_report/other_currency_existing', body)
const uploadSimulasiMRFAM = (body) => api.post('transaction/fam/monthly_report/import_monthly_report/other_currency_existing', body) const uploadSimulasiMRFAM = (body) => api.post('transaction/fam/monthly_report/import_monthly_report/other_currency_existing', body)
const uploadSimulasiMRLOCF = (body) => api.post('transaction/locf/monthly_report/import_monthly_report//other_currency_existing', body) const uploadSimulasiMRLOCF = (body) => api.post('transaction/locf/monthly_report/import_monthly_report//other_currency_existing', body)
const uploadSimulasiMRCAT = (body) => api.post('transaction/cat/monthly_report/import_monthly_report/other_currency_existing', body) const uploadSimulasiMRCAT = (body) => api.post('transaction/cat/monthly_report/import_monthly_report/other_currency_existing', body)
const uploadSimulasiMROI = (body) => api.post('transaction/operating_indicator/monthly_report/import_monthly_report/other_currency_existing', body)
const uploadSimulasiMRCF = (body) => api.post('transaction/cash_flow/monthly_report/create_monthly_report/other_currency', body) const uploadSimulasiMRCF = (body) => api.post('transaction/cash_flow/monthly_report/create_monthly_report/other_currency', body)
const createSimulasiReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/create_monthly_report/other_currency_existing', body) const createSimulasiReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/create_monthly_report/other_currency_existing', body)
const triggerHistoricalRatioSimulasi = (body) => api.get(`/transaction/cronjob/create_historical_company/other_currency/${body.report}/${body.companyId}/${body.periode}/${body.currency_id}`) const triggerHistoricalRatioSimulasi = (body) => api.get(`/transaction/cronjob/create_historical_company/other_currency/${body.report}/${body.companyId}/${body.periode}/${body.currency_id}`)
const triggerRatioFromLOCFSimulasi = (body) => api.get(`/transaction/cronjob/create_monthly_report_company/other_currency/${body.report}/${body.monthlyReportId}/${body.companyId}/${body.months}/${body.periode}/${body.currency_id}`) const triggerRatioFromLOCFSimulasi = (body) => api.get(`/transaction/cronjob/create_monthly_report_company/other_currency/${body.report}/${body.monthlyReportId}/${body.companyId}/${body.months}/${body.periode}/${body.currency_id}`)
// RO
const uploadSimulasiROPL = (body) => api.post('transaction/profit_loss/rolling_outlook/import_rolling_outlook/other_currency_existing', body)
const uploadSimulasiROTP = (body) => api.post('transaction/tax_planning/rolling_outlook/import_rolling_outlook/other_currency_existing', body)
const uploadSimulasiROBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/import_rolling_outlook/other_currency_existing', body)
const uploadSimulasiROCAT = (body) => api.post('transaction/cat/rolling_outlook/import_rolling_outlook/other_currency_existing', body)
const createRollingOutlookCFSimulasi = (body) => api.post('transaction/cash_flow/rolling_outlook/create_rolling_outlook/other_currency_existing', body)
const createDBPLROSimulasi = (body) => api.post('transaction/db_profit_loss/rolling_outlook/create_rolling_outlook/other_currency_existing', body)
const triggerRatioROSimulasi = (body) => api.get(`/transaction/cronjob/create_rolling_outlook_company/other_currency/${body.report}/${body.rollingOutlookId}/${body.companyId}/${body.quartal}/${body.periode}/${body.currency_id}`)
// OLPA
const uploadSimulasiOLPA = (body) => api.post('transaction/outlook_pa/import_outlook_pa/other_currency_existing', body)
const createDBPLOLPASimulasi = (body) => api.post('transaction/db_profit_loss/outlook_pa/create_outlook_report/other_currency_existing', body)
const triggerRatioOLPASimulasi = (body) => api.get(`/transaction/cronjob/create_outlook_pa_company/other_currency/${body.report}/${body.outlookPaId}/${body.companyId}/${body.periode}/${body.currency_id}`)
const createSimulasiOLPACF = (body) => api.post('transaction/cash_flow/outlook_pa/create_outlook_report/other_currency', body)
// OI
const uploadSimulasiOperatingInd = (body) => api.post('transaction/operating_indicator/master_budget/import_master_budget/other_currency_existing', body)
const uploadSimulasiMROI = (body) => api.post('transaction/operating_indicator/monthly_report/import_monthly_report/other_currency_existing', body)
const uploadSimulasiROOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/import_rolling_outlook/other_currency_existing', body)
// Superadmin Approve // Superadmin Approve
const getListApprover = (report, monthlyReportId) => api.get(`transaction/${report}/get_approver/${monthlyReportId}`) const getListApprover = (report, monthlyReportId) => api.get(`transaction/${report}/get_approver/${monthlyReportId}`)
...@@ -903,7 +921,20 @@ const create = (type = "") => { ...@@ -903,7 +921,20 @@ const create = (type = "") => {
createSimulasiReportPLMR, createSimulasiReportPLMR,
triggerHistoricalRatioSimulasi, triggerHistoricalRatioSimulasi,
triggerRatioFromLOCFSimulasi, triggerRatioFromLOCFSimulasi,
uploadSimulasiMROI uploadSimulasiROPL,
uploadSimulasiROTP,
uploadSimulasiROBS,
uploadSimulasiROCAT,
createRollingOutlookCFSimulasi,
createDBPLROSimulasi,
triggerRatioROSimulasi,
uploadSimulasiOLPA,
createDBPLOLPASimulasi,
triggerRatioOLPASimulasi,
createSimulasiOLPACF,
uploadSimulasiOperatingInd,
uploadSimulasiMROI,
uploadSimulasiROOI
} }
} }
......
...@@ -401,7 +401,7 @@ export default class CreateParameter extends Component { ...@@ -401,7 +401,7 @@ export default class CreateParameter extends Component {
// "type_report_id": 3, // "type_report_id": 3,
// "report_name": "Rolling Outlook" // "report_name": "Rolling Outlook"
// }, // },
// { // {checkUpload
// "type_report_id": 4, // "type_report_id": 4,
// "report_name": "Outlook PA" // "report_name": "Outlook PA"
// }, // },
...@@ -604,6 +604,9 @@ export default class CreateParameter extends Component { ...@@ -604,6 +604,9 @@ export default class CreateParameter extends Component {
} }
updateParameter() { updateParameter() {
let char = this.state.tempData.value
let arrayChar = char.split('');
console.log(arrayChar);
let body = { let body = {
"setting_id": this.state.tempData.setting_id, "setting_id": this.state.tempData.setting_id,
"setting_group_id": this.state.getTypes.setting_group_id, "setting_group_id": this.state.getTypes.setting_group_id,
...@@ -612,17 +615,21 @@ export default class CreateParameter extends Component { ...@@ -612,17 +615,21 @@ export default class CreateParameter extends Component {
"reference_id": this.state.getReportName == null ? null : this.state.getReportName.setting_type_id, "reference_id": this.state.getReportName == null ? null : this.state.getReportName.setting_type_id,
"description": this.state.tempData.description, "description": this.state.tempData.description,
"orders": this.state.tempData.order, "orders": this.state.tempData.order,
"value": this.state.tempData.value, // "value": this.state.tempData.value,
"value": this.state.enableReportName ? this.state.tempData.value.includes(".") || arrayChar.length == 2 ? this.state.tempData.value : Number((this.state.tempData.value)/1000).toFixed(1) : this.state.tempData.value ,
"max_value": this.state.tempData.max_value, "max_value": this.state.tempData.max_value,
"min_value": this.state.tempData.min_value, "min_value": this.state.tempData.min_value,
"start_date": this.state.tempData.start_date, "start_date": this.state.tempData.start_date,
"end_date": this.state.tempData.end_date "end_date": this.state.tempData.end_date
} }
// console.log(body); console.log(body);
this.props.updateParameter(body) // this.props.updateParameter(body)
} }
createParameter() { createParameter() {
let char = this.state.value
let arrayChar = char.split('');
console.log(arrayChar);
let body = { let body = {
"setting_group_id": this.state.getTypes.setting_group_id, "setting_group_id": this.state.getTypes.setting_group_id,
"setting_type_id": this.state.getParameter.setting_type_id, "setting_type_id": this.state.getParameter.setting_type_id,
...@@ -630,14 +637,14 @@ export default class CreateParameter extends Component { ...@@ -630,14 +637,14 @@ export default class CreateParameter extends Component {
"reference_id": this.state.getReportName == null ? null : this.state.getReportName.setting_type_id, "reference_id": this.state.getReportName == null ? null : this.state.getReportName.setting_type_id,
"description": this.state.description, "description": this.state.description,
"orders": this.state.order, "orders": this.state.order,
"value": this.state.value, "value": this.state.value.includes(".") && arrayChar.length == 2 ? this.state.value : Number((this.state.value)/1000).toFixed(1) ,
"max_value": this.state.maxValue, "max_value": this.state.maxValue,
"min_value": this.state.minValue, "min_value": this.state.minValue,
"start_date": this.state.startDate, "start_date": this.state.startDate,
"end_date": this.state.endDate "end_date": this.state.endDate
} }
console.log(body); console.log(body);
this.props.createParameter(body) // this.props.createParameter(body)
} }
render() { render() {
......
...@@ -76,6 +76,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -76,6 +76,7 @@ export default class OperatingIndicatorMR extends Component {
visibleAlertSave: false visibleAlertSave: false
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
this.fileHandlerSimulasi = this.fileHandlerSimulasi.bind(this);
} }
componentDidMount() { componentDidMount() {
...@@ -427,6 +428,46 @@ export default class OperatingIndicatorMR extends Component { ...@@ -427,6 +428,46 @@ export default class OperatingIndicatorMR extends Component {
}); });
} }
fileHandlerSimulasi = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
console.log(resp)
if (err) {
// // console.log(err);
}
else {
let isi = resp.rows.slice(3)
// // console.log(isi);
let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => {
if (i.length > 0) {
payload.push({
order: i[0] === undefined ? "" : String(i[0]).trim(),
item_report_id: i[1] === undefined ? "" : String(i[1]).trim(),
item_report: i[2] === undefined ? "" : String(i[2]).trim(),
uom: i[3] === undefined ? "" : String(i[3]).trim(),
actual: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
mtd_vs_mb: i[5] === undefined ? "" : String(i[5]).trim(),
mtd_vs_rb: i[6] === undefined ? "" : String(i[6]).trim(),
})
}
})
let body = {
company_id: this.props.data.company.company_id,
periode: this.props.data.periode,
report_id: this.props.data.report_id,
months: this.props.months,
status: 'submitted',
monthly_report: payload
}
console.log(body)
console.log(JSON.stringify(body));
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
}
});
}
checkUpload() { checkUpload() {
let payload = { let payload = {
...this.state.payload, ...this.state.payload,
...@@ -497,6 +538,32 @@ export default class OperatingIndicatorMR extends Component { ...@@ -497,6 +538,32 @@ export default class OperatingIndicatorMR extends Component {
}) })
} }
uploadSimulasi() {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
this.setState({ loading: true, dataTable: [] })
console.log(payload)
api.create().uploadSimulasiMROI(payload).then(response => {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.getReport()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
} else {
this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false })
}
})
}
uploadOI(type) { uploadOI(type) {
let data = [] let data = []
// console.log(this.state.dataTable) // console.log(this.state.dataTable)
...@@ -1702,6 +1769,21 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1702,6 +1769,21 @@ export default class OperatingIndicatorMR extends Component {
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload Simulasi'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginRight: 5
}}
onClick={() => this.setState({ visibleUploadSimulasi: true, buttonDraft: true })}
>
<img src={Images.simulasiUpload} style={{ width: 40, height: 40, marginRight: 3 }} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
{this.state.get_for == 'edit' && (this.props.permission.create || this.props.permission.edit) && <a data-tip={'Download Template'} data-for="template"> {this.state.get_for == 'edit' && (this.props.permission.create || this.props.permission.edit) && <a data-tip={'Download Template'} data-for="template">
<button <button
style={{ style={{
...@@ -2057,6 +2139,47 @@ export default class OperatingIndicatorMR extends Component { ...@@ -2057,6 +2139,47 @@ export default class OperatingIndicatorMR extends Component {
</div> </div>
)} )}
{this.state.visibleUploadSimulasi && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File Simulasi</span>
</div>
</div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
<button
type="button"
className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleUploadSimulasi: false })}
>
<img src={Images.close} />
</button>
</div>
</div>
<div style={{ padding: '25px 30px' }}>
<UploadFile
type={this.state.uploadStatusSimulasi}
percentage={this.state.percentageSimulasi}
result={this.state.resultSimulasi}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandlerSimulasi(dt)
this.setState({ uploadStatusSimulasi: 'idle', percentageSimulasi: '0' })
}}
onUpload={() => {
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("MONTHLY") && String(this.state.judul).includes("REPORT") && String(this.state.judul).includes("OPERATING") && String(this.state.judul).includes("INDICATOR") ?
this.uploadSimulasi() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
/>
</div>
<div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div>
</div>
</div>
)}
{this.state.visibleAlertSave && ( {this.state.visibleAlertSave && (
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}> <div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
......
This diff is collapsed.
This diff is collapsed.
...@@ -578,7 +578,8 @@ export default class OutlookPA extends Component { ...@@ -578,7 +578,8 @@ export default class OutlookPA extends Component {
}) })
} }
getOutlookPAID(type) { getOutlookPAID(type, trigger) {
this.setState({ loading: true }) this.setState({ loading: true })
let payload = { let payload = {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
...@@ -619,7 +620,7 @@ export default class OutlookPA extends Component { ...@@ -619,7 +620,7 @@ export default class OutlookPA extends Component {
this.getLatestPeriodSubmit() this.getLatestPeriodSubmit()
if (type != undefined && type == 'PL') { if (type != undefined && type == 'PL') {
// this.getCashFlow(type) // this.getCashFlow(type)
this.getPL(type) this.getPL(type, trigger)
} else if (type != undefined && type == 'BS') { } else if (type != undefined && type == 'BS') {
let bodyRatioOLPA = { let bodyRatioOLPA = {
"report": 'ratio', "report": 'ratio',
...@@ -1005,7 +1006,7 @@ export default class OutlookPA extends Component { ...@@ -1005,7 +1006,7 @@ export default class OutlookPA extends Component {
} }
getPL(type) { getPL(type, trigger) {
let PLID = null let PLID = null
let payloadID = { let payloadID = {
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
...@@ -1115,7 +1116,7 @@ export default class OutlookPA extends Component { ...@@ -1115,7 +1116,7 @@ export default class OutlookPA extends Component {
}) })
// console.log(dataTable) // console.log(dataTable)
this.setState({ dbPL: dataTable }, () => { this.setState({ dbPL: dataTable }, () => {
this.olahDataPL(this.state.dbPL, type) this.olahDataPL(this.state.dbPL, type, trigger)
}) })
} else { } else {
this.setState({ dbPL: [], previewTable: false, previewDownload: false }) this.setState({ dbPL: [], previewTable: false, previewDownload: false })
...@@ -1354,7 +1355,7 @@ export default class OutlookPA extends Component { ...@@ -1354,7 +1355,7 @@ export default class OutlookPA extends Component {
return total return total
} }
olahDataPL(dbPL, type) { olahDataPL(dbPL, type, trigger) {
dbPL.map((item, index) => { dbPL.map((item, index) => {
if (item[0] == 5 || item[0] == 6 || item[0] == 7) { if (item[0] == 5 || item[0] == 6 || item[0] == 7) {
item[7].value = this.handleValueFormulaDBPL(index, item[7], item, 7) item[7].value = this.handleValueFormulaDBPL(index, item[7], item, 7)
...@@ -1374,11 +1375,11 @@ export default class OutlookPA extends Component { ...@@ -1374,11 +1375,11 @@ export default class OutlookPA extends Component {
} }
}) })
this.setState({ dbPL }, () => { this.setState({ dbPL }, () => {
this.payloadPL(type) this.payloadPL(type, trigger)
}) })
} }
payloadPL(type) { payloadPL(type, trigger) {
let listPL = [] let listPL = []
// console.log(this.state.dbPL) // console.log(this.state.dbPL)
this.state.dbPL.map((item, index) => { this.state.dbPL.map((item, index) => {
...@@ -1473,13 +1474,13 @@ export default class OutlookPA extends Component { ...@@ -1473,13 +1474,13 @@ export default class OutlookPA extends Component {
if (type != undefined) { if (type != undefined) {
if (type == 'PL') { if (type == 'PL') {
console.log('tarik sis') console.log('tarik sis')
this.createDBPL() this.createDBPL(trigger)
} }
} }
}) })
} }
createDBPL() { createDBPL(trigger) {
let payload = { let payload = {
// "submission_id": this.state.submissionID, // "submission_id": this.state.submissionID,
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
...@@ -1492,10 +1493,17 @@ export default class OutlookPA extends Component { ...@@ -1492,10 +1493,17 @@ export default class OutlookPA extends Component {
} }
console.log(this.state.dbPL) console.log(this.state.dbPL)
// console.log(JSON.stringify(payload)) // console.log(JSON.stringify(payload))
api.create().createDBPLOLPA(payload).then((res) => { if (trigger === 'simulasiPL') {
console.log(res) api.create().createDBPLOLPASimulasi(payload).then((res) => {
this.setState({ loading: false }) console.log(res)
}) this.setState({ loading: false })
})
} else {
api.create().createDBPLOLPA(payload).then((res) => {
console.log(res)
this.setState({ loading: false })
})
}
} }
handleApproveAdmin() { handleApproveAdmin() {
......
This diff is collapsed.
This diff is collapsed.
...@@ -633,7 +633,7 @@ export default class BalanceSheetRO extends Component { ...@@ -633,7 +633,7 @@ export default class BalanceSheetRO extends Component {
} }
this.setState({ loading: true, dataTable: [] }) this.setState({ loading: true, dataTable: [] })
console.log(payload) console.log(payload)
api.create().uploadMBSimulasi(payload).then(response => { api.create().uploadSimulasiROBS(payload).then(response => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
......
...@@ -355,8 +355,36 @@ export default class CashFlow extends Component { ...@@ -355,8 +355,36 @@ export default class CashFlow extends Component {
} }
console.log(dbcf) console.log(dbcf)
console.log(JSON.stringify(payload)) console.log(JSON.stringify(payload))
if (trigger === "simulasi") { if (trigger === 'simulasi') {
api.create().createRollingOutlookCFSimulasi(payload).then(response => {
console.log(payload);
console.log(response);
// console.log(JSON.stringify(payload))
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.refresh()
} else {
if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true, loading: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
document.body.style.overflow = 'unset';
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
this.props.onClickClose()
this.props.refresh()
})
}
}
} else {
this.setState({ loading: false, handleDoubleClick: 0 })
}
})
} else { } else {
api.create().createRollingOutlookCF(payload).then(response => { api.create().createRollingOutlookCF(payload).then(response => {
console.log(payload); console.log(payload);
...@@ -2221,8 +2249,31 @@ export default class CashFlow extends Component { ...@@ -2221,8 +2249,31 @@ export default class CashFlow extends Component {
</div> </div>
</button> </button>
</div> </div>
{this.state.viewOnly && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<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.state.viewOnly &&
<button <button
type="button" type="button"
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
...@@ -2232,7 +2283,7 @@ export default class CashFlow extends Component { ...@@ -2232,7 +2283,7 @@ export default class CashFlow extends Component {
// : // :
this.state.handleDoubleClick == 1 ? null : this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => { this.setState({ handleDoubleClick: 1 }, () => {
this.olahDataCashFlow(dataTable2, "simulasi") this.olahDataCashFlow(dataTable2)
})} })}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -2245,8 +2296,8 @@ export default class CashFlow extends Component { ...@@ -2245,8 +2296,8 @@ export default class CashFlow extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div> </div>
</button> </button>
</div> }
} </div>
{this.state.visibleAlertSave && ( {this.state.visibleAlertSave && (
<div className="test app-popup-show"> <div className="test app-popup-show">
......
...@@ -662,7 +662,7 @@ export default class CorporateAnnualTargetRO extends Component { ...@@ -662,7 +662,7 @@ export default class CorporateAnnualTargetRO extends Component {
} }
this.setState({ loading: true, dataTable: [] }) this.setState({ loading: true, dataTable: [] })
console.log(payload) console.log(payload)
api.create().uploadMBSimulasi(payload).then(response => { api.create().uploadSimulasiROCAT(payload).then(response => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
......
...@@ -598,7 +598,7 @@ export default class ProfitLossROO extends Component { ...@@ -598,7 +598,7 @@ export default class ProfitLossROO extends Component {
} }
this.setState({ loading: true, dataTable: [] }) this.setState({ loading: true, dataTable: [] })
console.log(payload) console.log(payload)
api.create().uploadMBSimulasi(payload).then(response => { api.create().uploadSimulasiROPL(payload).then(response => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
...@@ -2415,7 +2415,7 @@ export default class ProfitLossROO extends Component { ...@@ -2415,7 +2415,7 @@ export default class ProfitLossROO extends Component {
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 15
}} }}
onClick={() => this.setState({ visibleUploadSimulasi: true, buttonDraft: true })} onClick={() => this.setState({ visibleUploadSimulasi: true, buttonDraft: true })}
> >
......
...@@ -663,10 +663,17 @@ export default class RollingOutlook extends Component { ...@@ -663,10 +663,17 @@ export default class RollingOutlook extends Component {
"quartal": this.state.quarter.value, "quartal": this.state.quarter.value,
"currency_id": this.state.defaultCurrency.id "currency_id": this.state.defaultCurrency.id
} }
api.create().triggerRatioRO(bodyRatioBs).then((res) => { if (trigger === "simulasiPL") {
console.log(res) api.create().triggerRatioROSimulasi(bodyRatioBs).then((res) => {
this.setState({ loading: false }) console.log(res)
}) this.setState({ loading: false })
})
} else {
api.create().triggerRatioRO(bodyRatioBs).then((res) => {
console.log(res)
this.setState({ loading: false })
})
}
} else { } else {
this.setState({ loading: false }) this.setState({ loading: false })
} }
...@@ -1507,7 +1514,10 @@ export default class RollingOutlook extends Component { ...@@ -1507,7 +1514,10 @@ export default class RollingOutlook extends Component {
console.log(this.state.dbPL) console.log(this.state.dbPL)
// console.log(JSON.stringify(payload)) // console.log(JSON.stringify(payload))
if (trigger === 'simulasiPL') { if (trigger === 'simulasiPL') {
api.create().createDBPLROSimulasi(payload).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else { } else {
api.create().createDBPLRO(payload).then((res) => { api.create().createDBPLRO(payload).then((res) => {
console.log(res) console.log(res)
......
...@@ -762,7 +762,7 @@ export default class TaxPlanning extends Component { ...@@ -762,7 +762,7 @@ export default class TaxPlanning extends Component {
} }
this.setState({ loading: true, dataTable: [] }) this.setState({ loading: true, dataTable: [] })
console.log(payload) console.log(payload)
api.create().uploadMBSimulasi(payload).then(response => { api.create().uploadSimulasiROTP(payload).then(response => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
......
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