Commit 8fa58802 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

update didam

See merge request !42
parents 8a734896 430ef26b
......@@ -65,9 +65,13 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
//Role
const getRole = () => api.get('role/get_all_role')
const getDetailRole = (roleId) => api.get(`role/get_role_by_id/${roleId}`)
const addRole = (body) => api.post('role/create_role', body)
const editRole = (body) => api.post('role/update_role', body)
const deleteRole = (roleId) => api.post(`role/delete_role/${roleId}`)
//Menu
const getMenu = () => api.get('menu/get_menu_hierarki')
// ------
// STEP 3
// ------
......@@ -86,9 +90,11 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
login,
verification,
getRole,
getDetailRole,
addRole,
editRole,
deleteRole,
getMenu
}
}
......
......@@ -18,7 +18,7 @@ export default class UserRole extends Component {
super(props)
this.state = {
listRole: [],
paramsData: {},
indexData: {},
add: false,
edit: false
}
......@@ -38,6 +38,7 @@ export default class UserRole extends Component {
getRole() {
api.create().getRole().then((response) => {
// console.log(response)
if (response.data.status == 'success') {
let data = response.data.data
let listData = data.map((item,index) => {
......@@ -52,7 +53,7 @@ export default class UserRole extends Component {
} else {
alert(response.data.message)
}
// console.log(response.data.data)
console.log(response.data.data)
})
}
......@@ -69,7 +70,8 @@ export default class UserRole extends Component {
cursor: 'pointer',
borderColor: 'transparent',
}}
onClick={() => this.setState({edit: true, paramsData: tableMeta.rowData})}
// onClick={() => console.log(tableMeta.rowData[1])}
onClick={() => this.setState({edit: true, indexData: tableMeta.rowData[1]})}
>
<img src={Images.editCopy} />
</button>
......@@ -148,14 +150,14 @@ export default class UserRole extends Component {
</div>
{this.state.add && (
<AddRole
onClickClose={this.closeAdd.bind(this)}
data={this.state.paramsData}
onClickClose={this.closeAdd.bind(this)}
data={this.state.indexData}
/>
)}
{this.state.edit && (
<EditRole
onClickClose={this.closeEdit.bind(this)}
data={this.state.paramsData}
onClickClose={this.closeEdit.bind(this)}
data={this.state.indexData}
/>
)}
</div>
......
import React, { Component } from 'react';
import { TextField } from '@material-ui/core';
export default class CreateUnitBisnis extends Component {
export default class AddRole extends Component {
render() {
return (
<div className="test app-popup-show" style={{display: 'flex', justifyContent: 'center', 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