Commit f94b40ab authored by Riri Novita's avatar Riri Novita

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

Update Monthly Currency

See merge request !1818
parents 3f0d787f a65e5958
......@@ -51,7 +51,7 @@ export default class EditApprovalMatrix extends Component {
getDetailAM() {
api.create().getDetailAM(this.props.data[1]).then(response => {
// console.log(response)
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
......@@ -89,6 +89,8 @@ export default class EditApprovalMatrix extends Component {
getUserData() {
api.create().getApprovedByAM().then((response) => {
console.log(response);
console.log(this.state.getUserId);
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
......
......@@ -93,7 +93,9 @@ export default class ProfitLossMR extends Component {
saveDraft: true,
buttonError: true,
viewOnly: true,
get_for: 'view'
get_for: 'view',
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -223,6 +225,7 @@ export default class ProfitLossMR extends Component {
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id,
"currency_id": this.props.defaultCurrency.id,
"get_for": this.state.get_for
}
console.log(payload);
......@@ -402,6 +405,7 @@ export default class ProfitLossMR extends Component {
"report_id": this.props.report_id,
"status": type,
"months": this.props.month.month_id,
"currency_id": this.props.defaultCurrency.id,
"profit_loss": data
}
console.log(payload);
......@@ -474,7 +478,11 @@ export default class ProfitLossMR extends Component {
}
checkUpload() {
api.create().checkUploadMonthlyReportPL(this.state.payload).then(response => {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkUploadMonthlyReportPL(payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
......@@ -568,6 +576,7 @@ export default class ProfitLossMR extends Component {
"periode": this.props.periode,
"report_id": this.props.report_id,
"months": this.props.month.month_id,
"currency_id": this.props.defaultCurrency.id,
"status": type,
"profit_loss": data
}
......@@ -653,6 +662,7 @@ export default class ProfitLossMR extends Component {
"report_id": this.props.report_id,
"status": "submitted",
"months": this.props.month.month_id,
"currency_id": this.props.defaultCurrency.id,
"profit_loss": data
}
// console.log(JSON.stringify(payload));
......
This diff is collapsed.
......@@ -94,7 +94,21 @@ export default class RollingOutlook extends Component {
isCheckAll: false,
downloadedFileReportId: null,
arrayReport: [],
popupDownload: false
popupDownload: false,
defaultCurrency: null,
dataCurrency: [],
currency: [],
visibleAlertSave: false,
dataCurrency: [
{
"id": 1,
"value": "IDR"
},
{
"id": 2,
"value": "USD",
}
]
}
this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this);
......@@ -221,6 +235,7 @@ export default class RollingOutlook extends Component {
// console.log(response.data.data.length)
if (response.data.data.length > 0) {
this.getRevision()
this.getCurrency(this.state.company.company_id)
} else {
// console.log(this.state.listCompany)
// console.log(this.state.company_submit)
......@@ -249,6 +264,50 @@ export default class RollingOutlook 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]
})
} 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' })
}
})
}
getReportAttachment() {
let payload = {
"company_id": this.state.company.company_id,
......@@ -1881,7 +1940,7 @@ export default class RollingOutlook extends Component {
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook & CAT</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<div style={{ display: 'flex' }}>
<Autocomplete
{...this.state.listPeriode}
id="periode"
......@@ -1901,6 +1960,27 @@ export default class RollingOutlook extends Component {
/>}
value={this.state.periode}
/>
<Autocomplete
id="tipe"
disableClearable
style={{ width: 250 }}
options={this.state.currency}
getOptionLabel={(option) => option.value}
value={this.state.defaultCurrency}
onChange={(event, newInputValue) => this.setState({ defaultCurrency: newInputValue }, () => {
this.getRevision()
})}
renderInput={(params) =>
<TextField
{...params}
variant="standard"
label="Currency"
margin="normal"
style={{ marginLeft: 25, marginTop: 7 }}
/>
}
/>
</div>
<div style={{ marginTop: 20 }}>
<Autocomplete
......@@ -1946,6 +2026,7 @@ export default class RollingOutlook extends Component {
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.setState({ visibleTableHistory: false })
this.getRevision()
this.getCurrency(newInputValue.company_id)
})}
disableClearable
style={{ width: 250 }}
......@@ -2328,6 +2409,8 @@ export default class RollingOutlook extends Component {
open={this.props.open}
report_id={this.state.report_id}
company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
rollingOutlookID={this.state.rollingOutlookID}
......@@ -2348,6 +2431,8 @@ export default class RollingOutlook extends Component {
open={this.props.open}
report_id={this.state.report_id}
company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
rollingOutlookID={this.state.rollingOutlookID}
......@@ -2368,6 +2453,8 @@ export default class RollingOutlook extends Component {
open={this.props.open}
report_id={this.state.report_id}
company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
rollingOutlookID={this.state.rollingOutlookID}
......@@ -2388,6 +2475,8 @@ export default class RollingOutlook extends Component {
open={this.props.open}
report_id={this.state.report_id}
company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
rollingOutlookID={this.state.rollingOutlookID}
......@@ -2409,6 +2498,8 @@ export default class RollingOutlook extends Component {
open={this.props.open}
report_id={this.state.report_id}
company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
rollingOutlookID={this.state.rollingOutlookID}
......
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