Commit 060127d3 authored by Riri Novita's avatar Riri Novita

Currency TP

parent 70a8b289
......@@ -100,6 +100,7 @@ export default class BudgetTahunan extends Component {
defaultCurrency: null,
dataCurrency: [],
currency: [],
visibleAlertSave: false,
dataCurrency: [
{
"id": 1,
......@@ -2322,6 +2323,7 @@ export default class BudgetTahunan extends Component {
if (response.data.status === 'success') {
this.getSubmission(type)
} else {
this.setState({ visibleAlertSave: true})
// this.setState({ loading: false }, () => {
this.getSubmission()
document.body.style.overflow = 'unset';
......@@ -3740,6 +3742,42 @@ export default class BudgetTahunan 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 >
);
}
......
......@@ -10,7 +10,7 @@ import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab';
import { Alert, Autocomplete } from '@material-ui/lab';
import * as R from 'ramda';
import Constant from '../../library/Constant';
import { roundMath } from '../../library/Utils';
......@@ -56,7 +56,9 @@ export default class TaxPlanning extends Component {
handleDoubleClick: 0,
saveDraft: true,
minValue: "0",
maxValue: "0"
maxValue: "0",
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.handleValue = this.handleValue.bind(this)
......@@ -472,9 +474,9 @@ export default class TaxPlanning extends Component {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkUploadMB(this.state.payload).then(response => {
// console.log(this.state.payload);
// console.log(response)
console.log(payload);
api.create().checkUploadMB(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleTP: false, loading: true })
......@@ -624,12 +626,13 @@ export default class TaxPlanning extends Component {
}
})
})
let body = {
submission_id: this.props.submissionID,
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
currency_id: this.props.defaultCurrency.id,
currency_id: this.state.defaultCurrencyUpload?.id,
tax_planning: data,
status: type
}
......@@ -641,7 +644,7 @@ export default class TaxPlanning extends Component {
this.props.onClickClose()
this.props.getReport()
} else {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
this.setState({ visibleAlertSave: true, loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......@@ -9294,21 +9297,83 @@ export default class TaxPlanning 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("MASTER") && String(this.state.judul).includes("BUDGET") && String(this.state.judul).includes("TAX") && String(this.state.judul).includes("PLANNING") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
/>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '20px 30px' }}>
<div className="column-1">
<Autocomplete
id="tipe"
disableClearable
options={this.props.currency}
getOptionLabel={(option) => option.value}
value={this.state.defaultCurrencyUpload}
onChange={(event, newInputValue) => this.setState({ defaultCurrencyUpload: newInputValue })}
renderInput={(params) =>
<TextField
{...params}
variant="standard"
label="Default Currency"
margin="normal"
style={{ marginBottom: 10 }}
// InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
// InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
/>
</div>
</div>
<div style={{ padding: '10px 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("MASTER") && String(this.state.judul).includes("BUDGET") && 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>
</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>
)}
......
......@@ -325,6 +325,30 @@ export default class CreatePerusahaan extends Component {
currencyID.push(item.id)
})
}
// OPSI 1
// if (this.state.currency.length > 0) {
// this.state.currency.map(item => {
// currencyID.push({
// "currency_id" : item.id,
// "status" : true
// })
// })
// }
// OPSI 2
// let finalCurrency = []
// console.log(this.state.dataCurrency);
// this.state.dataCurrency.map(item => {
// let index = this.state.currency.findIndex((val) => val.id == item.id)
// console.log(index);
// finalCurrency.push({
// "currency_id" : item.id,
// "status" : index == 0 || index == 1 ? true : false
// })
// })
let payload = {
"company_id": this.state.companyID,
"company_name": this.state.company,
......@@ -336,7 +360,7 @@ export default class CreatePerusahaan extends Component {
"default_currency": this.state.defaultCurrency.id,
"currency": currencyID
}
// console.log(payload);
console.log(payload);
this.props.updatePerusahaan(payload)
}
}
......@@ -452,6 +476,7 @@ export default class CreatePerusahaan extends Component {
multiple
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)
......
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