@@ -0,0 +1,4 @@
|
||||
import { http } from '@/services/api/http'
|
||||
import { endpoints } from '@/services/api/endpoints'
|
||||
|
||||
export const apiGetAdminDashboard = () => http.get(endpoints.getAdminDashboard)
|
||||
@@ -0,0 +1,4 @@
|
||||
import { http } from '@/services/api/http'
|
||||
import { endpoints } from '@/services/api/endpoints'
|
||||
|
||||
export const apiGetCounselorDashboard = () => http.get(endpoints.getCounselorDashboard)
|
||||
@@ -28,6 +28,7 @@ export const endpoints = {
|
||||
// (/courses, /sessions/:id, /exams/:id, /exams/:id/submit) — the backend
|
||||
// infers role from the auth token and scopes the response. Terms have a
|
||||
// dedicated student route (returns the membership row with the nested term).
|
||||
getStudentDashboard: '/student/dashboard',
|
||||
getStudentTerms: '/student/my-terms',
|
||||
showStudentTerm: '/student/my-terms/:id',
|
||||
getStudentExamResults: '/student/exam-results',
|
||||
@@ -46,6 +47,12 @@ export const endpoints = {
|
||||
getStudentCertificates: '/student/certificates',
|
||||
downloadStudentCertificate: '/student/certificates/:id/download',
|
||||
|
||||
// ─── Per-role aggregated dashboards ────────────────────────────────────────
|
||||
// Each requires the matching role's token; backend scopes the payload.
|
||||
getAdminDashboard: '/admin/dashboard',
|
||||
getCounselorDashboard: '/counselor/dashboard',
|
||||
getMissionaryDashboard: '/missionary/dashboard',
|
||||
|
||||
// ─── Admin: users (out of scope of the Terms/Courses backend doc) ──────────
|
||||
getPendingStudents: '/admin/pending-students',
|
||||
showPendingStudent: '/admin/pending-students/:id',
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import { http } from '@/services/api/http'
|
||||
import { endpoints } from '@/services/api/endpoints'
|
||||
|
||||
export const apiGetMissionaryDashboard = () => http.get(endpoints.getMissionaryDashboard)
|
||||
@@ -0,0 +1,4 @@
|
||||
import { http } from '@/services/api/http'
|
||||
import { endpoints } from '@/services/api/endpoints'
|
||||
|
||||
export const apiGetStudentDashboard = () => http.get(endpoints.getStudentDashboard)
|
||||
@@ -0,0 +1,45 @@
|
||||
export const adminDashboard = {
|
||||
profile: {
|
||||
id: 1,
|
||||
name: 'سید احمد علیزاده',
|
||||
avatarUrl: null,
|
||||
province: 'قم',
|
||||
city: 'قم',
|
||||
role: 'admin',
|
||||
roles: ['admin'],
|
||||
accessLevel: 'full',
|
||||
openTickets: 32,
|
||||
},
|
||||
stats: {
|
||||
activeUsers: 11_000,
|
||||
totalUsers: 11_540,
|
||||
coursesCreated: 6,
|
||||
coursesSold: 12,
|
||||
},
|
||||
recentRegistrations: [
|
||||
{
|
||||
id: 210,
|
||||
name: 'علیرضا محمدی',
|
||||
avatarUrl: null,
|
||||
registeredAt: '2021-10-11T08:30:00+00:00',
|
||||
},
|
||||
],
|
||||
recentAdviseRequests: [
|
||||
{
|
||||
id: 88,
|
||||
studentId: 205,
|
||||
studentName: 'حسین رضایی',
|
||||
subject: 'درخواست مشاوره',
|
||||
createdAt: '2021-10-11T08:30:00+00:00',
|
||||
},
|
||||
],
|
||||
recentServiceRequests: [
|
||||
{
|
||||
id: 91,
|
||||
studentId: 207,
|
||||
studentName: 'پوریا محسنی',
|
||||
subject: 'درخواست خدمات',
|
||||
createdAt: '2021-10-11T08:30:00+00:00',
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
export const counselorDashboard = {
|
||||
profile: {
|
||||
id: 6,
|
||||
name: 'زهرا مشاور',
|
||||
avatarUrl: null,
|
||||
province: 'قم',
|
||||
city: 'قم',
|
||||
role: 'counselor',
|
||||
membershipDays: 90,
|
||||
},
|
||||
stats: {
|
||||
openTickets: 12,
|
||||
answeredTickets: 8,
|
||||
closedTickets: 40,
|
||||
totalTickets: 60,
|
||||
assignedToMe: 9,
|
||||
},
|
||||
recentTickets: [
|
||||
{
|
||||
id: 88,
|
||||
studentId: 205,
|
||||
studentName: 'حسین رضایی',
|
||||
subject: 'درخواست مشاوره',
|
||||
status: 'open',
|
||||
createdAt: '2021-10-11T08:30:00+00:00',
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
export const missionaryDashboard = {
|
||||
profile: {
|
||||
id: 14,
|
||||
name: 'علی مبلغ',
|
||||
avatarUrl: null,
|
||||
province: 'قم',
|
||||
city: 'قم',
|
||||
role: 'missionary',
|
||||
membershipDays: 120,
|
||||
},
|
||||
stats: {
|
||||
totalRequests: 8,
|
||||
pendingRequests: 2,
|
||||
acceptedRequests: 5,
|
||||
rejectedRequests: 1,
|
||||
unassignedRequests: 3,
|
||||
memoriesCount: 4,
|
||||
completedTerms: 3,
|
||||
},
|
||||
recentRequests: [
|
||||
{
|
||||
id: 20,
|
||||
title: 'جلسه مطالعه کتاب',
|
||||
subject: 'مطالعه گروهی',
|
||||
status: 'pending',
|
||||
requesterName: 'احمد رضایی',
|
||||
createdAt: '2021-10-11T08:30:00+00:00',
|
||||
},
|
||||
],
|
||||
recentMemories: [
|
||||
{
|
||||
id: 7,
|
||||
title: 'اولین سفر تبلیغی',
|
||||
createdAt: '2021-10-11T08:30:00+00:00',
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
export const studentDashboard = {
|
||||
profile: {
|
||||
id: 5,
|
||||
name: 'سید احمد علیزاده',
|
||||
avatarUrl: null,
|
||||
province: 'قم',
|
||||
city: 'قم',
|
||||
membershipDays: 23,
|
||||
},
|
||||
stats: {
|
||||
hoursSpent: 25,
|
||||
enrolledTerms: 6,
|
||||
attendedSessions: 12,
|
||||
completedCourses: 12,
|
||||
activeCourses: 5,
|
||||
},
|
||||
lastEnrolledCourse: {
|
||||
courseId: 18,
|
||||
title: 'دوره تاریخچه ایران قدیم',
|
||||
startsAt: '2021-10-11T08:30:00+00:00',
|
||||
endsAt: '2022-02-04T08:30:00+00:00',
|
||||
teacher: {
|
||||
id: 1,
|
||||
name: 'علیرضا حسینی',
|
||||
avatarUrl: null,
|
||||
},
|
||||
},
|
||||
lastWatchedSession: {
|
||||
sessionId: 42,
|
||||
title: 'جلسه بیست و دوم',
|
||||
sessionNumber: 22,
|
||||
courseTitle: 'دوره تخصصی تربیت مبلغ بینالملل',
|
||||
teacher: {
|
||||
id: 1,
|
||||
name: 'علیرضا حسینی',
|
||||
},
|
||||
watchedAt: '2021-10-11T08:30:00+00:00',
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { register } from '@/services/mock/registry'
|
||||
import { endpoints } from '@/services/api/endpoints'
|
||||
import { adminDashboard } from '@/services/mock/fixtures/admin-dashboard'
|
||||
|
||||
register('GET', endpoints.getAdminDashboard, () => ({ data: adminDashboard }))
|
||||
@@ -0,0 +1,5 @@
|
||||
import { register } from '@/services/mock/registry'
|
||||
import { endpoints } from '@/services/api/endpoints'
|
||||
import { counselorDashboard } from '@/services/mock/fixtures/counselor-dashboard'
|
||||
|
||||
register('GET', endpoints.getCounselorDashboard, () => ({ data: counselorDashboard }))
|
||||
@@ -0,0 +1,5 @@
|
||||
import { register } from '@/services/mock/registry'
|
||||
import { endpoints } from '@/services/api/endpoints'
|
||||
import { missionaryDashboard } from '@/services/mock/fixtures/missionary-dashboard'
|
||||
|
||||
register('GET', endpoints.getMissionaryDashboard, () => ({ data: missionaryDashboard }))
|
||||
@@ -0,0 +1,5 @@
|
||||
import { register } from '@/services/mock/registry'
|
||||
import { endpoints } from '@/services/api/endpoints'
|
||||
import { studentDashboard } from '@/services/mock/fixtures/student-dashboard'
|
||||
|
||||
register('GET', endpoints.getStudentDashboard, () => ({ data: studentDashboard }))
|
||||
@@ -0,0 +1,13 @@
|
||||
import { useQuery } from '@tanstack/vue-query'
|
||||
import { apiGetAdminDashboard } from '@/services/api/admin-dashboard'
|
||||
|
||||
export const adminDashboardKeys = {
|
||||
all: ['admin', 'dashboard'],
|
||||
}
|
||||
|
||||
export const useAdminDashboardQuery = (options = {}) =>
|
||||
useQuery({
|
||||
queryKey: adminDashboardKeys.all,
|
||||
queryFn: apiGetAdminDashboard,
|
||||
...options,
|
||||
})
|
||||
@@ -0,0 +1,13 @@
|
||||
import { useQuery } from '@tanstack/vue-query'
|
||||
import { apiGetCounselorDashboard } from '@/services/api/counselor-dashboard'
|
||||
|
||||
export const counselorDashboardKeys = {
|
||||
all: ['counselor', 'dashboard'],
|
||||
}
|
||||
|
||||
export const useCounselorDashboardQuery = (options = {}) =>
|
||||
useQuery({
|
||||
queryKey: counselorDashboardKeys.all,
|
||||
queryFn: apiGetCounselorDashboard,
|
||||
...options,
|
||||
})
|
||||
@@ -0,0 +1,13 @@
|
||||
import { useQuery } from '@tanstack/vue-query'
|
||||
import { apiGetMissionaryDashboard } from '@/services/api/missionary-dashboard'
|
||||
|
||||
export const missionaryDashboardKeys = {
|
||||
all: ['missionary', 'dashboard'],
|
||||
}
|
||||
|
||||
export const useMissionaryDashboardQuery = (options = {}) =>
|
||||
useQuery({
|
||||
queryKey: missionaryDashboardKeys.all,
|
||||
queryFn: apiGetMissionaryDashboard,
|
||||
...options,
|
||||
})
|
||||
@@ -0,0 +1,13 @@
|
||||
import { useQuery } from '@tanstack/vue-query'
|
||||
import { apiGetStudentDashboard } from '@/services/api/student-dashboard'
|
||||
|
||||
export const studentDashboardKeys = {
|
||||
all: ['student', 'dashboard'],
|
||||
}
|
||||
|
||||
export const useStudentDashboardQuery = (options = {}) =>
|
||||
useQuery({
|
||||
queryKey: studentDashboardKeys.all,
|
||||
queryFn: apiGetStudentDashboard,
|
||||
...options,
|
||||
})
|
||||
Reference in New Issue
Block a user