|
|
|
@ -51,8 +51,6 @@ class DialogMenuRoles extends Component {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getAllMenu = async () => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { companyID } = this.props; |
|
|
|
|
const { roleName } = this.props; |
|
|
|
|
if (roleName !== "Super Admin") { |
|
|
|
@ -81,7 +79,6 @@ class DialogMenuRoles extends Component {
|
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
console.log('data Menu Role :', result.data.data); |
|
|
|
|
this.setState({ menu: result.data.data }, () => { |
|
|
|
|
this.setStateMenu(false); |
|
|
|
|
}); |
|
|
|
@ -129,13 +126,14 @@ class DialogMenuRoles extends Component {
|
|
|
|
|
let copyStateMenu = [...this.state.stateMenu]; |
|
|
|
|
this.props.menuRoles.map((val, indexMenu) => { |
|
|
|
|
let index = this.getIndexDataMenu(val.menu_id); |
|
|
|
|
console.log("index true", val.menu_id); |
|
|
|
|
console.log('index true', index); |
|
|
|
|
if (index >= 0) { |
|
|
|
|
copyStateMenu[index] = true; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.setState({ stateMenu: [] }, () => { |
|
|
|
|
let check = copyStateMenu.some(this.checkArray); |
|
|
|
|
console.log('icheck', check); |
|
|
|
|
if (check === false) { |
|
|
|
|
this.setState({ allChecked: true, stateMenu: copyStateMenu }) |
|
|
|
|
} else { |
|
|
|
@ -184,6 +182,7 @@ class DialogMenuRoles extends Component {
|
|
|
|
|
|
|
|
|
|
renderForm = () => { |
|
|
|
|
const { menu, stateMenu } = this.state |
|
|
|
|
console.log('stateMenu', stateMenu); |
|
|
|
|
return ( |
|
|
|
|
menu.map((val, index) => { |
|
|
|
|
return ( |
|
|
|
|