Commit 8d32f088 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'faisal' into 'master'

fixed issue company

See merge request !202
parents 6fb1eefd d742784c
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Container, Row, Col } from "react-bootstrap"; import { Container, Row, Col } from "react-bootstrap";
import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles'; import { Typography, withStyles, Snackbar } from '@material-ui/core';
import { TextField } from '@material-ui/core';
import MenuItem from '@material-ui/core/MenuItem';
import Perusahaan from "./Perusahaan"; import Perusahaan from "./Perusahaan";
import TreeView from '@material-ui/lab/TreeView'; import MuiAlert from '@material-ui/lab/Alert';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import TreeItem from '@material-ui/lab/TreeItem';
import Nestable from 'react-nestable/dist/Nestable'; import Nestable from 'react-nestable/dist/Nestable';
import AddIcon from '@material-ui/icons/Add'; import AddIcon from '@material-ui/icons/Add';
import RemoveIcon from '@material-ui/icons/Remove'; import RemoveIcon from '@material-ui/icons/Remove';
import api from '../../../api'; import api from '../../../api';
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
export default class VisualPerusahaan extends Component { export default class VisualPerusahaan extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
...@@ -40,7 +38,10 @@ export default class VisualPerusahaan extends Component { ...@@ -40,7 +38,10 @@ export default class VisualPerusahaan extends Component {
}, },
], ],
arrayCollapse: [], arrayCollapse: [],
defaultCollapsed: false defaultCollapsed: false,
alert: false,
tipeAlert: '',
messageAlert: '',
} }
} }
...@@ -50,9 +51,16 @@ export default class VisualPerusahaan extends Component { ...@@ -50,9 +51,16 @@ export default class VisualPerusahaan extends Component {
getPerusahaan() { getPerusahaan() {
api.create().getPerusahaanHierarki().then((response) => { api.create().getPerusahaanHierarki().then((response) => {
if (response.data.status == 'success') { console.log(response)
this.setState({ items: response.data.data }) if (response.data) {
console.log(response.data.data) if (response.data.status == 'success') {
this.setState({ items: response.data.data })
console.log(response.data.data)
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
}) })
} }
...@@ -98,6 +106,9 @@ export default class VisualPerusahaan extends Component { ...@@ -98,6 +106,9 @@ export default class VisualPerusahaan extends Component {
) )
}; };
closeAlert() {
this.setState({ alert: false })
}
render() { render() {
......
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