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