Commit 77b32080 authored by Riri Novita's avatar Riri Novita

Update Banyak (MR, OLPA, Fixing Issue)

parent abeb94ee
......@@ -1299,7 +1299,14 @@ export default class BudgetTahunan extends Component {
createCashFlow(payload) {
api.create().createReportCF(payload).then((res) => {
// console.log(res)
this.getSubmission()
// this.getSubmission()
if (res.data) {
if (res.data.status === "success") {
this.getSubmission()
} else {
this.setState({ visibleAlertSave: true})
}
}
// if (response.data) {
// if (response.data.status === "success") {
// this.props.saveToMonthlyReport()
......
......@@ -49,6 +49,7 @@ export default class CreatePerusahaan extends Component {
alert: false,
tipeAlert: '',
messageAlert: '',
optionCurrecy: []
}
}
......@@ -89,11 +90,14 @@ export default class CreatePerusahaan extends Component {
id: item.currencyId,
value: item.currencyName
})
})
// console.log(response.data.data.default_currency, datas);
}
let index = datas.findIndex((val) => val.id == response.data.data.default_currency)
let findIdx = datas.findIndex(e => e.id === 2)
let bizpar = findIdx >= 0 ? datas.filter(e => e.id === 2) : datas
console.log(bizpar);
this.setState({
businessID: response.data.data.business_unit_id,
companyID: response.data.data.company_id,
......@@ -108,7 +112,8 @@ export default class CreatePerusahaan extends Component {
updated: response.data.data.updated === null ? "" : response.data.data.updated,
defaultCurrencyID: response.data.data.default_currency,
currency: datas,
defaultCurrency: index == -1 ? null : datas[index]
defaultCurrency: index == -1 ? null : datas[index],
optionCurrecy: bizpar,
}, () => {
// setTimeout(() => {
this.getAllUnitBisnis()
......@@ -348,7 +353,7 @@ export default class CreatePerusahaan extends Component {
// })
// })
let payload = {
"company_id": this.state.companyID,
"company_name": this.state.company,
......@@ -477,13 +482,20 @@ export default class CreatePerusahaan extends Component {
options={this.state.dataCurrency}
getOptionLabel={(option) => option.value}
getOptionSelected={(option, value) => option.id === value.id}
onChange={(event, newInputValue) => this.setState({ currency: newInputValue }, () => {
if (this.state.defaultCurrency) {
const result = this.state.currency.find((elem) => elem.id === this.state.defaultCurrency.id)
this.setState({ defaultCurrency: result })
}
})}
onChange={(event, newInputValue) => {
let findIdx = newInputValue.findIndex(e => e.id === 2)
let bizpar = findIdx >= 0 ? this.state.dataCurrency.filter(e => e.id === 2) : newInputValue
this.setState({
optionCurrecy: bizpar,
currency: newInputValue
}, () => {
if (this.state.defaultCurrency) {
const result = this.state.currency.find((elem) => elem.id === this.state.defaultCurrency.id)
this.setState({ defaultCurrency: result })
}
})
}}
renderInput={(params) => (
<TextField
{...params}
......@@ -594,7 +606,7 @@ export default class CreatePerusahaan extends Component {
<Autocomplete
debug
id="tipe"
options={this.state.currency}
options={this.state.optionCurrecy}
getOptionLabel={(option) => option.value}
value={this.state.defaultCurrency}
disableClearable={!this.state.defaultCurrency}
......@@ -751,14 +763,20 @@ export default class CreatePerusahaan extends Component {
multiple
options={this.state.dataCurrency}
getOptionLabel={(option) => option.value}
onChange={(event, newInputValue) => this.setState({ currency: newInputValue }, () => {
if (this.state.defaultCurrency) {
console.log("tes");
const result = this.state.currency.find((elem) => elem.id === this.state.defaultCurrency.id)
this.setState({ defaultCurrency: result })
}
})}
onChange={(event, newInputValue) => {
let findIdx = newInputValue.findIndex(e => e.id === 2)
let bizpar = findIdx >= 0 ? this.state.dataCurrency.filter(e => e.id === 2) : newInputValue
this.setState({
optionCurrecy: bizpar,
currency: newInputValue
}, () => {
if (this.state.defaultCurrency) {
const result = this.state.currency.find((elem) => elem.id === this.state.defaultCurrency.id)
this.setState({ defaultCurrency: result })
}
})
}}
renderInput={(params) => (
<TextField
{...params}
......@@ -874,7 +892,7 @@ export default class CreatePerusahaan extends Component {
<Autocomplete
debug
id="tipe"
options={this.state.currency}
options={this.state.optionCurrecy}
getOptionLabel={(option) => option.value}
value={this.state.defaultCurrency}
disableClearable={!this.state.defaultCurrency}
......
......@@ -34,6 +34,7 @@ export default class EditPerusahaan extends Component {
msgErrorSD: '',
msgErrorED: '',
msgErrorJL: '',
optionCurrecy: []
}
}
......
......@@ -55,7 +55,9 @@ export default class BalanceSheetMR extends Component {
judulColumn: null,
get_for: "view",
viewOnly: true,
kansas: 0
kansas: 0,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -174,6 +176,7 @@ export default class BalanceSheetMR extends Component {
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id,
"currency_id": this.props.defaultCurrency.id,
"get_for": this.state.get_for
}
api.create().getHierarkiMontlyReportBS(payload).then(response => {
......@@ -367,7 +370,11 @@ export default class BalanceSheetMR extends Component {
}
checkUpload() {
api.create().checkUploadMonthlyReportBS(this.state.payload).then(response => {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkUploadMonthlyReportBS(payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
......@@ -466,6 +473,7 @@ export default class BalanceSheetMR 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,
"status": type,
"months": this.props.month.month_id,
"balance_sheet": data
......@@ -497,7 +505,7 @@ export default class BalanceSheetMR extends Component {
this.setState({ loading: false, handleDoubleClick: 0 })
// 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)
......@@ -539,6 +547,7 @@ export default class BalanceSheetMR 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,
"status": type,
"months": this.props.month.month_id,
"balance_sheet": data
......@@ -658,6 +667,7 @@ export default class BalanceSheetMR 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,
"status": "submitted",
"months": this.props.month.month_id,
"balance_sheet": data
......@@ -2992,21 +3002,60 @@ export default class BalanceSheetMR 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("MONTHLY") && String(this.state.judul).includes("REPORT") && 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("MONTHLY") && String(this.state.judul).includes("REPORT") && 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 })}
>
<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>
)}
......
......@@ -48,7 +48,9 @@ export default class CashFlowMR extends Component {
// valueThreshold: 0,
minValue: 0,
maxValue: 0,
viewOnly: true
viewOnly: true,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
}
......@@ -139,6 +141,7 @@ export default class CashFlowMR extends Component {
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id,
"currency_id": this.props.defaultCurrency.id,
"get_for": "edit"
}
......@@ -240,6 +243,7 @@ export default class CashFlowMR extends Component {
"report_id": 13,
"status": "submitted",
"months": this.props.month.month_id,
"currency_id": this.props.defaultCurrency.id,
"cash_flow": listCF
}
this.props.createCashFlow(payload)
......
......@@ -51,7 +51,9 @@ export default class FixedAssetsMovementMR extends Component {
get_for: 'view',
saveDraft: true,
buttonError: true,
viewOnly: true
viewOnly: true,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -142,6 +144,7 @@ export default class FixedAssetsMovementMR extends Component {
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id,
"currency_id": this.props.defaultCurrency.id,
"get_for": this.state.get_for
}
api.create().getHierarkiMontlyReportFAM(payload).then(response => {
......@@ -297,7 +300,11 @@ export default class FixedAssetsMovementMR extends Component {
}
checkUpload() {
api.create().checkUploadMonthlyReportFAM(this.state.payload).then(response => {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkUploadMonthlyReportFAM(payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
// console.log(this.state.payload)
console.log(response)
......@@ -371,6 +378,7 @@ export default class FixedAssetsMovementMR 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,
"status": type,
"months": this.props.month.month_id,
"fixed_asset_movement": data
......@@ -388,7 +396,7 @@ export default class FixedAssetsMovementMR extends Component {
}
// this.props.getReport()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
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)
......@@ -424,6 +432,7 @@ export default class FixedAssetsMovementMR 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,
"status": type,
"months": this.props.month.month_id,
"fixed_asset_movement": data
......@@ -489,6 +498,7 @@ export default class FixedAssetsMovementMR 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,
"status": "submitted",
"months": this.props.month.month_id,
"fixed_asset_movement": data
......@@ -1709,21 +1719,60 @@ export default class FixedAssetsMovementMR 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("FIXED") && String(this.state.judul).includes("ASSETS") && String(this.state.judul).includes("MOVEMENT") && String(this.state.judul).includes("MONTHLY") && String(this.state.judul).includes("REPORT") ?
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("FIXED") && String(this.state.judul).includes("ASSETS") && String(this.state.judul).includes("MOVEMENT") && String(this.state.judul).includes("MONTHLY") && String(this.state.judul).includes("REPORT") ?
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>
)}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3730,6 +3730,42 @@ export default class MonthlyReport 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 >
);
}
......
......@@ -2426,21 +2426,24 @@ export default class ProfitLossMR 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("MONTHLY") && String(this.state.judul).includes("REPORT") && 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("MONTHLY") && String(this.state.judul).includes("REPORT") && 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>
)}
......
......@@ -54,7 +54,9 @@ export default class BalanceSheetOLPA extends Component {
get_for: 'view',
minValue: "0",
maxValue: "0",
kansas: 0
kansas: 0,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -179,7 +181,8 @@ export default class BalanceSheetOLPA extends Component {
"revision": this.props.revision,
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"get_for": this.state.get_for
"get_for": this.state.get_for,
"currency_id": this.props.defaultCurrency.id
}
let response = await api.create().getDetailReportOLPA(payload)
console.log(payload);
......@@ -320,6 +323,7 @@ export default class BalanceSheetOLPA 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,
"status": type,
"balance_sheet": data
}
......@@ -407,7 +411,11 @@ export default class BalanceSheetOLPA extends Component {
}
checkUpload() {
api.create().checkUploadOLPA(this.state.payload).then(response => {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkUploadOLPA(payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
......@@ -492,6 +500,7 @@ export default class BalanceSheetOLPA 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,
balance_sheet: data,
status: type
}
......@@ -518,7 +527,7 @@ export default class BalanceSheetOLPA extends Component {
this.props.getReport()
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
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)
......@@ -601,6 +610,7 @@ export default class BalanceSheetOLPA 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,
"balance_sheet": data,
"status": "submitted"
}
......@@ -2215,21 +2225,60 @@ export default class BalanceSheetOLPA 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.judul).includes("OUTLOOK") && String(this.state.judul).includes("PA") && 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.judul).includes("OUTLOOK") && String(this.state.judul).includes("PA") && 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 })}
>
<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,8 @@ export default class CashFlow extends Component {
maxValue: "0",
handleDoubleClick: 0,
viewOnly: true,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
}
......@@ -144,6 +146,7 @@ export default class CashFlow extends Component {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"outlook_pa_id": this.props.outlook_pa_id,
"currency_id": this.props.defaultCurrency.id
}
api.create().getHierarkiCFOLPA(payload).then(response => {
let dataTable = []
......@@ -345,6 +348,7 @@ export default class CashFlow 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,
"status": "submitted",
// "quartal": this.props.quarter,
"cash_flow": dbcf
......
......@@ -72,6 +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 +129,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,
"outlook_pa_id": this.props.outlook_pa_id,
}
......@@ -422,6 +425,7 @@ export default class CorporateAnnualTargetRO 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": 'q1',
"status": type,
"cat": data,
......@@ -524,8 +528,12 @@ export default class CorporateAnnualTargetRO extends Component {
}
checkUpload() {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
this.setState({ loading: true, dataTable: [] })
api.create().checkUploadOLPA(this.state.payload).then(response => {
api.create().checkUploadOLPA(payload).then(response => {
console.log(JSON.stringify(this.state.payload));
console.log(this.state.payload)
console.log(response)
......@@ -547,7 +555,7 @@ export default class CorporateAnnualTargetRO extends Component {
item.formula,
item.level,
item.item_report,
Number(String(item.weight).substr(0,String(item.weight).length-1)),
Number(String(item.weight).substr(0, String(item.weight).length - 1)),
item.uom,
item.kpi_type == "" || item.kpi_type == null ? null : { value: item.kpi_type },
item.max_ach == "" || item.max_ach == null ? null : { value: titleCase(item.max_ach) },
......@@ -650,6 +658,7 @@ export default class CorporateAnnualTargetRO 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": 'q1',
"status": type,
"cat": data,
......@@ -669,7 +678,7 @@ export default class CorporateAnnualTargetRO extends Component {
// this.props.refresh()
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)
......@@ -2084,7 +2093,7 @@ export default class CorporateAnnualTargetRO extends Component {
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true || this.state.get_for == 'view' ?
null
null
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
// <a data-tip={'Download'} data-for="download">
// <button
......@@ -2465,21 +2474,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("PA") && 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("PA") && 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: '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>
</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>
)}
......
This diff is collapsed.
......@@ -64,7 +64,9 @@ export default class ProfitLossOLPA extends Component {
buttonDraft: true,
handleDoubleClick: 0,
viewOnly: true,
get_for: 'view'
get_for: 'view',
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -158,7 +160,8 @@ export default class ProfitLossOLPA extends Component {
"revision": this.props.revision,
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"get_for": this.state.get_for
"get_for": this.state.get_for,
"currency_id": this.props.defaultCurrency.id
}
console.log(payload)
let response = await api.create().getDetailReportOLPA(payload)
......@@ -314,6 +317,7 @@ export default class ProfitLossOLPA extends Component {
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": type,
"currency_id": this.props.defaultCurrency.id,
"profit_loss": data
}
console.log(data);
......@@ -391,7 +395,11 @@ export default class ProfitLossOLPA extends Component {
}
checkUpload() {
api.create().checkUploadOLPA(this.state.payload).then(response => {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkUploadOLPA(payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
......@@ -469,6 +477,7 @@ export default class ProfitLossOLPA 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,
profit_loss: data,
status: type
}
......@@ -484,6 +493,14 @@ export default class ProfitLossOLPA 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);
}
})
alert(response.data.status)
}
} else {
......@@ -539,6 +556,7 @@ export default class ProfitLossOLPA 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,
"profit_loss": data,
"status": "submitted"
}
......@@ -2124,21 +2142,60 @@ export default class ProfitLossOLPA 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.judul).includes("OUTLOOK") && String(this.state.judul).includes("PA") && 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.judul).includes("OUTLOOK") && String(this.state.judul).includes("PA") && 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>
)}
......
......@@ -52,7 +52,9 @@ export default class TaxPlanningOLPA extends Component {
buttonDraft: true,
handleDoubleClick: 0,
get_for: "view",
viewOnly: true
viewOnly: true,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.handleValue = this.handleValue.bind(this)
......@@ -169,7 +171,8 @@ export default class TaxPlanningOLPA extends Component {
"revision": this.props.revision,
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"get_for": this.state.get_for
"get_for": this.state.get_for,
"currency_id": this.props.defaultCurrency.id
}
api.create().getDetailReportOLPA(payload).then(response => {
console.log(payload);
......@@ -505,6 +508,7 @@ export default class TaxPlanningOLPA extends Component {
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": type,
"currency_id": this.props.defaultCurrency.id,
"tax_planning": data
}
console.log(payload);
......@@ -619,7 +623,11 @@ export default class TaxPlanningOLPA extends Component {
}
checkUpload() {
api.create().checkUploadOLPA(this.state.payload).then(response => {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkUploadOLPA(payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
......@@ -801,6 +809,7 @@ export default class TaxPlanningOLPA 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,
tax_planning: data,
status: type
}
......@@ -813,7 +822,7 @@ export default class TaxPlanningOLPA extends Component {
this.props.getReport()
} else {
// this.setState({ alert: true, messageAlert: response.data.status, tipeAlert: 'error', loading: false })
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
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)
......@@ -3561,21 +3570,60 @@ export default class TaxPlanningOLPA 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.judul).includes("OUTLOOK") && String(this.state.judul).includes("PA") && String(this.state.judul).includes("TAX") && String(this.state.judul).includes("PLANNING") ?
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.judul).includes("OUTLOOK") && String(this.state.judul).includes("PA") && String(this.state.judul).includes("TAX") && String(this.state.judul).includes("PLANNING") ?
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>
)}
......
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