-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: admin crud #44
base: main
Are you sure you want to change the base?
feat: admin crud #44
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
import { usePermissionStore } from '~/stores/admin/permission' | ||
import type { PivotRolePermission, Role } from '~/stores/admin/role' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { usePermissionStore } from '~/stores/admin/permission' | |
import type { PivotRolePermission, Role } from '~/stores/admin/role' | |
import { usePermissionStore } from '@base/stores/admin/permission' | |
import type { PivotRolePermission, Role } from '@base/stores/admin/role' |
const permissionStore = usePermissionStore() | ||
const { permissionList } = storeToRefs(permissionStore) | ||
const { fetchPermissions } = permissionStore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't destructure it
const permissionStore = usePermissionStore() | |
const { permissionList } = storeToRefs(permissionStore) | |
const { fetchPermissions } = permissionStore | |
const permissionStore = usePermissionStore() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't store permissions list in store also
if (!isIndeterminate.value) | ||
isSelectAll.value = false | ||
watch(queryOptions.value, async () => { | ||
await fetchPermissions(queryOptions.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await fetchPermissions(queryOptions.value) | |
await permissionStore.fetchPermissions(queryOptions.value) |
// 👉 select all and none | ||
const isSelectAll = computed(() => { | ||
return ( | ||
localRoleData.value.permissions?.length === permissionList.value.length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
localRoleData.value.permissions?.length === permissionList.value.length | |
formData.value.permissions?.length === permissionData.value.length |
permissions: permissions.value, | ||
} | ||
function handleCheckAllPermissions() { | ||
localRoleData.value.permissions = [...permissionList.value] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
localRoleData.value.permissions = [...permissionList.value] | |
formData.value.permissions = [... permissionData.value] |
<VBtn | ||
:color="isSelectAll ? 'primary' : 'secondary'" | ||
variant="text" | ||
text="All" | ||
@click="handleCheckAllPermissions" | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<VBtn | |
:color="isSelectAll ? 'primary' : 'secondary'" | |
variant="text" | |
text="All" | |
@click="handleCheckAllPermissions" | |
/> | |
<VBtn | |
:color="isSelectAll ? 'primary' : 'secondary'" | |
variant="text" | |
@click="handleCheckAllPermissions" | |
> | |
All | |
</VBtn> |
/> | ||
|
||
<VBtn | ||
:color="localRoleData?.permissions?.length === 0 ? 'primary' : 'secondary'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:color="localRoleData?.permissions?.length === 0 ? 'primary' : 'secondary'" | |
:color="formData?.permissions?.length ? 'secondary' : 'primary'" |
</VTable> | ||
<!-- 👉 Role Permissions --> | ||
<div class="mt-6 d-flex flex-wrap gap-3 permission-container"> | ||
<div v-for="permission in permissionList" :key="permission.id" class="d-flex align-center gap-2 flex-wrap"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div v-for="permission in permissionList" :key="permission.id" class="d-flex align-center gap-2 flex-wrap"> | |
<div v-for="permission in permissionData" :key="permission.id" class="d-flex align-center gap-2 flex-wrap"> |
app/pages/test-organization.vue
Outdated
import { DRAWER_ACTION_TYPES } from '~/constant/organization' | ||
import type { DrawerConfig } from '~/utils/types' | ||
import type { DrawerActionTypes } from '~/utils/types/landing-page' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { DRAWER_ACTION_TYPES } from '~/constant/organization' | |
import type { DrawerConfig } from '~/utils/types' | |
import type { DrawerActionTypes } from '~/utils/types/landing-page' | |
import { DRAWER_ACTION_TYPES } from '@base/constant/organization' | |
import type { DrawerConfig } from '@base/utils/types' | |
import type { DrawerActionTypes } from '@base/utils/types/landing-page' |
app/stores/admin/permission.ts
Outdated
const totalPermissions = ref(0) | ||
const permissionDetail = ref<Permission | null>(null) | ||
const permissionDetail = ref<PermissionWithRelations | null>(null) | ||
|
||
async function fetchPermissions(options?: ParsedFilterQuery) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return permissions here
c489538
to
9cb46a6
Compare
9cf0f08
to
b7d7055
Compare
ae6b9f7
to
c6e97f2
Compare
6abc134
to
71bb78e
Compare
No description provided.