@@ -21,11 +21,11 @@
|
||||
<div class="verification-item__date">
|
||||
<span class="verification-item__date-label">تاریخ ثبت نام:</span>
|
||||
<span class="verification-item__date-value">
|
||||
{{ user.faSubmittedAt || formatJalaaliDate(user.submittedAt) || '—' }}
|
||||
{{ formatJalaaliDate(user.createdAt) || '—' }}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="user.status === 'pending'"
|
||||
v-if="user.status === 'verified'"
|
||||
class="verification-item__badge verification-item__badge--pending"
|
||||
>
|
||||
<span class="verification-item__dot" />
|
||||
@@ -92,9 +92,7 @@ const props = defineProps({
|
||||
|
||||
const emit = defineEmits(['show-details', 'show-reject-reason', 'verify-user'])
|
||||
|
||||
const fullName = computed(
|
||||
() => `${props.user.firstName || ''} ${props.user.lastName || ''}`.trim() || '—'
|
||||
)
|
||||
const fullName = computed(() => `${props.user.name || ''}`.trim() || '—')
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -77,15 +77,12 @@ import TextField from '@/components/form/TextField.vue'
|
||||
import { rejectionReasonSchema } from '../../../schema'
|
||||
import SelectField from '@/components/form/SelectField.vue'
|
||||
import TextareaField from '@/components/form/TextareaField.vue'
|
||||
import {
|
||||
adminPendingStudentsKeys,
|
||||
useChangePendingStudentStatusMutation,
|
||||
} from '@/services/query/admin-pending-students'
|
||||
import { adminUsersKeys, useChangeAdminUserStatusMutation } from '@/services/query/admin-users'
|
||||
|
||||
defineOptions({ name: 'RejectReasonModal' })
|
||||
|
||||
const queryClient = useQueryClient()
|
||||
const changeStatusMutation = useChangePendingStudentStatusMutation()
|
||||
const changeStatusMutation = useChangeAdminUserStatusMutation()
|
||||
|
||||
const DEFAULT_FORM = { rejectionReason: '', adminNote: '' }
|
||||
|
||||
@@ -105,16 +102,14 @@ const handleChange = (key, value) => {
|
||||
|
||||
const onSubmit = async (data, close) => {
|
||||
const { isValid, payload } = await validate(form.value)
|
||||
console.log(errors)
|
||||
|
||||
if (!isValid) return
|
||||
const id = data?.id
|
||||
if (!id) return
|
||||
await changeStatusMutation.mutateAsync({
|
||||
id,
|
||||
payload: { status: 'rejected', ...payload },
|
||||
payload: { status: 'blocked', ...payload },
|
||||
})
|
||||
await queryClient.invalidateQueries({ queryKey: adminPendingStudentsKeys.all })
|
||||
await queryClient.invalidateQueries({ queryKey: adminUsersKeys.all })
|
||||
form.value = structuredClone({ ...DEFAULT_FORM })
|
||||
resetErrors()
|
||||
close()
|
||||
|
||||
+4
-49
@@ -7,7 +7,7 @@
|
||||
min-width="auto"
|
||||
:show-close-button="true"
|
||||
>
|
||||
<template #default="{ data, close }">
|
||||
<template #default>
|
||||
<div v-if="!user" class="user-verification-details">
|
||||
<p class="user-verification-details__loading">در حال بارگذاری…</p>
|
||||
</div>
|
||||
@@ -203,39 +203,19 @@
|
||||
class="user-verification-details__video"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<div class="user-verification-details__divider" />
|
||||
|
||||
<div class="user-verification-details__actions">
|
||||
<BaseButton
|
||||
text="ذخیره به صورت PDF"
|
||||
:loading="pdfLoading"
|
||||
custom-class="user-verification-details__pdf-btn"
|
||||
@click="onSaveAsPdf(data, close)"
|
||||
>
|
||||
<template #appendIcon>
|
||||
<SvgIcon name="arrow-left" :size="18" color="#fff" />
|
||||
</template>
|
||||
</BaseButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed } from 'vue'
|
||||
import useModal from '@/composables/useModal'
|
||||
import BasicModal from '@/components/BasicModal.vue'
|
||||
import BaseButton from '@/components/BaseButton.vue'
|
||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||
import { formatJalaaliDate } from '@/utils/date-utils'
|
||||
import LineTitleBlock from '@/components/LineTitleBlock.vue'
|
||||
import { useAdminUserQuery } from '@/services/query/admin-users'
|
||||
import LineInfoBlock from '@/components/blocks/LineInfoBlock.vue'
|
||||
import {
|
||||
usePendingStudentQuery,
|
||||
useDownloadPendingStudentPdfMutation,
|
||||
} from '@/services/query/admin-pending-students'
|
||||
import {
|
||||
AUDIENCE_CONFLICT_RESPONSE,
|
||||
COMPETING_PROPAGATOR_RESPONSE,
|
||||
@@ -258,7 +238,7 @@ const modalData = computed(() => getModal('UserVerificationDetailsModal')?.data
|
||||
const userId = computed(() => modalData.value.id ?? null)
|
||||
const userIdRef = computed(() => userId.value)
|
||||
|
||||
const { data: fetched } = usePendingStudentQuery(userIdRef, {
|
||||
const { data: fetched } = useAdminUserQuery(userIdRef, {
|
||||
enabled: () => !!userIdRef.value,
|
||||
})
|
||||
|
||||
@@ -293,31 +273,6 @@ const faithProduction = computed(() =>
|
||||
const leaderMessage = computed(() =>
|
||||
verificationMedia.value.find((m) => m.type === VERIFICATION_MEDIA_TYPE.LEADER_MESSAGE)
|
||||
)
|
||||
|
||||
const pdfLoading = ref(false)
|
||||
const pdfMutation = useDownloadPendingStudentPdfMutation()
|
||||
|
||||
const onSaveAsPdf = async (data, close) => {
|
||||
if (!user.value?.id) return
|
||||
pdfLoading.value = true
|
||||
try {
|
||||
const response = await pdfMutation.mutateAsync(user.value.id)
|
||||
const url = response?.data?.downloadUrl || response?.downloadUrl
|
||||
if (url) {
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.target = '_blank'
|
||||
link.download = 'profile.pdf'
|
||||
document.body.append(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
}
|
||||
close()
|
||||
} finally {
|
||||
pdfLoading.value = false
|
||||
}
|
||||
data
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user