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