Commit 3b1333ad authored by Rifka Kurnia's avatar Rifka Kurnia

Merge branch 'rifka' into 'master'

cf validasi merah

See merge request !929
parents b1920180 3dcaf866
......@@ -52,8 +52,41 @@ export default class CashFlowMR extends Component {
}
componentDidMount() {
this.getItemHierarki()
// this.getSettingControl()
// this.getItemHierarki()
this.getSettingControl()
}
getSettingControl() {
let body = {
group: 'THRESHOLD_CONTROL',
company_id: this.props.company.company_id,
type: 'CASH_FLOW'
}
api.create().getAllSettingByType(body).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({
minValue: response.data.data[0] ? response.data.data[0].min_value : null,
maxValue: response.data.data[0] ? response.data.data[0].max_value : null,
}, () => {
this.getItemHierarki()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: '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() {
......@@ -180,7 +213,7 @@ export default class CashFlowMR extends Component {
let tst = '@' + String(item).replace('[M-1]', '[M1]')
// console.log(dataTable2[tableMeta.rowIndex]);
// console.log(tableMeta);
console.log(tst);
// console.log(tst);
let indexID = dataTable2[tableMeta.rowIndex][6].formula.findIndex((val) => val.item_formula == tst)
// console.log(indexID);
......@@ -450,7 +483,7 @@ export default class CashFlowMR extends Component {
// console.log(tableMeta);
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ||tableMeta.rowData[0] === 7 ?
{tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -460,7 +493,55 @@ export default class CashFlowMR extends Component {
disabled={true}
value={Number(handleValueFormula(tableMeta, 6)).toFixed(1)}
/>
</span> : null}
</span>
:
tableMeta.rowData[0] === 7 ?
// <span style={{ fontSize: 12, textAlign: 'right' }}>
// <NumberFormat
// thousandSeparator={true}
// style={{ color: Number(handleValueFormula(tableMeta, 6)).toFixed(1) > Number(this.state.minValue) || Number(handleValueFormula(tableMeta, 6)).toFixed(1) < Number(this.state.maxValue) ? 'red' : 'black' , fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(tableMeta, 6)).toFixed(1)}
// />
// </span>
(Number(handleValueFormula(tableMeta, 6)).toFixed(1) > Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 6)).toFixed(1) < Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 6)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? null : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 6)).toFixed(1)}
/>
</LightTooltip>
: 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