feat(admin): wire up remove-student-from-term button
Deploy banu-front / deploy (push) Successful in 1m46s
Deploy banu-front / deploy (push) Successful in 1m46s
The mutation/API plumbing already existed (useRemoveAdminTermStudentMutation) but no UI ever called it. Adds a delete action to each row in the term details modal's seminarians list, with a confirmation prompt.
This commit is contained in:
@@ -70,6 +70,18 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="term-details__student-actions">
|
||||||
|
<CircleButton
|
||||||
|
tooltip="حذف از ترم"
|
||||||
|
bg-color="rgba(104, 104, 104, 0.05)"
|
||||||
|
size="2.5rem"
|
||||||
|
@click="onAskRemoveStudent(student)"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<SvgIcon name="trash" :size="18" color="var(--color-error)" />
|
||||||
|
</template>
|
||||||
|
</CircleButton>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<NoItems v-else title="متاسفیم" desc="طلبهای برای نمایش وجود ندارد." />
|
<NoItems v-else title="متاسفیم" desc="طلبهای برای نمایش وجود ندارد." />
|
||||||
@@ -130,18 +142,24 @@ import BaseButton from '@/components/BaseButton.vue'
|
|||||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||||
import NoItems from '@/components/blocks/NoItems.vue'
|
import NoItems from '@/components/blocks/NoItems.vue'
|
||||||
import { formatJalaaliDate } from '@/utils/date-utils'
|
import { formatJalaaliDate } from '@/utils/date-utils'
|
||||||
|
import CircleButton from '@/components/CircleButton.vue'
|
||||||
import TabsBlock from '@/components/blocks/TabsBlock.vue'
|
import TabsBlock from '@/components/blocks/TabsBlock.vue'
|
||||||
import { usePagination } from '@/composables/usePagination'
|
import { usePagination } from '@/composables/usePagination'
|
||||||
import LineTitleBlock from '@/components/LineTitleBlock.vue'
|
import LineTitleBlock from '@/components/LineTitleBlock.vue'
|
||||||
import LineInfoBlock from '@/components/blocks/LineInfoBlock.vue'
|
import LineInfoBlock from '@/components/blocks/LineInfoBlock.vue'
|
||||||
import PaginationBlock from '@/components/blocks/PaginationBlock.vue'
|
import PaginationBlock from '@/components/blocks/PaginationBlock.vue'
|
||||||
import SkeletonLoaderBlock from '@/components/blocks/SkeletonLoaderBlock.vue'
|
import SkeletonLoaderBlock from '@/components/blocks/SkeletonLoaderBlock.vue'
|
||||||
import { useAdminTermEnrolleesQuery, useAdminTermQuery } from '@/services/query/admin-terms'
|
|
||||||
import {
|
import {
|
||||||
adminCoursesKeys,
|
adminCoursesKeys,
|
||||||
useAdminCoursesListQuery,
|
useAdminCoursesListQuery,
|
||||||
useUpdateAdminCourseMutation,
|
useUpdateAdminCourseMutation,
|
||||||
} from '@/services/query/admin-courses'
|
} from '@/services/query/admin-courses'
|
||||||
|
import {
|
||||||
|
adminTermsKeys,
|
||||||
|
useAdminTermEnrolleesQuery,
|
||||||
|
useAdminTermQuery,
|
||||||
|
useRemoveAdminTermStudentMutation,
|
||||||
|
} from '@/services/query/admin-terms'
|
||||||
|
|
||||||
defineOptions({ name: 'TermDetailsModal' })
|
defineOptions({ name: 'TermDetailsModal' })
|
||||||
|
|
||||||
@@ -187,6 +205,24 @@ const studentPaginationMeta = computed(() => ({
|
|||||||
|
|
||||||
const studentAvatar = (student) => student.avatarUrl || student.avatarDownloadUrl || ''
|
const studentAvatar = (student) => student.avatarUrl || student.avatarDownloadUrl || ''
|
||||||
|
|
||||||
|
const invalidateStudents = () => queryClient.invalidateQueries({ queryKey: adminTermsKeys.all })
|
||||||
|
|
||||||
|
const removeStudentMutation = useRemoveAdminTermStudentMutation()
|
||||||
|
|
||||||
|
const onAskRemoveStudent = (student) => {
|
||||||
|
openModal('ConfirmModal', {
|
||||||
|
title: `حذف ${student?.user?.name || 'طلبه'}`,
|
||||||
|
message: `بعد از حذف، دسترسی <strong>${
|
||||||
|
student?.user?.name || 'این طلبه'
|
||||||
|
}</strong> به این ترم و محتوای آن قطع میشود. آیا مطمئن هستید؟`,
|
||||||
|
onConfirm: () =>
|
||||||
|
removeStudentMutation.mutate(
|
||||||
|
{ termId: termId.value, userId: student.user.id },
|
||||||
|
{ onSuccess: invalidateStudents }
|
||||||
|
),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const courseFilters = computed(() => ({ termId: termId.value }))
|
const courseFilters = computed(() => ({ termId: termId.value }))
|
||||||
const { pagination: coursePagination, setPage: setCoursePage } = usePagination({
|
const { pagination: coursePagination, setPage: setCoursePage } = usePagination({
|
||||||
page: 1,
|
page: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user