Commit 870242d0 authored by Riri Novita's avatar Riri Novita

minmax value

parent c86e8477
...@@ -57,7 +57,9 @@ export default class ProfitLossMR extends Component { ...@@ -57,7 +57,9 @@ export default class ProfitLossMR extends Component {
dataTable: [], dataTable: [],
loading: true, loading: true,
visiblePLMR: true, visiblePLMR: true,
valueThreshold: 0 // valueThreshold: 0,
minValue: 0,
maxValue: 0
} }
} }
...@@ -78,9 +80,14 @@ export default class ProfitLossMR extends Component { ...@@ -78,9 +80,14 @@ export default class ProfitLossMR extends Component {
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ this.setState({
valueThreshold: response.data.data[0] ? response.data.data[0].value : null // valueThreshold: response.data.data[0] ? response.data.data[0].value : null,
minValue: response.data.data[0] ? response.data.data[0].min_value : -10,
maxValue: response.data.data[0] ? response.data.data[0].max_value : 10,
}, () => { }, () => {
this.getItemHierarki() this.getItemHierarki()
console.log(response.data.data[0]);
console.log(response.data.data[0].max_value);
}) })
} 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 }, () => {
...@@ -391,8 +398,8 @@ export default class ProfitLossMR extends Component { ...@@ -391,8 +398,8 @@ export default class ProfitLossMR extends Component {
periode: this.props.periode, periode: this.props.periode,
report_id: this.props.report_id, report_id: this.props.report_id,
months: this.props.month.month_id, months: this.props.month.month_id,
profit_loss: data, status: type,
status: type profit_loss: data
} }
// console.log(data); // console.log(data);
api.create('UPLOAD').uploadMonthlyReportPL(body).then(response => { api.create('UPLOAD').uploadMonthlyReportPL(body).then(response => {
...@@ -1179,6 +1186,23 @@ export default class ProfitLossMR extends Component { ...@@ -1179,6 +1186,23 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
Number(tableMeta.rowData[15]) <= this.state.minValue || Number(tableMeta.rowData[15]) >= this.state.maxValue ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: 'red', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleVariancePercent(tableMeta, 1, 1)).toFixed(1)}
/>
}
/>
</div> :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1232,6 +1256,23 @@ export default class ProfitLossMR extends Component { ...@@ -1232,6 +1256,23 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: 'red', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleVariancePercent(tableMeta, 2, 3)).toFixed(1)}
/>
}
/>
</div> :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1285,6 +1326,23 @@ export default class ProfitLossMR extends Component { ...@@ -1285,6 +1326,23 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
Number(tableMeta.rowData[17]) <= this.state.minValue || Number(tableMeta.rowData[17]) >= this.state.maxValue ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: 'red', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleVariancePercent(tableMeta, 3, 5)).toFixed(1)}
/>
}
/>
</div> :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1380,7 +1438,7 @@ export default class ProfitLossMR extends Component { ...@@ -1380,7 +1438,7 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
Number(tableMeta.rowData[19]).toFixed(1) > Number(this.state.valueThreshold).toFixed(1) ? Number(tableMeta.rowData[19]) <= this.state.minValue || Number(tableMeta.rowData[19]) >= this.state.maxValue ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1435,7 +1493,7 @@ export default class ProfitLossMR extends Component { ...@@ -1435,7 +1493,7 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
Number(tableMeta.rowData[20]).toFixed(1) > Number(this.state.valueThreshold).toFixed(1) ? Number(tableMeta.rowData[20]) <= this.state.minValue || Number(tableMeta.rowData[20]) >= this.state.maxValue ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1490,7 +1548,7 @@ export default class ProfitLossMR extends Component { ...@@ -1490,7 +1548,7 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
Number(tableMeta.rowData[21]).toFixed(1) > Number(this.state.valueThreshold).toFixed(1) ? Number(tableMeta.rowData[21]) <= this.state.minValue || Number(tableMeta.rowData[21]) >= this.state.maxValue ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
......
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