Commit 836b73d8 authored by d.arizona's avatar d.arizona

apdet

parent eb391cc1
......@@ -173,7 +173,7 @@ export default class CorporateAnnualTargetMR extends Component {
// parentTrue ? item.corporate_annual_target.kpi_type == "" ? null : { value: item.corporate_annual_target.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type },
parentTrue ? item.corporate_annual_target.max_ach == "" ? null : titleCase(item.corporate_annual_target.max_ach) : item.max_ach == "" ? null : titleCase(item.max_ach),
// parentTrue ? item.corporate_annual_target.max_ach == "" ? null : { value: titleCase(item.corporate_annual_target.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
item.formula_ytd == "" ? null : item.formula_ytd,
item.corporate_annual_target.formula_ytd == "" ? null : item.corporate_annual_target.formula_ytd,
// parentTrue ? item.corporate_annual_target.formula == "" ? null : { value: item.corporate_annual_target.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd },
item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly).toFixed(1),
item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly,
......@@ -181,7 +181,8 @@ export default class CorporateAnnualTargetMR extends Component {
item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score,
item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight,
item.corporate_annual_target.notes === null ? "" : item.corporate_annual_target.notes,
item.corporate_annual_target.actual_formula === null? [] : item.corporate_annual_target.actual_formula
item.corporate_annual_target.actual_formula === null? [] : item.corporate_annual_target.actual_formula,
item.order
])
}
if (item.children !== null) {
......@@ -206,7 +207,7 @@ export default class CorporateAnnualTargetMR extends Component {
// item.kpi_type == "" ? null : { value: item.kpi_type },
item.max_ach == "" ? null : titleCase(item.max_ach),
// item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
item.formula == "" ? null : item.formula_ytd,
item.corporate_annual_target.formula == "" ? null : item.corporate_annual_target.formula_ytd,
// item.formula == "" ? null : { value: item.formula_ytd },
item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly).toFixed(1),
item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly,
......@@ -214,7 +215,8 @@ export default class CorporateAnnualTargetMR extends Component {
item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score,
item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight,
item.corporate_annual_target.notes === null ? "" : item.corporate_annual_target.notes,
item.corporate_annual_target.actual_formula === null? [] : item.corporate_annual_target.actual_formula
item.corporate_annual_target.actual_formula === null? [] : item.corporate_annual_target.actual_formula,
item.order
])
if (item.children !== null) {
if (item.children.length > 0) {
......@@ -318,6 +320,7 @@ export default class CorporateAnnualTargetMR extends Component {
}
checkUpload() {
this.setState({loading: true})
api.create().checkUploadMonthlyReportCAT(this.state.payload).then(response => {
console.log(JSON.stringify(this.state.payload));
console.log(this.state.payload)
......@@ -344,8 +347,8 @@ export default class CorporateAnnualTargetMR extends Component {
item.score,
item.score_x_weight,
item.notes,
item.order,
item.actual_formula === null? [] : item.actual_formula,
item.order,
item.error
]
})
......@@ -372,21 +375,22 @@ export default class CorporateAnnualTargetMR extends Component {
item_report: String(i[5]).trim(),
weight: String(i[6]),
uom: String(i[7]),
jenis_kpi: i[8] == null ? "" : i[8].value,
max_ach: i[9] == null ? "" : i[9].value,
formula_ytd: i[10] == null ? "" : i[10].value,
jenis_kpi: i[8] == null ? "" : i[8],
max_ach: i[9] == null ? "" : i[9],
formula_ytd: i[10] == null ? "" : i[10],
actual_monthly: String(Number(i[11]).toFixed(1)),
target_monthly: String(Number(i[12]).toFixed(1)),
achivement_monthly: String(Number(i[13]).toFixed(1)),
score: String(Number(i[14]).toFixed(1)),
score_x_weight: String(Number(i[15]).toFixed(1)),
score_x_weight: String(Number(i[15]).toFixed(2)),
notes: String(i[16]).trim()
})
})
let body = {
// "monthly_report_id": this.props.monthlyReportId,
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
"periode": "2021",
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": type,
"months": this.props.month.month_id,
......@@ -514,9 +518,9 @@ export default class CorporateAnnualTargetMR extends Component {
"item_report_id": i[1],
"weight": i[6],
"uom": i[7],
"jenis_kpi": i[8] == null ? "" : i[8].value,
"max_ach": i[9] == null ? "" : i[9].value,
"formula_ytd":i[10] == null ? "" : i[10].value,
"jenis_kpi": i[8] == null ? "" : i[8],
"max_ach": i[9] == null ? "" : i[9],
"formula_ytd":i[10] == null ? "" : i[10],
"actual_monthly": i[11],
"target_monthly": i[12],
"achivement_monthly": i[13],
......@@ -528,7 +532,7 @@ export default class CorporateAnnualTargetMR extends Component {
let payload = {
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
"periode": "2021",
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": type,
"months": this.props.month.month_id,
......@@ -563,6 +567,7 @@ export default class CorporateAnnualTargetMR extends Component {
let total = 0
let perfomanceScore = ''
let dataTable2 = this.state.dataTable
console.log(dataTable2)
dataTable2.map((item,index) => {
let value = String(item[15]) == 'NaN' || String(item[15]) == ''? 0 : Number(item[15])
total += value
......@@ -638,8 +643,8 @@ export default class CorporateAnnualTargetMR extends Component {
}
}
})
console.log(splitFormula)
console.log(baru)
// console.log(splitFormula)
// console.log(baru)
baru.map((item, index) => {
if (item == '-' || item == '+' || item == '/' || item == '*' || item == '(' || item == ')') {
anjay.push(item)
......@@ -686,8 +691,8 @@ export default class CorporateAnnualTargetMR extends Component {
let nilaiX = String(item).substr(indexX + 1, String(item).length)
if (forecast == undefined) {
console.log(formulaAwal)
console.log(tableMeta.rowData[17])
// console.log(formulaAwal)
// console.log(tableMeta.rowData[17])
let indexID = tableMeta.rowData[17].findIndex((val) => val.item_formula == String(`@${formulaAwal}`) && val.periode == Number(this.props.periode))
if (indexID !== -1) {
let valuezz = tableMeta.rowData[17][indexID].value
......@@ -695,7 +700,7 @@ export default class CorporateAnnualTargetMR extends Component {
}
} else {
// // // console.log(dataTable2[tableMeta.rowIndex][30])
let array = dataTable2[tableMeta.rowIndex][30].filter((val) => val.periode == Number(column))
let array = dataTable2[tableMeta.rowIndex][18].filter((val) => val.periode == Number(column))
let valuezz = array[0].value
// // // console.log(valuezz)
anjay.push(valuezz == "" ? 0 : valuezz)
......@@ -720,10 +725,10 @@ export default class CorporateAnnualTargetMR extends Component {
}
} else {
let indexID = dataTable2.findIndex((val) => val[31] == item)
let indexID = dataTable2.findIndex((val) => val[18] == item)
if (indexID !== -1) {
let valuezz = dataTable2[indexID][column].value == undefined ? dataTable2[indexID][column] : dataTable2[indexID][column].value
if (item == dataTable2[tableMeta.rowIndex][31]) {
if (item == dataTable2[tableMeta.rowIndex][18]) {
anjay.push(0)
} else {
anjay.push(valuezz == "" ? "0" : valuezz)
......@@ -858,24 +863,11 @@ export default class CorporateAnnualTargetMR extends Component {
}
})
console.log(anjay)
console.log(anjay2)
console.log(total)
total = dataTable2[tableMeta.rowIndex][5] == "ROIC" ? "0" : R.equals(total, NaN) ? "0.0" : total
if (dataTable2[tableMeta.rowIndex][5] == "ROIC") {
dataTable2[tableMeta.rowIndex][column] = 0
// if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = "0"
// } else {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = "0"
// }
} else {
dataTable2[tableMeta.rowIndex][column] = total
// if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
// } else {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = total
// }
}
return total
......@@ -1065,14 +1057,17 @@ export default class CorporateAnnualTargetMR extends Component {
const handleTotal = (tableMeta) => {
let total = 0
let handlePercent = String(tableMeta.rowData[6]).substr(0,String(tableMeta.rowData[6]).length-1)
if (tableMeta.rowData[12] == '' || String(tableMeta.rowData[12]) == '0' || String(tableMeta.rowData[12]) == '0.0') {
// if (tableMeta.rowData[5] == 'Trading profit (NPBT buah luar & plasma)') {
// console.log(dataTable2[tableMeta.rowIndex])
// }
let handlePercent = String(dataTable2[tableMeta.rowIndex][6]).substr(0,String(dataTable2[tableMeta.rowIndex][6]).length-1)
if (dataTable2[tableMeta.rowIndex][12] == '' || String(dataTable2[tableMeta.rowIndex][12]) == '0' || String(dataTable2[tableMeta.rowIndex][12]) == '0.0') {
total = 0
} else {
total = Number(tableMeta.rowData[14]) * Number(handlePercent) / 100
console.log(total)
total = Number(dataTable2[tableMeta.rowIndex][14]) * Number(handlePercent) / 100
// console.log(total)
}
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(2)
return total
}
......@@ -1141,8 +1136,8 @@ export default class CorporateAnnualTargetMR extends Component {
</div>
:
<div style={{ width: 300 }}>
{tableMeta.rowData[18] ?
tableMeta.rowData[18].length > 0 ?
{tableMeta.rowData[19] ?
tableMeta.rowData[19].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
......@@ -1282,21 +1277,30 @@ export default class CorporateAnnualTargetMR extends Component {
),
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 75 }}>
<div style={{ width: 75, textAlign: 'right' }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
this.state.get_for == 'view'?
Number(value).toFixed(1)
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={true}
decimalScale={1}
/>
:
<div style={{ flex: 1 }}>
<div style={{ flex: 1, textAlign: 'right' }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.state.get_for == 'view'? "black" : handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta)? "#5198ea" : 'black', fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.state.get_for == 'view'? "black" : handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta)? "#5198ea" : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={ tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6? Number(handleValueFormula(value, tableMeta, tableMeta.columnIndex)) : Number(value).toFixed(1)}
......@@ -1327,12 +1331,9 @@ export default class CorporateAnnualTargetMR extends Component {
),
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 75 }}>
<div style={{ width: 75, textAlign: 'right' }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
this.state.get_for == 'view'?
Number(value).toFixed(1)
:
<FormControlLabel
style={{ margin: 0 }}
value={value}
......@@ -1345,11 +1346,6 @@ export default class CorporateAnnualTargetMR extends Component {
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={true}
// onBlur={(event) => {
// // updateValue(event.target.value)
// handleChange(event.target.value, tableMeta)
// // // console.log(dataTable2)
// }}
/>
}
/>
......@@ -1368,11 +1364,20 @@ export default class CorporateAnnualTargetMR extends Component {
),
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 75 }}>
<div style={{ width: 75, textAlign: 'right' }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
this.state.get_for == 'view'?
Number(value).toFixed(1)
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={true}
decimalScale={1}
/>
:
<FormControlLabel
style={{ margin: 0 }}
......@@ -1386,11 +1391,6 @@ export default class CorporateAnnualTargetMR extends Component {
value={handleAchiement(tableMeta)}
decimalScale={1}
disabled={true}
// onBlur={(event) => {
// // updateValue(event.target.value)
// handleChange(event.target.value, tableMeta)
// // // console.log(dataTable2)
// }}
/>
}
/>
......@@ -1409,11 +1409,20 @@ export default class CorporateAnnualTargetMR extends Component {
),
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 70 }}>
<div style={{ width: 70, textAlign: 'right' }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
this.state.get_for == 'view'?
Number(value).toFixed(1)
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={true}
decimalScale={1}
/>
:
<FormControlLabel
style={{ margin: 0 }}
......@@ -1454,28 +1463,26 @@ export default class CorporateAnnualTargetMR extends Component {
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
this.state.get_for == 'view'?
Number(value).toFixed(1)
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={true}
decimalScale={1}
/>
:
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 75, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={handleTotal(tableMeta)}
decimalScale={1}
disabled={true}
// onBlur={(event) => {
// // updateValue(event.target.value)
// handleChange(event.target.value, tableMeta)
// // // console.log(dataTable2)
// }}
/>
}
/>
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={handleTotal(tableMeta)}
decimalScale={2}
disabled={true}
/>
}
</div>
)
......@@ -1739,7 +1746,7 @@ export default class CorporateAnnualTargetMR extends Component {
}}
onClick={() =>
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
......@@ -1753,10 +1760,10 @@ export default class CorporateAnnualTargetMR extends Component {
</button>}
{this.state.get_for === 'edit' && <button
type="button"
disabled={this.state.buttonError}
// disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
......@@ -1857,10 +1864,10 @@ export default class CorporateAnnualTargetMR extends Component {
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
this.setState({ loading: true, dataTable: dataTable2, saveDraft: false, buttonError: false }, () => {
setTimeout(() => {
this.setState({ loading: false })
// this.handleValidate()
this.handleCalculate()
}, 100);
})
}}
......@@ -1881,7 +1888,7 @@ export default class CorporateAnnualTargetMR extends Component {
}}
onClick={() =>
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' })
:
this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
......@@ -1895,10 +1902,10 @@ export default class CorporateAnnualTargetMR extends Component {
</button>
<button
type="button"
disabled={this.state.buttonError}
// disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' })
:
this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
......
......@@ -951,17 +951,17 @@ export default class FixedAssetsMovementMR extends Component {
}
/>
:
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 9)).toFixed(1)}
/>
</span> :
// tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
// <span style={{ fontSize: 12, textAlign: 'right' }}>
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(tableMeta, 9)).toFixed(1)}
// />
// </span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......
......@@ -392,7 +392,7 @@ export default class ListOfCreditFacilities extends Component {
"total_loan" : this.state.totalOutStand
}
console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
}
});
}
......@@ -540,7 +540,7 @@ export default class ListOfCreditFacilities extends Component {
})
}
uploadProfitLossMR(type) {
uploadLOCF(type) {
let data = []
this.state.dataTable.map(i => {
if (i[0] == 3) {
......@@ -1198,9 +1198,9 @@ export default class ListOfCreditFacilities extends Component {
// console.log(totalLoan);
// dataTable: newData, totalOutStand: newData[newData.length-1][22]
if (bankNameEmpty) {
this.setState({ loading: false, dataTable: this.state.dataTable, totalOutStand: 0, diff: Number(0 - this.state.perBS), saveDraft: true, saveComp: true})
this.setState({ loading: false, dataTable: this.state.dataTable, totalOutStand: 0, diff: Number(0 - this.state.perBS).toFixed(1), saveDraft: true, saveComp: true})
} else {
this.setState({ loading: false, dataTable: newData, totalOutStand: totalLoan, diff: Number(totalLoan - this.state.perBS), saveDraft: false, saveComp: Number(totalLoan - this.state.perBS) == 0? false : true })
this.setState({ loading: false, dataTable: newData, totalOutStand: Number(totalLoan).toFixed(1), diff: Number(totalLoan - this.state.perBS).toFixed(1), saveDraft: false, saveComp: Number(totalLoan - this.state.perBS) == 0? false : true })
}
}, 100);
})
......@@ -1214,6 +1214,10 @@ export default class ListOfCreditFacilities extends Component {
let indexNyasar = false
let totalLoan = 0
const formatSeparator = (num) => {
return String(num).replace(/(?<!\..*)(\d)(?=(?:\d{3})+(?:\.|$))/g, '$1,')
}
const handleAction = (typeReport, tableMeta, typeButton) => {
// console.log(typeReport)
if (typeReport == 3) {
......@@ -2556,13 +2560,13 @@ export default class ListOfCreditFacilities extends Component {
// console.log(columnMeta)
// console.log(tableMeta)
return (
<th style={{ ...style2, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<th style={{ ...style2, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 43, fontSize: 12, fontWeight: 'bold', padding: 5, textAlign: 'center' }}>{columnMeta.name}</div>
<div className="grid grid-2x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: '100%', display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", height: 45, display: 'grid', alignItems: 'center', backgroundColor: '#07a7d0', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Financial Covenant"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: '100%', display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Current Testing"}</span>
</div>
</div>
......@@ -2640,10 +2644,10 @@ export default class ListOfCreditFacilities extends Component {
<th style={{ ...style2, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 43, fontSize: 12, fontWeight: 'bold', padding: 5, textAlign: 'center' }}>{columnMeta.name}</div>
<div className="grid grid-2x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", height: 45, display: 'grid', alignItems: 'center', backgroundColor: '#07a7d0', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Financial Covenant"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: '100%', display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Current Testing"}</span>
</div>
</div>
......@@ -2720,10 +2724,10 @@ export default class ListOfCreditFacilities extends Component {
<th style={{ ...style2, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 43, fontSize: 12, fontWeight: 'bold', padding: 5, textAlign: 'center' }}>{columnMeta.name}</div>
<div className="grid grid-2x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", height: 45, display: 'grid', alignItems: 'center', backgroundColor: '#07a7d0', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Financial Covenant"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: '100%', display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Current Testing"}</span>
</div>
</div>
......@@ -3587,7 +3591,7 @@ export default class ListOfCreditFacilities extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Total Outstanding Loan</Typography>
</div>
<div style={{border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.state.totalOutStand}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{formatSeparator(this.state.totalOutStand)}</Typography>
</div>
</div>
</div>
......@@ -3597,7 +3601,7 @@ export default class ListOfCreditFacilities extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Diff</Typography>
</div>
<div style={{borderStyle: 'solid', borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.state.diff}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{formatSeparator(this.state.diff)}</Typography>
</div>
</div>
</div>
......@@ -3670,7 +3674,7 @@ export default class ListOfCreditFacilities extends Component {
type="button"
onClick={() =>
this.state.saveDraft === true ?
this.setState({snekbar: true, snekbarMsg: 'Data Incomplete !'})
this.setState({snekbar: true, snekbarMsg: 'Data Incomplete'})
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
......@@ -3696,7 +3700,7 @@ export default class ListOfCreditFacilities extends Component {
// disabled={this.state.buttonError}
onClick={() =>
this.state.saveComp ?
this.setState({snekbar: true, snekbarMsg: 'Data Incomplete !'})
this.setState({snekbar: true, snekbarMsg: 'Data Incomplete / Diff must be 0'})
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
......@@ -3754,7 +3758,7 @@ export default class ListOfCreditFacilities extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Total Outstanding Loan</Typography>
</div>
<div style={{border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', minWidth: 200, }}>{this.state.totalOutStand}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{formatSeparator(this.state.totalOutStand)}</Typography>
</div>
</div>
</div>
......@@ -3764,7 +3768,7 @@ export default class ListOfCreditFacilities extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Diff</Typography>
</div>
<div style={{borderStyle: 'solid', borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.state.diff}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{(formatSeparator(this.state.diff))}</Typography>
</div>
</div>
</div>
......@@ -3817,12 +3821,12 @@ export default class ListOfCreditFacilities extends Component {
type="button"
onClick={() =>
this.state.saveDraft === true ?
this.setState({snekbar: true, snekbarMsg: 'Data Incomplete !'})
this.setState({snekbar: true, snekbarMsg: 'Data Incomplete'})
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
setTimeout(() => {
this.uploadProfitLossMR('draft')
this.uploadLOCF('draft')
}, 100);
})
}
......@@ -3843,12 +3847,12 @@ export default class ListOfCreditFacilities extends Component {
// disabled={this.state.buttonError}
onClick={() =>
this.state.saveComp ?
this.setState({snekbar: true, snekbarMsg: 'Data Incomplete !'})
this.setState({snekbar: true, snekbarMsg: 'Data Incomplete / Diff must be 0'})
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
setTimeout(() => {
this.uploadProfitLossMR('submitted')
this.uploadLOCF('submitted')
}, 100);
})
}
......@@ -3898,7 +3902,7 @@ export default class ListOfCreditFacilities extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
String(this.state.judul).includes("MONTHLY") && String(this.state.judul).includes("REPORT") && String(this.state.judul).includes("LIST") && String(this.state.judul).includes("CREDIT") ?
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("LIST") && String(this.state.judul).includes("CREDIT") && String(this.state.judul).includes("MONTHLY") && String(this.state.judul).includes("REPORT") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
......
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