Commit 415a741c authored by d.arizona's avatar d.arizona

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into didam

parents b082fe19 3b1333ad
...@@ -52,8 +52,41 @@ export default class CashFlowMR extends Component { ...@@ -52,8 +52,41 @@ export default class CashFlowMR extends Component {
} }
componentDidMount() { componentDidMount() {
// 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() this.getItemHierarki()
// this.getSettingControl() })
} 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() { getItemHierarki() {
...@@ -180,7 +213,7 @@ export default class CashFlowMR extends Component { ...@@ -180,7 +213,7 @@ export default class CashFlowMR extends Component {
let tst = '@' + String(item).replace('[M-1]', '[M1]') let tst = '@' + String(item).replace('[M-1]', '[M1]')
// console.log(dataTable2[tableMeta.rowIndex]); // console.log(dataTable2[tableMeta.rowIndex]);
// console.log(tableMeta); // console.log(tableMeta);
console.log(tst); // console.log(tst);
let indexID = dataTable2[tableMeta.rowIndex][6].formula.findIndex((val) => val.item_formula == tst) let indexID = dataTable2[tableMeta.rowIndex][6].formula.findIndex((val) => val.item_formula == tst)
// console.log(indexID); // console.log(indexID);
...@@ -450,7 +483,7 @@ export default class CashFlowMR extends Component { ...@@ -450,7 +483,7 @@ export default class CashFlowMR extends Component {
// console.log(tableMeta); // console.log(tableMeta);
return ( return (
<div style={{ textAlign: 'right' }}> <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' }}> <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -460,7 +493,55 @@ export default class CashFlowMR extends Component { ...@@ -460,7 +493,55 @@ export default class CashFlowMR extends Component {
disabled={true} disabled={true}
value={Number(handleValueFormula(tableMeta, 6)).toFixed(1)} 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> </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