Commit f6c27c4e authored by faisalhamdi's avatar faisalhamdi

merge conflict

parents 3799d451 d534fd40
......@@ -42,6 +42,7 @@ export default class Parameter extends Component {
getAllParameter() {
api.create().getAllParameter().then(response => {
if (response.data) {
if (response.data.status === "success") {
console.log(response);
let data = response.data.data
......@@ -61,7 +62,10 @@ export default class Parameter extends Component {
})
this.setState({ dataTable: listData, data: response.data.data })
} else {
alert(response.data.message)
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......@@ -83,6 +87,7 @@ export default class Parameter extends Component {
updateParameter = (payload) => {
this.setState({ visibleEdit: false })
api.create().updateParameter(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status == 'success') {
this.getAllParameter()
......@@ -517,8 +522,7 @@ export default class Parameter extends Component {
if (response.data.status === "success") {
console.log(response)
this.getAllParameter()
this.setState({ visibleParameter: true })
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
this.setState({ visibleParameter: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
......
......@@ -96,7 +96,7 @@ export default class CreatePerusahaan extends Component {
options: perusahaanData,
getOptionLabel: (option) => option.company_name,
};
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? perusahaanData[0] : perusahaanData[index] })
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index] })
} else {
alert(response.data.message)
}
......@@ -120,7 +120,7 @@ export default class CreatePerusahaan extends Component {
options: typeData,
getOptionLabel: (option) => option.business_unit_name,
};
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? typeData[0] : typeData[index] })
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? null : typeData[index] })
} else {
alert(response.data.message)
}
......@@ -174,19 +174,21 @@ export default class CreatePerusahaan extends Component {
errorSD: false,
errorED: false,
errorJL: false,
errorUB: false,
msgErrorNP: '',
msgErrorPC: '',
msgErrorSD: '',
msgErrorED: '',
msgErrorJL: '',
msgErrorUB: ''
})
}
validasiEdit() {
if (R.isEmpty(this.state.company)) {
this.setState({ errorNP: true, msgErrorNP: 'Nama perusahaan harus diisi' })
// } else if (R.isEmpty(this.state.totalReport)) {
// this.setState({ errorJL: true, msgErrorJL: 'Total Report harus diisi' })
} else if (R.isNil(this.state.getTypes)) {
this.setState({ errorUB: true, msgErrorUB: 'Unit Bisnis harus diisi' })
} else if (R.isNil(this.state.startDate)) {
this.setState({ errorSD: true, msgErrorSD: 'Start Date tidak boleh kosong' })
} else if (R.isNil(this.state.endDate)) {
......@@ -196,7 +198,7 @@ export default class CreatePerusahaan extends Component {
"company_id": this.state.companyID,
"company_name": this.state.company,
"business_unit_id": this.state.getTypes.business_unit_id,
"parent": this.state.getPerusahaan.company_id,
"parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
// "total_report": this.state.totalReport,
"start_date": this.state.startDate,
"end_date": this.state.endDate
......@@ -209,7 +211,7 @@ export default class CreatePerusahaan extends Component {
validasi() {
if (R.isEmpty(this.state.company)) {
this.setState({ errorNP: true, msgErrorNP: 'Nama perusahaan harus diisi' })
} else if (R.isNil(this.state.types)) {
} else if (R.isNil(this.state.getTypes)) {
this.setState({ errorUB: true, msgErrorUB: 'Unit Bisnis harus diisi' })
} else if (R.isNil(this.state.startDate)) {
this.setState({ errorSD: true, msgErrorSD: 'Start Date tidak boleh kosong' })
......@@ -217,12 +219,14 @@ export default class CreatePerusahaan extends Component {
this.setState({ errorED: true, msgErrorED: 'End Date tidak boleh kosong' })
} else if (!R.isEmpty(this.state.startDate) && !R.isEmpty(this.state.endDate) && (this.state.startDate > this.state.endDate)) {
return alert("Masa Berlaku Tidak Boleh Kurang Dari Tanggal Mulai")
// } else if (R.isEmpty(this.state.totalReport)) {
}
// else if (R.isEmpty(this.state.totalReport)) {
// this.setState({ errorJL: true, msgErrorJL: 'Total Report harus diisi' })
} else {
// }
else {
let payload = {
"company_name": this.state.company,
"parent": this.state.getPerusahaan.company_id,
"parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
"business_unit_id": this.state.getTypes.business_unit_id,
// "total_report": this.state.totalReport,
"start_date": this.state.startDate,
......@@ -282,8 +286,17 @@ export default class CreatePerusahaan extends Component {
{...this.state.types}
debug
id="tipe"
onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue })}
renderInput={(params) => <TextField {...params} InputProps={{ ...params.InputProps, style: { fontSize: 11 } }} InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }} label="Unit Bisnis" />}
onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, ()=> this.clearError())}
renderInput={(params) =>
<TextField
{...params}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
label="Unit Bisnis"
error={this.state.errorUB}
helperText={this.state.msgErrorUB}
/>
}
value={this.state.getTypes}
/>
</div>
......@@ -510,14 +523,13 @@ export default class CreatePerusahaan extends Component {
{...this.state.types}
debug
id="tipe"
onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue })}
onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, ()=> this.clearError())}
renderInput={(params) =>
<TextField
{...params}
label="Unit Bisnis"
margin="normal"
style={{marginTop: 7}}
onChange={(e) => this.handleChange(e, '')}
error={this.state.errorUB}
helperText={this.state.msgErrorUB}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
......
......@@ -138,7 +138,7 @@ export default class EditPerusahaan extends Component {
"company_id": this.state.companyID,
"company_name": this.state.company,
"business_unit_id": this.state.getTypes.business_unit_id,
"parent": this.state.getPerusahaan.company_id,
"parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
"total_report": this.state.totalReport,
"start_date": this.state.startDate,
"end_date": this.state.endDate
......
......@@ -446,7 +446,7 @@ export default class Perusahaan extends Component {
{this.state.visiblePerusahaan === true ?
<div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%' }}>Master Data - Perusahaan</label>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Perusahaan</label>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
<img src={Images.searchBlack} style={{ marginRight: 10 }} />
<InputBase
......@@ -457,7 +457,8 @@ export default class Perusahaan extends Component {
inputProps={{ 'aria-label': 'naked' }}
/>
</div>
<div style={{ width: '20%', justifyContent: 'space-around', display: 'flex', flexFlow: 'wrap' }}>
<div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button
style={{
backgroundColor: 'transparent',
......@@ -469,6 +470,9 @@ export default class Perusahaan extends Component {
>
<img src={Images.template} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
......@@ -480,6 +484,9 @@ export default class Perusahaan extends Component {
>
<img src={Images.upload} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
......@@ -491,6 +498,9 @@ export default class Perusahaan extends Component {
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
<a data-tip={'Visualisasi'} data-for="visual">
<button
style={{
backgroundColor: 'transparent',
......@@ -502,6 +512,9 @@ export default class Perusahaan extends Component {
>
<img src={Images.visualisasi} onClick={() => this.setState({ visibleVisual: true, visiblePerusahaan: false })} />
</button>
</a>
<ReactTooltip border={true} id="visual" place="bottom" type="light" effect="solid" />
<a data-tip={'Tambah'} data-for="create">
<button
style={{
backgroundColor: 'transparent',
......@@ -513,6 +526,8 @@ export default class Perusahaan extends Component {
>
<img src={Images.add} />
</button>
</a>
<ReactTooltip border={true} id="create" place="bottom" type="light" effect="solid" />
</div>
</div>
<div style={{ padding: 25 }}>
......@@ -626,7 +641,7 @@ export default class Perusahaan extends Component {
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["pdf"]}
acceptedFiles={["xsls"]}
onHandle={(dt) => {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
......
import React, { Component } from "react";
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import { createMuiTheme, MuiThemeProvider, withStyles } from '@material-ui/core/styles';
import Images from "../../assets/Images";
import MUIDataTable from "mui-datatables";
import { InputBase } from "@material-ui/core";
import { InputBase, Snackbar } from "@material-ui/core";
import { ExcelRenderer } from 'react-excel-renderer';
import UploadFile from "../../library/Upload";
import MuiAlert from '@material-ui/lab/Alert';
import CreateReportItems from "./formReportItems/CreateReportItems";
import EditReportItems from "./formReportItems/EditReportItems";
import VisualReportItems from "./formReportItems/VisualReportItems";
......@@ -17,6 +18,9 @@ const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptions();
const options2 = ct.customOptions2();
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
export default class ReportItems extends Component {
constructor(props) {
super(props)
......@@ -32,7 +36,10 @@ export default class ReportItems extends Component {
dataLoaded: false,
cols: null,
rows: null,
popupError: false
popupError: false,
alert: false,
tipeAlert: '',
messageAlert: ''
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -450,6 +457,7 @@ export default class ReportItems extends Component {
getData() {
api.create().getReportItems().then((response) => {
console.log(response)
if (response.data) {
if (response.data.status == 'success') {
let data = response.data.data
let listData = data.sort((a, b) => a.item_report_id - b.item_report_id).map((item, index) => {
......@@ -457,7 +465,10 @@ export default class ReportItems extends Component {
})
this.setState({ dataTable: listData, listData: response.data.data })
} else {
alert(response.data.message)
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......@@ -482,6 +493,7 @@ export default class ReportItems extends Component {
}
api.create().searchReportItems(body).then(response => {
// console.log(response.data);
if (response.data) {
if (response.data.status == 'success') {
let data = response.data.data
let listData = data.map((item, index) => {
......@@ -489,7 +501,10 @@ export default class ReportItems extends Component {
})
this.setState({ dataTable: listData, listData: response.data.data })
} else {
alert(response.data.message)
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......@@ -497,10 +512,15 @@ export default class ReportItems extends Component {
createReportItems = (payload) => {
this.setState({ add: false })
api.create().createReportItems(payload).then(response => {
if (response.data) {
if (response.data.status == 'success') {
this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
alert(response.data.message)
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......@@ -538,10 +558,15 @@ export default class ReportItems extends Component {
updateReportItems = (payload) => {
this.setState({ edit: false })
api.create().updateReportItems(payload).then(response => {
if (response.data) {
if (response.data.status == 'success') {
this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
alert(response.data.message)
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......@@ -550,15 +575,22 @@ export default class ReportItems extends Component {
api.create().uploadReportItems(this.state.payload).then(response => {
if (response.data) {
if (response.data.status === "success") {
console.log(response)
alert(response.data.message)
this.getData()
this.setState({ itemReport: true })
this.setState({ itemReport: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
closeAlert() {
this.setState({ alert: false })
}
render() {
const columns = [{
name: "Action",
......@@ -716,10 +748,15 @@ export default class ReportItems extends Component {
<div style={{ height: this.props.height }}>
{/* <Row> */}
<div className={"main-color"} style={{ height: 199, width: '100%' }} />
<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.itemReport === true ?
<div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Item Report</label>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Item Laporan</label>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
<img src={Images.searchBlack} style={{ marginRight: 10 }} />
<InputBase
......
......@@ -134,6 +134,21 @@ export default class AddUser extends Component {
}
}
clearError() {
this.setState({
errorFullname: false,
errorEmail: false,
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
})
}
isEmail(email) {
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
......@@ -272,6 +287,8 @@ export default class AddUser extends Component {
padding = 20
}
return (
<div>
{item.children.length > 0 && (
<ul>
{item.children.map((data, index) => {
return (
......@@ -313,6 +330,8 @@ export default class AddUser extends Component {
)
})}
</ul>
)}
</div>
)
}
......@@ -498,7 +517,7 @@ export default class AddUser extends Component {
<Autocomplete
{...this.state.listRole}
id="role"
onChange={(event, newInputValue) => this.setState({ role: newInputValue })}
onChange={(event, newInputValue) => this.setState({ role: newInputValue }, ()=> this.clearError())}
debug
renderInput={(params) =>
<TextField
......@@ -662,8 +681,8 @@ export default class AddUser extends Component {
</div>
</div>
<div style={{ flexDirection: 'column', display: 'flex', paddingLeft: 20, paddingRight: 20 }}>
<Typography style={{ fontSize: 12 }}>{`Dibuat : ${format(this.state.date, 'dd MMMM yyyy', { locale: localeID })}`}</Typography>
{/* <Typography style={{fontSize: 12}}>{`Diubah: ${this.state.tempData === null? '' : this.state.tempData.updated}`}</Typography> */}
<Typography style={{ fontSize: 12 }}>{`Dibuat: `}</Typography>
<Typography style={{fontSize: 12}}>{`Diubah: `}</Typography>
</div>
<Divider style={{ margin: 20 }} />
<div style={{ paddingLeft: 20, paddingRight: 20 }}>
......
......@@ -121,6 +121,21 @@ export default class EditUser extends Component {
}
}
clearError() {
this.setState({
errorFullname: false,
errorEmail: false,
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
})
}
getDetailUser() {
api.create().getDetailUser(this.state.paramsId).then((response) => {
this.getRole()
......@@ -274,6 +289,8 @@ export default class EditUser extends Component {
padding = 20
}
return (
<div>
{item.children.length > 0 && (
<ul>
{item.children.map((data, index) => {
return (
......@@ -315,6 +332,8 @@ export default class EditUser extends Component {
)
})}
</ul>
)}
</div>
)
}
......@@ -497,7 +516,7 @@ export default class EditUser extends Component {
<Autocomplete
{...this.state.listRole}
id="role"
onChange={(event, newInputValue) => this.setState({ role: newInputValue })}
onChange={(event, newInputValue) => this.setState({ role: newInputValue }, ()=> this.clearError())}
debug
renderInput={(params) => <TextField
......
......@@ -116,7 +116,7 @@ export default class AddRole extends Component {
} else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorED: 'End Date tidak boleh kosong' })
} else if (this.state.privileges.length < 1) {
alert('Hak Akses belum di pilih !!')
this.setState({ alert: true, messageAlert: 'Hak Akses belum di pilih !!', tipeAlert: 'warning' })
} else {
this.addRole()
}
......@@ -468,8 +468,8 @@ export default class AddRole extends Component {
</div>
</div>
<div style={{ flexDirection: 'column', display: 'flex', paddingLeft: 20, paddingRight: 20 }}>
<Typography style={{ fontSize: 12 }}>{`Dibuat : ${format(this.state.date, 'dd MMMM yyyy', { locale: localeID })}`}</Typography>
{/* <Typography style={{fontSize: 12}}>{`Diubah: ${this.state.tempData === null? '' : this.state.tempData.updated}`}</Typography> */}
<Typography style={{ fontSize: 12 }}>{`Dibuat: `}</Typography>
<Typography style={{fontSize: 12}}>{`Diubah: `}</Typography>
</div>
<Divider style={{ margin: 20 }} />
<div style={{ paddingLeft: 20, paddingRight: 20 }}>
......
......@@ -122,7 +122,7 @@ export default class EditRole extends Component {
} else if (R.isNil(this.state.tempData.end_date)) {
this.setState({ errorEndDate: true, msgErrorED: 'End Date tidak boleh kosong' })
} else if (this.state.privileges.length < 1) {
alert('Hak Akses belum di pilih !!')
this.setState({ alert: true, messageAlert: 'Hak Akses belum di pilih !!', tipeAlert: 'warning' })
} else {
this.updateRole()
}
......
import React, { Component } from 'react';
import { Typography, AppBar, Tabs, Tab, TextField, Collapse, withStyles, Checkbox, InputAdornment, IconButton } from '@material-ui/core';
import { Typography, AppBar, Tabs, Tab, TextField, Snackbar, Collapse, withStyles, Checkbox, InputAdornment, IconButton } from '@material-ui/core';
import Visibility from '@material-ui/icons/Visibility';
import VisibilityOff from '@material-ui/icons/VisibilityOff';
import HomePage from './HomePage';
import MuiAlert from '@material-ui/lab/Alert';
import Images from '../assets/Images';
import api from '../api';
import Constant from '../library/Constant';
......@@ -22,6 +22,9 @@ const CustomCheckbox = withStyles({
checked: {},
})((props) => <Checkbox color="default" {...props} />);
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
export default class Profile extends Component {
constructor(props) {
super(props)
......@@ -43,7 +46,10 @@ export default class Profile extends Component {
showPass2: false,
showPass3: false,
pictures: [],
name: ""
name: "",
alert: false,
tipeAlert: '',
messageAlert: ''
}
this.onDrop = this.onDrop.bind(this);
}
......@@ -111,12 +117,22 @@ export default class Profile extends Component {
api.create().changePassword(body).then(response => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
this.setState({ oldPassword: "", password: "", confirmPassword: "" })
localStorage.removeItem(Constant.TOKEN)
setTimeout(() => {
window.location.reload();
}, 1000);
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
alert(response.data.message)
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......@@ -136,11 +152,20 @@ export default class Profile extends Component {
let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
this.setState({ company: response.data.data.company, photo: response.data.data.photo, name: response.data.data.fullname })
console.log(response)
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......@@ -148,10 +173,18 @@ export default class Profile extends Component {
api.create().getPerusahaanHierarki().then((response) => {
// console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
this.setState({ listCompany: 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.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......@@ -169,6 +202,8 @@ export default class Profile extends Component {
padding = 20
}
return (
<div>
{item.children.length > 0 && (
<ul>
{item.children.map((data, index) => {
return (
......@@ -199,6 +234,8 @@ export default class Profile extends Component {
)
})}
</ul>
)}
</div>
)
}
......@@ -269,20 +306,40 @@ export default class Profile extends Component {
api.create().uploadFoto(formData).then(response => {
console.log(response)
if (response.data) {
if (response.ok){
if (response.data.status === "success") {
this.setState({ uploadVisible: false }, () => {
alert(response.data.message)
this.getUser()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }, () => {
setTimeout(() => {
window.location.reload()
}, 1000);
})
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
closeAlert() {
this.setState({ alert: false })
}
render() {
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
<div className={"main-color"} style={{ height: 203, flex: 1, display: 'flex', alignItems: 'flex-end', padding: 20 }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', width: '100%' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
......
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