Commit 3567de68 authored by Riri Novita's avatar Riri Novita

Update TP ke replace

parent d7d1eaf5
......@@ -58,6 +58,7 @@ export default class TaxPlanning extends Component {
get_for: "view",
viewOnly: true,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this)
......@@ -173,7 +174,7 @@ export default class TaxPlanning extends Component {
"revision": Number(this.props.revision),
"rolling_outlook_id": this.props.rollingOutlookID,
"quartal": this.props.quarter,
"currency_id": this.state.defaultCurrencyUpload?.id
"currency_id": this.props.defaultCurrency.id
}
api.create().getRollingOutlookTP(payload).then(response => {
console.log(payload);
......@@ -409,6 +410,7 @@ export default class TaxPlanning extends Component {
"status": type,
"revision": 0,
"quartal": this.props.quarter,
"currency_id": this.props.defaultCurrency.id,
"tax_planning": data
}
// this.props.saveToMasterBudget(payload)
......@@ -421,6 +423,9 @@ export default class TaxPlanning extends Component {
// this.props.saveToMonthlyReport()
this.props.onClickClose()
this.props.refresh()
} else {
if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true, loading: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
document.body.style.overflow = 'unset';
......@@ -435,6 +440,7 @@ export default class TaxPlanning extends Component {
this.props.refresh()
})
}
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
......@@ -678,7 +684,11 @@ export default class TaxPlanning extends Component {
}
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(response)
if (response.data) {
......@@ -857,6 +867,7 @@ export default class TaxPlanning extends Component {
report_id: this.props.report_id,
quartal: this.props.quarter,
status: type,
currency_id: this.state.defaultCurrencyUpload?.id,
tax_planning: data,
}
console.log(data);
......@@ -867,6 +878,9 @@ export default class TaxPlanning extends Component {
this.props.onClickClose()
// this.props.getReport()
this.props.refresh()
} else {
if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true, loading: false })
} else {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
......@@ -878,6 +892,7 @@ export default class TaxPlanning extends Component {
this.props.onClickClose()
this.props.refresh()
})
}
// alert(response.data.status)
}
} else {
......@@ -918,11 +933,11 @@ export default class TaxPlanning extends Component {
}
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);
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/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()
if (res.size > 0) {
......@@ -6146,7 +6161,11 @@ export default class TaxPlanning extends Component {
<div>
<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>
{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 style={{ width: '50%' }}>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
......@@ -6166,27 +6185,29 @@ export default class TaxPlanning extends Component {
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
{this.props.isApprover === true || this.state.get_for == 'view' ?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> :
null
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
// <a data-tip={'Download'} data-for="download">
// <button
// style={{
// backgroundColor: 'transparent',
// cursor: 'pointer',
// borderColor: 'transparent',
// margin: 5
// }}
// onClick={() =>
// this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.downloadAllData()
// }, 100);
// })}
// >
// <img src={Images.download} />
// </button>
// </a>
// <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
// </div>
:
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button
......@@ -6394,7 +6415,11 @@ export default class TaxPlanning extends Component {
<div>
<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>
{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>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
......@@ -6523,6 +6548,7 @@ export default class TaxPlanning extends Component {
</button>
</div>
</div>
<div style={{ padding: '25px 30px' }}>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
......@@ -6540,6 +6566,8 @@ export default class TaxPlanning extends Component {
}}
/>
</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>
)}
......@@ -6562,6 +6590,7 @@ export default class TaxPlanning extends Component {
</button>
</div>
</div>
<div style={{ padding: '25px 30px' }}>
<UploadFile
type={this.state.uploadStatusSimulasi}
percentage={this.state.percentageSimulasi}
......@@ -6579,6 +6608,44 @@ export default class TaxPlanning extends Component {
}}
/>
</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>
......
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