diff --git a/Frontend-Learner/components/discovery/CategorySidebar.vue b/Frontend-Learner/components/discovery/CategorySidebar.vue index 213bd8a2..0065fd90 100644 --- a/Frontend-Learner/components/discovery/CategorySidebar.vue +++ b/Frontend-Learner/components/discovery/CategorySidebar.vue @@ -23,129 +23,80 @@ const getLocalizedText = (text: any) => { const currentLocale = locale.value as 'th' | 'en'; return text[currentLocale] || text.th || text.en || ""; }; +const toggleCategory = (id: number) => { + const current = [...props.modelValue]; + const index = current.indexOf(id); + if (index > -1) { + current.splice(index, 1); + } else { + current.push(id); + } + emit("update:modelValue", current); +}; - - diff --git a/Frontend-Learner/pages/browse/discovery.vue b/Frontend-Learner/pages/browse/discovery.vue index 9fb57233..893f6bd8 100644 --- a/Frontend-Learner/pages/browse/discovery.vue +++ b/Frontend-Learner/pages/browse/discovery.vue @@ -34,14 +34,13 @@ const totalPages = ref(1); const itemsPerPage = 12; -const { t } = useI18n(); +const { t, locale } = useI18n(); const { currentUser } = useAuth(); const { fetchCategories } = useCategory(); const { fetchCourses, fetchCourseById, enrollCourse, getLocalizedText } = useCourse(); - // 2. Computed Properties -const sortOption = ref(computed(() => t('discovery.sortRecent'))); +const sortOption = ref(t('discovery.sortRecent')); const sortOptions = computed(() => [t('discovery.sortRecent')]); const filteredCourses = computed(() => { diff --git a/Frontend-Learner/pages/course/[id].vue b/Frontend-Learner/pages/course/[id].vue index 5a694db8..8b41d9af 100644 --- a/Frontend-Learner/pages/course/[id].vue +++ b/Frontend-Learner/pages/course/[id].vue @@ -13,6 +13,7 @@ definePageMeta({ const route = useRoute() // ดึง courseId จาก URL params (แปลงเป็น integer) const courseId = computed(() => parseInt(route.params.id as string)) +const { currentUser } = useAuth() const { fetchCourseById, enrollCourse, getLocalizedText } = useCourse() // ใช้ useAsyncData ดึงข้อมูลคอร์ส Server-side rendering (SSR) @@ -65,85 +66,13 @@ useHead({
-
- -
-
-
- -
-
- -

{{ getLocalizedText(course.title) }}

- -
-

{{ getLocalizedText(course.description) }}

-
- -
-

- - {{ $t('course.courseContent') }} -

- -
-
-
- {{ getLocalizedText(chapter.title) }} - - {{ chapter.lessons ? chapter.lessons.length : 0 }} {{ $t('course.lessons') }} - -
- -
-
-
- - {{ Number(lIdx) + 1 }} - - {{ getLocalizedText(lesson.title) }} -
- {{ lesson.duration_minutes || 0 }}:00 -
-
-
-
- -
-

{{ $t('course.noContent') }}

-
-
-
- -
-
-
- {{ course.original_price }} -
-

{{ course.is_free ? 'ฟรี' : course.price }}

-
-
- - - -
-
- {{ $t('course.certificate') }} - {{ course.have_certificate ? $t('course.available') : '-' }} -
- -
- -
-
- +
+