Commit c0cde3ea authored by Riri Novita's avatar Riri Novita

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

Update TP ke replace

See merge request !1900
parents 33d4d9b1 49d7115f
...@@ -58,6 +58,7 @@ export default class TaxPlanning extends Component { ...@@ -58,6 +58,7 @@ export default class TaxPlanning extends Component {
get_for: "view", get_for: "view",
viewOnly: true, viewOnly: true,
defaultCurrencyUpload: this.props.defaultCurrency, 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)
...@@ -173,7 +174,7 @@ export default class TaxPlanning extends Component { ...@@ -173,7 +174,7 @@ export default class TaxPlanning extends Component {
"revision": Number(this.props.revision), "revision": Number(this.props.revision),
"rolling_outlook_id": this.props.rollingOutlookID, "rolling_outlook_id": this.props.rollingOutlookID,
"quartal": this.props.quarter, "quartal": this.props.quarter,
"currency_id": this.state.defaultCurrencyUpload?.id "currency_id": this.props.defaultCurrency.id
} }
api.create().getRollingOutlookTP(payload).then(response => { api.create().getRollingOutlookTP(payload).then(response => {
console.log(payload); console.log(payload);
...@@ -409,6 +410,7 @@ export default class TaxPlanning extends Component { ...@@ -409,6 +410,7 @@ export default class TaxPlanning extends Component {
"status": type, "status": type,
"revision": 0, "revision": 0,
"quartal": this.props.quarter, "quartal": this.props.quarter,
"currency_id": this.props.defaultCurrency.id,
"tax_planning": data "tax_planning": data
} }
// this.props.saveToMasterBudget(payload) // this.props.saveToMasterBudget(payload)
...@@ -422,18 +424,22 @@ export default class TaxPlanning extends Component { ...@@ -422,18 +424,22 @@ export default class TaxPlanning extends Component {
this.props.onClickClose() this.props.onClickClose()
this.props.refresh() this.props.refresh()
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { if (response.data?.message == "Please Set Up Rate Currency First") {
document.body.style.overflow = 'unset'; this.setState({ visibleAlertSave: true, loading: false })
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { } else {
setTimeout(() => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
localStorage.removeItem(Constant.TOKEN) document.body.style.overflow = 'unset';
window.location.reload(); if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
}, 1000); setTimeout(() => {
} localStorage.removeItem(Constant.TOKEN)
// this.props.saveToMonthlyReport() window.location.reload();
this.props.onClickClose() }, 1000);
this.props.refresh() }
}) // this.props.saveToMonthlyReport()
this.props.onClickClose()
this.props.refresh()
})
}
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
...@@ -678,7 +684,11 @@ export default class TaxPlanning extends Component { ...@@ -678,7 +684,11 @@ export default class TaxPlanning extends Component {
} }
checkUpload() { checkUpload() {
api.create().checkImportRollingOutlookTP(this.state.payload).then(response => { let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkImportRollingOutlookTP(payload).then(response => {
console.log(this.state.payload); console.log(this.state.payload);
console.log(response) console.log(response)
if (response.data) { if (response.data) {
...@@ -857,6 +867,7 @@ export default class TaxPlanning extends Component { ...@@ -857,6 +867,7 @@ export default class TaxPlanning extends Component {
report_id: this.props.report_id, report_id: this.props.report_id,
quartal: this.props.quarter, quartal: this.props.quarter,
status: type, status: type,
currency_id: this.state.defaultCurrencyUpload?.id,
tax_planning: data, tax_planning: data,
} }
console.log(data); console.log(data);
...@@ -868,16 +879,20 @@ export default class TaxPlanning extends Component { ...@@ -868,16 +879,20 @@ export default class TaxPlanning extends Component {
// this.props.getReport() // this.props.getReport()
this.props.refresh() this.props.refresh()
} else { } else {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { if (response.data?.message == "Please Set Up Rate Currency First") {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { this.setState({ visibleAlertSave: true, loading: false })
setTimeout(() => { } else {
localStorage.removeItem(Constant.TOKEN) this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
window.location.reload(); if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
}, 1000); setTimeout(() => {
} localStorage.removeItem(Constant.TOKEN)
this.props.onClickClose() window.location.reload();
this.props.refresh() }, 1000);
}) }
this.props.onClickClose()
this.props.refresh()
})
}
// alert(response.data.status) // alert(response.data.status)
} }
} else { } else {
...@@ -918,11 +933,11 @@ export default class TaxPlanning extends Component { ...@@ -918,11 +933,11 @@ export default class TaxPlanning extends Component {
} }
downloadTemplate = async () => { downloadTemplate = async () => {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}&&currency_id=${this.props.defaultCurrency.id}`
console.log(url); console.log(url);
let res = await fetch( let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}` // `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}&&currency_id=${this.props.defaultCurrency.id}`
) )
res = await res.blob() res = await res.blob()
if (res.size > 0) { if (res.size > 0) {
...@@ -6146,7 +6161,11 @@ export default class TaxPlanning extends Component { ...@@ -6146,7 +6161,11 @@ export default class TaxPlanning extends Component {
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision}) </Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision}) </Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> {this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
...@@ -6166,27 +6185,29 @@ export default class TaxPlanning extends Component { ...@@ -6166,27 +6185,29 @@ export default class TaxPlanning extends Component {
</a> </a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
{this.props.isApprover === true || this.state.get_for == 'view' ? {this.props.isApprover === true || this.state.get_for == 'view' ?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> null
<a data-tip={'Download'} data-for="download"> // <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<button // <a data-tip={'Download'} data-for="download">
style={{ // <button
backgroundColor: 'transparent', // style={{
cursor: 'pointer', // backgroundColor: 'transparent',
borderColor: 'transparent', // cursor: 'pointer',
margin: 5 // borderColor: 'transparent',
}} // margin: 5
onClick={() => // }}
this.setState({ loading: true }, () => { // onClick={() =>
setTimeout(() => { // this.setState({ loading: true }, () => {
this.downloadAllData() // setTimeout(() => {
}, 100); // this.downloadAllData()
})} // }, 100);
> // })}
<img src={Images.download} /> // >
</button> // <img src={Images.download} />
</a> // </button>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> // </a>
</div> : // <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
// </div>
:
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template"> <a data-tip={'Download Template'} data-for="template">
<button <button
...@@ -6394,7 +6415,11 @@ export default class TaxPlanning extends Component { ...@@ -6394,7 +6415,11 @@ export default class TaxPlanning extends Component {
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision}) </Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision}) </Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> {this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div> </div>
{this.state.dataLoaded && ( {this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
...@@ -6523,22 +6548,25 @@ export default class TaxPlanning extends Component { ...@@ -6523,22 +6548,25 @@ export default class TaxPlanning 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={() => { }}
"ROLLING OUTLOOK - TAX PLANNING (in IDR mn)" onUpload={() => {
String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("TAX") && String(this.state.judul).includes("PLANNING") ? "ROLLING OUTLOOK - TAX PLANNING (in IDR mn)"
this.checkUpload() : String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && 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>
</div> </div>
)} )}
...@@ -6562,22 +6590,61 @@ export default class TaxPlanning extends Component { ...@@ -6562,22 +6590,61 @@ export default class TaxPlanning extends Component {
</button> </button>
</div> </div>
</div> </div>
<UploadFile <div style={{ padding: '25px 30px' }}>
type={this.state.uploadStatusSimulasi} <UploadFile
percentage={this.state.percentageSimulasi} type={this.state.uploadStatusSimulasi}
result={this.state.resultSimulasi} percentage={this.state.percentageSimulasi}
acceptedFiles={["xlsx"]} result={this.state.resultSimulasi}
onHandle={(dt) => { acceptedFiles={["xlsx"]}
this.fileHandlerSimulasi(dt) onHandle={(dt) => {
this.setState({ uploadStatusSimulasi: 'idle', percentageSimulasi: '0' }) this.fileHandlerSimulasi(dt)
}} this.setState({ uploadStatusSimulasi: 'idle', percentageSimulasi: '0' })
onUpload={() => { }}
"ROLLING OUTLOOK - TAX PLANNING (in IDR mn)" onUpload={() => {
String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("TAX") && String(this.state.judul).includes("PLANNING") ? "ROLLING OUTLOOK - TAX PLANNING (in IDR mn)"
this.uploadSimulasi() : String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("TAX") && String(this.state.judul).includes("PLANNING") ?
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) this.uploadSimulasi() :
}} 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, handleDoubleClick: 0 })}
>
<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