Commit 5a61e7cc authored by Riri Novita's avatar Riri Novita

Merge branch 'ENV-DEV' into 'ENV-DEPLOYMENT'

alert error

See merge request !2261
parents a0d7c716 2d0edb47
...@@ -22,9 +22,12 @@ import { fixNumber, roundMath } from "../../library/Utils"; ...@@ -22,9 +22,12 @@ import { fixNumber, roundMath } from "../../library/Utils";
import LOCF from './LOCFMR'; import LOCF from './LOCFMR';
import LOV from './LOVMR'; import LOV from './LOVMR';
function Alert(props) { const Alert = withStyles({
return <MuiAlert elevation={6} variant="filled" {...props} />; })((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
}
// function Alert(props) {
// return <MuiAlert elevation={6} variant="filled" {...props} />;
// }
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
...@@ -136,6 +139,9 @@ export default class ListOfCreditFacilities extends Component { ...@@ -136,6 +139,9 @@ export default class ListOfCreditFacilities extends Component {
saveTambahan: true, saveTambahan: true,
defaultCurrencyUpload: this.props.defaultCurrency, defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false, visibleAlertSave: false,
alert: false,
tipeAlert: '',
messageAlert: '',
} }
} }
...@@ -456,17 +462,13 @@ export default class ListOfCreditFacilities extends Component { ...@@ -456,17 +462,13 @@ export default class ListOfCreditFacilities extends Component {
let error = false let error = false
// this.deleteReport() // this.deleteReport()
if (this.state.dataTablelov !== undefined && this.state.tambahLOV == undefined) { if (this.state.dataTablelov !== undefined && this.state.tambahLOV == undefined) {
console.log('1');
dataTable2 = this.state.dataTablelov dataTable2 = this.state.dataTablelov
} else { } else {
console.log('2');
dataTable2 = this.state.dataTableLOV dataTable2 = this.state.dataTableLOV
this.setState({ updateTambah: true, updateData: false }) this.setState({ updateTambah: true, updateData: false })
if (this.state.tambahLOV = 'tambah' && this.state.updateData == false) { if (this.state.tambahLOV = 'tambah' && this.state.updateData == false) {
console.log('3');
dataTable2 = this.state.dataTablelov dataTable2 = this.state.dataTablelov
} else { } else {
console.log('4')
dataTable2 = this.state.dataTableLOV dataTable2 = this.state.dataTableLOV
} }
...@@ -552,7 +554,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -552,7 +554,7 @@ export default class ListOfCreditFacilities extends Component {
if (response.data?.message == "Please Set Up Rate Currency First") { if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true }) this.setState({ visibleAlertSave: true })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loadingChild: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -564,10 +566,11 @@ export default class ListOfCreditFacilities extends Component { ...@@ -564,10 +566,11 @@ export default class ListOfCreditFacilities extends Component {
// alert(response.data.status) // alert(response.data.status)
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false, handleDoubleClick: 0 }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loadingChild: false, handleDoubleClick: 0 })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false, handleDoubleClick: 0 }) console.log(response.problem);
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loadingChild: false, handleDoubleClick: 0 })
} }
this.setState({ handleDoubleClick: 0 }) this.setState({ handleDoubleClick: 0 })
}) })
...@@ -1403,6 +1406,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1403,6 +1406,10 @@ export default class ListOfCreditFacilities extends Component {
} }
} }
closeAlert() {
this.setState({ alert: false })
}
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
let loading = this.state.loading let loading = this.state.loading
...@@ -1437,9 +1444,9 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1437,9 +1444,9 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleParent ? {this.state.visibleParent ?
< Paper style={{ paddingTop: 10, paddingBottom: 20 }}> < Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<Snackbar open={this.state.snekbar} autoHideDuration={3000} onClose={handleClose}> <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={handleClose} severity="error"> <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.snekbarMsg} {this.state.messageAlert}
</Alert> </Alert>
</Snackbar> </Snackbar>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
......
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