Commit c4e3afee authored by Riri Novita's avatar Riri Novita

Merge branch 'riri' into 'master'

pl issue

See merge request !789
parents 148c59cf e744d5d9
...@@ -76,7 +76,8 @@ export default class ProfitLossMR extends Component { ...@@ -76,7 +76,8 @@ export default class ProfitLossMR extends Component {
// valueThreshold: 0, // valueThreshold: 0,
minValue: 0, minValue: 0,
maxValue: 0, maxValue: 0,
updateBy: '-' updateBy: '-',
bebeas: false
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -488,6 +489,30 @@ export default class ProfitLossMR extends Component { ...@@ -488,6 +489,30 @@ export default class ProfitLossMR extends Component {
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleCalculate = () => {
let error = false
let messageError = ""
dataTable2.map((item, index) => {
if (item[19] == "" && Number(item[14]) <= this.state.minValue || Number(item[14]) >= this.state.maxValue) {
error = true
messageError = "MTD Explanation vs Prev. Month is Reqiured"
}
if (item[20] == "" && Number(item[16]) <= this.state.minValue || Number(item[16]) >= this.state.maxValue) {
error = true
messageError = "MTD Explanation vs MB is Reqiured"
}
if (item[21] == "" && Number(item[18]) <= this.state.minValue || Number(item[18]) >= this.state.maxValue) {
error = true
messageError = "MTD Explanation vs RB is Reqiured"
}
})
if (error === true) {
this.setState({ alert: true, messageAlert: messageError, tipeAlert: 'error', loading: false, bebas: true })
}
}
const handleText = (value, tableMeta, type) => { const handleText = (value, tableMeta, type) => {
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = value let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = value
// console.log(dataTable2[tableMeta.rowIndex]); // console.log(dataTable2[tableMeta.rowIndex]);
...@@ -1503,21 +1528,39 @@ export default class ProfitLossMR extends Component { ...@@ -1503,21 +1528,39 @@ export default class ProfitLossMR extends Component {
style={{ margin: 0 }} style={{ margin: 0 }}
// value={value} // value={value}
control={ control={
<Input tableMeta.rowData[19] == "" && Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ?
disableUnderline={true} <LightTooltip title={"MTD Explanation vs Prev. Month is Reqiured"} arrow>
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} <Input
type="text" disableUnderline={true}
placeholder="" style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
disabled={Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ? false : true} type="text"
defaultValue={tableMeta.rowData[19]} placeholder=""
inputProps={{style: { // disabled={Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ? false : true}
color: "#5198ea", defaultValue={tableMeta.rowData[19]}
textAlign: 'right' inputProps={{style: {
}}} color: "#5198ea",
onBlur={(event) => { textAlign: 'right'
handleText(event.target.value, tableMeta, 0) }}}
}} onBlur={(event) => {
/> handleText(event.target.value, tableMeta, 0)
}}
/>
</LightTooltip> :
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ? false : true}
defaultValue={tableMeta.rowData[19]}
inputProps={{style: {
color: "#5198ea",
textAlign: 'right'
}}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 0)
}}
/>
} }
/>} />}
</div> </div>
...@@ -1531,21 +1574,39 @@ export default class ProfitLossMR extends Component { ...@@ -1531,21 +1574,39 @@ export default class ProfitLossMR extends Component {
style={{ margin: 0 }} style={{ margin: 0 }}
// value={value} // value={value}
control={ control={
<Input tableMeta.rowData[20] == "" && Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ?
disableUnderline={true} <LightTooltip title={"MTD Explanation vs MB is Reqiured"} arrow>
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} <Input
type="text" disableUnderline={true}
placeholder="" style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
disabled={Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ? false : true} type="text"
defaultValue={tableMeta.rowData[20]} placeholder=""
inputProps={{style: { // disabled={Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ? false : true}
color: "#5198ea", defaultValue={tableMeta.rowData[20]}
textAlign: 'right' inputProps={{style: {
}}} color: "#5198ea",
onBlur={(event) => { textAlign: 'right'
handleText(event.target.value, tableMeta, 1) }}}
}} onBlur={(event) => {
/> handleText(event.target.value, tableMeta, 1)
}}
/>
</LightTooltip> :
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ? false : true}
defaultValue={tableMeta.rowData[20]}
inputProps={{style: {
color: "#5198ea",
textAlign: 'right'
}}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 1)
}}
/>
} }
/>} />}
</div> </div>
...@@ -1559,21 +1620,39 @@ export default class ProfitLossMR extends Component { ...@@ -1559,21 +1620,39 @@ export default class ProfitLossMR extends Component {
style={{ margin: 0 }} style={{ margin: 0 }}
// value={value} // value={value}
control={ control={
<Input tableMeta.rowData[21] == "" && Number(tableMeta.rowData[18]) <= this.state.minValue || Number(tableMeta.rowData[18]) >= this.state.maxValue ?
disableUnderline={true} <LightTooltip title={"MTD Explanation vs Prev. Month is Reqiured"} arrow>
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} <Input
type="text" disableUnderline={true}
placeholder="" style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
disabled={Number(tableMeta.rowData[18]) <= this.state.minValue || Number(tableMeta.rowData[18]) >= this.state.maxValue ? false : true} type="text"
defaultValue={tableMeta.rowData[21]} placeholder=""
inputProps={{style: { // disabled={Number(tableMeta.rowData[18]) <= this.state.minValue || Number(tableMeta.rowData[18]) >= this.state.maxValue ? false : true}
color: "#5198ea", defaultValue={tableMeta.rowData[21]}
textAlign: 'right' inputProps={{style: {
}}} color: "#5198ea",
onBlur={(event) => { textAlign: 'right'
handleText(event.target.value, tableMeta, 0) }}}
}} onBlur={(event) => {
/> handleText(event.target.value, tableMeta, 0)
}}
/>
</LightTooltip> :
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[18]) <= this.state.minValue || Number(tableMeta.rowData[18]) >= this.state.maxValue ? false : true}
defaultValue={tableMeta.rowData[21]}
inputProps={{style: {
color: "#5198ea",
textAlign: 'right'
}}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 0)
}}
/>
} }
/>} />}
</div> </div>
...@@ -1768,8 +1847,10 @@ export default class ProfitLossMR extends Component { ...@@ -1768,8 +1847,10 @@ export default class ProfitLossMR extends Component {
marginRight: 20 marginRight: 20
}} }}
onClick={() => { onClick={() => {
this.setState({ loading: true }, () => { this.setState({ loading: true, bebas: false }, () => {
setTimeout(() => { setTimeout(() => {
handleCalculate()
this.setState({ loading: false }) this.setState({ loading: false })
// this.handleValidate() // this.handleValidate()
}, 100); }, 100);
...@@ -1785,14 +1866,15 @@ export default class ProfitLossMR extends Component { ...@@ -1785,14 +1866,15 @@ export default class ProfitLossMR extends Component {
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default', cursor: this.state.bebas ? 'default' : this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => onClick={() =>
this.state.saveDraft === true ? this.state.saveDraft === true ?
null : null :
this.state.bebas ? null :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
this.backToMonthlyReport('draft') this.backToMonthlyReport('draft')
...@@ -1807,6 +1889,7 @@ export default class ProfitLossMR extends Component { ...@@ -1807,6 +1889,7 @@ export default class ProfitLossMR extends Component {
type="button" type="button"
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => onClick={() =>
this.state.bebas ? null :
this.state.buttonError ? this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
: :
...@@ -1816,7 +1899,7 @@ export default class ProfitLossMR extends Component { ...@@ -1816,7 +1899,7 @@ export default class ProfitLossMR extends Component {
})} })}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: this.state.buttonError === true ? 'default' : this.state.bebas ? 'default' : 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
......
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