Commit 3dd6cca1 authored by Riri Novita's avatar Riri Novita

Merge branch 'ENV-DEV' into 'ENV-DEPLOYMENT'

Update Currency MB

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