Commit 201a68ad authored by faisalhamdi's avatar faisalhamdi

Laporan CAT

parent fc56110e
......@@ -2890,68 +2890,69 @@ export default class SubHolding extends Component {
if (response.data) {
if (response.data.status === 'success') {
let res = response.data.data
console.log(res);
// const handlePushChild = (item) => {
// let indexIDzz = dbCATPQ.findIndex((val) => val[1] === item.id)
// if (indexIDzz === -1) {
// dbCATPQ.push([
// item.type_report_id,
// item.id,
// item.parent,
// item.formula,
// item.level,
// item.description,
// item.weight,
// item.uom,
// item.kpi_type,
// item.max_ach,
// item.formula_ytd,
// item.actual_monthly,
// item.target_monthly,
// item.achivement_monthly,
// item.score,
// item.score_x_weight,
// item.order
// ])
// }
// if (item.children !== null) {
// if (item.children.length > 0) {
// item.children.map((items, indexs) => {
// handlePushChild(items)
// })
// }
// }
// }
// res.map((item, index) => {
// dbCATPQ.push([
// item.type_report_id,
// item.id,
// item.parent,
// item.formula,
// item.level,
// item.description,
// item.weight,
// item.uom,
// item.kpi_type,
// item.max_ach,
// item.formula_ytd,
// item.actual_monthly,
// item.target_monthly,
// item.achivement_monthly,
// item.score,
// item.score_x_weight,
// item.order
// ])
// if (item.children !== null) {
// if (item.children.length > 0) {
// item.children.map((items, indexs) => {
// handlePushChild(items)
// })
// }
// }
// })
// this.setState({ dataTable: dbCATPQ, previewTable: true, loading: false, previewDownload: true })
// console.log(this.state.dataTable)
const handlePushChild = (item) => {
let indexIDzz = dbCATPQ.findIndex((val) => val[1] === item.id)
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)
dbCATPQ.push([
item.typeItemReportId,
item.itemReportId,
item.parent,
item.formula,
item.level,
item.itemName,
item.corporate_annual_target.weight == "" ? Number(0).toFixed(1) : Number(weight).toFixed(1),
item.uom,
item.typeKpi,
item.max_ach,
item.formula_ytd,
item.actual_monthly,
item.target_monthly,
item.achivement_monthly,
item.score,
item.score_x_weight,
item.order
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
res.map((item, index) => {
dbCATPQ.push([
item.typeItemReportId,
item.itemReportId,
item.parent,
item.formula,
item.level,
item.itemName,
item.weight == '' ? Number(0).toFixed(1) : Number(Number(item.weight) * 100).toFixed(1),
item.uom,
item.typeKpi,
item.max_ach,
item.formula_ytd,
item.actual_monthly,
item.target_monthly,
item.achivement_monthly,
item.score,
item.score_x_weight,
item.order
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
this.setState({ dataTable: dbCATPQ, previewTable: true, loading: false, previewDownload: true })
console.log(this.state.dataTable)
} else {
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")) {
......@@ -2977,7 +2978,9 @@ export default class SubHolding extends Component {
let res = response.data.data
const handlePushChild = (item) => {
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([
item.type_report_id,
item.id,
......@@ -2985,7 +2988,7 @@ export default class SubHolding extends Component {
item.formula,
item.level,
item.description,
item.weight,
item.corporate_annual_target.weight == "" ? Number(0).toFixed(1) : Number(weight).toFixed(1),
item.uom,
item.kpi_type,
item.max_ach,
......@@ -3009,22 +3012,22 @@ export default class SubHolding extends Component {
res.map((item, index) => {
dbCATPA.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.weight,
item.uom,
item.kpi_type,
item.max_ach,
item.formula_ytd,
item.corporate_annual_target.actual_ytd,
item.corporate_annual_target.target_ytd,
item.corporate_annual_target.achivement_ytd,
item.corporate_annual_target.score,
item.corporate_annual_target.score_x_weight,
item.order
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.weight == '' ? Number(0).toFixed(1) : Number(Number(item.weight) * 100).toFixed(1),
item.uom,
item.kpi_type,
item.max_ach,
item.formula_ytd,
item.corporate_annual_target.actual_ytd,
item.corporate_annual_target.target_ytd,
item.corporate_annual_target.achivement_ytd,
item.corporate_annual_target.score,
item.corporate_annual_target.score_x_weight,
item.order
])
if (item.children !== null) {
if (item.children.length > 0) {
......@@ -3818,6 +3821,32 @@ export default class SubHolding extends Component {
a.download = 'Report Financial Ratio - Summary.xlsx';
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 {
setTimeout(() => {
this.setState({ loading: false })
......
......@@ -35,6 +35,13 @@ const styleNotesEmpty = {
}
export default class TableSubHolding extends Component {
constructor(props) {
super(props)
this.state = {
perfomanceScoreColor: '#fff'
}
}
render() {
let dataTable2 = this.props.dataTable
const handleChangeBS = (value, tableMeta, type) => {
......@@ -26522,6 +26529,31 @@ export default class TableSubHolding extends Component {
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",
options: {
customHeadRender: (columnMeta) => (
......@@ -26610,7 +26642,6 @@ export default class TableSubHolding extends Component {
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
{ console.log(tableMeta); }
return (
<div>
<div className="grid grid-3x content-center">
......@@ -27210,12 +27241,26 @@ export default class TableSubHolding extends Component {
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ width: 90, textAlign: 'center' }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
<div style={{ textAlign: 'center' }}>
{tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
<div>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : value}</span>
</div>
<FormControlLabel
style={{ margin: 0 }}
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>
)
......@@ -27481,6 +27526,42 @@ export default class TableSubHolding extends Component {
/>
</MuiThemeProvider>
</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>
)
}
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