Commit 4c00357c authored by Riri Novita's avatar Riri Novita

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

Fixing Alert Rate Currency MB

See merge request !1822
parents 5ca5dfd2 8d8eba06
......@@ -288,7 +288,7 @@ export default class BalanceSheet extends Component {
} else {
this.props.saveToMasterBudget(payload)
}
this.props.onClickClose()
// this.props.onClickClose()
}
downloadTemplate = async () => {
......@@ -493,14 +493,18 @@ export default class BalanceSheet extends Component {
this.props.getReport()
}
} else {
this.setState({ visibleAlertSave: true, 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);
}
})
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);
}
})
}
}
} else {
this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false })
......
......@@ -20,7 +20,7 @@ import CashFlow from './CashFlow';
import { DatePicker } from '@material-ui/pickers';
import moment from 'moment';
import * as R from 'ramda'
import { PhotoSizeSelectLargeTwoTone, ThreeSixty } from '@material-ui/icons';
import { PhotoSizeSelectLargeTwoTone, ThreeSixty, TripOriginSharp } from '@material-ui/icons';
import { startTransition } from 'react';
var ct = require("../../library/CustomTable");
......@@ -1298,13 +1298,18 @@ export default class BudgetTahunan extends Component {
createCashFlow(payload) {
api.create().createReportCF(payload).then((res) => {
// console.log(res)
console.log(res)
// this.getSubmission()
if (res.data) {
if (res.data.status === "success") {
this.setState({ visibleCF: false, visibleBudgetTahunan: true })
this.getSubmission()
} else {
this.setState({ visibleAlertSave: true})
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 })
}
}
}
// if (response.data) {
......@@ -2319,19 +2324,36 @@ export default class BudgetTahunan extends Component {
this.setState({ loading: true }, () => {
document.body.style.overflow = 'hidden';
})
console.log(data);
console.log(type);
// // console.log(JSON.stringify(data));
api.create('UPLOAD').createSubmitReport(data).then(response => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
if (type === "PL" || "DraftPL") {
this.setState({ visiblePL: false, visibleBudgetTahunan: true })
} else if (type === "TP") {
this.setState({ visibleTP: false, visibleBudgetTahunan: true })
} else if (type === "BS") {
this.setState({ visibleBS: false, visibleBudgetTahunan: true })
} else if (type === "FAM") {
this.setState({ visibleFAM: false, visibleBudgetTahunan: true })
} else if (type === "CAT") {
this.setState({ visibleFAM: false, visibleBudgetTahunan: true })
} else {
this.setState({ visibleBudgetTahunan: true, loading: false })
}
this.getSubmission(type)
} else {
this.setState({ visibleAlertSave: true})
// this.setState({ loading: false }, () => {
this.getSubmission()
document.body.style.overflow = 'unset';
console.log(response.data);
if (response.data.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true })
} else {
// this.setState({ loading: false }, () => {
this.getSubmission()
document.body.style.overflow = 'unset';
}
// })
}
} else {
......@@ -3772,7 +3794,7 @@ export default class BudgetTahunan 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>
......
......@@ -389,7 +389,7 @@ export default class CashFlow extends Component {
console.log(dbcf)
console.log(JSON.stringify(payload))
this.props.createCashFlow(payload)
this.props.onClickClose()
// this.props.onClickClose()
}
render() {
......
......@@ -665,7 +665,7 @@ export default class CorporateAnnualTarget extends Component {
this.props.onClickClose()
this.props.getReport()
} else {
this.setState({ visibleAlertSave: true, 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")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......@@ -886,10 +886,10 @@ export default class CorporateAnnualTarget extends Component {
"cat": data
}
console.log(JSON.stringify(payload));
this.deleteReport(payload)
this.deleteReport(payload, type)
}
deleteReport(payloadBro) {
deleteReport(payloadBro, type) {
let payload = { "item_report_id": this.state.dataDelete }
if (this.state.dataDelete.length > 0) {
......@@ -899,8 +899,13 @@ export default class CorporateAnnualTarget extends Component {
// api.create().validateSubmitReport(payloadBro).then((response) => {
// // // // // console.log(response)
// if (response.data.data.result) {
this.props.saveToMasterBudget(payloadBro)
this.props.onClickClose()
if (type == 'submitted') {
this.props.saveToMasterBudget(payloadBro, 'CAT')
} else {
this.props.saveToMasterBudget(payloadBro)
}
// this.props.saveToMasterBudget(payloadBro)
// this.props.onClickClose()
// } else {
// }
......
......@@ -271,7 +271,7 @@ export default class FixedAssetsMovement extends Component {
} else {
this.props.saveToMasterBudget(payload)
}
this.props.onClickClose()
// this.props.onClickClose()
}
downloadTemplate = async () => {
......@@ -454,7 +454,7 @@ export default class FixedAssetsMovement extends Component {
this.props.getReport()
}
} else {
this.setState({ visibleAlertSave: true, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......
......@@ -291,7 +291,7 @@ export default class ProfitLoss extends Component {
} else {
this.props.saveToMasterBudget(payload)
}
this.props.onClickClose()
// this.props.onClickClose()
}
downloadTemplate = async () => {
......@@ -470,14 +470,18 @@ export default class ProfitLoss extends Component {
this.props.getReport()
}
} else {
this.setState({ visibleAlertSave: true, 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);
}
})
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 diff is collapsed.
......@@ -97,7 +97,7 @@ export default class ReportItems extends Component {
formula_ytd: item[13] === undefined ? "" : item[13],
start_date: item[14] === undefined ? "" : item[14],
end_date: item[15] === undefined ? "" : item[15],
is_can_convert_value: item[16] === undefined ? "" : item[16] === "Yes" || item[16] === "yes" ? 1 : 0,
is_can_convert_value: item[16] === undefined ? "" : item[16] === "Yes" || item[16] === "yes" || item[16] === "YES" ? 1 : 0,
})
}
})
......
......@@ -127,6 +127,7 @@ export default class ProfitLossOLPA extends Component {
"get_for": this.state.get_for,
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"currency_id": this.props.defaultCurrency.id,
"outlook_pa_id": this.props.outlook_pa_id
}
api.create().getLastestUpdateOLPA(payload).then(response => {
......
......@@ -85,7 +85,9 @@ export default class ProfitLossROO extends Component {
saveDraft: true,
buttonError: true,
viewOnly: true,
get_for: 'view'
get_for: 'view',
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -216,7 +218,8 @@ export default class ProfitLossROO 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
}
console.log("getItemHierarki payload", payload);
api.create().getRollingOutlookPL(payload).then(response => {
......@@ -388,6 +391,7 @@ export default class ProfitLossROO extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"quartal": this.props.quarter,
"status": type,
"profit_loss": data
......@@ -405,7 +409,7 @@ export default class ProfitLossROO extends Component {
}
this.props.onClickClose()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
this.setState({ visibleAlertSave: true, 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(() => {
......@@ -474,7 +478,11 @@ export default class ProfitLossROO extends Component {
}
checkUpload() {
api.create().checkImportRollingOutlookPL(this.state.payload).then(response => {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkImportRollingOutlookPL(payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log("checkUpload Response", response)
if (response.data) {
......@@ -560,6 +568,7 @@ export default class ProfitLossROO extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
currency_id: this.state.defaultCurrencyUpload?.id,
"quartal": this.props.quarter,
"rolling_outlook_id": this.props.rollingOutlookID,
"status": type,
......@@ -580,7 +589,7 @@ export default class ProfitLossROO extends Component {
// this.props.onClickClose()
// this.props.getReport()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
this.setState({ visibleAlertSave: true, 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)
......@@ -2677,21 +2686,60 @@ export default class ProfitLossROO 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("PROFIT") && String(this.state.judul).includes("LOSS") ?
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("PROFIT") && String(this.state.judul).includes("LOSS") ?
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 })}
>
<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>
)}
......
......@@ -2721,6 +2721,42 @@ export default class RollingOutlook extends Component {
</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 })}
>
<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 >
);
}
......
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