Commit 2d3a9c77 authored by Riri Novita's avatar Riri Novita

Currency OPIN RO

parent ae4c89f8
...@@ -547,7 +547,7 @@ export default class OperatingIndicator extends Component { ...@@ -547,7 +547,7 @@ export default class OperatingIndicator extends Component {
if (response.data.message == "Please Set Up Rate Currency First") { if (response.data.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true, loading: false }) this.setState({ visibleAlertSave: true, loading: false })
} else { } else {
this.setState({alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
} }
} }
...@@ -561,16 +561,52 @@ export default class OperatingIndicator extends Component { ...@@ -561,16 +561,52 @@ export default class OperatingIndicator extends Component {
saveMonthlyOI(payload) { saveMonthlyOI(payload) {
api.create().createMonthlyReportOI(payload).then((response) => { api.create().createMonthlyReportOI(payload).then((response) => {
console.log(response); console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.setState({ visibleDetailMonthly: false, visibleOperatingIndicator: true, loading: false }, () =>
this.getOperatingID(),
this.getReport() this.getReport()
this.getOperatingID() )
} else {
if (response.data.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true, loading: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
}
} else {
this.setState({ alert: true, messageAlert: "Error saving data. Please try again", tipeAlert: 'warning', loading: false, handleDoubleClick: 0 })
}
// this.getReport()
// this.getOperatingID()
}) })
} }
saveRollingOI(payload) { saveRollingOI(payload) {
api.create().createRollingOI(payload).then((response) => { api.create().createRollingOI(payload).then((response) => {
console.log(response); console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.setState({ visibleDetailRolling: false, visibleOperatingIndicator: true, loading: false }, () =>
this.getOperatingID(),
this.getReport() this.getReport()
this.getOperatingID() )
} else {
if (response.data.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true, loading: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
}
} else {
this.setState({ alert: true, messageAlert: "Error saving data. Please try again", tipeAlert: 'warning', loading: false, handleDoubleClick: 0 })
}
// this.getReport()
// this.getOperatingID()
}) })
} }
...@@ -1169,6 +1205,7 @@ export default class OperatingIndicator extends Component { ...@@ -1169,6 +1205,7 @@ export default class OperatingIndicator extends Component {
</button> </button>
</div> </div>
</div> </div>
<div style={{ padding: '25px 30px' }}>
<UploadFile <UploadFile
type={this.state.uploadStatus} type={this.state.uploadStatus}
percentage={this.state.percentage} percentage={this.state.percentage}
...@@ -1181,6 +1218,8 @@ export default class OperatingIndicator extends Component { ...@@ -1181,6 +1218,8 @@ export default class OperatingIndicator extends Component {
onUpload={() => this.uploadAttachment(this.state.formData)} onUpload={() => this.uploadAttachment(this.state.formData)}
/> />
</div> </div>
<div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div>
</div>
</div> </div>
)} )}
...@@ -1237,7 +1276,7 @@ export default class OperatingIndicator extends Component { ...@@ -1237,7 +1276,7 @@ export default class OperatingIndicator extends Component {
marginRight: 20, marginRight: 20,
borderRadius: 9 borderRadius: 9
}} }}
onClick={() => this.setState({ visibleAlertSave: false})} 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' }}> <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> <Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
......
...@@ -317,43 +317,6 @@ export default class OperatingIndicatorRO extends Component { ...@@ -317,43 +317,6 @@ export default class OperatingIndicatorRO extends Component {
} }
} }
backToMasterBudget(type) {
let data = []
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
total_actual_before: String(i[6]),
january: String(i[7]),
february: String(i[8]),
march: String(i[9]),
april: String(i[10]),
may: String(i[11]),
june: String(i[12]),
july: String(i[13]),
august: String(i[14]),
september: String(i[15]),
october: String(i[16]),
november: String(i[17]),
december: String(i[18]),
total_current_year: String(i[19]),
total_next_year: String(i[20]),
total_more_year: String(i[21])
})
})
// let payload = {
// "submission_id": this.props.submissionID,
// "company_id": this.props.company.company_id,
// "periode": this.props.periode,
// "report_id": this.props.report_id,
// "status": type,
// "balance_sheet": data
// }
// // // // console.log(data);
// this.props.saveToMasterBudget(payload)
this.props.onClickClose()
}
downloadTemplate = async () => { downloadTemplate = async () => {
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/download_template?report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&quartal=${this.props.quartal}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/download_template?report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&quartal=${this.props.quartal}`
...@@ -445,8 +408,12 @@ export default class OperatingIndicatorRO extends Component { ...@@ -445,8 +408,12 @@ export default class OperatingIndicatorRO extends Component {
} }
checkUpload() { checkUpload() {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
// // console.log(JSON.stringify(this.state.payload)) // // console.log(JSON.stringify(this.state.payload))
api.create().checkUploadRollingOutlookOI(this.state.payload).then(response => { api.create().checkUploadRollingOutlookOI(payload).then(response => {
// // // console.log(JSON.stringify(this.state.payload)); // // // console.log(JSON.stringify(this.state.payload));
// // console.log('===============') // // console.log('===============')
console.log(response) console.log(response)
...@@ -517,6 +484,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -517,6 +484,7 @@ export default class OperatingIndicatorRO extends Component {
periode: this.props.data.periode, periode: this.props.data.periode,
quartal: this.props.quartal, quartal: this.props.quartal,
report_id: this.props.data.report_id, report_id: this.props.data.report_id,
currency_id: this.props.defaultCurrency.id,
status: type, status: type,
rolling_outlook: data rolling_outlook: data
} }
...@@ -2385,6 +2353,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -2385,6 +2353,7 @@ export default class OperatingIndicatorRO extends Component {
</button> </button>
</div> </div>
</div> </div>
<div style={{ padding: '25px 30px' }}>
<UploadFile <UploadFile
type={this.state.uploadStatus} type={this.state.uploadStatus}
percentage={this.state.percentage} percentage={this.state.percentage}
...@@ -2401,6 +2370,44 @@ export default class OperatingIndicatorRO extends Component { ...@@ -2401,6 +2370,44 @@ export default class OperatingIndicatorRO extends Component {
}} }}
/> />
</div> </div>
<div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></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> </div>
......
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