Commit 1955d960 authored by a.bairuha's avatar a.bairuha

update report items riri

parent 6921ae0d
...@@ -75,8 +75,11 @@ export default class ReportItems extends Component { ...@@ -75,8 +75,11 @@ export default class ReportItems extends Component {
formula: item[8], formula: item[8],
condition_it_should_be: item[9] === undefined ? null : item[9], condition_it_should_be: item[9] === undefined ? null : item[9],
condition_if_wrong: item[10] === undefined ? null : item[10], condition_if_wrong: item[10] === undefined ? null : item[10],
start_date: item[11], kpi_type: item[11] === undefined ? "" : item[11],
end_date: item[12], max_ach: item[12] === undefined ? "" : item[12],
formula_ytd: item[13] === undefined ? "" : item[13],
start_date: item[14],
end_date: item[15],
}) })
} }
}) })
...@@ -110,6 +113,9 @@ export default class ReportItems extends Component { ...@@ -110,6 +113,9 @@ export default class ReportItems extends Component {
item.formula, item.formula,
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong, item.condition_if_wrong,
item.kpi_type,
item.max_ach,
item.formula_ytd,
item.start_date, item.start_date,
item.end_date, item.end_date,
item.error item.error
...@@ -121,16 +127,16 @@ export default class ReportItems extends Component { ...@@ -121,16 +127,16 @@ export default class ReportItems extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[13] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[13].findIndex((val) => val.field.includes('report')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('report'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[13] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[13][check].message} data-for="reportname"> <a data-tip={tableMeta.rowData[16][check].message} data-for="reportname">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
...@@ -146,16 +152,16 @@ export default class ReportItems extends Component { ...@@ -146,16 +152,16 @@ export default class ReportItems extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[13] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[13].findIndex((val) => val.field.includes('company')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('company'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[13] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[13][check].message} data-for="companyname"> <a data-tip={tableMeta.rowData[16][check].message} data-for="companyname">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
...@@ -171,16 +177,16 @@ export default class ReportItems extends Component { ...@@ -171,16 +177,16 @@ export default class ReportItems extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[13] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[13].findIndex((val) => val.field.includes('orders')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('orders'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[13] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[13][check].message} data-for="order"> <a data-tip={tableMeta.rowData[16][check].message} data-for="order">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
...@@ -196,16 +202,16 @@ export default class ReportItems extends Component { ...@@ -196,16 +202,16 @@ export default class ReportItems extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[13] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[13].findIndex((val) => val.field.includes('description')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('description'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[13] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[13][check].message} data-for="desc"> <a data-tip={tableMeta.rowData[16][check].message} data-for="desc">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
...@@ -221,16 +227,16 @@ export default class ReportItems extends Component { ...@@ -221,16 +227,16 @@ export default class ReportItems extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[13] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[13].findIndex((val) => val.field.includes('parent')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('parent'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[13] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[13][check].message} data-for="parents"> <a data-tip={tableMeta.rowData[16][check].message} data-for="parents">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
...@@ -246,16 +252,16 @@ export default class ReportItems extends Component { ...@@ -246,16 +252,16 @@ export default class ReportItems extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[13] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[13].findIndex((val) => val.field.includes('uom')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('uom'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[13] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[13][check].message} data-for="uoms"> <a data-tip={tableMeta.rowData[16][check].message} data-for="uoms">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
...@@ -271,16 +277,16 @@ export default class ReportItems extends Component { ...@@ -271,16 +277,16 @@ export default class ReportItems extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[13] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[13].findIndex((val) => val.field.includes('weight')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('weight'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[13] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[13][check].message} data-for="weights"> <a data-tip={tableMeta.rowData[16][check].message} data-for="weights">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
...@@ -296,16 +302,16 @@ export default class ReportItems extends Component { ...@@ -296,16 +302,16 @@ export default class ReportItems extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[13] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[13].findIndex((val) => val.field.includes('type_report')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('type_report'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[13] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[13][check].message} data-for="datatype"> <a data-tip={tableMeta.rowData[16][check].message} data-for="datatype">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
...@@ -321,16 +327,16 @@ export default class ReportItems extends Component { ...@@ -321,16 +327,16 @@ export default class ReportItems extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[13] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[13].findIndex((val) => val.field.includes('formula')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('formula'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[13] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[13][check].message} data-for="formulas"> <a data-tip={tableMeta.rowData[16][check].message} data-for="formulas">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
...@@ -346,16 +352,16 @@ export default class ReportItems extends Component { ...@@ -346,16 +352,16 @@ export default class ReportItems extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[13] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[13].findIndex((val) => val.field.includes('condition_it_should_be')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('condition_it_should_be'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[13] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[13][check].message} data-for="values"> <a data-tip={tableMeta.rowData[16][check].message} data-for="values">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
...@@ -371,16 +377,16 @@ export default class ReportItems extends Component { ...@@ -371,16 +377,16 @@ export default class ReportItems extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[13] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[13].findIndex((val) => val.field.includes('condition_if_wrong')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('condition_if_wrong'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[13] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[13][check].message} data-for="conditions"> <a data-tip={tableMeta.rowData[16][check].message} data-for="conditions">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
...@@ -391,21 +397,96 @@ export default class ReportItems extends Component { ...@@ -391,21 +397,96 @@ export default class ReportItems extends Component {
} }
} }
}, },
{
name: "KPI Type",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('kpi_type'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="kpi_type">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
}
<ReactTooltip border={true} id="kpi_type" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Max Achievement",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('max_ach'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="max_ach">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
}
<ReactTooltip border={true} id="max_ach" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Formula YTD",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('formula_ytd'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="formula_ytd">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
}
<ReactTooltip border={true} id="formula_ytd" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{ {
name: "Valid From", name: "Valid From",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[13] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[13].findIndex((val) => val.field.includes('start_date')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('start_date'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[13] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[13][check].message} data-for="startdate"> <a data-tip={tableMeta.rowData[16][check].message} data-for="startdate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
...@@ -421,16 +502,16 @@ export default class ReportItems extends Component { ...@@ -421,16 +502,16 @@ export default class ReportItems extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[13] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[13].findIndex((val) => val.field.includes('end_date')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('end_date'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[13] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[13][check].message} data-for="enddate"> <a data-tip={tableMeta.rowData[16][check].message} data-for="enddate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
...@@ -920,7 +1001,7 @@ export default class ReportItems extends Component { ...@@ -920,7 +1001,7 @@ export default class ReportItems extends Component {
<img src={Images.download} /> <img src={Images.download} />
</button> </button>
</a> </a>
<ReactTooltip border={true} id="visualisasi" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
<a data-tip={'Visualization'} data-for="visualisasi"> <a data-tip={'Visualization'} data-for="visualisasi">
<button <button
style={{ style={{
...@@ -934,7 +1015,7 @@ export default class ReportItems extends Component { ...@@ -934,7 +1015,7 @@ export default class ReportItems extends Component {
<img src={Images.visualisasi} /> <img src={Images.visualisasi} />
</button> </button>
</a> </a>
<ReactTooltip border={true} id="tambah" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="visualisasi" place="bottom" type="light" effect="solid" />
{this.state.buttonCreate && ( {this.state.buttonCreate && (
<a data-tip={'Add New'} data-for="tambah"> <a data-tip={'Add New'} data-for="tambah">
<button <button
......
...@@ -60,8 +60,13 @@ export default class CreateReportItems extends Component { ...@@ -60,8 +60,13 @@ export default class CreateReportItems extends Component {
options: ['WARNING', 'STOPPER'], options: ['WARNING', 'STOPPER'],
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
messageAlert: '' messageAlert: '',
kpiType: ['HIG', 'HIB'],
maxAch: ['50%', '100%', 'Unlimited'],
formulaYtd: ['SUM', 'AVG', 'MIN', 'MAX'],
kpiTypeValue: null,
maxAchValue: null,
formulaYTDValue: null
} }
} }
...@@ -194,6 +199,9 @@ export default class CreateReportItems extends Component { ...@@ -194,6 +199,9 @@ export default class CreateReportItems extends Component {
"weight": this.state.weight, "weight": this.state.weight,
"condition_if_wrong": this.state.condition, "condition_if_wrong": this.state.condition,
"condition_it_should_be": this.state.realVal, "condition_it_should_be": this.state.realVal,
"type_kpi": this.state.kpiTypeValue,
"max_ach": this.state.maxAchValue,
"formula_ytd": this.state.formulaYTDValue,
"start_date": this.state.startDate, "start_date": this.state.startDate,
"end_date": this.state.endDate "end_date": this.state.endDate
} }
...@@ -442,7 +450,10 @@ export default class CreateReportItems extends Component { ...@@ -442,7 +450,10 @@ export default class CreateReportItems extends Component {
<Autocomplete <Autocomplete
{...this.state.listReportType} {...this.state.listReportType}
id="reportType" id="reportType"
onChange={(event, newInputValue) => this.setState({ reportType: newInputValue }, ()=> this.clearMessage())} onChange={(event, newInputValue) => this.setState({ reportType: newInputValue }, () => {
newInputValue == null || (newInputValue.report_name !== 'CAT') ? this.setState({ kpiTypeValue: null, maxAchValue: null, formulaYTDValue: null }, () => this.clearMessage())
: this.clearMessage();
})}
debug debug
renderInput={(params) => renderInput={(params) =>
<TextField {...params} <TextField {...params}
...@@ -778,6 +789,90 @@ export default class CreateReportItems extends Component { ...@@ -778,6 +789,90 @@ export default class CreateReportItems extends Component {
</div> </div>
</div> </div>
{this.state.reportType !== null && (
this.state.reportType.report_name === 'CAT' && (
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
value={this.state.kpiTypeValue}
id="kpiType"
onChange={(event, newValue) => {
this.setState({ kpiTypeValue: newValue }, () => this.clearMessage());
}}
options={this.state.kpiType}
renderInput={(params) =>
<TextField {...params}
label="KPI Type"
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
/>
</div>
</div>
<div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
value={this.state.maxAchValue}
id="maxAch"
onChange={(event, newValue) => {
this.setState({ maxAchValue: newValue }, () => this.clearMessage());
}}
options={this.state.maxAch}
renderInput={(params) =>
<TextField {...params}
label="Max Achievement"
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
/>
</div>
</div>
</div>
))}
{this.state.reportType !== null && (
this.state.reportType.report_name === 'CAT' && (
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
value={this.state.formulaYTDValue}
id="formulaYTD"
onChange={(event, newValue) => {
this.setState({ formulaYTDValue: newValue }, () => this.clearMessage());
}}
options={this.state.formulaYtd}
renderInput={(params) =>
<TextField {...params}
label="Formula YTD"
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
/>
</div>
</div>
</div>
))}
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1"> <div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
......
...@@ -62,7 +62,13 @@ export default class EditReportItems extends Component { ...@@ -62,7 +62,13 @@ export default class EditReportItems extends Component {
options: ['WARNING', 'STOPPER'], options: ['WARNING', 'STOPPER'],
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
messageAlert: '' messageAlert: '',
kpiType: ['HIG', 'HIB'],
maxAch: ['50%', '100%', 'Unlimited'],
formulaYtd: ['SUM', 'AVG', 'MIN', 'MAX'],
kpiTypeValue: null,
maxAchValue: null,
formulaYTDValue: null
} }
} }
...@@ -169,6 +175,9 @@ export default class EditReportItems extends Component { ...@@ -169,6 +175,9 @@ export default class EditReportItems extends Component {
"weight": this.state.tempData.weight == null ? "" : this.state.tempData.weight, "weight": this.state.tempData.weight == null ? "" : this.state.tempData.weight,
"condition_if_wrong": this.state.tempData.condition_if_wrong, "condition_if_wrong": this.state.tempData.condition_if_wrong,
"condition_it_should_be": this.state.tempData.condition_it_should_be, "condition_it_should_be": this.state.tempData.condition_it_should_be,
"type_kpi": this.state.tempData.kpi_type,
"max_ach": this.state.tempData.max_ach,
"formula_ytd": this.state.tempData.formula_ytd,
"start_date": this.state.tempData.start_date, "start_date": this.state.tempData.start_date,
"end_date": this.state.tempData.end_date "end_date": this.state.tempData.end_date
} }
...@@ -456,7 +465,10 @@ export default class EditReportItems extends Component { ...@@ -456,7 +465,10 @@ export default class EditReportItems extends Component {
<Autocomplete <Autocomplete
{...this.state.listReportType} {...this.state.listReportType}
id="reportType" id="reportType"
onChange={(event, newInputValue) => this.setState({ reportType: newInputValue }, () => this.getParent(), this.clearMessage() )} onChange={(event, newInputValue) => this.setState({ reportType: newInputValue }, () =>
newInputValue == null || (newInputValue.report_name !== 'CAT') ? this.setState({ tempData: { ...this.state.tempData, kpi_type: null, max_ach: null, formula_ytd: null } }, () => this.getParent(), this.clearMessage())
: this.getParent(), this.clearMessage()
)}
debug debug
renderInput={(params) => renderInput={(params) =>
<TextField {...params} <TextField {...params}
...@@ -760,6 +772,91 @@ export default class EditReportItems extends Component { ...@@ -760,6 +772,91 @@ export default class EditReportItems extends Component {
</div> </div>
</div> </div>
</div> </div>
{this.state.reportType !== null && (
this.state.reportType.report_name === 'CAT' && (
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
value={this.state.tempData === null ? "" : this.state.tempData.kpi_type}
id="kpiType"
onChange={(event, newValue) => {
this.setState({ tempData: { ...this.state.tempData, kpi_type: newValue } }, () => this.clearMessage());
}}
options={this.state.kpiType}
renderInput={(params) =>
<TextField {...params}
label="KPI Type"
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
/>
</div>
</div>
<div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
value={this.state.tempData === null ? "" : this.state.tempData.max_ach}
id="maxAch"
onChange={(event, newValue) => {
this.setState({ tempData: { ...this.state.tempData, max_ach: newValue } }, () => this.clearMessage());
}}
options={this.state.maxAch}
renderInput={(params) =>
<TextField {...params}
label="Max Achievement"
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
/>
</div>
</div>
</div>
))}
{this.state.reportType !== null && (
this.state.reportType.report_name === 'CAT' && (
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
value={this.state.tempData === null ? "" : this.state.tempData.formula_ytd}
id="kpiType"
onChange={(event, newValue) => {
this.setState({ tempData: { ...this.state.tempData, formula_ytd: newValue } }, () => this.clearMessage());
}}
options={this.state.formulaYtd}
renderInput={(params) =>
<TextField {...params}
label="Formula YTD"
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
/>
</div>
</div>
</div>
))}
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1"> <div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
......
...@@ -94,7 +94,7 @@ export default class Profile extends Component { ...@@ -94,7 +94,7 @@ export default class Profile extends Component {
} else if (!this.isRegex(this.state.password)) { } else if (!this.isRegex(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'Password Must be a Combination of Characters, Letters and Numbers.' }) this.setState({ errorPassword: true, msgPassword: 'Password Must be a Combination of Characters, Letters and Numbers.' })
} else if (this.state.confirmPassword.trim() == "") { } else if (this.state.confirmPassword.trim() == "") {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation Cannot be Empty.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Repeat Password Cannot be Empty.' })
} else if (this.state.password !== this.state.confirmPassword) { } else if (this.state.password !== this.state.confirmPassword) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Does Not Match.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Does Not Match.' })
} else { } else {
......
...@@ -76,7 +76,7 @@ class SetPassword extends Component { ...@@ -76,7 +76,7 @@ class SetPassword extends Component {
} else if (!this.isRegex(this.state.password)) { } else if (!this.isRegex(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'Invalid password. Must using combination of characters, letters and numbers.' }) this.setState({ errorPassword: true, msgPassword: 'Invalid password. Must using combination of characters, letters and numbers.' })
} else if (this.state.confirmPassword.trim() == "") { } else if (this.state.confirmPassword.trim() == "") {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation Cannot be Empty.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Repeat Password Cannot be Empty.' })
} else if (this.state.password !== this.state.confirmPassword) { } else if (this.state.password !== this.state.confirmPassword) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'The password and password confirmation do not match.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'The password and password confirmation do not match.' })
} else { } else {
......
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