diff --git a/src/views/Master/MasterRoles/DialogForm.js b/src/views/Master/MasterRoles/DialogForm.js index 3bbfc78..966c5ee 100644 --- a/src/views/Master/MasterRoles/DialogForm.js +++ b/src/views/Master/MasterRoles/DialogForm.js @@ -30,7 +30,6 @@ class DialogForm extends Component { isParentClick: false, menu: [], selectedMenu: null, - company_id } } @@ -134,12 +133,13 @@ class DialogForm extends Component { } handleSave = () => { + const { companyID } = this.props; const { id, name, description, selectedMenu, - company_id + } = this.state let data = ''; @@ -151,7 +151,7 @@ class DialogForm extends Component { name, description, selectedMenu, - company_id + company_id: companyID } // console.log('data', data); this.props.closeDialog('save', data); @@ -161,7 +161,7 @@ class DialogForm extends Component { name, description, selectedMenu, - company_id + company_id: companyID } this.props.closeDialog('edit', data); } diff --git a/src/views/Master/MasterRoles/DialogMenuRoles.js b/src/views/Master/MasterRoles/DialogMenuRoles.js index 0606092..6826a8b 100644 --- a/src/views/Master/MasterRoles/DialogMenuRoles.js +++ b/src/views/Master/MasterRoles/DialogMenuRoles.js @@ -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 ( diff --git a/src/views/Master/MasterRoles/index.js b/src/views/Master/MasterRoles/index.js index b4a1066..360b0f3 100644 --- a/src/views/Master/MasterRoles/index.js +++ b/src/views/Master/MasterRoles/index.js @@ -198,7 +198,7 @@ class index extends Component { name: data.name, description: data.description, default_page: data.selectedMenu, - company_id: this.company_id + company_id: data.company_id } const result = await axios.post(ROLE_ADD, formData, this.config) @@ -218,7 +218,8 @@ class index extends Component { const formData = { name: data.name, description: data.description, - default_page: data.selectedMenu + default_page: data.selectedMenu, + company_id: data.company_id } const url = ROLE_EDIT(data.id) const result = await axios.put(url, formData, this.config)