Commit b66bbe9b authored by Riri Novita's avatar Riri Novita

Update Monthly Currency

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