Commit fba17755 authored by d.arizona's avatar d.arizona

apdet

parent fa223e16
...@@ -832,9 +832,11 @@ export default class MonthlyReport extends Component { ...@@ -832,9 +832,11 @@ export default class MonthlyReport extends Component {
cursor: tableMeta.rowData[5] ? 'pointer' : 'default', cursor: tableMeta.rowData[5] ? 'pointer' : 'default',
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => onClick={() =>{
// tableMeta.rowData[5] ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3]) this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
console.log(tableMeta.rowData)
}
// tableMeta.rowData[5] ?
// : null // : null
} }
> >
......
...@@ -123,6 +123,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -123,6 +123,7 @@ export default class ListOfCreditFacilities extends Component {
} }
componentDidMount() { componentDidMount() {
this.getPerBS()
this.getBankData() this.getBankData()
this.getTypeOfCredit() this.getTypeOfCredit()
this.getSubmission() this.getSubmission()
...@@ -132,6 +133,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -132,6 +133,7 @@ export default class ListOfCreditFacilities extends Component {
handleGetFor(type) { handleGetFor(type) {
this.setState({get_for: type}, () => { this.setState({get_for: type}, () => {
this.getPerBS()
this.getBankData() this.getBankData()
this.getTypeOfCredit() this.getTypeOfCredit()
this.getSubmission() this.getSubmission()
...@@ -249,6 +251,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -249,6 +251,7 @@ export default class ListOfCreditFacilities extends Component {
// } // }
// } // }
res.map((item, index) => { res.map((item, index) => {
let tgl = String(item.locf.loan_maturity_date).split('-')
if (index == res.length -1) { if (index == res.length -1) {
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
...@@ -261,7 +264,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -261,7 +264,7 @@ export default class ListOfCreditFacilities extends Component {
item.locf.bank_name === null ? null : item.locf.bank_name === "" ? null : {value: item.locf.bank_name}, item.locf.bank_name === null ? null : item.locf.bank_name === "" ? null : {value: item.locf.bank_name},
item.locf.type_of_credit === null ? null : item.locf.type_of_credit === "" ? null : {value: item.locf.type_of_credit}, item.locf.type_of_credit === null ? null : item.locf.type_of_credit === "" ? null : {value: item.locf.type_of_credit},
item.locf.remarks === null || item.locf.remarks === "" ? "" : item.locf.remarks, item.locf.remarks === null || item.locf.remarks === "" ? "" : item.locf.remarks,
item.locf.loan_maturity_date === null || item.locf.loan_maturity_date === "" ? null : item.locf.loan_maturity_date, item.locf.loan_maturity_date == null || item.locf.loan_maturity_date == "" ? null : (item.locf.loan_maturity_date !== "null"? String(tgl[2]).length > 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(item.locf.loan_maturity_date) : null),
item.locf.interest === null || item.locf.interest === "" ? "0.00" : item.locf.interest, item.locf.interest === null || item.locf.interest === "" ? "0.00" : item.locf.interest,
item.locf.currency === null || item.locf.currency === "" ? "" : item.locf.currency, item.locf.currency === null || item.locf.currency === "" ? "" : item.locf.currency,
item.locf.loan_plafond_amount_ori, item.locf.loan_plafond_amount_ori,
...@@ -317,7 +320,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -317,7 +320,7 @@ export default class ListOfCreditFacilities extends Component {
item.locf.bank_name === null ? null : item.locf.bank_name === "" ? null : {value: item.locf.bank_name}, item.locf.bank_name === null ? null : item.locf.bank_name === "" ? null : {value: item.locf.bank_name},
item.locf.type_of_credit === null ? null : item.locf.type_of_credit === "" ? null : {value: item.locf.type_of_credit}, item.locf.type_of_credit === null ? null : item.locf.type_of_credit === "" ? null : {value: item.locf.type_of_credit},
item.locf.remarks === null || item.locf.remarks === "" ? "" : item.locf.remarks, item.locf.remarks === null || item.locf.remarks === "" ? "" : item.locf.remarks,
item.locf.loan_maturity_date === null || item.locf.loan_maturity_date === "" ? null : item.locf.loan_maturity_date, item.locf.loan_maturity_date == null || item.locf.loan_maturity_date == "" ? null : (item.locf.loan_maturity_date !== "null"? String(tgl[2]).length > 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(item.locf.loan_maturity_date) : null),
item.locf.interest === null || item.locf.interest === "" ? "0.00" : item.locf.interest, item.locf.interest === null || item.locf.interest === "" ? "0.00" : item.locf.interest,
item.locf.currency === null || item.locf.currency === "" ? "" : item.locf.currency, item.locf.currency === null || item.locf.currency === "" ? "" : item.locf.currency,
item.locf.loan_plafond_amount_ori, item.locf.loan_plafond_amount_ori,
...@@ -376,7 +379,6 @@ export default class ListOfCreditFacilities extends Component { ...@@ -376,7 +379,6 @@ export default class ListOfCreditFacilities extends Component {
[9, "", "", "", "", "", {value: "Grand Total"}, null, "", "", "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 999999 ], [9, "", "", "", "", "", {value: "Grand Total"}, null, "", "", "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 999999 ],
) )
} }
this.getPerBS()
console.log(dataTable) console.log(dataTable)
this.setState({ dataTable, loading: false, visibleLOCFMR: true, totalOutStand: 0, diff: 0 }, () => { this.setState({ dataTable, loading: false, visibleLOCFMR: true, totalOutStand: 0, diff: 0 }, () => {
this.handleCalculate() this.handleCalculate()
...@@ -435,13 +437,15 @@ export default class ListOfCreditFacilities extends Component { ...@@ -435,13 +437,15 @@ export default class ListOfCreditFacilities extends Component {
isi.map((i, index) => { isi.map((i, index) => {
if (i.length > 0) { if (i.length > 0) {
let tgl = String(i[5]).split('-') let tgl = String(i[5]).split('-')
console.log(i[5])
console.log(tgl)
payload.push({ payload.push({
"item_report_id": i[1], "item_report_id": i[1],
"borrower_comp_name": this.props.company.company_name, "borrower_comp_name": this.props.company.company_name,
"bank_name": i[2], "bank_name": i[2],
"type_of_credit": i[3], "type_of_credit": i[3],
"remarks": i[4], "remarks": i[4],
"loan_maturity_date": tgl[2] + '-' + tgl[1] + '-' + tgl[0], "loan_maturity_date": i[5] !== undefined? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : null,
"interest": i[6], "interest": i[6],
"currency": i[7], "currency": i[7],
"loan_plafond_amount_ori": i[8], "loan_plafond_amount_ori": i[8],
...@@ -677,6 +681,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -677,6 +681,7 @@ export default class ListOfCreditFacilities extends Component {
error = true error = true
} }
let tgl = String(i[9]).split('-') let tgl = String(i[9]).split('-')
let checkUndifined = tgl.findIndex((val) => val == undefined)
data.push({ data.push({
"item_report_id": i[1], "item_report_id": i[1],
"borrower_comp_name": i[5], "borrower_comp_name": i[5],
...@@ -684,7 +689,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -684,7 +689,8 @@ export default class ListOfCreditFacilities extends Component {
"type_of_credit": i[7] == null? i[7] : i[7].value, "type_of_credit": i[7] == null? i[7] : i[7].value,
"remarks": i[8], "remarks": i[8],
// "loan_maturity_date": i[9], // "loan_maturity_date": i[9],
"loan_maturity_date": tgl[2] + '-' + tgl[1] + '-' + tgl[0], "loan_maturity_date": i[9] == undefined || i[9] == "null" || i[9] == null? "" : (String(tgl[2]).length <= 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])),
// "loan_maturity_date": i[9] !== undefined || i[9] !== "null" || i[9] !== null? (String(tgl[2]).length <= 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])) : "",
"interest": i[10] == ""? "0.00" : i[10], "interest": i[10] == ""? "0.00" : i[10],
"currency": i[11], "currency": i[11],
"loan_plafond_amount_ori": i[12] == ""? "0.0" : i[12], "loan_plafond_amount_ori": i[12] == ""? "0.0" : i[12],
...@@ -735,7 +741,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -735,7 +741,7 @@ export default class ListOfCreditFacilities extends Component {
"locf": data, "locf": data,
"per_bs": this.state.perBS, "per_bs": this.state.perBS,
"diff": this.state.diff, "diff": this.state.diff,
"total_loan" : this.state.totalOutStand "total_loan" : this.state.perBS
} }
console.log(JSON.stringify(body)); console.log(JSON.stringify(body));
if (error && type == 'submitted') { if (error && type == 'submitted') {
...@@ -934,8 +940,12 @@ export default class ListOfCreditFacilities extends Component { ...@@ -934,8 +940,12 @@ export default class ListOfCreditFacilities extends Component {
} }
api.create().getPerBSiMontlyReportLOCF(payload).then((response) => { api.create().getPerBSiMontlyReportLOCF(payload).then((response) => {
console.log(response) console.log(response)
if (response.data.status == "success") { if (this.state.get_for == 'view') {
this.setState({perBS: response.data.data.per_bs == null || response.data.data.per_bs == ''? Number(0).toFixed(1) : Number(response.data.data.per_bs).toFixed(1)}) this.setState({perBS: "0.0"})
} else {
if (response.data.status == "success") {
this.setState({perBS: response.data.data.per_bs == null || response.data.data.per_bs == ''? Number(0).toFixed(1) : Number(response.data.data.per_bs).toFixed(1)})
}
} }
}) })
} }
...@@ -1064,13 +1074,14 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1064,13 +1074,14 @@ export default class ListOfCreditFacilities extends Component {
error = true error = true
} }
let tgl = String(i[9]).split('-') let tgl = String(i[9]).split('-')
let checkUndifined = tgl.findIndex((val) => val == undefined)
data.push({ data.push({
"item_report_id": i[1], "item_report_id": i[1],
"borrower_comp_name": i[5], "borrower_comp_name": i[5],
"bank_name": i[6] == null? [6] : i[6].value, "bank_name": i[6] == null? [6] : i[6].value,
"type_of_credit": i[7] == null? i[7] : i[7].value, "type_of_credit": i[7] == null? i[7] : i[7].value,
"remarks": i[8], "remarks": i[8],
"loan_maturity_date": tgl[2] + '-' + tgl[1] + '-' + tgl[0], "loan_maturity_date": i[9] == undefined || i[9] == "null" || i[9] == null? "" : (String(tgl[2]).length <= 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])),
// "loan_maturity_date": i[9], // "loan_maturity_date": i[9],
"interest": i[10] == ""? "0.00" : i[10], "interest": i[10] == ""? "0.00" : i[10],
"currency": i[11], "currency": i[11],
...@@ -1122,7 +1133,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1122,7 +1133,7 @@ export default class ListOfCreditFacilities extends Component {
"locf": data, "locf": data,
"per_bs": this.state.perBS, "per_bs": this.state.perBS,
"diff": this.state.diff, "diff": this.state.diff,
"total_loan" : this.state.totalOutStand "total_loan" : this.state.perBS
} }
console.log(JSON.stringify(payload)) console.log(JSON.stringify(payload))
...@@ -1353,6 +1364,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1353,6 +1364,8 @@ export default class ListOfCreditFacilities extends Component {
console.log(newData) console.log(newData)
// console.log(dataTampungBank) // console.log(dataTampungBank)
console.log(totalLoan); console.log(totalLoan);
console.log(this.state.perBS)
// console.log(bankNameEmpty)
// dataTable: newData, totalOutStand: newData[newData.length-1][22] // dataTable: newData, totalOutStand: newData[newData.length-1][22]
if (bankNameEmpty) { if (bankNameEmpty) {
this.setState({ loading: false, dataTable: this.state.dataTable, totalOutStand: 0, diff: Number(0 - this.state.perBS).toFixed(1), saveDraft: false, saveComp: true}) this.setState({ loading: false, dataTable: this.state.dataTable, totalOutStand: 0, diff: Number(0 - this.state.perBS).toFixed(1), saveDraft: false, saveComp: true})
...@@ -2423,23 +2436,9 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2423,23 +2436,9 @@ export default class ListOfCreditFacilities extends Component {
// /> // />
// </div> // </div>
: :
<div style={{ flex: 1 }}> <div style={{ padding: 0, margin: 0 }}>
<ThemeProvider theme={this.state.get_for == 'view'? theme3 : theme2}> <textarea disabled={this.state.get_for == 'view'} style={{ borderColor: 'white', width: 96, textAlign: 'center', justifyContent:'center', padding: 0, margin: 0, color: this.state.get_for == 'view'? "black" : "#5198ea", backgroundColor: 'transparent' }} type="text" defaultValue={tableMeta.rowData[18]}
<Input onBlur={(event) => handleChange(event.target.value, tableMeta, 18)} />
disableUnderline={true}
style={{ width: 96, color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Others'? "#5198ea" : "black", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', backgroundColor: tableMeta.rowData[7] == null? "transparent" : tableMeta.rowData[7].value == 'Others' && tableMeta.rowData[18] == ''? "#ffac99" : "transparent" }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Others'? false : true}
defaultValue={tableMeta.rowData[18]}
onBlur={(event) => {
// // // console.log(event.target.value)
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta, 18)
// // // console.log(dataTable2)
}}
/>
</ThemeProvider>
</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