Skip to content
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

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

feat: admin crud #44

wants to merge 18 commits into from

Conversation

HaoNguyen-Ron
Copy link
Collaborator

No description provided.

Copy link

vercel bot commented Nov 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nuxt-template ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 5:16pm

Comment on lines 4 to 5
import { usePermissionStore } from '~/stores/admin/permission'
import type { PivotRolePermission, Role } from '~/stores/admin/role'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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'

Comment on lines 19 to 21
const permissionStore = usePermissionStore()
const { permissionList } = storeToRefs(permissionStore)
const { fetchPermissions } = permissionStore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't destructure it

Suggested change
const permissionStore = usePermissionStore()
const { permissionList } = storeToRefs(permissionStore)
const { fetchPermissions } = permissionStore
const permissionStore = usePermissionStore()

Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await fetchPermissions(queryOptions.value)
await permissionStore.fetchPermissions(queryOptions.value)

// 👉 select all and none
const isSelectAll = computed(() => {
return (
localRoleData.value.permissions?.length === permissionList.value.length
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
localRoleData.value.permissions?.length === permissionList.value.length
formData.value.permissions?.length === permissionData.value.length

permissions: permissions.value,
}
function handleCheckAllPermissions() {
localRoleData.value.permissions = [...permissionList.value]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
localRoleData.value.permissions = [...permissionList.value]
formData.value.permissions = [... permissionData.value]

Comment on lines 171 to 176
<VBtn
:color="isSelectAll ? 'primary' : 'secondary'"
variant="text"
text="All"
@click="handleCheckAllPermissions"
/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
: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">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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">

Comment on lines 3 to 5
import { DRAWER_ACTION_TYPES } from '~/constant/organization'
import type { DrawerConfig } from '~/utils/types'
import type { DrawerActionTypes } from '~/utils/types/landing-page'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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'

const totalPermissions = ref(0)
const permissionDetail = ref<Permission | null>(null)
const permissionDetail = ref<PermissionWithRelations | null>(null)

async function fetchPermissions(options?: ParsedFilterQuery) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return permissions here

@imrim12 imrim12 changed the title Feat/admin crud feat: admin crud Dec 10, 2024
@imrim12 imrim12 force-pushed the main branch 2 times, most recently from 6abc134 to 71bb78e Compare February 9, 2025 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants