Commit d9163c6c authored by Riri Novita's avatar Riri Novita

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

Currency MB PL

See merge request !1795
parents 6812a354 64eada77
...@@ -97,7 +97,9 @@ export default class BudgetTahunan extends Component { ...@@ -97,7 +97,9 @@ export default class BudgetTahunan extends Component {
downloadedFileReportId: null, downloadedFileReportId: null,
arrayReport: [], arrayReport: [],
popupDownload: false, popupDownload: false,
currency: null, defaultCurrency: null,
dataCurrency: [],
currency: [],
dataCurrency: [ dataCurrency: [
{ {
"id": 1, "id": 1,
...@@ -259,7 +261,6 @@ export default class BudgetTahunan extends Component { ...@@ -259,7 +261,6 @@ export default class BudgetTahunan extends Component {
this.setState({ listCompany: defaultProps, company: indexID == null ? (this.state.company !== null ? this.state.company : companyData[0]) : companyData[indexID] }, () => { this.setState({ listCompany: defaultProps, company: indexID == null ? (this.state.company !== null ? this.state.company : companyData[0]) : companyData[indexID] }, () => {
// this.setState({ listCompany: defaultProps, company: indexID == null ? companyData[0] : companyData[indexID] }, () => { // this.setState({ listCompany: defaultProps, company: indexID == null ? companyData[0] : companyData[indexID] }, () => {
// // // console.log(response.data.data);
if (response.data.data.length > 0) { if (response.data.data.length > 0) {
this.getRevision() this.getRevision()
} else { } else {
...@@ -310,6 +311,7 @@ export default class BudgetTahunan extends Component { ...@@ -310,6 +311,7 @@ export default class BudgetTahunan extends Component {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"report_type": "Master Budget", "report_type": "Master Budget",
"currency_id": this.state.defaultCurrency.id
} }
console.log(payload); console.log(payload);
api.create().getReportTypeBody(payload).then(response => { api.create().getReportTypeBody(payload).then(response => {
...@@ -377,7 +379,6 @@ export default class BudgetTahunan extends Component { ...@@ -377,7 +379,6 @@ export default class BudgetTahunan extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ isSubmit: response.data.data.is_can_submit }, () => { this.setState({ isSubmit: response.data.data.is_can_submit }, () => {
this.getReport()
this.getReportAttachment() this.getReportAttachment()
}) })
} else { } else {
...@@ -394,6 +395,52 @@ export default class BudgetTahunan extends Component { ...@@ -394,6 +395,52 @@ export default class BudgetTahunan extends Component {
}) })
} }
getCurrency(companyID) {
// console.log(companyID);
api.create().getDetailPerusahaan(companyID).then(response => {
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
let data = response.data.data
let datas = []
if (response.data.data.currency.length > 0) {
response.data.data.currency.map((item) => {
console.log(item);
datas.push({
id: item.currencyId,
value: item.currencyName
})
})
}
let index = datas.findIndex((val) => val.id == response.data.data.default_currency)
this.setState({
defaultCurrencyID: response.data.data.default_currency,
currency: datas,
defaultCurrency: index == -1 ? null : datas[index]
}, () => {
this.getReport()
})
} else {
this.setState({ 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)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
getDetailUser() { getDetailUser() {
let userId = localStorage.getItem(Constant.USER) let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => { api.create().getDetailUser(userId).then((response) => {
...@@ -443,6 +490,7 @@ export default class BudgetTahunan extends Component { ...@@ -443,6 +490,7 @@ export default class BudgetTahunan extends Component {
let index = arrayBaru.findIndex((val) => val.company_id == comID) let index = arrayBaru.findIndex((val) => val.company_id == comID)
this.setState({ listCompany: defaultProps, company: arrayBaru.length < 1 ? companyData[0] : (index == -1 ? arrayBaru[0] : arrayBaru[index]) }, () => { this.setState({ listCompany: defaultProps, company: arrayBaru.length < 1 ? companyData[0] : (index == -1 ? arrayBaru[0] : arrayBaru[index]) }, () => {
this.getLastPeriod() this.getLastPeriod()
console.log(this.state.company.company_id);
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -515,6 +563,7 @@ export default class BudgetTahunan extends Component { ...@@ -515,6 +563,7 @@ export default class BudgetTahunan extends Component {
this.getCompanySubmitted() this.getCompanySubmitted()
} else { } else {
this.getRevision() this.getRevision()
this.getCurrency(this.state.company.company_id)
} }
}) })
} }
...@@ -2910,8 +2959,28 @@ export default class BudgetTahunan extends Component { ...@@ -2910,8 +2959,28 @@ export default class BudgetTahunan extends Component {
value={this.state.periode} value={this.state.periode}
/> />
</div> </div>
<div style={{ width: '20%', marginTop: 12}}> <div style={{ width: 255 }}>
<Autocomplete <Autocomplete
id="tipe"
disableClearable
options={this.state.currency}
getOptionLabel={(option) => option.value}
value={this.state.defaultCurrency}
onChange={(event, newInputValue) => this.setState({ defaultCurrency: newInputValue }, () => this.clearError())}
renderInput={(params) =>
<TextField
{...params}
variant="standard"
label="Default Currency"
margin="normal"
style={{ marginTop: 6 }}
// InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
// InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
/>
{/* <Autocomplete
options={this.state.dataCurrency} options={this.state.dataCurrency}
getOptionLabel={(option) => option.value} getOptionLabel={(option) => option.value}
onChange={(event, newInputValue) => this.setState({ currency: newInputValue })} onChange={(event, newInputValue) => this.setState({ currency: newInputValue })}
...@@ -2927,7 +2996,7 @@ export default class BudgetTahunan extends Component { ...@@ -2927,7 +2996,7 @@ export default class BudgetTahunan extends Component {
/> />
)} )}
value={this.state.currency == null ? "IDR" : this.state.currency} value={this.state.currency == null ? "IDR" : this.state.currency}
/> /> */}
</div> </div>
</div> </div>
...@@ -2939,6 +3008,7 @@ export default class BudgetTahunan extends Component { ...@@ -2939,6 +3008,7 @@ export default class BudgetTahunan extends Component {
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.setState({ visibleTableHistory: false }) this.setState({ visibleTableHistory: false })
// this.getLastPeriod() // this.getLastPeriod()
this.getCurrency(newInputValue.company_id)
this.getRevision() this.getRevision()
})} })}
disableClearable disableClearable
...@@ -3314,6 +3384,7 @@ export default class BudgetTahunan extends Component { ...@@ -3314,6 +3384,7 @@ export default class BudgetTahunan extends Component {
height={this.props.height} height={this.props.height}
width={this.props.width} width={this.props.width}
company={this.state.company} company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
revision={this.state.revisionTable} revision={this.state.revisionTable}
periode={this.state.periode.periode} periode={this.state.periode.periode}
submissionID={this.state.submissionID} submissionID={this.state.submissionID}
...@@ -3336,6 +3407,7 @@ export default class BudgetTahunan extends Component { ...@@ -3336,6 +3407,7 @@ export default class BudgetTahunan extends Component {
height={this.props.height} height={this.props.height}
width={this.props.width} width={this.props.width}
company={this.state.company} company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
revision={this.state.revisionTable} revision={this.state.revisionTable}
periode={this.state.periode.periode} periode={this.state.periode.periode}
submissionID={this.state.submissionID} submissionID={this.state.submissionID}
......
...@@ -81,7 +81,8 @@ export default class ProfitLoss extends Component { ...@@ -81,7 +81,8 @@ export default class ProfitLoss extends Component {
"revision": Number(this.props.revision), "revision": Number(this.props.revision),
"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) {
...@@ -110,10 +111,10 @@ export default class ProfitLoss extends Component { ...@@ -110,10 +111,10 @@ export default class ProfitLoss extends Component {
"revision": Number(this.props.revision), "revision": Number(this.props.revision),
"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().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
// console.log(response);
let dataTable = [] let dataTable = []
this.setState({ visibleProfitLoss: true }) this.setState({ visibleProfitLoss: true })
if (response.data) { if (response.data) {
......
This diff is collapsed.
...@@ -268,7 +268,7 @@ export default class BalanceSheetRO extends Component { ...@@ -268,7 +268,7 @@ export default class BalanceSheetRO extends Component {
} }
} }
}) })
console.log(dataTable) // console.log(dataTable)
this.setState({ dataTable, loading: false, buttonError: true, editable: true }) this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else { } else {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......
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