Commit 539e52c1 authored by fahrur huzain's avatar fahrur huzain

Merge branch 'ENV-STAGING' of http://103.44.149.204/d.arizona/tia-dev into fahrur/audit

parents 7462c7bd bc2f4fad
...@@ -196,6 +196,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -196,6 +196,7 @@ export default class CorporateAnnualTargetMR extends Component {
} }
getItemHierarki() { getItemHierarki() {
this.setState({ loading: true })
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
"revision": Number(this.props.revision), "revision": Number(this.props.revision),
...@@ -218,7 +219,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -218,7 +219,7 @@ export default class CorporateAnnualTargetMR extends Component {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE' let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE'
let weight = String(item.weight).includes('%') ? String(item.weight).substr(0, String(item.weight).length - 1) : String(item.weight) // let weight = String(item.weight).includes('%') ? String(item.weight).substr(0, String(item.weight).length - 1) : String(item.weight)
let weightTB = String(item.corporate_annual_target.weight).includes('%') ? String(item.corporate_annual_target.weight).substr(0, String(item.corporate_annual_target.weight).length - 1) : String(item.corporate_annual_target.weight) let weightTB = String(item.corporate_annual_target.weight).includes('%') ? String(item.corporate_annual_target.weight).substr(0, String(item.corporate_annual_target.weight).length - 1) : String(item.corporate_annual_target.weight)
// console.log(weight) // console.log(weight)
dataTable.push([ dataTable.push([
...@@ -229,7 +230,8 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -229,7 +230,8 @@ export default class CorporateAnnualTargetMR extends Component {
item.level, item.level,
item.description, item.description,
// item.corporate_annual_target.weight == "" ? Number(0).toFixed(1) : Number(weight).toFixed(1), // item.corporate_annual_target.weight == "" ? Number(0).toFixed(1) : Number(weight).toFixed(1),
parentTrue ? weight : weightTB, // parentTrue ? weight : weightTB,
weightTB,
parentTrue ? item.corporate_annual_target.uom : item.uom, parentTrue ? item.corporate_annual_target.uom : item.uom,
parentTrue ? item.corporate_annual_target.jenis_kpi == "" ? null : item.corporate_annual_target.jenis_kpi : item.jenis_kpi == "" ? null : item.kpi_type, parentTrue ? item.corporate_annual_target.jenis_kpi == "" ? null : item.corporate_annual_target.jenis_kpi : item.jenis_kpi == "" ? null : item.kpi_type,
// 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.kpi_type == "" ? null : { value: item.corporate_annual_target.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type },
...@@ -282,6 +284,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -282,6 +284,7 @@ export default class CorporateAnnualTargetMR extends Component {
} }
} }
res.map((item, index) => { res.map((item, index) => {
let weightParent = String(item.corporate_annual_target.weight).includes('%') ? String(item.corporate_annual_target.weight).substr(0, String(item.corporate_annual_target.weight).length - 1) : String(item.corporate_annual_target.weight)
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -289,7 +292,8 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -289,7 +292,8 @@ export default class CorporateAnnualTargetMR extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.weight == '' ? Number(0) : Number(Number(item.weight) * 100), item.parent == null ? weightParent : item.corporate_annual_target.weight,
// item.weight == '' ? Number(0) : Number(Number(item.weight) * 100),
item.uom, item.uom,
item.kpi_type == "" ? null : item.kpi_type, item.kpi_type == "" ? null : item.kpi_type,
// item.kpi_type == "" ? null : { value: item.kpi_type }, // item.kpi_type == "" ? null : { value: item.kpi_type },
...@@ -621,11 +625,11 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -621,11 +625,11 @@ export default class CorporateAnnualTargetMR extends Component {
options: inputMaxAch, options: inputMaxAch,
getOptionLabel: (option) => titleCase(option.value), getOptionLabel: (option) => titleCase(option.value),
}; };
// setTimeout(() => { setTimeout(() => {
this.setState({ maxAchList: defaultProps }, () => { this.setState({ maxAchList: defaultProps }, () => {
this.getItemHierarki() this.getItemHierarki()
}) })
// }, 300); }, 300);
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
...@@ -939,11 +943,11 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -939,11 +943,11 @@ export default class CorporateAnnualTargetMR extends Component {
}) })
} }
// console.log(Number(lastTotal)) // console.log(Number(lastTotal))
console.log(this.state.parameterPerfom) // console.log(this.state.parameterPerfom)
console.log(listPerfomanceDefault) // console.log(listPerfomanceDefault)
console.log(perfomanceScore) // console.log(perfomanceScore)
console.log(perfomanceScoreColor) // console.log(perfomanceScoreColor)
console.log(datatable3) // console.log(datatable3)
// if (lastTotal >= 1.00 && lastTotal <= 2.00) { // if (lastTotal >= 1.00 && lastTotal <= 2.00) {
// perfomanceScore = 'K' // perfomanceScore = 'K'
// } else if (lastTotal >= 2.01 && lastTotal <= 2.75) { // } else if (lastTotal >= 2.01 && lastTotal <= 2.75) {
......
...@@ -149,7 +149,7 @@ export default class LOCF extends Component { ...@@ -149,7 +149,7 @@ export default class LOCF extends Component {
if (this.props.dataTablelocf !== prevProps.dataTablelocf) { if (this.props.dataTablelocf !== prevProps.dataTablelocf) {
let array = this.props.dataTablelocf let array = this.props.dataTablelocf
let datas = array[array.length - 1] let datas = array[array.length - 1]
this.setState({ dataTable: this.props.dataTablelocf, diff: datas[47], loanTotal: datas[48], perBS: datas[49] }) this.setState({ dataTable: this.props.dataTablelocf, diff: this.props.defaultCurrency.id == 1 ? fixNumber(Number(datas[47]), 1) : datas[47], loanTotal: datas[48], perBS: this.props.defaultCurrency.id == 1 ? fixNumber(Number(datas[49]), 1) : datas[49] })
} }
if (this.props.loadingChild !== prevProps.loadingChild) { if (this.props.loadingChild !== prevProps.loadingChild) {
this.setState({ loading: this.props.loadingChild }) this.setState({ loading: this.props.loadingChild })
...@@ -353,7 +353,7 @@ export default class LOCF extends Component { ...@@ -353,7 +353,7 @@ export default class LOCF extends Component {
// let sortingTable = dataTable.sort((a, b) => a[6].value - b[6].value) // let sortingTable = dataTable.sort((a, b) => a[6].value - b[6].value)
// console.log(sortingTable); // console.log(sortingTable);
let lastArray = dataTable[res.length - 1] let lastArray = dataTable[res.length - 1]
this.setState({ dataTable, diff: lastArray[47], loanTotal: lastArray[48], perBS: lastArray[49], loading: false, visibleLOCFMR: true }, () => { this.setState({ dataTable, diff: this.props.defaultCurrency.id == 1 ? fixNumber(Number(lastArray[47]), 1) : lastArray[47], loanTotal: lastArray[48], perBS: this.props.defaultCurrency.id == 1 ? fixNumber(Number(lastArray[49]), 1) : lastArray[49], loading: false, visibleLOCFMR: true }, () => {
this.props.sendToParent(dataTable, lastArray, 'LOCF') this.props.sendToParent(dataTable, lastArray, 'LOCF')
}) })
} }
...@@ -565,10 +565,8 @@ export default class LOCF extends Component { ...@@ -565,10 +565,8 @@ export default class LOCF extends Component {
console.log(dataTable); console.log(dataTable);
let lastArray = dataTable[dataTable.length - 1] let lastArray = dataTable[dataTable.length - 1]
console.log(lastArray); this.setState({ dataTable, diff: this.props.defaultCurrency.id == 1 ? fixNumber(Number(lastArray[47]), 1) : lastArray[47], loanTotal: lastArray[48], perBS: this.props.defaultCurrency.id == 1 ? fixNumber(Number(lastArray[49]), 1) : lastArray[49], dataLoaded: true, loading: false, buttonError: false, dataDelete: [] }, () => {
this.setState({ dataTable, diff: lastArray[47], loanTotal: lastArray[48], perBS: lastArray[49], dataLoaded: true, loading: false, buttonError: false, dataDelete: [] }, () => { this.props.sendToParent(dataTable, lastArray, 'LOCF', 'upload', this.state.visibleLOCFMR)
console.log(this.state.visibleLOCFMR);
this.props.sendToParent(dataTable, lastArray , 'LOCF', 'upload', this.state.visibleLOCFMR)
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, typeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, typeAlert: 'warning', loading: false }, () => {
...@@ -3619,7 +3617,7 @@ export default class LOCF extends Component { ...@@ -3619,7 +3617,7 @@ export default class LOCF extends Component {
<Typography style={{ fontSize: '12px', color: '#4b4b4b' }}>Diff</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b' }}>Diff</Typography>
</div> </div>
<div style={{ borderStyle: 'solid', borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}> <div style={{ borderStyle: 'solid', borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '14px', color: Number(this.state.diff) > 0 ? 'red' : '#4b4b4b' }}><NumberFormat value={this.state.diff} displayType={'text'} thousandSeparator={true} prefix={''} /></Typography> <Typography style={{ fontSize: '14px', color: Number(this.state.diff) > '0.0' || Number(this.state.diff) < '0.0' ? 'red' : '#4b4b4b' }}><NumberFormat value={this.state.diff == 0 ? "0.0" : this.state.diff} displayType={'text'} thousandSeparator={true} prefix={''} /></Typography>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -287,7 +287,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -287,7 +287,7 @@ export default class ListOfCreditFacilities extends Component {
backToMonthlyReportLOCF(type) { backToMonthlyReportLOCF(type) {
console.log('masoook LOCF'); console.log('masoook LOCF');
let dataTable2 = this.state.dataTablelocf == undefined || this.state.tambah == 'tambah' || this.state.tambah == 'upload' ? this.state.dataTableLOCF : this.state.dataTablelocf let dataTable2 = (this.state.dataTablelocf !== undefined && this.state.tambah == 'upload') ? this.state.dataTablelocf : (this.state.dataTablelocf == undefined || this.state.tambah == 'tambah' || this.state.tambah == 'upload') ? this.state.dataTableLOCF : this.state.dataTablelocf
let data = [] let data = []
let error = false let error = false
// this.deleteReport() // this.deleteReport()
...@@ -579,7 +579,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -579,7 +579,10 @@ export default class ListOfCreditFacilities extends Component {
handleCalculateLOCF = () => { handleCalculateLOCF = () => {
this.setState({ loading: true }) this.setState({ loading: true })
let dataTable2 = this.state.dataTablelocf == undefined || this.state.tambah == 'tambah' || this.state.tambah == 'upload' ? this.state.dataTableLOCF : this.state.dataTablelocf // console.log(this.state.dataTableLOCF);
// console.log(this.state.dataTablelocf);
// console.log(this.state.tambah);
let dataTable2 = (this.state.dataTablelocf !== undefined && this.state.tambah == 'upload') ? this.state.dataTablelocf : (this.state.dataTablelocf == undefined || this.state.tambah == 'tambah' || this.state.tambah == 'upload') ? this.state.dataTableLOCF : this.state.dataTablelocf
let data = [] let data = []
let error = false let error = false
let bankNameEmpty = false let bankNameEmpty = false
...@@ -850,6 +853,9 @@ export default class ListOfCreditFacilities extends Component { ...@@ -850,6 +853,9 @@ export default class ListOfCreditFacilities extends Component {
}) })
let lastArrayLOCF = dataTablelocf[res.length - 1] let lastArrayLOCF = dataTablelocf[res.length - 1]
let roundDataDiff = fixNumber(Number(lastArrayLOCF[47]), 1)
let roundDataLoan = fixNumber(Number(lastArrayLOCF[48]), 1)
let roundDataPerBS = fixNumber(Number(lastArrayLOCF[49]), 1)
console.log(dataTablelocf); console.log(dataTablelocf);
if (bankNameEmpty) { if (bankNameEmpty) {
if (this.state.get_for == 'view') { if (this.state.get_for == 'view') {
...@@ -861,10 +867,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -861,10 +867,10 @@ export default class ListOfCreditFacilities extends Component {
if (this.state.get_for == 'view') { if (this.state.get_for == 'view') {
console.log("view"); console.log("view");
} else { } else {
this.setState({ saveDraft: false, saveComp: lastArrayLOCF[47] == 0 || lastArrayLOCF[47] == '0.0' || lastArrayLOCF[47] == "-0.0" ? false : true }) this.setState({ saveDraft: false, saveComp: roundDataDiff == 0 || roundDataDiff == '0.0' || roundDataDiff == "-0.0" ? false : true })
} }
} }
this.setState({ dataTablelocf, diffLOCF: lastArrayLOCF[47], totalLoanLOCF: lastArrayLOCF[48], perBSLOCF: lastArrayLOCF[49], loading: false }, () => { this.setState({ dataTablelocf, diffLOCF: roundDataDiff, totalLoanLOCF: roundDataLoan, perBSLOCF: roundDataPerBS, loading: false }, () => {
this.handleCalculateLOV() this.handleCalculateLOV()
}) })
} }
...@@ -1102,7 +1108,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1102,7 +1108,7 @@ export default class ListOfCreditFacilities extends Component {
uploadLOCF(type) { uploadLOCF(type) {
console.log('masoook LOCF'); console.log('masoook LOCF');
let dataTable2 = this.state.dataTablelocf == undefined || this.state.tambah == 'tambah' || this.state.tambah == 'upload' ? this.state.dataTableLOCF : this.state.dataTablelocf let dataTable2 = (this.state.dataTablelocf !== undefined && this.state.tambah == 'upload') ? this.state.dataTablelocf : (this.state.dataTablelocf == undefined || this.state.tambah == 'tambah' || this.state.tambah == 'upload') ? this.state.dataTableLOCF : this.state.dataTablelocf
let data = [] let data = []
let error = false let error = false
// this.deleteReport() // this.deleteReport()
......
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