Commit 201a68ad authored by faisalhamdi's avatar faisalhamdi

Laporan CAT

parent fc56110e
...@@ -2890,68 +2890,69 @@ export default class SubHolding extends Component { ...@@ -2890,68 +2890,69 @@ export default class SubHolding extends Component {
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let res = response.data.data let res = response.data.data
console.log(res); const handlePushChild = (item) => {
// const handlePushChild = (item) => { let indexIDzz = dbCATPQ.findIndex((val) => val[1] === item.id)
// let indexIDzz = dbCATPQ.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'
// dbCATPQ.push([ let weight = String(item.corporate_annual_target.weight).substr(0, String(item.corporate_annual_target.weight).length - 1)
// item.type_report_id, dbCATPQ.push([
// item.id, item.typeItemReportId,
// item.parent, item.itemReportId,
// item.formula, item.parent,
// item.level, item.formula,
// item.description, item.level,
// item.weight, item.itemName,
// item.uom, item.corporate_annual_target.weight == "" ? Number(0).toFixed(1) : Number(weight).toFixed(1),
// item.kpi_type, item.uom,
// item.max_ach, item.typeKpi,
// item.formula_ytd, item.max_ach,
// item.actual_monthly, item.formula_ytd,
// item.target_monthly, item.actual_monthly,
// item.achivement_monthly, item.target_monthly,
// item.score, item.achivement_monthly,
// item.score_x_weight, item.score,
// item.order item.score_x_weight,
// ]) item.order
// } ])
// if (item.children !== null) { }
// if (item.children.length > 0) { if (item.children !== null) {
// item.children.map((items, indexs) => { if (item.children.length > 0) {
// handlePushChild(items) item.children.map((items, indexs) => {
// }) handlePushChild(items)
// } })
// } }
// } }
// res.map((item, index) => { }
// dbCATPQ.push([ res.map((item, index) => {
// item.type_report_id, dbCATPQ.push([
// item.id, item.typeItemReportId,
// item.parent, item.itemReportId,
// item.formula, item.parent,
// item.level, item.formula,
// item.description, item.level,
// item.weight, item.itemName,
// item.uom, item.weight == '' ? Number(0).toFixed(1) : Number(Number(item.weight) * 100).toFixed(1),
// item.kpi_type, item.uom,
// item.max_ach, item.typeKpi,
// item.formula_ytd, item.max_ach,
// item.actual_monthly, item.formula_ytd,
// item.target_monthly, item.actual_monthly,
// item.achivement_monthly, item.target_monthly,
// item.score, item.achivement_monthly,
// item.score_x_weight, item.score,
// item.order item.score_x_weight,
// ]) item.order
// if (item.children !== null) { ])
// if (item.children.length > 0) { if (item.children !== null) {
// item.children.map((items, indexs) => { if (item.children.length > 0) {
// handlePushChild(items) item.children.map((items, indexs) => {
// }) handlePushChild(items)
// } })
// } }
// }) }
// this.setState({ dataTable: dbCATPQ, previewTable: true, loading: false, previewDownload: true }) })
// console.log(this.state.dataTable) this.setState({ dataTable: dbCATPQ, previewTable: true, loading: false, previewDownload: true })
console.log(this.state.dataTable)
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
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")) {
...@@ -2978,6 +2979,8 @@ export default class SubHolding extends Component { ...@@ -2978,6 +2979,8 @@ export default class SubHolding extends Component {
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dbCATPA.findIndex((val) => val[1] === item.id) let indexIDzz = dbCATPA.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 weight = String(item.corporate_annual_target.weight).substr(0, String(item.corporate_annual_target.weight).length - 1)
dbCATPA.push([ dbCATPA.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -2985,7 +2988,7 @@ export default class SubHolding extends Component { ...@@ -2985,7 +2988,7 @@ export default class SubHolding extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.weight, item.corporate_annual_target.weight == "" ? Number(0).toFixed(1) : Number(weight).toFixed(1),
item.uom, item.uom,
item.kpi_type, item.kpi_type,
item.max_ach, item.max_ach,
...@@ -3014,7 +3017,7 @@ export default class SubHolding extends Component { ...@@ -3014,7 +3017,7 @@ export default class SubHolding extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.weight, item.weight == '' ? Number(0).toFixed(1) : Number(Number(item.weight) * 100).toFixed(1),
item.uom, item.uom,
item.kpi_type, item.kpi_type,
item.max_ach, item.max_ach,
...@@ -3818,6 +3821,32 @@ export default class SubHolding extends Component { ...@@ -3818,6 +3821,32 @@ export default class SubHolding extends Component {
a.download = 'Report Financial Ratio - Summary.xlsx'; a.download = 'Report Financial Ratio - Summary.xlsx';
a.click(); a.click();
} }
} else if (this.state.report.value === 10) {
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/performance_quarterly/export?submission_id=${this.state.submissionID === null ? "" : this.state.submissionID}&&report_id=4&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.revisionType}`
)
res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Report CAT Performance Quarterly.xlsx';
a.click();
}
} else if (this.state.report.value === 11) {
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/performance_appraisal/export?submission_id=${this.state.submissionID === null ? "" : this.state.submissionID}&&report_id=4&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.revisionType}`
)
res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Report CAT Performance Appraisal.xlsx';
a.click();
}
}else { }else {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false }) this.setState({ loading: false })
......
...@@ -35,6 +35,13 @@ const styleNotesEmpty = { ...@@ -35,6 +35,13 @@ const styleNotesEmpty = {
} }
export default class TableSubHolding extends Component { export default class TableSubHolding extends Component {
constructor(props) {
super(props)
this.state = {
perfomanceScoreColor: '#fff'
}
}
render() { render() {
let dataTable2 = this.props.dataTable let dataTable2 = this.props.dataTable
const handleChangeBS = (value, tableMeta, type) => { const handleChangeBS = (value, tableMeta, type) => {
...@@ -26522,6 +26529,31 @@ export default class TableSubHolding extends Component { ...@@ -26522,6 +26529,31 @@ export default class TableSubHolding extends Component {
const columnCatPQ = [ const columnCatPQ = [
{ {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "Key Performance Indicator", name: "Key Performance Indicator",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
...@@ -26610,7 +26642,6 @@ export default class TableSubHolding extends Component { ...@@ -26610,7 +26642,6 @@ export default class TableSubHolding extends Component {
), ),
setCellProps: () => ({ style2 }), setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
{ console.log(tableMeta); }
return ( return (
<div> <div>
<div className="grid grid-3x content-center"> <div className="grid grid-3x content-center">
...@@ -27210,12 +27241,26 @@ export default class TableSubHolding extends Component { ...@@ -27210,12 +27241,26 @@ export default class TableSubHolding extends Component {
setCellProps: () => ({ style2 }), setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 90, textAlign: 'center' }}> <div style={{ textAlign: 'center' }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null : null :
<div> <FormControlLabel
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : value}</span> style={{ margin: 0 }}
</div> value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={"%"}
value={Number(value).toFixed(1)}
disabled={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)}
decimalScale={1}
/>
}
/>
} }
</div> </div>
) )
...@@ -27481,6 +27526,42 @@ export default class TableSubHolding extends Component { ...@@ -27481,6 +27526,42 @@ export default class TableSubHolding extends Component {
/> />
</MuiThemeProvider> </MuiThemeProvider>
</div> </div>
{this.props.type === 11 ?
<div style={{ paddingBottom: 15 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5 }}>
<div>
<div style={{display: 'flex'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}></Typography>
<div style={{marginLeft: 10, overflowY: 'scroll', height: 25, marginTop: 10}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}></Typography>
</div>
</div>
</div>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>TOTAL SCORE</Typography>
</div>
<div style={{ border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>100</Typography>
</div>
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}></Typography>
</div>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography>
</div>
<div style={{ borderStyle: 'solid', backgroundColor: this.state.perfomanceScoreColor, borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>100</Typography>
</div>
</div>
</div>
</div>
: null
}
</div> </div>
) )
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment