Commit f8a03050 authored by faisalhamdi's avatar faisalhamdi

olpa bs!

parent 3e88701f
...@@ -51,17 +51,19 @@ export default class BalanceSheetOLPA extends Component { ...@@ -51,17 +51,19 @@ export default class BalanceSheetOLPA extends Component {
updateBy: '-', updateBy: '-',
handleTekTekTek: 0, handleTekTekTek: 0,
viewOnly: true, viewOnly: true,
get_for: 'view' get_for: 'view',
minValue: "0",
maxValue: "0",
kansas: 0
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
componentDidMount() { componentDidMount() {
this.getItemHierarki()
this.getLatestUpdate() this.getLatestUpdate()
this.handleViewOnly() this.handleViewOnly()
// console.log(this.props); this.getSettingControl()
} }
handleViewOnly() { handleViewOnly() {
...@@ -100,8 +102,40 @@ export default class BalanceSheetOLPA extends Component { ...@@ -100,8 +102,40 @@ export default class BalanceSheetOLPA extends Component {
handleGetFor(type) { handleGetFor(type) {
this.setState({ get_for: type }, () => { this.setState({ get_for: type }, () => {
this.getLatestUpdate() this.getLatestUpdate()
this.getSettingControl()
})
}
getSettingControl() {
let body = {
group: 'THRESHOLD_CONTROL',
company_id: this.props.company.company_id,
type: 'BALANCE_SHEET'
}
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 })
}
}) })
} }
...@@ -225,9 +259,9 @@ export default class BalanceSheetOLPA extends Component { ...@@ -225,9 +259,9 @@ export default class BalanceSheetOLPA extends Component {
} }
}) })
console.log(dataTable); console.log(dataTable);
this.setState({ dataTable, loading: false, buttonError: true, editable: true }) this.setState({ dataTable, loading: false, buttonError: true, editable: true, saveDraft: true })
} else { } else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true }) this.setState({ dataTable, loading: false, buttonError: true, editable: true, saveDraft: true })
} }
} }
...@@ -470,8 +504,21 @@ export default class BalanceSheetOLPA extends Component { ...@@ -470,8 +504,21 @@ export default class BalanceSheetOLPA extends Component {
handleValidate() { handleValidate() {
let data = [] let data = []
let err = false
let dataTable = this.state.dataTable
let kansas = this.state.kansas
// console.log(this.state.dataTable) // console.log(this.state.dataTable)
this.state.dataTable.map(i => { dataTable.map((i, index) => {
if (String(i[5]) == "Control (should be nil)") {
if ( Number(i[17]) < this.state.minValue || Number(i[17]) > this.state.maxValue ) {
err = true
} else if (Number(i[18]) < this.state.minValue || Number(i[18]) > this.state.maxValue) {
err = true
} else if (Number(i[19]) < this.state.minValue || Number(i[19]) > this.state.maxValue) {
err = true
}
}
data.push({ data.push({
item_report_id: i[1], item_report_id: i[1],
total_actual_before: String(i[6]), total_actual_before: String(i[6]),
...@@ -501,10 +548,41 @@ export default class BalanceSheetOLPA extends Component { ...@@ -501,10 +548,41 @@ export default class BalanceSheetOLPA extends Component {
} }
api.create().validateSubmitReportOLPA(payload).then((response) => { api.create().validateSubmitReportOLPA(payload).then((response) => {
// console.log(response) // console.log(response)
if (response.data.data.result) { // console.log(response.data.data.result)
this.setState({ loading: false, buttonError: false, editable: false }) // console.log(err);
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && err === false) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
if (kansas == 0) {
this.setState({kansas: 1, loading: true}, () => {
this.handleValidate()
})
} else {
this.setState({kansas: 0})
}
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: true })
if (kansas == 0) {
this.setState({kansas: 1, loading: true}, () => {
this.handleValidate()
})
} else { } else {
this.setState({ loading: false, buttonError: true, editable: true }) this.setState({kansas: 0})
}
}
} 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 })
} }
}) })
} }
...@@ -1316,27 +1394,6 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1316,27 +1394,6 @@ export default class BalanceSheetOLPA extends Component {
value={Number(handleValue(tableMeta)).toFixed(1)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// // disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 4 ?
null null
...@@ -1350,26 +1407,6 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1350,26 +1407,6 @@ export default class BalanceSheetOLPA extends Component {
disabled={true} disabled={true}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)} value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/> />
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
<NumberFormat <NumberFormat
...@@ -1380,49 +1417,12 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1380,49 +1417,12 @@ export default class BalanceSheetOLPA extends Component {
disabled={true} disabled={true}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)} value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/> />
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
null null
: :
tableMeta.rowData[0] === 7 ? tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[21]).toFixed(1) ? (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).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(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[22] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[21]}`} arrow>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ style={{
...@@ -1431,16 +1431,14 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1431,16 +1431,14 @@ export default class BalanceSheetOLPA extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 0, margin: 0,
width: 96, width: 96,
backgroundColor: 'transparent', backgroundColor: 'transparent'
color: 'red'
}} }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)} value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> /> :
</LightTooltip> : <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={`Value Should be ${tableMeta.rowData[21]}`} arrow>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ style={{
...@@ -1458,26 +1456,6 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1458,26 +1456,6 @@ export default class BalanceSheetOLPA extends Component {
value={Number(handleValidation(value, tableMeta)).toFixed(1)} value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> />
</LightTooltip> </LightTooltip>
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
null null
} }
...@@ -1542,27 +1520,6 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1542,27 +1520,6 @@ export default class BalanceSheetOLPA extends Component {
value={Number(handleValue(tableMeta)).toFixed(1)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// // disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 4 ?
null null
...@@ -1576,26 +1533,6 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1576,26 +1533,6 @@ export default class BalanceSheetOLPA extends Component {
disabled={true} disabled={true}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)} value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/> />
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
<NumberFormat <NumberFormat
...@@ -1606,49 +1543,12 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1606,49 +1543,12 @@ export default class BalanceSheetOLPA extends Component {
disabled={true} disabled={true}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)} value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/> />
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
null null
: :
tableMeta.rowData[0] === 7 ? tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[21]).toFixed(1) ? (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).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(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[22] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[21]}`} arrow>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ style={{
...@@ -1657,16 +1557,14 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1657,16 +1557,14 @@ export default class BalanceSheetOLPA extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 0, margin: 0,
width: 96, width: 96,
backgroundColor: 'transparent', backgroundColor: 'transparent'
color: 'red'
}} }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)} value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> /> :
</LightTooltip> : <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={`Value Should be ${tableMeta.rowData[21]}`} arrow>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ style={{
...@@ -1684,26 +1582,6 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1684,26 +1582,6 @@ export default class BalanceSheetOLPA extends Component {
value={Number(handleValidation(value, tableMeta)).toFixed(1)} value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> />
</LightTooltip> </LightTooltip>
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
null null
} }
...@@ -1768,27 +1646,6 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1768,27 +1646,6 @@ export default class BalanceSheetOLPA extends Component {
value={Number(handleValue(tableMeta)).toFixed(1)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// // disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 4 ?
null null
...@@ -1803,26 +1660,6 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1803,26 +1660,6 @@ export default class BalanceSheetOLPA extends Component {
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)} value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
// value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)} // value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)}
/> />
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
<NumberFormat <NumberFormat
...@@ -1834,42 +1671,12 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1834,42 +1671,12 @@ export default class BalanceSheetOLPA extends Component {
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)} value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
// value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)} // value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)}
/> />
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null null
: :
tableMeta.rowData[0] === 7 ? tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[21]).toFixed(1) ? (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ style={{
...@@ -1878,33 +1685,14 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1878,33 +1685,14 @@ export default class BalanceSheetOLPA extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 0, margin: 0,
width: 96, width: 96,
backgroundColor: 'transparent', backgroundColor: 'transparent'
color: 'black'
}} }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)} value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[22] === "STOPPER" ? /> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[21]}`} arrow> <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `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(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[21]}`} arrow>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ style={{
...@@ -1922,26 +1710,6 @@ export default class BalanceSheetOLPA extends Component { ...@@ -1922,26 +1710,6 @@ export default class BalanceSheetOLPA extends Component {
value={Number(handleValidation(value, tableMeta)).toFixed(1)} value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> />
</LightTooltip> </LightTooltip>
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
null null
} }
...@@ -2143,7 +1911,7 @@ export default class BalanceSheetOLPA extends Component { ...@@ -2143,7 +1911,7 @@ export default class BalanceSheetOLPA extends Component {
marginRight: 20 marginRight: 20
}} }}
onClick={() => { onClick={() => {
this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false }, () => { this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => { setTimeout(() => {
this.handleValidate() this.handleValidate()
}, 100); }, 100);
...@@ -2164,10 +1932,12 @@ export default class BalanceSheetOLPA extends Component { ...@@ -2164,10 +1932,12 @@ export default class BalanceSheetOLPA extends Component {
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
disabled={this.state.buttonDraft}
onClick={() => onClick={() =>
this.state.saveDraft ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
this.backToOLPA('draft') this.backToOLPA('draft')
}) })
} }
......
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