@@ -4,7 +4,14 @@
|
||||
<span class="student-lesson-item__decor" aria-hidden="true">
|
||||
<SvgIcon name="users-three" :size="20" color="rgba(0, 112, 116, 0.31)" />
|
||||
</span>
|
||||
<p class="student-lesson-item__title">{{ lesson.title || '—' }}</p>
|
||||
<div>
|
||||
<p class="student-lesson-item__title">{{ lesson.title || '—' }}</p>
|
||||
<div class="student-lesson-item__hours">
|
||||
<SvgIcon name="calendar" :size="11" color="#007074" />
|
||||
<span class="student-lesson-item__hours-label">زمان یادگیری :</span>
|
||||
<span class="student-lesson-item__hours-value">{{ hoursText }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="student-lesson-item__stats">
|
||||
@@ -25,12 +32,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="student-lesson-item__hours">
|
||||
<SvgIcon name="calendar" :size="11" color="#007074" />
|
||||
<span class="student-lesson-item__hours-label">زمان یادگیری :</span>
|
||||
<span class="student-lesson-item__hours-value">{{ hoursText }}</span>
|
||||
</div>
|
||||
|
||||
<div class="student-lesson-item__actions">
|
||||
<BaseButton
|
||||
text="جزئیات درس"
|
||||
@@ -93,7 +94,7 @@ const studentsText = computed(() =>
|
||||
gap: 0.625rem;
|
||||
flex: 1 1 22%;
|
||||
min-width: 0;
|
||||
justify-content: flex-end;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
&__decor {
|
||||
|
||||
@@ -13,9 +13,8 @@
|
||||
<p class="student-term-summary__title">{{ term.title || '—' }}</p>
|
||||
|
||||
<div class="student-term-summary__teacher">
|
||||
<span class="student-term-summary__teacher-label">استـــــــاد:</span>
|
||||
<span class="student-term-summary__teacher-name">{{ teacherName }}</span>
|
||||
<SvgIcon name="user" :size="13" color="#bcbcbc" />
|
||||
<span class="student-term-summary__teacher-label">تعداد دوره ها:</span>
|
||||
<span class="student-term-summary__teacher-name">{{ courseCount }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -36,7 +35,6 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { STUDENT_COURSE_STATUS } from '@/enums'
|
||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||
import { formatJalaaliDate } from '@/utils/date-utils'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -49,11 +47,7 @@ const status = computed(() => props.enrollment.status || 'active')
|
||||
|
||||
const statusLabel = computed(() => STUDENT_COURSE_STATUS[status.value] || '—')
|
||||
|
||||
const teacherName = computed(() => {
|
||||
const t = term.value.teacher
|
||||
if (t) return `${t.firstName || ''} ${t.lastName || ''}`.trim() || t.fullName || '—'
|
||||
return term.value.teacherName || '—'
|
||||
})
|
||||
const courseCount = computed(() => term.value?.coursesCount ?? '—')
|
||||
|
||||
const startDate = computed(() => formatJalaaliDate(term.value.startsAt) || '—')
|
||||
|
||||
|
||||
@@ -19,7 +19,11 @@
|
||||
</template>
|
||||
</SimpleTitleIconBlock>
|
||||
|
||||
<SkeletonLoaderBlock v-if="isLoading && lessons.length === 0" :rows="3" :cols-per-row="1" />
|
||||
<SkeletonLoaderBlock
|
||||
v-if="lessonsLoading && lessons.length === 0"
|
||||
:rows="3"
|
||||
:cols-per-row="1"
|
||||
/>
|
||||
<div v-else-if="lessons.length > 0">
|
||||
<StudentLessonItem
|
||||
v-for="lesson in lessons"
|
||||
@@ -33,11 +37,12 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { computed, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||
import NoItems from '@/components/blocks/NoItems.vue'
|
||||
import { useStudentTermQuery } from '@/services/query/student-terms'
|
||||
import { useStudentCoursesListQuery } from '@/services/query/student-courses'
|
||||
import BoxedIconTitleBlock from '@/components/blocks/BoxedIconTitleBlock.vue'
|
||||
import SkeletonLoaderBlock from '@/components/blocks/SkeletonLoaderBlock.vue'
|
||||
import SimpleTitleIconBlock from '@/components/blocks/SimpleTitleIconBlock.vue'
|
||||
@@ -53,7 +58,15 @@ const { data: enrollment, isLoading } = useStudentTermQuery(termId, {
|
||||
enabled: () => !!termId.value,
|
||||
})
|
||||
|
||||
const lessons = computed(() => enrollment.value?.term?.courses ?? [])
|
||||
const coursesFilters = computed(() => ({ termId: termId.value }))
|
||||
const coursesPagination = ref({ page: 1, perPage: 10 })
|
||||
const { data: coursesData, isLoading: lessonsLoading } = useStudentCoursesListQuery(
|
||||
coursesFilters,
|
||||
coursesPagination,
|
||||
{ enabled: () => !!termId.value, keepPreviousData: true }
|
||||
)
|
||||
|
||||
const lessons = computed(() => coursesData.value?.data?.items ?? [])
|
||||
|
||||
const onShowLesson = (lesson) => {
|
||||
router.push({ name: 'student-lesson-details', params: { id: lesson.id } }).catch(() => {})
|
||||
|
||||
@@ -97,7 +97,6 @@ const { data: endedData, isLoading: endedPending } = useStudentTermsListQuery(
|
||||
|
||||
const currentTerms = computed(() => currentData.value?.data ?? [])
|
||||
const endedTerms = computed(() => endedData.value?.data ?? [])
|
||||
console.log({ endedTerms: endedData.value })
|
||||
|
||||
const currentMeta = computed(() => ({
|
||||
page: currentPagination.value.page,
|
||||
@@ -112,7 +111,7 @@ const endedMeta = computed(() => ({
|
||||
}))
|
||||
|
||||
const onShowDetails = (term) => {
|
||||
router.push({ name: 'student-term-details', params: { id: term.id } }).catch(() => {})
|
||||
router.push({ name: 'student-term-details', params: { id: term?.term?.id } }).catch(() => {})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user