Commit ecf887fd authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

Toast ++

See merge request !129
parents ab6b1382 b5f16e69
...@@ -78,6 +78,7 @@ export default class Parameter extends Component { ...@@ -78,6 +78,7 @@ export default class Parameter extends Component {
api.create().updateParameter(payload).then(response => { api.create().updateParameter(payload).then(response => {
if (response.data.status == 'success') { if (response.data.status == 'success') {
this.getAllParameter() this.getAllParameter()
alert(response.data.message)
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
...@@ -89,6 +90,7 @@ export default class Parameter extends Component { ...@@ -89,6 +90,7 @@ export default class Parameter extends Component {
api.create().createParameter(payload).then(response => { api.create().createParameter(payload).then(response => {
if (response.data.status == 'success') { if (response.data.status == 'success') {
this.getAllParameter() this.getAllParameter()
alert(response.data.message)
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
......
...@@ -7,7 +7,8 @@ import UploadFile from "../../library/Upload"; ...@@ -7,7 +7,8 @@ import UploadFile from "../../library/Upload";
import MUIDataTable from "mui-datatables"; import MUIDataTable from "mui-datatables";
import CreateUnitBisnis from "./formUnitBisnis/CreateUnitBisnis"; import CreateUnitBisnis from "./formUnitBisnis/CreateUnitBisnis";
import ReactTooltip from 'react-tooltip'; import ReactTooltip from 'react-tooltip';
import { TextField, InputBase } from "@material-ui/core"; import MuiAlert from '@material-ui/lab/Alert';
import { TextField, InputBase, Snackbar, withStyles } from "@material-ui/core";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import api from "../../api"; import api from "../../api";
import { isThisSecond } from "date-fns"; import { isThisSecond } from "date-fns";
...@@ -18,6 +19,9 @@ const getMuiTheme = () => createMuiTheme(ct.customTable()); ...@@ -18,6 +19,9 @@ const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptions(); const options = ct.customOptions();
const options2 = ct.customOptions2(); const options2 = ct.customOptions2();
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
export default class UnitBisnis extends Component { export default class UnitBisnis extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
...@@ -32,7 +36,10 @@ export default class UnitBisnis extends Component { ...@@ -32,7 +36,10 @@ export default class UnitBisnis extends Component {
cols: null, cols: null,
rows: null, rows: null,
dataLoaded: false, dataLoaded: false,
popupError: false popupError: false,
alert: false,
tipeAlert: '',
messageAlert: ''
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -238,10 +245,10 @@ export default class UnitBisnis extends Component { ...@@ -238,10 +245,10 @@ export default class UnitBisnis extends Component {
this.setState({ visibleEdit: false }) this.setState({ visibleEdit: false })
api.create().updateUnitBisnis(payload).then(response => { api.create().updateUnitBisnis(payload).then(response => {
if (response.data.status == 'success') { if (response.data.status == 'success') {
alert(response.data.message)
this.getData() this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
alert(response.data.message) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
} }
}) })
} }
...@@ -251,8 +258,9 @@ export default class UnitBisnis extends Component { ...@@ -251,8 +258,9 @@ export default class UnitBisnis extends Component {
api.create().createUnitBisnis(payload).then(response => { api.create().createUnitBisnis(payload).then(response => {
if (response.data.status == 'success') { if (response.data.status == 'success') {
this.getData() this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
alert(response.data.message) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
} }
}) })
} }
...@@ -290,14 +298,21 @@ export default class UnitBisnis extends Component { ...@@ -290,14 +298,21 @@ export default class UnitBisnis extends Component {
uploadUnitBisnis() { uploadUnitBisnis() {
api.create().uploadUnitBisnis(this.state.payload).then(response => { api.create().uploadUnitBisnis(this.state.payload).then(response => {
console.log(response) console.log(response)
if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
alert(response.data.message)
this.getData() this.getData()
this.setState({ visibleUnitBisnis: true }) this.setState({ visibleUnitBisnis: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} }
}) })
} }
closeAlert() {
this.setState({ alert: false })
}
render() { render() {
const columns = [{ const columns = [{
name: "Action", name: "Action",
...@@ -366,6 +381,11 @@ export default class UnitBisnis extends Component { ...@@ -366,6 +381,11 @@ export default class UnitBisnis extends Component {
<div style={{ height: this.props.height }}> <div style={{ height: this.props.height }}>
{/* <Row> */} {/* <Row> */}
<div style={{ height: 199, width: '100%' }} className={"main-color"} /> <div style={{ height: 199, width: '100%' }} className={"main-color"} />
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
{this.state.visibleUnitBisnis === true ? {this.state.visibleUnitBisnis === true ?
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
......
...@@ -298,7 +298,7 @@ export default class UserRole extends Component { ...@@ -298,7 +298,7 @@ export default class UserRole extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[6] === "Aktif" ? {/* {tableMeta.rowData[6] === "Aktif" ? */}
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -310,9 +310,9 @@ export default class UserRole extends Component { ...@@ -310,9 +310,9 @@ export default class UserRole extends Component {
> >
<img src={Images.editCopy} /> <img src={Images.editCopy} />
</button> </button>
: {/* :
null null
} } */}
</div > </div >
); );
} }
......
...@@ -202,9 +202,13 @@ export default class EditUser extends Component { ...@@ -202,9 +202,13 @@ export default class EditUser extends Component {
getPerusahaan() { getPerusahaan() {
api.create().getPerusahaanHierarki().then((response) => { api.create().getPerusahaanHierarki().then((response) => {
if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ listCompany: response.data.data }) this.setState({ listCompany: response.data.data })
} }
} else {
alert(response.problem)
}
}) })
} }
......
...@@ -113,7 +113,7 @@ class UserRole extends Component { ...@@ -113,7 +113,7 @@ class UserRole extends Component {
onClick={() => this.setState({ edit: true, indexData: tableMeta.rowData[1] })} onClick={() => this.setState({ edit: true, indexData: tableMeta.rowData[1] })}
> >
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[2] !== "superadmin" && tableMeta.rowData[4] === "Aktif" ? {tableMeta.rowData[2] !== "superadmin" ?
<img src={Images.editCopy} /> : <img src={Images.editCopy} /> :
null null
} }
......
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