Commit 9d0dab52 authored by Riri Novita's avatar Riri Novita

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

Currency TP

See merge request !1808
parents 836f886d 724b4974
...@@ -100,6 +100,7 @@ export default class BudgetTahunan extends Component { ...@@ -100,6 +100,7 @@ export default class BudgetTahunan extends Component {
defaultCurrency: null, defaultCurrency: null,
dataCurrency: [], dataCurrency: [],
currency: [], currency: [],
visibleAlertSave: false,
dataCurrency: [ dataCurrency: [
{ {
"id": 1, "id": 1,
...@@ -2322,6 +2323,7 @@ export default class BudgetTahunan extends Component { ...@@ -2322,6 +2323,7 @@ export default class BudgetTahunan extends Component {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.getSubmission(type) this.getSubmission(type)
} else { } else {
this.setState({ visibleAlertSave: true})
// this.setState({ loading: false }, () => { // this.setState({ loading: false }, () => {
this.getSubmission() this.getSubmission()
document.body.style.overflow = 'unset'; document.body.style.overflow = 'unset';
...@@ -3740,6 +3742,42 @@ export default class BudgetTahunan extends Component { ...@@ -3740,6 +3742,42 @@ export default class BudgetTahunan 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 >
); );
} }
......
...@@ -10,7 +10,7 @@ import Images from '../../assets/Images'; ...@@ -10,7 +10,7 @@ import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip'; import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer'; 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 * as R from 'ramda';
import Constant from '../../library/Constant'; import Constant from '../../library/Constant';
import { roundMath } from '../../library/Utils'; import { roundMath } from '../../library/Utils';
...@@ -56,7 +56,9 @@ export default class TaxPlanning extends Component { ...@@ -56,7 +56,9 @@ export default class TaxPlanning extends Component {
handleDoubleClick: 0, handleDoubleClick: 0,
saveDraft: true, saveDraft: true,
minValue: "0", minValue: "0",
maxValue: "0" maxValue: "0",
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
...@@ -472,9 +474,9 @@ export default class TaxPlanning extends Component { ...@@ -472,9 +474,9 @@ export default class TaxPlanning extends Component {
...this.state.payload, ...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id currency_id: this.state.defaultCurrencyUpload?.id
} }
api.create().checkUploadMB(this.state.payload).then(response => { console.log(payload);
// console.log(this.state.payload); api.create().checkUploadMB(payload).then(response => {
// console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleTP: false, loading: true }) this.setState({ visibleUpload: false, visibleTP: false, loading: true })
...@@ -624,12 +626,13 @@ export default class TaxPlanning extends Component { ...@@ -624,12 +626,13 @@ export default class TaxPlanning extends Component {
} }
}) })
}) })
let body = { let body = {
submission_id: this.props.submissionID, submission_id: this.props.submissionID,
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, currency_id: this.state.defaultCurrencyUpload?.id,
tax_planning: data, tax_planning: data,
status: type status: type
} }
...@@ -641,7 +644,7 @@ export default class TaxPlanning extends Component { ...@@ -641,7 +644,7 @@ export default class TaxPlanning extends Component {
this.props.onClickClose() this.props.onClickClose()
this.props.getReport() this.props.getReport()
} else { } 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")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -9294,21 +9297,83 @@ export default class TaxPlanning extends Component { ...@@ -9294,21 +9297,83 @@ export default class TaxPlanning extends Component {
</button> </button>
</div> </div>
</div> </div>
<UploadFile <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '20px 30px' }}>
type={this.state.uploadStatus} <div className="column-1">
percentage={this.state.percentage} <Autocomplete
result={this.state.result} id="tipe"
acceptedFiles={["xlsx"]} disableClearable
onHandle={(dt) => { options={this.props.currency}
this.fileHandler(dt) getOptionLabel={(option) => option.value}
this.setState({ uploadStatus: 'idle', percentage: '0' }) value={this.state.defaultCurrencyUpload}
}} onChange={(event, newInputValue) => this.setState({ defaultCurrencyUpload: newInputValue })}
onUpload={() => { renderInput={(params) =>
String(this.state.judul).includes("MASTER") && String(this.state.judul).includes("BUDGET") && String(this.state.judul).includes("TAX") && String(this.state.judul).includes("PLANNING") ? <TextField
this.checkUpload() : {...params}
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) 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>
</div> </div>
)} )}
......
...@@ -325,6 +325,30 @@ export default class CreatePerusahaan extends Component { ...@@ -325,6 +325,30 @@ export default class CreatePerusahaan extends Component {
currencyID.push(item.id) 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 = { let payload = {
"company_id": this.state.companyID, "company_id": this.state.companyID,
"company_name": this.state.company, "company_name": this.state.company,
...@@ -336,7 +360,7 @@ export default class CreatePerusahaan extends Component { ...@@ -336,7 +360,7 @@ export default class CreatePerusahaan extends Component {
"default_currency": this.state.defaultCurrency.id, "default_currency": this.state.defaultCurrency.id,
"currency": currencyID "currency": currencyID
} }
// console.log(payload); console.log(payload);
this.props.updatePerusahaan(payload) this.props.updatePerusahaan(payload)
} }
} }
...@@ -452,6 +476,7 @@ export default class CreatePerusahaan extends Component { ...@@ -452,6 +476,7 @@ export default class CreatePerusahaan extends Component {
multiple multiple
options={this.state.dataCurrency} options={this.state.dataCurrency}
getOptionLabel={(option) => option.value} getOptionLabel={(option) => option.value}
getOptionSelected={(option, value) => option.id === value.id}
onChange={(event, newInputValue) => this.setState({ currency: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ currency: newInputValue }, () => {
if (this.state.defaultCurrency) { if (this.state.defaultCurrency) {
const result = this.state.currency.find((elem) => elem.id === this.state.defaultCurrency.id) 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