Commit 92e9e0de authored by Deni Rinaldi's avatar Deni Rinaldi

checkbox

parent cafd8bd4
This diff is collapsed.
This diff is collapsed.
......@@ -100,6 +100,7 @@ class UserRole extends Component {
name: "Action",
options: {
customBodyRender: (val, tableMeta) => {
console.log(tableMeta);
return (
<div style={{ display: 'flex' }}>
<button
......@@ -112,7 +113,7 @@ class UserRole extends Component {
onClick={() => this.setState({ edit: true, indexData: tableMeta.rowData[1] })}
>
<div style={{ display: 'flex' }}>
{tableMeta.rowData[4] === "Aktif" ?
{tableMeta.rowData[2] !== "superadmin" && tableMeta.rowData[4] === "Aktif" ?
<img src={Images.editCopy} /> :
null
}
......
......@@ -253,18 +253,8 @@ export default class Profile extends Component {
};
async onDrop(pictureFiles) {
let formData = new FormData()
formData.append('file', pictureFiles[0])
let response = await api.create().uploadFoto(formData)
if (response.data) {
if (response.data.status === "success") {
this.setState({ uploadVisible: false }, () => {
alert(response.data.message)
this.getUser()
window.location.reload()
})
}
}
console.log(pictureFiles);
this.setState({ pictures: pictureFiles })
// console.log(response);
// console.log(pictureFiles);
// console.log(pictureDataURLs);
......@@ -273,6 +263,23 @@ export default class Profile extends Component {
// });
}
async uploadFoto(){
let formData = new FormData()
formData.append('file', this.state.pictures[0])
api.create().uploadFoto(formData).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({ uploadVisible: false }, () => {
alert(response.data.message)
this.getUser()
window.location.reload()
})
}
}
})
}
render() {
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
......@@ -487,11 +494,21 @@ export default class Profile extends Component {
</div>
<ImageUploader
withIcon={true}
buttonText='Choose images'
withPreview
buttonText='Pilih Gambar'
onChange={this.onDrop}
imgExtension={['.jpg', '.gif', '.png', '.gif', '.jpeg']}
maxFileSize={5242880}
maxFileSize={1000000}
label={"Max file size: 1 Mb, accepted: jpg or png"}
/>
{this.state.pictures.length > 0 ?
<div style={{ display: 'grid', margin: 20 }}>
<div style={{ justifySelf: 'center' }}>
<span className="main-color" style={{ color: '#fff', padding: 20, paddingBottom: 10, paddingTop: 10, borderRadius: 15, cursor: 'pointer' }} onClick={() => this.uploadFoto()}>Upload Foto</span>
</div>
</div> : null
}
</div>
</div>
)}
......
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