Browse Source

update filter by company and project

pull/2/head
farhantock 1 year ago
parent
commit
676ebfcce1
  1. 8
      src/views/Master/MasterRoles/DialogForm.js
  2. 7
      src/views/Master/MasterRoles/DialogMenuRoles.js
  3. 5
      src/views/Master/MasterRoles/index.js

8
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);
}

7
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 (

5
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)

Loading…
Cancel
Save