master
sajjad_talkhabi 2 years ago
parent 28d12a38cd
commit 203a4e4cee

@ -104,8 +104,8 @@ export default {
}); });
}, },
chageRole() { chageRole() {
this.$emit("userId", this.user.id);
this.$_openModal("changeRole", { this.$_openModal("changeRole", {
userId: this.user.id,
role: this.user.role_id ? this.user.role_id : null, role: this.user.role_id ? this.user.role_id : null,
roles: this.getRoles, roles: this.getRoles,
}); });

@ -44,17 +44,14 @@
</template> </template>
<template #items="{ item }"> <template #items="{ item }">
<v-col cols="12" class="pb-0"> <v-col cols="12" class="pb-0">
<UserItem :user="item" @userId="userId" /> <UserItem :user="item" />
</v-col> </v-col>
</template> </template>
</data-iterator> </data-iterator>
</div> </div>
<!-- <div class="text-center mt-40 mb-5">
<pagination :pagination="getPaginationUser" @pagination="changePagination" />
</div> -->
</main-back> </main-back>
<div class="text-center"> <div class="text-center">
<ChangeRoleModal :userId="id" v-if="isModal('modal_changeRole')" /><FiltersModal <ChangeRoleModal v-if="isModal('modal_changeRole')" /><FiltersModal
@filter="load" @filter="load"
v-if="isModal('modal_filters')" v-if="isModal('modal_filters')"
/> />
@ -79,7 +76,6 @@ export default {
}, },
data: () => ({ data: () => ({
role: UserStorage.getRole() ? UserStorage.getRole() : null, role: UserStorage.getRole() ? UserStorage.getRole() : null,
id: null,
}), }),
computed: { computed: {
...mapGetters("users", [ ...mapGetters("users", [
@ -111,10 +107,9 @@ export default {
} }
}, },
async load() { async load() {
this.role === "admin" ? await this.loadUsers() : await this.loadTrainerTrainee(); this.role === "admin"
}, ? await this.loadUsers()
userId(id) { : await this.loadTrainerTrainee();
this.id = id;
}, },
}, },
async created() { async created() {

@ -67,23 +67,22 @@ import { mapActions } from "vuex";
import toast from "@/utils/toast"; import toast from "@/utils/toast";
export default { export default {
name: "modal_changeRole", name: "modal_changeRole",
props: {
userId: {},
},
data: () => ({ data: () => ({
role_id: null, role_id: null,
currectRoleId: null, currectRoleId: null,
changeRoleRequestLoading: false, changeRoleRequestLoading: false,
roles: null, roles: null,
user_id: null,
}), }),
computed: { computed: {
form() { form() {
return { userId: this.userId }; return { userId: this.user_id };
}, },
}, },
methods: { methods: {
...mapActions("users", ["updateRole"]), ...mapActions("users", ["updateRole"]),
openModal({ role, roles }) { openModal({ role, roles, userId }) {
this.user_id = userId;
this.roles = { ...roles }; this.roles = { ...roles };
this.currectRoleId = role ? role : 0; this.currectRoleId = role ? role : 0;
this.role_id = role ? role : 0; this.role_id = role ? role : 0;

@ -22,14 +22,10 @@
</v-container> </v-container>
</template> </template>
<script> <script>
import { mapState } from 'vuex';
import UsersHome from "../components/Users/Items"; import UsersHome from "../components/Users/Items";
export default { export default {
components: { components: {
UsersHome, UsersHome,
}, },
computed: {
...mapState('users', ['filters']),
},
}; };
</script> </script>
Loading…
Cancel
Save