Commit 22fdf53b authored by Riri Novita's avatar Riri Novita

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

Check API MB MR

See merge request !1832
parents 79a169cb 5353c3cd
...@@ -662,10 +662,18 @@ export default class CorporateAnnualTarget extends Component { ...@@ -662,10 +662,18 @@ export default class CorporateAnnualTarget extends Component {
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.props.onClickClose() if (type == 'submitted') {
this.props.getReport() this.props.saveToMasterBudget(body, 'CAT')
} else {
this.props.saveToMasterBudget(body)
}
// this.props.onClickClose()
// this.props.getReport()
} else {
if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true })
} else { } else {
this.setState({alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { 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")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -674,6 +682,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -674,6 +682,7 @@ export default class CorporateAnnualTarget extends Component {
} }
}) })
} }
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
} }
...@@ -899,11 +908,27 @@ export default class CorporateAnnualTarget extends Component { ...@@ -899,11 +908,27 @@ export default class CorporateAnnualTarget extends Component {
// api.create().validateSubmitReport(payloadBro).then((response) => { // api.create().validateSubmitReport(payloadBro).then((response) => {
// // // // // console.log(response) // // // // // console.log(response)
// if (response.data.data.result) { // if (response.data.data.result) {
if (response.data.status === "success") {
if (type == 'submitted') { if (type == 'submitted') {
this.props.saveToMasterBudget(payloadBro, 'CAT') this.props.saveToMasterBudget(payloadBro, 'CAT')
} else { } else {
this.props.saveToMasterBudget(payloadBro) this.props.saveToMasterBudget(payloadBro)
} }
} 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);
}
})
}
}
// this.props.saveToMasterBudget(payloadBro) // this.props.saveToMasterBudget(payloadBro)
// this.props.onClickClose() // this.props.onClickClose()
// } else { // } else {
......
...@@ -97,6 +97,10 @@ class DownloadReport extends Component { ...@@ -97,6 +97,10 @@ class DownloadReport extends Component {
return () => clearInterval(interval); return () => clearInterval(interval);
} }
closeAlert() {
this.setState({ alert: false })
}
getListDownload() { getListDownload() {
api.create().getListDownload().then((response) => { api.create().getListDownload().then((response) => {
// console.log(response); // console.log(response);
......
...@@ -884,7 +884,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -884,7 +884,7 @@ export default class ListOfCreditFacilities extends Component {
downloadTemplate = async () => { downloadTemplate = async () => {
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/locf/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&months=${this.props.month.month_id}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/locf/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&months=${this.props.month.month_id}&&currency_id=${this.props.defaultCurrency.id}`
) )
res = await res.blob() res = await res.blob()
// console.log(this.props.report_id) // console.log(this.props.report_id)
......
...@@ -92,6 +92,10 @@ export default class OperatingIndicator extends Component { ...@@ -92,6 +92,10 @@ export default class OperatingIndicator extends Component {
this.getPermission() this.getPermission()
} }
closeAlert() {
this.setState({ alert: false })
}
getPermission() { getPermission() {
let payload = { let payload = {
menu: "operating indicator" menu: "operating indicator"
...@@ -691,8 +695,7 @@ export default class OperatingIndicator extends Component { ...@@ -691,8 +695,7 @@ export default class OperatingIndicator extends Component {
// }, 200); // }, 200);
// } // }
// } // }
handleGenerateReport = async (data) => {
async handleGenerateReport(data) {
let { selectReport, operatingIndID, company, periode, downloadedFileReportId, defaultCurrency } = this.state let { selectReport, operatingIndID, company, periode, downloadedFileReportId, defaultCurrency } = this.state
if (selectReport.length > 0) { if (selectReport.length > 0) {
let result = [] let result = []
...@@ -718,17 +721,21 @@ export default class OperatingIndicator extends Component { ...@@ -718,17 +721,21 @@ export default class OperatingIndicator extends Component {
String(report[1]).toLocaleLowerCase().includes('dec') ? 12 : null String(report[1]).toLocaleLowerCase().includes('dec') ? 12 : null
if (String(report[1]).toLocaleLowerCase().includes('master budget')) { if (String(report[1]).toLocaleLowerCase().includes('master budget')) {
try {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}`
console.log(url);
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}`
) )
if (res.status === 200) { if (res.status === 200) {
result = [...result, res]; result = [...result, res];
} }
} catch (e) {
alert(e)
}
} else if (String(report[1]).toLocaleLowerCase().includes('monthly report')) { } else if (String(report[1]).toLocaleLowerCase().includes('monthly report')) {
try {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}`
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}`
...@@ -737,8 +744,12 @@ export default class OperatingIndicator extends Component { ...@@ -737,8 +744,12 @@ export default class OperatingIndicator extends Component {
if (res.status === 200) { if (res.status === 200) {
result = [...result, res]; result = [...result, res];
} }
} catch (error) {
alert(error)
}
} else if (String(report[1]).toLocaleLowerCase().includes('rolling outlook')) { } else if (String(report[1]).toLocaleLowerCase().includes('rolling outlook')) {
try {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}`
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}`
...@@ -747,6 +758,9 @@ export default class OperatingIndicator extends Component { ...@@ -747,6 +758,9 @@ export default class OperatingIndicator extends Component {
if (res.status === 200) { if (res.status === 200) {
result = [...result, res]; result = [...result, res];
} }
} catch (error) {
alert(error)
}
} }
} }
......
...@@ -898,9 +898,21 @@ export default class OutlookPA extends Component { ...@@ -898,9 +898,21 @@ export default class OutlookPA extends Component {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
if (type === "PL") {
this.setState({ visiblePL: false, visibleOutlookPA: true })
} else if (type === "TP") {
this.setState({ visibleTP: false, visibleOutlookPA: true })
} else if (type === "BS") {
this.setState({ visibleBS: false, visibleOutlookPA: true })
} else {
this.setState({ visibleOutlookPA: true, loading: false })
}
this.getOutlookPAID(type) this.getOutlookPAID(type)
} else { } else {
this.setState({ visibleAlertSave: true, alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => { 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'; document.body.style.overflow = 'unset';
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => { setTimeout(() => {
...@@ -911,6 +923,7 @@ export default class OutlookPA extends Component { ...@@ -911,6 +923,7 @@ export default class OutlookPA extends Component {
this.getOutlookPAID() this.getOutlookPAID()
}) })
} }
}
// else { // else {
// this.setState({ loading: false }, () => { // this.setState({ loading: false }, () => {
// // alert(response.data.message) // // alert(response.data.message)
...@@ -2714,6 +2727,42 @@ export default class OutlookPA extends Component { ...@@ -2714,6 +2727,42 @@ export default class OutlookPA extends Component {
</div> </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, 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>
</div>
</button>
</div>
</div>
</div>
</div>
)}
</div > </div >
); );
} }
......
...@@ -328,7 +328,7 @@ export default class ProfitLossOLPA extends Component { ...@@ -328,7 +328,7 @@ export default class ProfitLossOLPA extends Component {
} else { } else {
this.props.saveToOLPA(payload) this.props.saveToOLPA(payload)
} }
this.props.onClickClose() // this.props.onClickClose()
} }
downloadTemplate = async () => { downloadTemplate = async () => {
...@@ -494,7 +494,10 @@ export default class ProfitLossOLPA extends Component { ...@@ -494,7 +494,10 @@ export default class ProfitLossOLPA extends Component {
this.props.getReport() this.props.getReport()
} }
} else { } else {
this.setState({ visibleAlertSave: true, alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { 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")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -504,6 +507,7 @@ export default class ProfitLossOLPA extends Component { ...@@ -504,6 +507,7 @@ export default class ProfitLossOLPA extends Component {
}) })
alert(response.data.status) alert(response.data.status)
} }
}
} else { } else {
this.setState({ loading: false }) this.setState({ loading: false })
alert(response.problem) alert(response.problem)
...@@ -1742,6 +1746,11 @@ export default class ProfitLossOLPA extends Component { ...@@ -1742,6 +1746,11 @@ export default class ProfitLossOLPA extends Component {
options: { options: {
display: false display: false
} }
}, {
name: "",
options: {
display: false
}
} }
] ]
......
...@@ -514,8 +514,13 @@ export default class TaxPlanningOLPA extends Component { ...@@ -514,8 +514,13 @@ export default class TaxPlanningOLPA extends Component {
console.log(payload); console.log(payload);
// console.log(JSON.stringify(payload)); // console.log(JSON.stringify(payload));
// this.setState({ loading: false }) // this.setState({ loading: false })
if (type == 'submitted') {
this.props.saveToOLPA(payload, 'TP')
} else {
this.props.saveToOLPA(payload) this.props.saveToOLPA(payload)
this.props.onClickClose() }
// this.props.saveToOLPA(payload)
// this.props.onClickClose()
} }
fileHandler = (event) => { fileHandler = (event) => {
......
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