Commit 9c1525f9 authored by Riri Novita's avatar Riri Novita

locf up

parent a8557588
...@@ -392,6 +392,7 @@ const create = (type = "") => { ...@@ -392,6 +392,7 @@ const create = (type = "") => {
// const getHierarkiMontlyReportTP = (body) => api.post('transaction/monthly_report_tp/get_report_hierarki', body) // const getHierarkiMontlyReportTP = (body) => api.post('transaction/monthly_report_tp/get_report_hierarki', body)
const getHierarkiMontlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/get_report_hierarki', body) const getHierarkiMontlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/get_report_hierarki', body)
const getHierarkiMontlyReportLOCF = (body) => api.post('transaction/locf/monthly_report/get_report_hierarki', body) const getHierarkiMontlyReportLOCF = (body) => api.post('transaction/locf/monthly_report/get_report_hierarki', body)
const getHierarkiMontlyReportInvesment = (body) => api.post('transaction/lov/monthly_report/get_report_hierarki', body)
const getHierarkiMontlyReportFAM = (body) => api.post('transaction/fam/monthly_report/get_report_hierarki', body) const getHierarkiMontlyReportFAM = (body) => api.post('transaction/fam/monthly_report/get_report_hierarki', body)
const getHierarkiMontlyReportCF = (body) => api.post('transaction/cash_flow/monthly_report/get_report_hierarki', body) const getHierarkiMontlyReportCF = (body) => api.post('transaction/cash_flow/monthly_report/get_report_hierarki', body)
const getHierarkiMontlyReportCAT = (body) => api.post('/transaction/cat/monthly_report/get_report_hierarki', body) const getHierarkiMontlyReportCAT = (body) => api.post('/transaction/cat/monthly_report/get_report_hierarki', body)
...@@ -746,6 +747,7 @@ const create = (type = "") => { ...@@ -746,6 +747,7 @@ const create = (type = "") => {
getDetailHierarkiCF, getDetailHierarkiCF,
getHierarkiMontlyReportPL, getHierarkiMontlyReportPL,
getHierarkiMontlyReportLOCF, getHierarkiMontlyReportLOCF,
getHierarkiMontlyReportInvesment,
getHierarkiMontlyReportFAM, getHierarkiMontlyReportFAM,
getHierarkiMontlyReportCAT, getHierarkiMontlyReportCAT,
checkUploadMonthlyReportTP, checkUploadMonthlyReportTP,
......
...@@ -101,6 +101,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -101,6 +101,7 @@ export default class ListOfCreditFacilities extends Component {
super(props) super(props)
this.state = { this.state = {
dataTable: [], dataTable: [],
dataTableInvest: [],
bankNameList: [], bankNameList: [],
typeOfCreditList: [], typeOfCreditList: [],
loading: false, loading: false,
...@@ -397,6 +398,83 @@ export default class ListOfCreditFacilities extends Component { ...@@ -397,6 +398,83 @@ export default class ListOfCreditFacilities extends Component {
}) })
} }
getItemHierarkiInvesment() {
let payload = {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id,
"currency_id": this.props.defaultCurrency.id,
"get_for": this.state.get_for
}
api.create().getHierarkiMontlyReportInvesment(payload).then(response => {
console.log(payload);
console.log(response);
let dataTableInvest = []
if (response.data) {
let res = response.data.data
res.map((item, index) => {
let tgl = String(item.lov.placement_date).split('-')
if (index == res.length - 1) {
dataTableInvest.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.lov.company_name === null || item.lov.company_name === "" ? this.props.company.company_name : item.lov.company_name,
item.lov.institution_name === null || item.lov.institution_name === "" ? "" : item.lov.institution_name,
item.lov.type_of_investment === null ? null : item.lov.type_of_investment === "" ? null : { value: item.lov.type_of_investment },
item.lov.remarks === null || item.lov.remarks === "" ? "" : item.lov.remarks,
item.lov.placement_date == null || item.lov.placement_date == "" ? null : (item.lov.placement_date !== "null" ? String(tgl[2]).length > 2 ? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(item.lov.placement_date) : null),
item.lov.tenor === null || item.lov.tenor === "" ? "" : item.lov.tenor,
item.lov.expected_return === null || item.lov.expected_return === "" ? "0.0" : item.lov.expected_return,
item.lov.currency === null ? null : item.lov.currency === "" ? null : { value: item.lov.currency },
item.lov.investment_amount_ori === null ? "0.0" : item.lov.investment_amount_ori === "" ? "0.0" : item.lov.investment_amount_ori,
item.lov.investment_amount_cur === null ? "0.0" : item.lov.investment_amount_cur === "" ? "0.0" : item.lov.investment_amount_cur,
item.lov.notes,
index
],
[9, "", "", "", "", "", { value: "Grand Total" }, "", "", "", "", "notes", 999999],
)
} else {
dataTableInvest.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.lov.company_name === null || item.lov.company_name === "" ? this.props.company.company_name : item.lov.company_name,
item.lov.institution_name === null || item.lov.institution_name === "" ? "" : item.lov.institution_name,
item.lov.type_of_investment === null ? null : item.lov.type_of_investment === "" ? null : { value: item.lov.type_of_investment },
item.lov.remarks === null || item.lov.remarks === "" ? "" : item.lov.remarks,
item.lov.placement_date == null || item.lov.placement_date == "" ? null : (item.lov.placement_date !== "null" ? String(tgl[2]).length > 2 ? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(item.lov.placement_date) : null),
item.lov.tenor === null || item.lov.tenor === "" ? "" : item.lov.tenor,
item.lov.expected_return === null || item.lov.expected_return === "" ? "0.0" : item.lov.expected_return,
item.lov.currency === null ? null : item.lov.currency === "" ? null : { value: item.lov.currency },
item.lov.investment_amount_ori === null ? "0.0" : item.lov.investment_amount_ori === "" ? "0.0" : item.lov.investment_amount_ori,
item.lov.investment_amount_cur === null ? "0.0" : item.lov.investment_amount_cur === "" ? "0.0" : item.lov.investment_amount_cur,
item.lov.notes,
index
])
}
})
if (dataTableInvest.length == 0 && this.state.get_for == 'edit') {
dataTableInvest.push(
[3, "", "", "", "", this.props.company.company_name, "", null, "", null, "0.0", "0.0", "", "", "", 0],
[9, "", "", "", "", "", { value: "Grand Total" }, "", "", "", "", "notes", 999999],
)
}
console.log(dataTableInvest)
this.setState({ dataTableInvest, loading: false, visibleLOCFMR: true }, () => {
// this.handleCalculate()
})
}
})
}
getLatestUpdate() { getLatestUpdate() {
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
...@@ -1017,6 +1095,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1017,6 +1095,7 @@ export default class ListOfCreditFacilities extends Component {
// if (this.state.get_for == 'view') { // if (this.state.get_for == 'view') {
// this.setState({perBS: "0.0"}) // this.setState({perBS: "0.0"})
// } else { // } else {
if (response.data) {
if (response.data.status == "success") { if (response.data.status == "success") {
this.setState({ this.setState({
perBS: this.props.defaultCurrency.id == 1 ? (response.data.data.per_bs == null || response.data.data.per_bs == '' ? fixNumber(Number(0), 1) : fixNumber(Number(response.data.data.per_bs), 1)) : (response.data.data.per_bs == null || response.data.data.per_bs == '' ? Number(0) : Number(response.data.data.per_bs)), perBS: this.props.defaultCurrency.id == 1 ? (response.data.data.per_bs == null || response.data.data.per_bs == '' ? fixNumber(Number(0), 1) : fixNumber(Number(response.data.data.per_bs), 1)) : (response.data.data.per_bs == null || response.data.data.per_bs == '' ? Number(0) : Number(response.data.data.per_bs)),
...@@ -1024,6 +1103,9 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1024,6 +1103,9 @@ export default class ListOfCreditFacilities extends Component {
diff: response.data.data.diff diff: response.data.data.diff
}) })
} }
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
// } // }
}) })
} }
...@@ -1123,6 +1205,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1123,6 +1205,7 @@ export default class ListOfCreditFacilities extends Component {
console.log(dataTable) console.log(dataTable)
this.setState({ dataTableRatio: dataTable }, () => { this.setState({ dataTableRatio: dataTable }, () => {
this.getItemHierarki() this.getItemHierarki()
this.getItemHierarkiInvesment()
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -1359,9 +1442,9 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1359,9 +1442,9 @@ export default class ListOfCreditFacilities extends Component {
}) })
console.log(dataGabung); console.log(dataGabung);
dataGabung.map((items, index) => { dataGabung.map((items, index) => {
console.log(items); // console.log(items);
if (items[0] == 3) { if (items[0] == 3) {
console.log(Number(totalLoan)); // console.log(Number(totalLoan));
this.props.defaultCurrency.id == 1 ? totalLoan += items[22] : totalLoan += items[21] this.props.defaultCurrency.id == 1 ? totalLoan += items[22] : totalLoan += items[21]
} }
if (bankPrev != "") { if (bankPrev != "") {
...@@ -1551,6 +1634,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1551,6 +1634,7 @@ export default class ListOfCreditFacilities extends Component {
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
let dataTableInvestment = this.state.dataTableInvest
let loading = this.state.loading let loading = this.state.loading
let dataTampungBank = [] let dataTampungBank = []
let indexNyasar = false let indexNyasar = false
...@@ -1587,9 +1671,11 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1587,9 +1671,11 @@ export default class ListOfCreditFacilities extends Component {
this.setState({ loading: false }) this.setState({ loading: false })
}) })
} else { } else {
console.log(column, value);
if (column != 8 && column != 11 && column != 18 && column != 25 && column != 27 && column != 29 && column != 31 && column != 33 && column != 36 && column != 39 && column != 42 && column != 45) { if (column != 8 && column != 11 && column != 18 && column != 25 && column != 27 && column != 29 && column != 31 && column != 33 && column != 36 && column != 39 && column != 42 && column != 45) {
val = String(value).split(",").join("") val = String(value).split(",").join("")
val = this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 2) : Number(val) val = this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 2) : Number(val)
console.log(val);
} else { } else {
val = String(value).split(",").join("") val = String(value).split(",").join("")
...@@ -1624,6 +1710,52 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1624,6 +1710,52 @@ export default class ListOfCreditFacilities extends Component {
console.log(String(value).split(",").join("")) console.log(String(value).split(",").join(""))
} }
const handleChangeInves = (value, tableMeta, column, typeChange, typeDrop) => {
let val = ''
if (typeChange == 'date') {
dataTable2[tableMeta.rowIndex][column] = format(value, 'yyyy-MM-dd')
this.setState({ loading: true }, () => {
this.setState({ loading: false })
})
} else {
console.log(column, value);
// if (column != 6 && column != 11 && column != 18 && column != 25 && column != 27 && column != 29 && column != 31 && column != 33 && column != 36 && column != 39 && column != 42 && column != 45) {
// val = String(value).split(",").join("")
// val = this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 2) : Number(val)
// } else {
// val = String(value).split(",").join("")
// }
// if (value.value !== undefined) {
// if (value.value == 'Investment Loan') {
// dataTable2[tableMeta.rowIndex][16] = 0
// dataTable2[tableMeta.rowIndex][17] = 0
// dataTable2[tableMeta.rowIndex][18] = ""
// dataTable2[tableMeta.rowIndex][19] = 0
// dataTable2[tableMeta.rowIndex][20] = 0
// } else if (value.value == 'Revolving Loan (KMK)') {
// dataTable2[tableMeta.rowIndex][14] = 0
// dataTable2[tableMeta.rowIndex][15] = 0
// dataTable2[tableMeta.rowIndex][18] = ""
// dataTable2[tableMeta.rowIndex][19] = 0
// dataTable2[tableMeta.rowIndex][20] = 0
// } else if (value.value == 'others') {
// dataTable2[tableMeta.rowIndex][14] = 0
// dataTable2[tableMeta.rowIndex][15] = 0
// dataTable2[tableMeta.rowIndex][16] = 0
// dataTable2[tableMeta.rowIndex][17] = 0
// }
// dataTable2[tableMeta.rowIndex][column] = value
// } else {
// dataTable2[tableMeta.rowIndex][column] = val
// }
}
console.log(dataTable2[tableMeta.rowIndex][column]);
console.log(value)
console.log(String(value).split(",").join(""))
}
const handleValueDropDown = (value, type, tableMeta) => { const handleValueDropDown = (value, type, tableMeta) => {
let data = type == 'bankName' ? this.state.bankNameList.options : this.state.typeOfCreditList.options let data = type == 'bankName' ? this.state.bankNameList.options : this.state.typeOfCreditList.options
let index = 0 let index = 0
...@@ -1644,6 +1776,26 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1644,6 +1776,26 @@ export default class ListOfCreditFacilities extends Component {
} }
} }
const handleValueDropDownInves = (value, type, tableMeta) => {
// let data = type == 'bankName' ? this.state.bankNameList.options : this.state.typeOfCreditList.options
// let index = 0
// if (type == 'bankName' && dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] != null && dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] != "") {
// indexNyasar = true
// }
// if (value == null) {
// index = -1
// } else {
// index = data.findIndex((val) => String(val.value) == String(value.value))
// }
// if (index == -1) {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = null
// return null
// } else {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
// return value
// }
}
const handleTableRatio = (value, tableMeta, column, reportName) => { const handleTableRatio = (value, tableMeta, column, reportName) => {
let dataTableRatio = this.state.dataTableRatio let dataTableRatio = this.state.dataTableRatio
let indexId = dataTableRatio.findIndex((val) => String(val[5]).toLocaleLowerCase() == String(reportName).toLocaleLowerCase()) let indexId = dataTableRatio.findIndex((val) => String(val[5]).toLocaleLowerCase() == String(reportName).toLocaleLowerCase())
...@@ -1695,8 +1847,44 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1695,8 +1847,44 @@ export default class ListOfCreditFacilities extends Component {
return valuez return valuez
} }
const handleFormulaHardcodeInves = (value, tableMeta, column) => {
// console.log("------------coba------------------");
// console.log(tableMeta);
// console.log(tableMeta.rowData[0]);
// let valuez = 0
// if (tableMeta.rowData[0] == 8) {
// dataTable2.map((item, index) => {
// if (item[6].value.includes(String(tableMeta.rowData[6].value).substr(6, tableMeta.rowData[6].length)) && item[0] != 8) {
// valuez += Number(item[column])
// }
// })
// } else if (tableMeta.rowData[0] == 9) {
// dataTable2.map((item, index) => {
// if (item[0] == 8) {
// valuez += Number(item[column])
// }
// })
// if (column == 22) {
// totalLoan = valuez
// }
// } else {
// if (column == 21) {
// valuez = Number(tableMeta.rowData[14]) + Number(tableMeta.rowData[16]) + Number(tableMeta.rowData[19])
// } else if (column == 22) {
// valuez = Number(tableMeta.rowData[15]) + Number(tableMeta.rowData[17]) + Number(tableMeta.rowData[20])
// } else if (column == 23) {
// valuez = Number(tableMeta.rowData[12]) - Number(tableMeta.rowData[21])
// } else if (column == 24) {
// valuez = Number(tableMeta.rowData[13]) - Number(tableMeta.rowData[22])
// }
// }
// dataTable2[tableMeta.rowIndex][column] = valuez
// return valuez
}
const handleTambah = (data, rowIndex) => { const handleTambah = (data, rowIndex) => {
// // console.log(dataTable2) console.log(dataTable2)
let newData = [] let newData = []
let indexxx = 0 let indexxx = 0
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
...@@ -1770,6 +1958,52 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1770,6 +1958,52 @@ export default class ListOfCreditFacilities extends Component {
}) })
} }
const handleTambahInvesment = (data, rowIndex) => {
// // console.log(dataTable2)
let newData = []
let indexxx = 0
dataTable2.map((item, index) => {
indexxx = index
if (item[6] == "Grand Total") {
item[46] = 999999
} else {
item[46] = indexxx
}
newData.push(item)
if (index == rowIndex) {
indexxx = index + 1
newData.push([
3,
"",
"",
"",
"",
this.props.company.company_name,
"",
null,
"",
null,
"",
"",
null,
"0",
"",
"",
"",
indexxx],
)
}
})
dataTable2 = newData.sort((a, b) => a[46] - b[46])
this.setState({ dataTable: dataTable2 }, () => {
setTimeout(() => {
this.setState({ loading: false })
console.log(dataTable2)
}, 500)
})
}
const handleDelete = (index) => { const handleDelete = (index) => {
let dataDelete = this.state.dataDelete let dataDelete = this.state.dataDelete
let berapaInput = 0 let berapaInput = 0
...@@ -3998,7 +4232,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3998,7 +4232,7 @@ export default class ListOfCreditFacilities extends Component {
// onClick={() => // // console.log(tableMeta.rowData[1])} // onClick={() => // // console.log(tableMeta.rowData[1])}
onClick={() => { onClick={() => {
this.setState({ loading: true }) this.setState({ loading: true })
handleTambah(tableMeta.rowData[1], tableMeta.rowIndex) handleTambahInvesment(tableMeta.rowData[1], tableMeta.rowIndex)
}} }}
> >
<img src={Images.add} /> <img src={Images.add} />
...@@ -4057,13 +4291,14 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4057,13 +4291,14 @@ export default class ListOfCreditFacilities extends Component {
), ),
setCellProps: () => ({ style2 }), setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => { customBodyRender: (val, tableMeta, updateValue) => {
console.log(tableMeta);
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9 ?
null : null :
<div style={{ padding: 0, margin: 0 }}> <div style={{ padding: 0, margin: 0 }}>
<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: tableMeta.rowData[11] == '' && this.state.get_for == 'edit' ? '#ffac99' : 'white' }} type="text" defaultValue={tableMeta.rowData[11]} <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: tableMeta.rowData[6] == '' && this.state.get_for == 'edit' ? '#ffac99' : 'white' }} type="text" defaultValue={tableMeta.rowData[6]}
onBlur={(event) => handleChange(event.target.value, tableMeta, tableMeta.columnIndex)} /> onBlur={(event) => handleChangeInves(event.target.value, tableMeta, tableMeta.columnIndex)} />
</div> </div>
} }
</div> </div>
...@@ -4087,9 +4322,9 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4087,9 +4322,9 @@ export default class ListOfCreditFacilities extends Component {
<Autocomplete <Autocomplete
{...this.state.typeOfCreditList} {...this.state.typeOfCreditList}
id="typeOfCreditList" id="typeOfCreditList"
onChange={(event, newInputValue) => handleChange(newInputValue, tableMeta, tableMeta.columnIndex)} onChange={(event, newInputValue) => handleChangeInves(newInputValue, tableMeta, tableMeta.columnIndex)}
debug debug
value={handleValueDropDown(val, 'typeOfCreditList', tableMeta)} value={handleValueDropDownInves(val, 'typeOfCreditList', tableMeta)}
disableClearable disableClearable
disabled={this.state.get_for == 'view'} disabled={this.state.get_for == 'view'}
// disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])} // disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])}
...@@ -4121,7 +4356,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4121,7 +4356,7 @@ export default class ListOfCreditFacilities extends Component {
null : null :
<div style={{ padding: 0, margin: 0 }}> <div style={{ padding: 0, margin: 0 }}>
<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: tableMeta.rowData[8] == '' && this.state.get_for == 'edit' ? '#ffac99' : 'white' }} type="text" defaultValue={tableMeta.rowData[8]} <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: tableMeta.rowData[8] == '' && this.state.get_for == 'edit' ? '#ffac99' : 'white' }} type="text" defaultValue={tableMeta.rowData[8]}
onBlur={(event) => handleChange(event.target.value, tableMeta, tableMeta.columnIndex)} /> onBlur={(event) => handleChangeInves(event.target.value, tableMeta, tableMeta.columnIndex)} />
</div> </div>
// <Input // <Input
// disableUnderline={true} // disableUnderline={true}
...@@ -4186,7 +4421,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4186,7 +4421,7 @@ export default class ListOfCreditFacilities extends Component {
format="dd-MM-yyyy" format="dd-MM-yyyy"
value={val} value={val}
disabled={this.state.get_for == 'view'} disabled={this.state.get_for == 'view'}
onChange={(e) => handleChange(e, tableMeta, tableMeta.columnIndex, 'date')} onChange={(e) => handleChangeInves(e, tableMeta, tableMeta.columnIndex, 'date')}
// minDate={this.state.startDate} // minDate={this.state.startDate}
KeyboardButtonProps={{ KeyboardButtonProps={{
'aria-label': 'change date', 'aria-label': 'change date',
...@@ -4231,8 +4466,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4231,8 +4466,8 @@ export default class ListOfCreditFacilities extends Component {
{tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9 ? {tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9 ?
null : null :
<div style={{ padding: 0, margin: 0 }}> <div style={{ padding: 0, margin: 0 }}>
<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: tableMeta.rowData[8] == '' && this.state.get_for == 'edit' ? '#ffac99' : 'white' }} type="text" defaultValue={tableMeta.rowData[8]} <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: tableMeta.rowData[10] == '' && this.state.get_for == 'edit' ? '#ffac99' : 'white' }} type="text" defaultValue={tableMeta.rowData[10]}
onBlur={(event) => handleChange(event.target.value, tableMeta, tableMeta.columnIndex)} /> onBlur={(event) => handleChangeInves(event.target.value, tableMeta, tableMeta.columnIndex)} />
</div> </div>
// <Input // <Input
// disableUnderline={true} // disableUnderline={true}
...@@ -4296,7 +4531,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4296,7 +4531,7 @@ export default class ListOfCreditFacilities extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: this.state.get_for == 'view' ? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: (tableMeta.rowData[10] == '0.00' || tableMeta.rowData[10] == '') && this.state.get_for == 'edit' ? '#ffac99' : 'transparent' }} style={{ color: this.state.get_for == 'view' ? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: (tableMeta.rowData[11] == '0.00' || tableMeta.rowData[11] == '') && this.state.get_for == 'edit' ? '#ffac99' : 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={this.state.get_for == 'view' ? fixNumber(Number(value), 2) : this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 2) : Number(value) == 0 ? "0.0" : Number(value)} value={this.state.get_for == 'view' ? fixNumber(Number(value), 2) : this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 2) : Number(value) == 0 ? "0.0" : Number(value)}
...@@ -4305,7 +4540,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4305,7 +4540,7 @@ export default class ListOfCreditFacilities extends Component {
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta, tableMeta.columnIndex) handleChangeInves(event.target.value, tableMeta, tableMeta.columnIndex)
// // // // console.log(tableMeta.rowData[0]) // // // // console.log(tableMeta.rowData[0])
}} }}
/> />
...@@ -4331,8 +4566,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4331,8 +4566,8 @@ export default class ListOfCreditFacilities extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9 ?
null : null :
<div style={{ padding: 0, margin: 0 }}> <div style={{ padding: 0, margin: 0 }}>
<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: tableMeta.rowData[11] == '' && this.state.get_for == 'edit' ? '#ffac99' : 'white' }} type="text" defaultValue={tableMeta.rowData[11]} <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: tableMeta.rowData[12] == '' && this.state.get_for == 'edit' ? '#ffac99' : 'white' }} type="text" defaultValue={tableMeta.rowData[12]}
onBlur={(event) => handleChange(event.target.value, tableMeta, tableMeta.columnIndex)} /> onBlur={(event) => handleChangeInves(event.target.value, tableMeta, tableMeta.columnIndex)} />
</div> </div>
// <ThemeProvider theme={this.state.get_for == 'view'? theme3 : theme2}> // <ThemeProvider theme={this.state.get_for == 'view'? theme3 : theme2}>
// <Input // <Input
...@@ -4384,7 +4619,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4384,7 +4619,7 @@ export default class ListOfCreditFacilities extends Component {
placeholder="" placeholder=""
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormulaHardcode(tableMeta.rowData[12], tableMeta, 12)), 1) : Number(handleFormulaHardcode(tableMeta.rowData[12], tableMeta, 12)) == 0 ? "0.0" : Number(handleFormulaHardcode(tableMeta.rowData[12], tableMeta, 12))} value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormulaHardcodeInves(tableMeta.rowData[13], tableMeta, 13)), 1) : Number(handleFormulaHardcodeInves(tableMeta.rowData[13], tableMeta, 13)) == 0 ? "0.0" : Number(handleFormulaHardcodeInves(tableMeta.rowData[13], tableMeta, 13))}
/> />
} }
/> />
...@@ -4402,9 +4637,9 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4402,9 +4637,9 @@ export default class ListOfCreditFacilities extends Component {
placeholder="" placeholder=""
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
disabled={this.state.get_for == 'view'} disabled={this.state.get_for == 'view'}
value={this.props.defaultCurrency.id == 1 ? (fixNumber(Number(tableMeta.rowData[12]), 1) == 0.0 ? "0.0" : fixNumber(Number(tableMeta.rowData[12]), 1)) : (Number(tableMeta.rowData[12]) == 0.0 ? "0.0" : Number(tableMeta.rowData[12]))} value={this.props.defaultCurrency.id == 1 ? (fixNumber(Number(tableMeta.rowData[12]), 1) == 0.0 ? "0.0" : fixNumber(Number(tableMeta.rowData[13]), 1)) : (Number(tableMeta.rowData[13]) == 0.0 ? "0.0" : Number(tableMeta.rowData[13]))}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 12) handleChange(event.target.value, tableMeta, 13)
}} }}
/> />
...@@ -4418,7 +4653,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4418,7 +4653,7 @@ export default class ListOfCreditFacilities extends Component {
} }
} }
}, { }, {
name: `Investment Amount (Original Currency)`, name: `Investment Amount (Reporting Currency)`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96, borderRight: '1px #fff solid' }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96, borderRight: '1px #fff solid' }}>
...@@ -4446,7 +4681,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4446,7 +4681,7 @@ export default class ListOfCreditFacilities extends Component {
placeholder="" placeholder=""
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormulaHardcode(tableMeta.rowData[12], tableMeta, 12)), 1) : Number(handleFormulaHardcode(tableMeta.rowData[12], tableMeta, 12)) == 0 ? "0.0" : Number(handleFormulaHardcode(tableMeta.rowData[12], tableMeta, 12))} value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormulaHardcodeInves(tableMeta.rowData[14], tableMeta, 14)), 1) : Number(handleFormulaHardcodeInves(tableMeta.rowData[14], tableMeta, 14)) == 0 ? "0.0" : Number(handleFormulaHardcodeInves(tableMeta.rowData[14], tableMeta, 14))}
/> />
} }
/> />
...@@ -4464,9 +4699,9 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4464,9 +4699,9 @@ export default class ListOfCreditFacilities extends Component {
placeholder="" placeholder=""
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
disabled={this.state.get_for == 'view'} disabled={this.state.get_for == 'view'}
value={this.props.defaultCurrency.id == 1 ? (fixNumber(Number(tableMeta.rowData[12]), 1) == 0.0 ? "0.0" : fixNumber(Number(tableMeta.rowData[12]), 1)) : (Number(tableMeta.rowData[12]) == 0.0 ? "0.0" : Number(tableMeta.rowData[12]))} value={this.props.defaultCurrency.id == 1 ? (fixNumber(Number(tableMeta.rowData[14]), 1) == 0.0 ? "0.0" : fixNumber(Number(tableMeta.rowData[14]), 1)) : (Number(tableMeta.rowData[14]) == 0.0 ? "0.0" : Number(tableMeta.rowData[14]))}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 12) handleChange(event.target.value, tableMeta, 14)
}} }}
/> />
...@@ -4494,8 +4729,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4494,8 +4729,8 @@ export default class ListOfCreditFacilities extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9 ?
null : null :
<div style={{ padding: 0, margin: 0 }}> <div style={{ padding: 0, margin: 0 }}>
<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[45]} <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[15]}
onBlur={(event) => handleChange(event.target.value, tableMeta, 45)} /> onBlur={(event) => handleChangeInves(event.target.value, tableMeta, 45)} />
</div> </div>
// <FormControlLabel // <FormControlLabel
// style={{ margin: 0 }} // style={{ margin: 0 }}
...@@ -4917,7 +5152,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -4917,7 +5152,7 @@ export default class ListOfCreditFacilities extends Component {
{this.state.loading && loadingComponent} {this.state.loading && loadingComponent}
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}> {!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTableInvestment}
columns={columnsInvesment} columns={columnsInvesment}
options={options} options={options}
/> />
...@@ -5251,7 +5486,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -5251,7 +5486,7 @@ export default class ListOfCreditFacilities extends Component {
{this.state.loading && loadingComponent} {this.state.loading && loadingComponent}
{this.state.dataLoaded && !this.state.loading && <MuiThemeProvider theme={getMuiTheme()}> {this.state.dataLoaded && !this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTableInvestment}
columns={columnsInvesment} columns={columnsInvesment}
options={options} options={options}
/> />
......
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