Commit 72c2d88d authored by fahrur huzain's avatar fahrur huzain

issue LOV MR validasi

parent 4bfafc7a
......@@ -409,31 +409,31 @@ export default class LOCF extends Component {
if (i.length > 0) {
let tgl = String(i[6]).split('-')
payload.push({
"item_report_id": i[1],
"item_report_id": i[1] !== undefined ? Number(i[1]) : null,
"borrower_comp_name": this.props.company.company_name,
"bank_name": i[2],
"type_of_credit": i[3],
"remarks": i[4],
"remarks2": i[5],
"loan_maturity_date": i[6] !== undefined ? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : null,
"interest": i[7],
"currency": i[8],
"loan_plafond_amount_ori": i[9] !== undefined ? Number(i[9]) : i[8],
"loan_plafond_amount_idr": i[10] !== undefined ? Number(i[10]) : i[10],
"out_loan_ki_amount_ori": i[11] !== undefined ? Number(i[11]) : i[11],
"out_loan_ki_amount_idr": i[12] !== undefined ? Number(i[12]) : i[12],
"out_loan_kmk_amount_ori": i[13] !== undefined ? Number(i[13]) : i[13],
"out_loan_kmk_amount_idr": i[14] !== undefined ? Number(i[14]) : i[14],
"out_loan_other_type": i[15],
"out_loan_other_amount_ori": i[16] !== undefined ? Number(i[16]) : i[16],
"out_loan_other_amount_idr": i[17] !== undefined ? Number(i[17]) : i[17],
"bank_name": i[2] !== undefined ? i[2] : "",
"type_of_credit": i[3] !== undefined ? i[3] : "",
"remarks": i[4] !== undefined ? i[4] : "",
"remarks2": i[5] !== undefined ? i[5] : "",
"loan_maturity_date": i[6] !== undefined ? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : "",
"interest": i[7] !== undefined ? Number(i[7]) : "",
"currency": i[8] !== undefined ? i[8] : "",
"loan_plafond_amount_ori": i[9] !== undefined ? Number(i[9]) : "",
"loan_plafond_amount_idr": i[10] !== undefined ? Number(i[10]) : "",
"out_loan_ki_amount_ori": i[11] !== undefined ? Number(i[11]) : "",
"out_loan_ki_amount_idr": i[12] !== undefined ? Number(i[12]) : "",
"out_loan_kmk_amount_ori": i[13] !== undefined ? Number(i[13]) : "",
"out_loan_kmk_amount_idr": i[14] !== undefined ? Number(i[14]) : "",
"out_loan_other_type": i[15] !== undefined ? Number(i[2]) : "",
"out_loan_other_amount_ori": i[16] !== undefined ? Number(i[16]) : "",
"out_loan_other_amount_idr": i[17] !== undefined ? Number(i[17]) : "",
// "total_out_loan_ori": i[18],
// "total_out_loan_idr": i[19],
// "remaining_plafond_ori": i[20],
// "remaining_plafond_idr": i[21],
"current_ratio_financial": i[18],
"der_financial": i[19],
"debt_to_ebitda_financial": i[20],
"current_ratio_financial": i[18] !== undefined ? Number(i[18]) : "",
"der_financial": i[19] !== undefined ? Number(i[19]) : "",
"debt_to_ebitda_financial": i[20] !== undefined ? Number(i[20]) : "",
"ebitda_to_interest_financial": i[21],
"other_ratio1_ratio_name": i[22],
"other_ratio1_financial": i[23],
......
......@@ -143,7 +143,8 @@ export default class ListOfCreditFacilities extends Component {
alert: false,
tipeAlert: '',
messageAlert: '',
emptyData: false,
emptyDataLOV: false,
emptyDataLOCF: false,
}
}
......@@ -479,13 +480,14 @@ export default class ListOfCreditFacilities extends Component {
dataTable2.map(i => {
if (i[0] == 3) {
if (i[6] == null || i[7] == null || i[9] == "" || i[10] == "" || i[11] == "" || i[12] == "") {
console.log('masuk sini');
error = true
this.setState({emptyDataLOCF : true})
}
console.log(i[7]?.value);
if ((i[7].value == 'Government bonds' && i[8] == '') || (i[7].value == 'Stocks' && i[8] == '') || (i[7].value == 'Mutual funds' && i[8] == '') || (i[7].value == 'Investment in associate' && i[8] == '') || (i[7].value == 'Investment in joint venture' && i[8] == '') || (i[7].value == 'Investment in subsidiary' && i[8] == '') || (i[7].value == 'Corporate bonds' && i[8] == '') || (i[7].value == 'Others' && i[8] == '')) {
if ((i[7]?.value == 'Government bonds' && i[8] == '') || (i[7].value == 'Stocks' && i[8] == '') || (i[7].value == 'Mutual funds' && i[8] == '') || (i[7].value == 'Investment in associate' && i[8] == '') || (i[7].value == 'Investment in joint venture' && i[8] == '') || (i[7].value == 'Investment in subsidiary' && i[8] == '') || (i[7].value == 'Corporate bonds' && i[8] == '') || (i[7].value == 'Others' && i[8] == '')) {
error = true
this.setState({emptyDataLOCF : true})
} else {
error = false
}
......@@ -596,10 +598,11 @@ export default class ListOfCreditFacilities extends Component {
if (i[0] == 3) {
if (i[6] == null || i[7] == null || i[8] == "" || i[10] == "" || i[11] == "" || i[12] == "") {
error = true
this.setState({emptyDataLOCF : true})
}
if (i[7].value == 'Others' && i[18] == '') {
if (i[7]?.value == 'Others' && i[18] == '') {
error = true
this.setState({emptyDataLOCF : true})
}
let tgl = String(i[10]).split('-')
let checkUndifined = tgl.findIndex((val) => val == undefined)
......@@ -607,7 +610,7 @@ export default class ListOfCreditFacilities extends Component {
data.push({
"item_report_id": i[1],
"borrower_comp_name": i[5],
"bank_name": i[6] == null ? [6] : i[6].value,
"bank_name": i[6] == null ? "" : i[6].value,
"type_of_credit": i[7] == null ? i[7] : i[7].value,
"remarks": i[8],
"remarks2": i[9] == null ? i[9] : i[9].value,
......@@ -656,7 +659,7 @@ export default class ListOfCreditFacilities extends Component {
data.push({
"item_report_id": i[1],
"borrower_comp_name": i[5],
"bank_name": i[6] == null ? [6] : i[6].value,
"bank_name": i[6] == null ? "" : i[6].value,
"type_of_credit": i[7] == null ? i[7] : i[7].value,
"remarks": i[8],
"remarks2": i[9] == null ? i[9] : i[9].value,
......@@ -944,19 +947,15 @@ export default class ListOfCreditFacilities extends Component {
bankNameEmpty = true
}
if (i[0] == 3) {
if (i[6] == null || i[7] == null || i[9] == "" || i[10] == "" || i[11] == "" || i[12] == "") {
if (i[6] == "" || i[7] == null || i[9] == "" || i[10] == "" || i[11] == "" || i[12] == "") {
error = true
this.setState({ emptyData: true})
this.setState({emptyDataLOV : true})
}
if (i[7] == null || i[7] == ""){
if ((i[7]?.value == 'Government bonds' && i[8] == '') || (i[7]?.value == 'Stocks' && i[8] == '') || (i[7]?.value == 'Mutual funds' && i[8] == '') || (i[7]?.value == 'Investment in associate' && i[8] == '') || (i[7]?.value == 'Investment in joint venture' && i[8] == '') || (i[7]?.value == 'Investment in subsidiary' && i[8] == '') || (i[7]?.value == 'Corporate bonds' && i[8] == '') || (i[7]?.value == 'Others' && i[8] == '')) {
error = true
}else {
if ((i[7].value == 'Government bonds' && i[8] == '') || (i[7].value == 'Stocks' && i[8] == '') || (i[7].value == 'Mutual funds' && i[8] == '') || (i[7].value == 'Investment in associate' && i[8] == '') || (i[7].value == 'Investment in joint venture' && i[8] == '') || (i[7].value == 'Investment in subsidiary' && i[8] == '') || (i[7].value == 'Corporate bonds' && i[8] == '') || (i[7].value == 'Others' && i[8] == '')) {
error = true
this.setState({ emptyData: true})
} else {
error = false
}
this.setState({emptyDataLOV : true})
} else {
error = false
}
// if (i[7].value == 'Government bonds' || i[7].value == 'Stocks' || i[7].value == 'Mutual funds' || i[7].value == 'Investment in associate' || i[7].value == 'Investment in joint venture' || i[7].value == 'Investment in subsidiary' || i[7].value == 'Corporate bonds' || i[7].value == 'Others' && i[8] == '' ) {
// error = true
......@@ -999,6 +998,8 @@ export default class ListOfCreditFacilities extends Component {
}
})
console.log(this.state.emptyDataLOCF)
console.log(this.state.emptyDataLOV)
let body = {
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
......@@ -1767,9 +1768,11 @@ export default class ListOfCreditFacilities extends Component {
</div>
</Paper>}
</div>
{this.state.emptyData && (
{(this.state.emptyDataLOV || this.state.emptyDataLOCF) && (
<PopUpValidationLOV
onClickClose={() => this.setState({ emptyData: false })}
onClickClose={() => this.setState({ emptyDataLOV: false, emptyDataLOCF: false })}
emptyDataLOV={this.state.emptyDataLOV}
emptyDataLOCF={this.state.emptyDataLOCF}
/>
)}
{
......
......@@ -3,7 +3,27 @@ import Images from '../assets/Images';
import { Typography } from '@material-ui/core';
export default class PopUpValidationLOV extends Component {
constructor(props) {
super(props)
this.state = {}
}
popUpInformation(){
console.log(this.props.emptyDataLOV)
console.log(this.props.emptyDataLOCF)
if (this.props.emptyDataLOV && !this.props.emptyDataLOCF){
return "There is empty value in List of Investment"
} else if (!this.props.emptyDataLOV && this.props.emptyDataLOCF){
return "There is empty value in List Of Credit Facilities and Investment"
} else {
return "There is empty value in List Of Credit Facilities and Investment and List of Investment"
}
}
render() {
console.log(this.props.emptyDataLOV)
console.log(this.props.emptyDataLOCF)
return (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8, padding: 50 }}>
......@@ -12,7 +32,7 @@ export default class PopUpValidationLOV extends Component {
</div>
<div style={{ display: 'grid', justifyContent: 'center', marginTop: 20 }}>
<span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
{`There is empty value`}
{this.popUpInformation()}
</span>
<span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
{`Please fill the blank`}
......
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