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 {
// valueThreshold: 0,
minValue: 0,
maxValue: 0,
updateBy: '-'
updateBy: '-',
bebeas: false
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -488,6 +489,30 @@ export default class ProfitLossMR extends Component {
render() {
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) => {
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = value
// console.log(dataTable2[tableMeta.rowIndex]);
......@@ -1503,21 +1528,39 @@ export default class ProfitLossMR extends Component {
style={{ margin: 0 }}
// value={value}
control={
<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)
}}
/>
tableMeta.rowData[19] == "" && Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ?
<LightTooltip title={"MTD Explanation vs Prev. Month is Reqiured"} arrow>
<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)
}}
/>
</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>
......@@ -1531,21 +1574,39 @@ export default class ProfitLossMR extends Component {
style={{ margin: 0 }}
// value={value}
control={
<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)
}}
/>
tableMeta.rowData[20] == "" && Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ?
<LightTooltip title={"MTD Explanation vs MB is Reqiured"} arrow>
<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)
}}
/>
</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>
......@@ -1559,21 +1620,39 @@ export default class ProfitLossMR extends Component {
style={{ margin: 0 }}
// value={value}
control={
<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)
}}
/>
tableMeta.rowData[21] == "" && Number(tableMeta.rowData[18]) <= this.state.minValue || Number(tableMeta.rowData[18]) >= this.state.maxValue ?
<LightTooltip title={"MTD Explanation vs Prev. Month is Reqiured"} arrow>
<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)
}}
/>
</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>
......@@ -1768,8 +1847,10 @@ export default class ProfitLossMR extends Component {
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
this.setState({ loading: true, bebas: false }, () => {
setTimeout(() => {
handleCalculate()
this.setState({ loading: false })
// this.handleValidate()
}, 100);
......@@ -1785,14 +1866,15 @@ export default class ProfitLossMR extends Component {
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
cursor: this.state.bebas ? 'default' : this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
null :
null :
this.state.bebas ? null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
this.backToMonthlyReport('draft')
......@@ -1807,6 +1889,7 @@ export default class ProfitLossMR extends Component {
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.state.bebas ? null :
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
......@@ -1816,7 +1899,7 @@ export default class ProfitLossMR extends Component {
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
cursor: this.state.buttonError === true ? 'default' : this.state.bebas ? 'default' : 'pointer',
borderColor: 'transparent',
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