Commit b0364acd authored by Riri Novita's avatar Riri Novita

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

Update Currency MB

See merge request !1810
parents 9d0dab52 21d0f53e
......@@ -295,8 +295,9 @@ export default class BalanceSheet extends Component {
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}`
)
console.log(res);
res = await res.blob()
// console.log(res)
console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
......@@ -306,6 +307,23 @@ export default class BalanceSheet extends Component {
}
}
// downloadTemplate = async () => {
// 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}`
// )
// console.log(res)
// res = await res.blob()
// console.log(res)
// if (res.size > 0) {
// let url = window.URL.createObjectURL(res);
// console.log(url);
// let a = document.createElement('a');
// a.href = url;
// a.download = 'Template Master Budget Balance Sheet.xlsx';
// a.click();
// }
// }
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
......@@ -3803,7 +3821,7 @@ export default class BalanceSheet extends Component {
/>
</div>
</div>
<div style={{ padding: '10px 30px' }}>
<div style={{ padding: '15px 30px 55px' }}>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
......
......@@ -8,7 +8,7 @@ import Images from '../../assets/Images';
import * as R from 'ramda'
import { PropagateLoader } from 'react-spinners';
import Constant from '../../library/Constant';
import { Alert } from '@material-ui/lab';
import { Alert, Autocomplete } from '@material-ui/lab';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3());
......@@ -42,7 +42,9 @@ export default class CashFlow extends Component {
loading: false,
minValue: "0",
maxValue: "0",
handleDoubleClick: 0
handleDoubleClick: 0,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
}
......@@ -380,6 +382,7 @@ export default class CashFlow extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": 6,
"currency_id": this.props.defaultCurrency.id,
"status": "submitted",
"cash_flow": dbcf
}
......
......@@ -85,6 +85,8 @@ export default class CorporateAnnualTarget extends Component {
dataFin: [],
dataLearn: [],
handleDataSalah: false,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -435,9 +437,13 @@ export default class CorporateAnnualTarget extends Component {
}
checkUpload() {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
this.setState({ loading: true, dataTable: [] })
let dataDelete = this.state.dataDelete
api.create().getIdDeleteFromExcel(this.state.payload).then((response) => {
api.create().getIdDeleteFromExcel(payload).then((response) => {
if (response.data) {
// // // // // console.log(response.data)
let idDelete = response.data.data.item_report_id
......@@ -449,8 +455,8 @@ export default class CorporateAnnualTarget extends Component {
}
}
})
console.log(this.state.payload)
api.create().checkUploadMB(this.state.payload).then(response => {
console.log(payload)
api.create().checkUploadMB(payload).then(response => {
// // console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
......@@ -645,6 +651,7 @@ export default class CorporateAnnualTarget extends Component {
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID,
"currency_id": this.state.defaultCurrencyUpload?.id,
"status": type,
"cat": data
}
......@@ -658,7 +665,7 @@ export default class CorporateAnnualTarget extends Component {
this.props.onClickClose()
this.props.getReport()
} 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")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......@@ -791,6 +798,7 @@ export default class CorporateAnnualTarget extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"status": "submitted",
"cat": data
}
......@@ -873,6 +881,7 @@ export default class CorporateAnnualTarget extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"status": type,
"cat": data
}
......@@ -1008,7 +1017,6 @@ export default class CorporateAnnualTarget extends Component {
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID,
"currency_id": this.props.defaultCurrency.id
}
api.create().getLastestUpdateMB(payload).then(response => {
if (response.data) {
......@@ -4076,6 +4084,31 @@ export default class CorporateAnnualTarget extends Component {
</button>
</div>
</div>
<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: '15px 30px 55px' }}>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
......@@ -4093,6 +4126,43 @@ export default class CorporateAnnualTarget extends Component {
/>
</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>
);
......
......@@ -8,7 +8,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 Constant from '../../library/Constant';
import * as R from 'ramda'
......@@ -48,7 +48,9 @@ export default class FixedAssetsMovement extends Component {
buttonError: false,
judulColumn: null,
updateBy: [],
handleDoubleClick: 0
handleDoubleClick: 0,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -258,6 +260,7 @@ export default class FixedAssetsMovement extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"status": type,
"fixed_asset_movement": data
}
......@@ -335,7 +338,11 @@ export default class FixedAssetsMovement extends Component {
}
checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkUploadMB(payload).then(response => {
// // console.log(JSON.stringify(this.state.payload));
// // console.log(response)
if (response.data) {
......@@ -428,12 +435,13 @@ export default class FixedAssetsMovement extends Component {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
currency_id: this.state.defaultCurrencyUpload?.id,
fixed_asset_movement: data,
status: type
}
// // console.log(JSON.stringify(body));
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// // console.log(response);
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
......@@ -444,7 +452,7 @@ export default class FixedAssetsMovement extends Component {
this.props.getReport()
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
this.setState({ visibleAlertSave: true, 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)
......@@ -513,6 +521,7 @@ export default class FixedAssetsMovement extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"fixed_asset_movement": data,
"status": "submitted"
}
......@@ -2970,6 +2979,31 @@ export default class FixedAssetsMovement extends Component {
</button>
</div>
</div>
<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: '15px 30px 55px' }}>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
......@@ -2987,6 +3021,43 @@ export default class FixedAssetsMovement extends Component {
/>
</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>
);
......
......@@ -252,6 +252,7 @@ export default class ProfitLoss extends Component {
backToMasterBudget(type) {
// tambahin currency
console.log("tes");
let data = []
this.state.dataTable.map(i => {
data.push({
......@@ -3228,7 +3229,7 @@ export default class ProfitLoss extends Component {
/>
</div>
</div>
<div style={{ padding: '10px 30px' }}>
<div style={{ padding: '15px 30px 55px' }}>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
......
......@@ -765,8 +765,9 @@ export default class TaxPlanning extends Component {
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}`
)
console.log(res)
res = await res.blob()
// console.log(res)
console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
......@@ -9085,8 +9086,8 @@ export default class TaxPlanning extends Component {
</div>
</button>
</div>
{this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(!this.props.truelyApprover) && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ?
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(!this.props.truelyApprover) && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */}
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
......@@ -9159,8 +9160,9 @@ export default class TaxPlanning extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div> : null
}
</div>
{/* : null
} */}
</div>
</Paper>
:
......@@ -9321,7 +9323,7 @@ export default class TaxPlanning extends Component {
/>
</div>
</div>
<div style={{ padding: '10px 30px' }}>
<div style={{ padding: '15px 30px 55px' }}>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
......@@ -9342,7 +9344,7 @@ export default class TaxPlanning extends Component {
</div>
)}
{this.state.visibleAlertSave && (
{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 }}>
......
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