Commit a1862fa5 authored by Riri Novita's avatar Riri Novita

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

Currency OPIN

See merge request !1826
parents 0e508cb7 ce3c2d58
...@@ -539,17 +539,17 @@ export default class OperatingIndicator extends Component { ...@@ -539,17 +539,17 @@ export default class OperatingIndicator extends Component {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ visibleDetailOpt: false, visibleOperatingIndicator: true, loading: false }, () => this.setState({ visibleDetailOpt: false, visibleOperatingIndicator: true, loading: false }, () =>
this.getOperatingID(), this.getOperatingID(),
this.getReport() this.getReport()
) )
} else { } else {
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 })
} }
} }
} else { } else {
...@@ -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);
this.getReport() if (response.data) {
this.getOperatingID() if (response.data.status === "success") {
this.setState({ visibleDetailMonthly: false, visibleOperatingIndicator: true, loading: false }, () =>
this.getOperatingID(),
this.getReport()
)
} 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);
this.getReport() if (response.data) {
this.getOperatingID() if (response.data.status === "success") {
this.setState({ visibleDetailRolling: false, visibleOperatingIndicator: true, loading: false }, () =>
this.getOperatingID(),
this.getReport()
)
} 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,17 +1205,20 @@ export default class OperatingIndicator extends Component { ...@@ -1169,17 +1205,20 @@ export default class OperatingIndicator extends Component {
</button> </button>
</div> </div>
</div> </div>
<UploadFile <div style={{ padding: '25px 30px' }}>
type={this.state.uploadStatus} <UploadFile
percentage={this.state.percentage} type={this.state.uploadStatus}
result={this.state.result} percentage={this.state.percentage}
acceptedFiles={["xlsx"]} result={this.state.result}
onHandle={(dt) => { acceptedFiles={["xlsx"]}
this.fileHandler(dt) onHandle={(dt) => {
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.fileHandler(dt)
}} this.setState({ uploadStatus: 'idle', percentage: '0' })
onUpload={() => this.uploadAttachment(this.state.formData)} }}
/> onUpload={() => this.uploadAttachment(this.state.formData)}
/>
</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> </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
} }
...@@ -2138,7 +2106,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -2138,7 +2106,7 @@ export default class OperatingIndicatorRO extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
) )
}) : }) :
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
} }
</div> </div>
</div> </div>
...@@ -2385,21 +2353,60 @@ export default class OperatingIndicatorRO extends Component { ...@@ -2385,21 +2353,60 @@ export default class OperatingIndicatorRO extends Component {
</button> </button>
</div> </div>
</div> </div>
<UploadFile <div style={{ padding: '25px 30px' }}>
type={this.state.uploadStatus} <UploadFile
percentage={this.state.percentage} type={this.state.uploadStatus}
result={this.state.result} percentage={this.state.percentage}
acceptedFiles={["xlsx"]} result={this.state.result}
onHandle={(dt) => { acceptedFiles={["xlsx"]}
this.fileHandler(dt) onHandle={(dt) => {
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.fileHandler(dt)
}} this.setState({ uploadStatus: 'idle', percentage: '0' })
onUpload={() => { }}
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes(String(this.props.quartal).toLocaleUpperCase()) && String(this.state.judul).includes("OPERATING") && String(this.state.judul).includes("INDICATOR") ? onUpload={() => {
this.checkUpload() : String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes(String(this.props.quartal).toLocaleUpperCase()) && String(this.state.judul).includes("OPERATING") && String(this.state.judul).includes("INDICATOR") ?
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) this.checkUpload() :
}} this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
/> }}
/>
</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>
)} )}
......
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