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 { ...@@ -288,7 +288,7 @@ export default class BalanceSheet extends Component {
} else { } else {
this.props.saveToMasterBudget(payload) this.props.saveToMasterBudget(payload)
} }
this.props.onClickClose() // this.props.onClickClose()
} }
downloadTemplate = async () => { downloadTemplate = async () => {
...@@ -493,7 +493,10 @@ export default class BalanceSheet extends Component { ...@@ -493,7 +493,10 @@ export default class BalanceSheet 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)
...@@ -502,6 +505,7 @@ export default class BalanceSheet extends Component { ...@@ -502,6 +505,7 @@ export default class BalanceSheet extends Component {
} }
}) })
} }
}
} else { } else {
this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false })
} }
......
...@@ -20,7 +20,7 @@ import CashFlow from './CashFlow'; ...@@ -20,7 +20,7 @@ import CashFlow from './CashFlow';
import { DatePicker } from '@material-ui/pickers'; import { DatePicker } from '@material-ui/pickers';
import moment from 'moment'; import moment from 'moment';
import * as R from 'ramda' import * as R from 'ramda'
import { PhotoSizeSelectLargeTwoTone, ThreeSixty } from '@material-ui/icons'; import { PhotoSizeSelectLargeTwoTone, ThreeSixty, TripOriginSharp } from '@material-ui/icons';
import { startTransition } from 'react'; import { startTransition } from 'react';
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
...@@ -1298,13 +1298,18 @@ export default class BudgetTahunan extends Component { ...@@ -1298,13 +1298,18 @@ export default class BudgetTahunan extends Component {
createCashFlow(payload) { createCashFlow(payload) {
api.create().createReportCF(payload).then((res) => { api.create().createReportCF(payload).then((res) => {
// console.log(res) console.log(res)
// this.getSubmission() // this.getSubmission()
if (res.data) { if (res.data) {
if (res.data.status === "success") { if (res.data.status === "success") {
this.setState({ visibleCF: false, visibleBudgetTahunan: true })
this.getSubmission() this.getSubmission()
} else { } 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) { // if (response.data) {
...@@ -2319,19 +2324,36 @@ export default class BudgetTahunan extends Component { ...@@ -2319,19 +2324,36 @@ export default class BudgetTahunan extends Component {
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
document.body.style.overflow = 'hidden'; document.body.style.overflow = 'hidden';
}) })
console.log(data); console.log(type);
// // console.log(JSON.stringify(data)); // // console.log(JSON.stringify(data));
api.create('UPLOAD').createSubmitReport(data).then(response => { api.create('UPLOAD').createSubmitReport(data).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { 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) this.getSubmission(type)
} else { } else {
this.setState({ visibleAlertSave: true}) console.log(response.data);
if (response.data.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true })
} else {
// this.setState({ loading: false }, () => { // this.setState({ loading: false }, () => {
this.getSubmission() this.getSubmission()
document.body.style.overflow = 'unset'; document.body.style.overflow = 'unset';
}
// }) // })
} }
} else { } else {
...@@ -3772,7 +3794,7 @@ export default class BudgetTahunan extends Component { ...@@ -3772,7 +3794,7 @@ export default class BudgetTahunan extends Component {
marginRight: 20, marginRight: 20,
borderRadius: 9 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' }}> <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> <Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
......
...@@ -389,7 +389,7 @@ export default class CashFlow extends Component { ...@@ -389,7 +389,7 @@ export default class CashFlow extends Component {
console.log(dbcf) console.log(dbcf)
console.log(JSON.stringify(payload)) console.log(JSON.stringify(payload))
this.props.createCashFlow(payload) this.props.createCashFlow(payload)
this.props.onClickClose() // this.props.onClickClose()
} }
render() { render() {
......
...@@ -665,7 +665,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -665,7 +665,7 @@ export default class CorporateAnnualTarget extends Component {
this.props.onClickClose() this.props.onClickClose()
this.props.getReport() this.props.getReport()
} else { } 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")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -886,10 +886,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -886,10 +886,10 @@ export default class CorporateAnnualTarget extends Component {
"cat": data "cat": data
} }
console.log(JSON.stringify(payload)); 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 } let payload = { "item_report_id": this.state.dataDelete }
if (this.state.dataDelete.length > 0) { if (this.state.dataDelete.length > 0) {
...@@ -899,8 +899,13 @@ export default class CorporateAnnualTarget extends Component { ...@@ -899,8 +899,13 @@ 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 (type == 'submitted') {
this.props.saveToMasterBudget(payloadBro, 'CAT')
} else {
this.props.saveToMasterBudget(payloadBro) this.props.saveToMasterBudget(payloadBro)
this.props.onClickClose() }
// this.props.saveToMasterBudget(payloadBro)
// this.props.onClickClose()
// } else { // } else {
// } // }
......
...@@ -271,7 +271,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -271,7 +271,7 @@ export default class FixedAssetsMovement extends Component {
} else { } else {
this.props.saveToMasterBudget(payload) this.props.saveToMasterBudget(payload)
} }
this.props.onClickClose() // this.props.onClickClose()
} }
downloadTemplate = async () => { downloadTemplate = async () => {
...@@ -454,7 +454,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -454,7 +454,7 @@ export default class FixedAssetsMovement extends Component {
this.props.getReport() this.props.getReport()
} }
} else { } 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")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
......
...@@ -291,7 +291,7 @@ export default class ProfitLoss extends Component { ...@@ -291,7 +291,7 @@ export default class ProfitLoss extends Component {
} else { } else {
this.props.saveToMasterBudget(payload) this.props.saveToMasterBudget(payload)
} }
this.props.onClickClose() // this.props.onClickClose()
} }
downloadTemplate = async () => { downloadTemplate = async () => {
...@@ -470,7 +470,10 @@ export default class ProfitLoss extends Component { ...@@ -470,7 +470,10 @@ export default class ProfitLoss 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)
...@@ -478,6 +481,7 @@ export default class ProfitLoss extends Component { ...@@ -478,6 +481,7 @@ export default class ProfitLoss extends Component {
}, 1000); }, 1000);
} }
}) })
}
// alert(response.data.status) // alert(response.data.status)
} }
} else { } else {
......
This diff is collapsed.
...@@ -97,7 +97,7 @@ export default class ReportItems extends Component { ...@@ -97,7 +97,7 @@ export default class ReportItems extends Component {
formula_ytd: item[13] === undefined ? "" : item[13], formula_ytd: item[13] === undefined ? "" : item[13],
start_date: item[14] === undefined ? "" : item[14], start_date: item[14] === undefined ? "" : item[14],
end_date: item[15] === undefined ? "" : item[15], 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 { ...@@ -127,6 +127,7 @@ export default class ProfitLossOLPA extends Component {
"get_for": this.state.get_for, "get_for": this.state.get_for,
"periode": this.props.periode, "periode": this.props.periode,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"currency_id": this.props.defaultCurrency.id,
"outlook_pa_id": this.props.outlook_pa_id "outlook_pa_id": this.props.outlook_pa_id
} }
api.create().getLastestUpdateOLPA(payload).then(response => { api.create().getLastestUpdateOLPA(payload).then(response => {
......
...@@ -85,7 +85,9 @@ export default class ProfitLossROO extends Component { ...@@ -85,7 +85,9 @@ export default class ProfitLossROO extends Component {
saveDraft: true, saveDraft: true,
buttonError: true, buttonError: true,
viewOnly: true, viewOnly: true,
get_for: 'view' get_for: 'view',
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -216,7 +218,8 @@ export default class ProfitLossROO extends Component { ...@@ -216,7 +218,8 @@ export default class ProfitLossROO extends Component {
"periode": this.props.periode, "periode": this.props.periode,
"report_id": this.props.report_id, "report_id": this.props.report_id,
"revision": Number(this.props.revision), "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); console.log("getItemHierarki payload", payload);
api.create().getRollingOutlookPL(payload).then(response => { api.create().getRollingOutlookPL(payload).then(response => {
...@@ -388,6 +391,7 @@ export default class ProfitLossROO extends Component { ...@@ -388,6 +391,7 @@ export default class ProfitLossROO extends Component {
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"periode": this.props.periode, "periode": this.props.periode,
"report_id": this.props.report_id, "report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"quartal": this.props.quarter, "quartal": this.props.quarter,
"status": type, "status": type,
"profit_loss": data "profit_loss": data
...@@ -405,7 +409,7 @@ export default class ProfitLossROO extends Component { ...@@ -405,7 +409,7 @@ export default class ProfitLossROO extends Component {
} }
this.props.onClickClose() this.props.onClickClose()
} else { } 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'; 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(() => {
...@@ -474,7 +478,11 @@ export default class ProfitLossROO extends Component { ...@@ -474,7 +478,11 @@ export default class ProfitLossROO extends Component {
} }
checkUpload() { 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(JSON.stringify(this.state.payload));
console.log("checkUpload Response", response) console.log("checkUpload Response", response)
if (response.data) { if (response.data) {
...@@ -560,6 +568,7 @@ export default class ProfitLossROO extends Component { ...@@ -560,6 +568,7 @@ export default class ProfitLossROO extends Component {
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"periode": this.props.periode, "periode": this.props.periode,
"report_id": this.props.report_id, "report_id": this.props.report_id,
currency_id: this.state.defaultCurrencyUpload?.id,
"quartal": this.props.quarter, "quartal": this.props.quarter,
"rolling_outlook_id": this.props.rollingOutlookID, "rolling_outlook_id": this.props.rollingOutlookID,
"status": type, "status": type,
...@@ -580,7 +589,7 @@ export default class ProfitLossROO extends Component { ...@@ -580,7 +589,7 @@ export default class ProfitLossROO extends Component {
// this.props.onClickClose() // this.props.onClickClose()
// this.props.getReport() // this.props.getReport()
} else { } 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")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -2677,6 +2686,7 @@ export default class ProfitLossROO extends Component { ...@@ -2677,6 +2686,7 @@ export default class ProfitLossROO extends Component {
</button> </button>
</div> </div>
</div> </div>
<div style={{ padding: '25px 30px' }}>
<UploadFile <UploadFile
type={this.state.uploadStatus} type={this.state.uploadStatus}
percentage={this.state.percentage} percentage={this.state.percentage}
...@@ -2693,6 +2703,44 @@ export default class ProfitLossROO extends Component { ...@@ -2693,6 +2703,44 @@ export default class ProfitLossROO extends Component {
}} }}
/> />
</div> </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> </div>
)} )}
</div> </div>
......
...@@ -2721,6 +2721,42 @@ export default class RollingOutlook extends Component { ...@@ -2721,6 +2721,42 @@ export default class RollingOutlook 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 })}
>
<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 >
); );
} }
......
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