Commit 6150d3b8 authored by Riri Novita's avatar Riri Novita

update

parent aa37ad95
......@@ -72,6 +72,8 @@ export default class OperatingIndicatorMR extends Component {
alert: false,
tipeAlert: '',
messageAlert: '',
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.fileHandler = this.fileHandler.bind(this);
}
......
......@@ -1881,7 +1881,8 @@ export default class SubHolding extends Component {
"company_id": this.state.company.company_id,
"operating_indicator_id": this.state.OPID,
"periode": this.state.periode.periode,
"report_id": 21
"report_id": 21,
"currency_id": this.state.defaultCurrency.id
}
api.create().getAllReportOI(payloadOI).then(response => {
......
......@@ -57,7 +57,9 @@ export default class BalanceSheetRO extends Component {
messageAlert: '',
visibleUpload: false,
visibleBSRO: true,
kansas: 0
kansas: 0,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
}
......@@ -186,7 +188,8 @@ export default class BalanceSheetRO extends Component {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"quartal": this.props.quarter,
"rolling_outlook_id": this.props.rollingOutlookID
"rolling_outlook_id": this.props.rollingOutlookID,
"currency_id": this.props.defaultCurrency.id
}
api.create().getRollingOutlookBS(payload).then(response => {
// console.log(response);
......@@ -364,6 +367,7 @@ export default class BalanceSheetRO extends Component {
"report_id": this.props.report_id,
"quartal": this.props.quarter,
"status": type,
"currency_id": this.props.defaultCurrency.id,
"balance_sheet": data
}
api.create('UPLOAD').createRollingOutlookBS(payload).then(response => {
......@@ -391,17 +395,21 @@ export default class BalanceSheetRO extends Component {
this.props.refresh()
}
} 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()
})
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 }, () => {
......@@ -508,7 +516,11 @@ export default class BalanceSheetRO extends Component {
}
checkUpload() {
api.create().checkImportRollingOutlookBS(this.state.payload).then(response => {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkImportRollingOutlookBS(payload).then(response => {
this.props.refresh()
if (response.data) {
if (response.data.status === 'success') {
......@@ -547,13 +559,13 @@ export default class BalanceSheetRO extends Component {
item.forecast_formula == null ? [] : item.forecast_formula
]
})
console.log(dataTable)
console.log(dataTable)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: true, isUpload: true }, () => {
// this.state.dataTable.map(item => {
// if (item[24].length > 0) {
// // console.log('masuk')
// this.setState({ buttonError: true, errorPreview: true })
// }
// if (item[24].length > 0) {
// // console.log('masuk')
// this.setState({ buttonError: true, errorPreview: true })
// }
// })
// console.log(this.state.buttonError)
})
......@@ -590,6 +602,7 @@ export default class BalanceSheetRO extends Component {
"report_id": this.props.report_id,
"quartal": this.props.quarter,
"status": type,
"currency_id": this.state.defaultCurrencyUpload?.id,
"balance_sheet": data
}
api.create('UPLOAD').importRollingOutlookBS(payload).then(response => {
......@@ -617,11 +630,15 @@ export default class BalanceSheetRO extends Component {
this.props.refresh()
}
} else {
this.setState({ loading: false, handleDoubleClick: 0 }, () => {
// this.props.saveToMonthlyReport()
this.props.onClickClose()
this.props.refresh()
})
if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true, loading: false })
} else {
this.setState({ loading: false, handleDoubleClick: 0 }, () => {
// this.props.saveToMonthlyReport()
this.props.onClickClose()
this.props.refresh()
})
}
}
} else {
this.setState({ loading: false, handleDoubleClick: 0 })
......@@ -2508,7 +2525,11 @@ export default class BalanceSheetRO extends Component {
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true || this.state.get_for == 'view' ?
......@@ -2751,7 +2772,11 @@ export default class BalanceSheetRO extends Component {
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div style={{ width: '50%' }} />
{/* </div> */}
......@@ -2889,21 +2914,60 @@ export default class BalanceSheetRO extends Component {
</button>
</div>
</div>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("BALANCE") && String(this.state.judul).includes("SHEET") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
/>
<div style={{ padding: '25px 30px' }}>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("BALANCE") && String(this.state.judul).includes("SHEET") ?
this.checkUpload() :
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 && (
<div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
<div style={{ margin: 30 }}>
<div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
<div style={{ alignSelf: 'center', marginRight: 25 }}>
<img src={Images.warning} />
</div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
<b>Rate Currency USD</b> pada periode yang dipilih <b>belum</b> diatur.<br /> Silahkan menghubungi Superadmin
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button
className="button"
type="button"
style={{
background: '#F6F7F9',
cursor: 'pointer',
border: '1px solid #3549609e',
outline: 'none',
marginRight: 20,
borderRadius: 9
}}
onClick={() => this.setState({ visibleAlertSave: false, handleDoubleClick: 0 })}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
<Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
</div>
</button>
</div>
</div>
</div>
</div>
)}
......
......@@ -44,6 +44,9 @@ export default class CashFlow extends Component {
maxValue: "0",
handleDoubleClick: 0,
viewOnly: true,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
}
......@@ -142,7 +145,8 @@ export default class CashFlow extends Component {
"periode": this.props.periode,
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"rolling_outlook_id": this.props.rollingOutlookID
"rolling_outlook_id": this.props.rollingOutlookID,
"currency_id": this.props.defaultCurrency.id
}
api.create().getRollingOutlookCF(payload).then(response => {
let dataTable = []
......@@ -346,6 +350,7 @@ export default class CashFlow extends Component {
"report_id": this.props.report_id,
"status": "submitted",
"quartal": this.props.quarter,
"currency_id": this.props.defaultCurrency.id,
"cash_flow": dbcf
}
console.log(dbcf)
......@@ -359,17 +364,21 @@ export default class CashFlow extends Component {
this.props.onClickClose()
this.props.refresh()
} 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()
})
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 }, () => {
......@@ -2146,7 +2155,11 @@ export default class CashFlow extends Component {
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
{/* <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
......@@ -2230,6 +2243,42 @@ export default class CashFlow extends Component {
</button>
</div>
}
{this.state.visibleAlertSave && (
<div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
<div style={{ margin: 30 }}>
<div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
<div style={{ alignSelf: 'center', marginRight: 25 }}>
<img src={Images.warning} />
</div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
<b>Rate Currency USD</b> pada periode yang dipilih <b>belum</b> diatur.<br /> Silahkan menghubungi Superadmin
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button
className="button"
type="button"
style={{
background: '#F6F7F9',
cursor: 'pointer',
border: '1px solid #3549609e',
outline: 'none',
marginRight: 20,
borderRadius: 9
}}
onClick={() => this.setState({ visibleAlertSave: false, handleDoubleClick: 0 })}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
<Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
</div>
</button>
</div>
</div>
</div>
</div>
)}
</div>
</div>
</Paper>
......
......@@ -72,7 +72,8 @@ export default class CorporateAnnualTargetRO extends Component {
editable: false,
get_for: 'view',
viewOnly: true,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -127,6 +128,7 @@ export default class CorporateAnnualTargetRO extends Component {
"periode": this.props.periode,
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"currency_id": this.props.defaultCurrency.id,
"rolling_outlook_id": this.props.rollingOutlookID
}
console.log(payload);
......@@ -426,6 +428,7 @@ export default class CorporateAnnualTargetRO extends Component {
"periode": this.props.periode,
"report_id": this.props.report_id,
"quartal": this.props.quarter,
"currency_id": this.props.defaultCurrency.id,
"status": type,
"cat": data
}
......@@ -439,17 +442,21 @@ export default class CorporateAnnualTargetRO extends Component {
this.props.onClickClose()
this.props.refresh()
} 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()
})
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, 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 }, () => {
......@@ -519,7 +526,11 @@ export default class CorporateAnnualTargetRO extends Component {
checkUpload() {
this.setState({ loading: true, dataTable: [] })
api.create().checkImportRollingOutlookCAT(this.state.payload).then(response => {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkImportRollingOutlookCAT(payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
......@@ -638,6 +649,7 @@ export default class CorporateAnnualTargetRO extends Component {
"periode": this.props.periode,
"report_id": this.props.report_id,
"quartal": this.props.quarter,
"currency_id": this.state.defaultCurrencyUpload?.id,
"status": type,
"cat": data
}
......@@ -652,14 +664,18 @@ export default class CorporateAnnualTargetRO extends Component {
this.props.onClickClose()
this.props.refresh()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
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, handleDoubleClick: 0 }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
......@@ -784,7 +800,7 @@ export default class CorporateAnnualTargetRO extends Component {
if (forecast == undefined) {
let convertID = -1
if (tableMeta.rowData[10].value == 'FORMULA') {
if (tableMeta.rowData[10]?.value == 'FORMULA') {
// let indexIDReport = dataTable2.findIndex((val) => val[1] == formulaAwal)
// convertID = dataTable2[indexIDReport][31]
// let indexID = dataTable2.findIndex((val) => val[31] == (convertID == -1 ? item : convertID))
......@@ -2571,7 +2587,11 @@ export default class CorporateAnnualTargetRO extends Component {
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true || this.state.get_for == 'view' ?
......@@ -2806,7 +2826,11 @@ export default class CorporateAnnualTargetRO extends Component {
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div style={{ width: '50%' }} />
</div>
......@@ -2957,21 +2981,60 @@ export default class CorporateAnnualTargetRO extends Component {
</button>
</div>
</div>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("CAT") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
/>
<div style={{ padding: '25px 30px' }}>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("CAT") ?
this.checkUpload() :
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 && (
<div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
<div style={{ margin: 30 }}>
<div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
<div style={{ alignSelf: 'center', marginRight: 25 }}>
<img src={Images.warning} />
</div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
<b>Rate Currency USD</b> pada periode yang dipilih <b>belum</b> diatur.<br /> Silahkan menghubungi Superadmin
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button
className="button"
type="button"
style={{
background: '#F6F7F9',
cursor: 'pointer',
border: '1px solid #3549609e',
outline: 'none',
marginRight: 20,
borderRadius: 9
}}
onClick={() => this.setState({ visibleAlertSave: false, handleDoubleClick: 0 })}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
<Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
</div>
</button>
</div>
</div>
</div>
</div>
)}
......
......@@ -288,7 +288,9 @@ export default class OperatingIndicatorRO extends Component {
// // console.log('=========================')
// console.log(JSON.stringify(payload))
this.props.saveRollingOI(payload)
this.props.onClickClose()
this.setState({ loading: false })
// this.props.onClickClose()
}
handleValue(data) {
......@@ -498,7 +500,19 @@ export default class OperatingIndicatorRO extends Component {
this.props.onClickClose()
this.props.getReport()
} else {
alert(response.data.status)
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 }, () => {
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 {
alert(response.problem)
......@@ -2030,7 +2044,11 @@ export default class OperatingIndicatorRO extends Component {
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode} {String(this.props.quartal).toLocaleUpperCase()}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
......@@ -2226,7 +2244,11 @@ export default class OperatingIndicatorRO extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode} {String(this.props.quartal).toLocaleUpperCase()}
</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
......@@ -2399,7 +2421,7 @@ export default class OperatingIndicatorRO extends Component {
marginRight: 20,
borderRadius: 9
}}
onClick={() => this.setState({ visibleAlertSave: false })}
onClick={() => this.setState({ visibleAlertSave: false, loading: false })}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
<Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
......
......@@ -672,7 +672,7 @@ export default class RollingOutlook extends Component {
}
api.create().getRollingOutlookIsApprover().then(response => {
console.log(response);
console.log(response);
if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true })
} else {
......@@ -1591,7 +1591,7 @@ export default class RollingOutlook extends Component {
}
async handleGenerateReport(data) {
let { selectReport, rollingOutlookID, company, periode, month, downloadedFileReportId, quarter } = this.state
let { selectReport, rollingOutlookID, company, periode, month, downloadedFileReportId, quarter, defaultCurrency } = this.state
if (selectReport.length > 0) {
let result = []
console.log('mulai hit')
......@@ -1599,16 +1599,22 @@ export default class RollingOutlook extends Component {
let urlReport = items === 14 ? "profit_loss" : items === 15 ? "tax_planning" : items === 16 ? "balance_sheet" : items === 17 ? "cash_flow" : items === 37 ? "cat" : null
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID}&report_id=${report[4]}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&quartal=${quarter.value}&download_file_report_id=${downloadedFileReportId}`
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID}&report_id=${report[4]}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&quartal=${quarter.value}&download_file_report_id=${downloadedFileReportId}&currency_id=${defaultCurrency.id}`
console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID === null ? "" : rollingOutlookID}&report_id=${report[4]}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&quartal=${quarter.value}&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
result = [...result, res];
console.log(result);
try {
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID === null ? "" : rollingOutlookID}&report_id=${report[4]}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&quartal=${quarter.value}&download_file_report_id=${downloadedFileReportId}&currency_id=${defaultCurrency.id}`
)
if (res.status === 200) {
result = [...result, res];
console.log(result);
}
} catch (error) {
alert(error)
}
}
console.log('ini result', result);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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