Commit 35e63719 authored by Faisal Hamdi's avatar Faisal Hamdi

Merge branch 'faisal' into 'master'

cat mr

See merge request !782
parents 1b1a7da4 85df3e25
...@@ -1190,7 +1190,9 @@ export default class MonthlyReport extends Component { ...@@ -1190,7 +1190,9 @@ export default class MonthlyReport extends Component {
periode={this.state.periode.periode} periode={this.state.periode.periode}
monthlyReportId={this.state.monthlyReportId} monthlyReportId={this.state.monthlyReportId}
month={this.state.month} month={this.state.month}
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleCAT: false, visibleMonthlyReport: true })} onClickClose={() => this.setState({ visibleCAT: false, visibleMonthlyReport: true })}
isApprover={this.state.isApprover}
/> />
)} )}
{this.state.visibleLOCF && ( {this.state.visibleLOCF && (
......
...@@ -7,6 +7,8 @@ import api from '../../api'; ...@@ -7,6 +7,8 @@ import api from '../../api';
import { titleCase } from '../../library/Utils'; import { titleCase } from '../../library/Utils';
import Tooltip from '@material-ui/core/Tooltip'; import Tooltip from '@material-ui/core/Tooltip';
import NumberFormat from 'react-number-format'; import NumberFormat from 'react-number-format';
import Constant from '../../library/Constant';
import { Alert, Autocomplete } from '@material-ui/lab';
const LightTooltip = withStyles((theme) => ({ const LightTooltip = withStyles((theme) => ({
tooltip: { tooltip: {
...@@ -51,15 +53,24 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -51,15 +53,24 @@ export default class CorporateAnnualTargetMR extends Component {
super(props) super(props)
this.state = { this.state = {
dataTables: [], dataTables: [],
loading: true loading: true,
kpiTypeList: [],
maxAchList: [],
formulaYtdList: {
options: [{ value: 'SUM' }, { value: 'AVG' }, { value: 'LAST' }],
getOptionLabel: (option) => titleCase(option.value),
},
} }
} }
componentDidMount() { componentDidMount() {
this.getItemHierarki() this.getItemHierarki()
this.getLatestUpdate()
this.getKPIType()
this.getMaxAch()
} }
getItemHierarki() { getLatestUpdate() {
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),
...@@ -68,39 +79,50 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -68,39 +79,50 @@ export default class CorporateAnnualTargetMR extends Component {
"monthly_report_id": this.props.monthlyReportId, "monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id "months": this.props.month.month_id
} }
api.create().getLastestUpdateMR(payload).then(response => {
if (response.data) {
if (response.data.status === "success") {
this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, typeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
getItemHierarki() {
let payload = {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": "2021",
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id
}
api.create().getHierarkiMontlyReportCAT(payload).then(response => { api.create().getHierarkiMontlyReportCAT(payload).then(response => {
let dataTable = [] let dataTable = []
let dataCustomerPrs = [] let dataCustomerPrs = []
let dataInternalBsn = [] let dataInternalBsn = []
console.log(payload);
console.log(response); console.log(response);
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
const handlePushChild = (item) => { const handlePushChild = (item) => {
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'
// if (item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
// if (item.type_report_id !== 4) {
// dataInternalBsn.push({
// id: item.id,
// name: item.description,
// check: false
// })
// }
// }
// if (item.parent_name == 'CUSTOMER PERSPECTIVE') {
// if (item.type_report_id !== 4) {
// dataCustomerPrs.push({
// id: item.id,
// name: item.description,
// check: false
// })
// }
// }
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -108,16 +130,17 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -108,16 +130,17 @@ export default class CorporateAnnualTargetMR extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.corporate_annual_target.weight === null ? "0" : item.corporate_annual_target.weight === "" ? "0" : item.corporate_annual_target.weight, item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(item.corporate_annual_target.weight).indexOf(".") == -1 ? item.corporate_annual_target.weight : `${Number(item.weight) * 100}%`),
item.corporate_annual_target.jenis_kpi === null ? "0" : item.corporate_annual_target.jenis_kpi === "" ? "0" : item.corporate_annual_target.jenis_kpi, parentTrue ? item.corporate_annual_target.uom : item.uom,
item.corporate_annual_target.max_ach === null ? "0" : item.corporate_annual_target.max_ach === "" ? "0" : item.corporate_annual_target.max_ach, parentTrue ? item.corporate_annual_target.kpi_type == "" ? null : { value: item.corporate_annual_target.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type },
item.corporate_annual_target.formula_ytd === null ? "0" : item.corporate_annual_target.formula_ytd === "" ? "0" : item.corporate_annual_target.formula_ytd, 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.corporate_annual_target.actual_monthly === null ? "0" : item.corporate_annual_target.actual_monthly === "" ? "0" : item.corporate_annual_target.actual_monthly, 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.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly === "" ? "0" : item.corporate_annual_target.target_monthly, 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.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly === "" ? "0" : item.corporate_annual_target.achivement_monthly, item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly,
item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score === "" ? "0" : item.corporate_annual_target.score, item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly,
item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight === "" ? "0" : item.corporate_annual_target.score_x_weight, item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score,
item.corporate_annual_target.notes === null ? "0" : item.corporate_annual_target.notes === "" ? "0" : item.corporate_annual_target.notes, 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,
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -134,17 +157,19 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -134,17 +157,19 @@ export default class CorporateAnnualTargetMR extends Component {
item.id, item.id,
item.parent, item.parent,
item.formula, item.formula,
item.level,
item.description, item.description,
item.corporate_annual_target.weight === null ? "0" : item.corporate_annual_target.weight === "" ? "0" : item.corporate_annual_target.weight, item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : item.weight,
item.corporate_annual_target.jenis_kpi === null ? "0" : item.corporate_annual_target.jenis_kpi === "" ? "0" : item.corporate_annual_target.jenis_kpi, item.corporate_annual_target.uom,
item.corporate_annual_target.max_ach === null ? "0" : item.corporate_annual_target.max_ach === "" ? "0" : item.corporate_annual_target.max_ach, item.kpi_type == "" ? null : { value: item.kpi_type },
item.corporate_annual_target.formula_ytd === null ? "0" : item.corporate_annual_target.formula_ytd === "" ? "0" : item.corporate_annual_target.formula_ytd, item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
item.corporate_annual_target.actual_monthly === null ? "0" : item.corporate_annual_target.actual_monthly === "" ? "0" : item.corporate_annual_target.actual_monthly, item.formula == "" ? null : { value: item.formula_ytd },
item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly === "" ? "0" : item.corporate_annual_target.target_monthly, 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.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly === "" ? "0" : item.corporate_annual_target.achivement_monthly, item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly,
item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score === "" ? "0" : item.corporate_annual_target.score, item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly,
item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight === "" ? "0" : item.corporate_annual_target.score_x_weight, item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score,
item.corporate_annual_target.notes === null ? "0" : item.corporate_annual_target.notes === "" ? "0" : item.corporate_annual_target.notes, 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,
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -162,6 +187,96 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -162,6 +187,96 @@ export default class CorporateAnnualTargetMR extends Component {
}) })
} }
getKPIType() {
let body = {
group: 'CAT',
company_id: this.props.company.company_id,
type: 'KPI_TYPE'
}
api.create().getAllSettingByType(body).then(response => {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
let data = response.data.data
// // // console.log(data)
let inputKPI = []
data.map((item) => {
inputKPI.push({
value: item.value
})
})
let defaultProps = {
options: inputKPI,
getOptionLabel: (option) => titleCase(option.value),
};
// // // console.log(defaultProps)
this.setState({ kpiTypeList: defaultProps })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
getMaxAch() {
let body = {
group: 'CAT',
company_id: this.props.company.company_id,
type: 'MAX_ACHIEVEMENT'
}
api.create().getAllSettingByType(body).then(response => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
let data = response.data.data
let inputMaxAch = data.map((item) => {
return {
value: item.value
}
})
let defaultProps = {
options: inputMaxAch,
getOptionLabel: (option) => titleCase(option.value),
};
// setTimeout(() => {
this.setState({ maxAchList: defaultProps })
// }, 300);
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
// alert(response.data.message)
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
this.getItemHierarki()
})
}
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
let dataDelete = this.state.dataDelete let dataDelete = this.state.dataDelete
...@@ -202,17 +317,22 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -202,17 +317,22 @@ export default class CorporateAnnualTargetMR extends Component {
dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz)) dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz))
} }
} }
const handleValueDropdown = (value, type, tableMeta) => { const handleValueDropdown = (value, type, tableMeta) => {
let data = type == 'KPI'? this.state.kpiTypeList.options : (type == 'MAX'? this.state.maxAchList.options : this.state.formulaYtdList.options) console.log(value,type, tableMeta);
console.log(this.state.maxAchList.options);
let data = type == 'KPI' ? this.state.kpiTypeList.options : (type == 'MAX' ? this.state.maxAchList.options : this.state.formulaYtdList.options)
console.log(data);
let index = 0 let index = 0
if (value == null) { if (value == null) {
console.log("masuk");
index = -1 index = -1
} else { } else {
index = data.findIndex((val) => val.value == value.value) index = data.findIndex((val) => val.value == value.value)
} }
// // console.log(value) // console.log(value)
// // console.log(data) // console.log(data)
// // console.log(index) // console.log(index)
if (index == -1) { if (index == -1) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = null dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = null
return null return null
...@@ -396,12 +516,12 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -396,12 +516,12 @@ export default class CorporateAnnualTargetMR extends Component {
display: false display: false
} }
}, },
// { {
// name: "", name: "",
// options: { options: {
// display: false display: false
// } }
// }, },
{ {
name: "Key Performance Indicator", name: "Key Performance Indicator",
options: { options: {
...@@ -413,65 +533,61 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -413,65 +533,61 @@ export default class CorporateAnnualTargetMR extends Component {
setCellProps: () => ({ style }), setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
// handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta) && (tableMeta.rowData[1] == "" || String(this.props.status).toLocaleLowerCase() == 'draft' || String(this.props.status).toLocaleLowerCase() == 'submitted' || String(this.props.status).toLocaleLowerCase() == 'revision')? handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta) && (tableMeta.rowData[1] == "" || String(this.props.status).toLocaleLowerCase() == 'draft' || String(this.props.status).toLocaleLowerCase() == 'submitted' || String(this.props.status).toLocaleLowerCase() == 'revision')?
// <div style={{ textAlign: 'left', paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <div style={{ textAlign: 'left', paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
// {!this.state.loading && <FormControlLabel {!this.state.loading && <FormControlLabel
// style={{ margin: 0 }} style={{ margin: 0 }}
// control={ control={
// <Input <Input
// disableUnderline={true} disableUnderline={true}
// style={{ color: tableMeta.rowData[1] == "" ? "#5198ea" : "black", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent' }} style={{ color: tableMeta.rowData[1] == "" ? "#5198ea" : "black", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent' }}
// type="text" type="text"
// placeholder="" placeholder=""
// defaultValue={val} defaultValue={val}
// // disabled={!handleAction(tableMeta.rowData[2])} // disabled={!handleAction(tableMeta.rowData[2])}
// onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // console.log(event.target.value)
// handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
// }} }}
// /> />
// } }
// />} />}
// </div> </div>
// : :
// <div style={{ width: 300 }}>
// {tableMeta.rowData[30] ?
// tableMeta.rowData[30].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>
// </LightTooltip>
// </div>
// :
// tableMeta.rowData[4] == 0 ?
// <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
// :
// tableMeta.rowData[1] == null ?
// <div style={{ paddingLeft: 20 }}>
// <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
// </div>
// :
// <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
// <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
// </div>
// :
// tableMeta.rowData[4] == 0 ?
// <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
// :
// tableMeta.rowData[1] == null ?
// <div style={{ paddingLeft: 20 }}>
// <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
// </div>
// :
// <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
// <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
// </div>
// }
// </div>
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{val} {tableMeta.rowData[30] ?
tableMeta.rowData[30].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>
</LightTooltip>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
tableMeta.rowData[1] == null ?
<div style={{ paddingLeft: 20 }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
tableMeta.rowData[1] == null ?
<div style={{ paddingLeft: 20 }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
}
</div> </div>
) )
} }
...@@ -490,31 +606,31 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -490,31 +606,31 @@ export default class CorporateAnnualTargetMR extends Component {
<div style={{ textAlign: 'center' }}> <div style={{ textAlign: 'center' }}>
{tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 1 ? // tableMeta.rowData[0] === 1 ?
value value
: // :
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value} // value={value}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
suffix="%" // suffix="%"
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 60, backgroundColor: 'transparent' }} // style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 60, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
value={value} // value={value}
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={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)}
maxLength={4} // maxLength={4}
onBlur={(event) => { // onBlur={(event) => {
// updateValue(some) // // updateValue(some)
handleChangePercentage(event.target.value, tableMeta) // handleChangePercentage(event.target.value, tableMeta)
}} // }}
/> // />
} // }
/> // />
</div> // </div>
} }
</div> </div>
) )
...@@ -591,7 +707,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -591,7 +707,7 @@ export default class CorporateAnnualTargetMR extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{/* {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null : null :
<Autocomplete <Autocomplete
{...this.state.kpiTypeList} {...this.state.kpiTypeList}
...@@ -608,11 +724,8 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -608,11 +724,8 @@ export default class CorporateAnnualTargetMR extends Component {
</div> </div>
} }
/> />
} */} // val
<div style={{ textAlign: 'center', width: 90 }}> }
{val}
</div>
</div> </div>
) )
} }
...@@ -628,7 +741,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -628,7 +741,7 @@ export default class CorporateAnnualTargetMR extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ textAlign: 'center', width: 60 }}> <div style={{ textAlign: 'center', width: 60 }}>
{/* {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null : null :
<Autocomplete <Autocomplete
{...this.state.maxAchList} {...this.state.maxAchList}
...@@ -638,7 +751,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -638,7 +751,7 @@ export default class CorporateAnnualTargetMR extends Component {
disableClearable disableClearable
value={handleValueDropdown(val, 'MAX', tableMeta)} value={handleValueDropdown(val, 'MAX', tableMeta)}
style={{ padding: 0, margin: 0 }} style={{ padding: 0, margin: 0 }}
disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])} // disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])}
renderInput={(params) => renderInput={(params) =>
<div ref={params.InputProps.ref} style={{ padding: 0, margin: 0 }}> <div ref={params.InputProps.ref} style={{ padding: 0, margin: 0 }}>
<input style={{ borderColor: 'white', width: 96, textAlign: 'center', padding: 0, margin: 0, color: handleAction(tableMeta.rowData[2], tableMeta.rowData[0]) ? "#5198ea" : "black" }} type="text" {...params.inputProps} /> <input style={{ borderColor: 'white', width: 96, textAlign: 'center', padding: 0, margin: 0, color: handleAction(tableMeta.rowData[2], tableMeta.rowData[0]) ? "#5198ea" : "black" }} type="text" {...params.inputProps} />
...@@ -646,8 +759,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -646,8 +759,7 @@ export default class CorporateAnnualTargetMR extends Component {
} }
// value={this.state.parent} // value={this.state.parent}
/> />
} */} }
{val}
</div> </div>
) )
} }
...@@ -663,7 +775,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -663,7 +775,7 @@ export default class CorporateAnnualTargetMR extends Component {
customBodyRender: (val, tableMeta, updateValue) => { customBodyRender: (val, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 60 }}> <div style={{ width: 60 }}>
{/* {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null : null :
<Autocomplete <Autocomplete
{...this.state.formulaYtdList} {...this.state.formulaYtdList}
...@@ -685,8 +797,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -685,8 +797,7 @@ export default class CorporateAnnualTargetMR extends Component {
} }
// value={this.state.parent} // value={this.state.parent}
/> />
} */} }
{val}
</div> </div>
) )
} }
...@@ -712,11 +823,12 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -712,11 +823,12 @@ export default class CorporateAnnualTargetMR extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={Number(value).toFixed(1)} 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={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={false}
decimalScale={1} decimalScale={1}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -743,7 +855,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -743,7 +855,7 @@ export default class CorporateAnnualTargetMR extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 75 }}> <div style={{ width: 75 }}>
{/* {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null : null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -765,8 +877,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -765,8 +877,7 @@ export default class CorporateAnnualTargetMR extends Component {
/> />
} }
/> />
} */} }
{value}
</div> </div>
) )
} }
...@@ -782,7 +893,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -782,7 +893,7 @@ export default class CorporateAnnualTargetMR extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 75 }}> <div style={{ width: 75 }}>
{/* {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null : null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -804,8 +915,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -804,8 +915,7 @@ export default class CorporateAnnualTargetMR extends Component {
/> />
} }
/> />
} */} }
{value}
</div> </div>
) )
} }
...@@ -821,7 +931,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -821,7 +931,7 @@ export default class CorporateAnnualTargetMR extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 70 }}> <div style={{ width: 70 }}>
{/* {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null : null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -843,8 +953,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -843,8 +953,7 @@ export default class CorporateAnnualTargetMR extends Component {
/> />
} }
/> />
} */} }
{value}
</div> </div>
) )
} }
...@@ -860,7 +969,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -860,7 +969,7 @@ export default class CorporateAnnualTargetMR extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 75 }}> <div style={{ width: 75 }}>
{/* {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null : null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -882,8 +991,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -882,8 +991,7 @@ export default class CorporateAnnualTargetMR extends Component {
/> />
} }
/> />
} */} }
{value}
</div> </div>
) )
} }
...@@ -929,10 +1037,6 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -929,10 +1037,6 @@ export default class CorporateAnnualTargetMR extends Component {
} }
} }
] ]
let data = [
["Revenue", "0%", "Rp Bio", "HIG", "unlimited", "SUM", "input", "result", "result", "result", "result", "Lorem ipsum" ],
// ["Total Assets", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22" ]
]
return ( return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}> <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
......
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