From 2aa99119e289423d1d137f8a7087c4269324fdc3 Mon Sep 17 00:00:00 2001 From: Kavehhn174 Date: Sun, 16 Aug 2026 08:11:42 +0330 Subject: [PATCH] feat: improve filters and class pricing controls in dashboard Add session class filter, distinct partial payment tag, richer notifications list, class discount/frontend toggles, and remove unused course discount column. --- src/components/common/StatusTag.vue | 2 +- src/views/classes/ClassFormView.vue | 59 +++++++++++++++- src/views/courses/CourseListView.vue | 7 -- .../notifications/NotificationListView.vue | 67 +++++++++++++++---- src/views/sessions/SessionListView.vue | 40 +++++++++-- 5 files changed, 147 insertions(+), 28 deletions(-) diff --git a/src/components/common/StatusTag.vue b/src/components/common/StatusTag.vue index 72ef625..2a6ebb4 100644 --- a/src/components/common/StatusTag.vue +++ b/src/components/common/StatusTag.vue @@ -54,7 +54,7 @@ const severity = computed(() => { if (props.type === 'payment') { if (val === 'paid' || val === 'تسویه شده' || val === 'تسویه‌شده') return 'success'; - if (val === 'partial' || val === 'پرداخت جزئی') return 'warning'; + if (val === 'partial' || val === 'پرداخت جزئی') return 'contrast'; if (val === 'pending' || val === 'در انتظار پرداخت') return 'info'; if (val === 'overdue' || val === 'معوق شده' || val === 'معوق') return 'danger'; } diff --git a/src/views/classes/ClassFormView.vue b/src/views/classes/ClassFormView.vue index 06a8c43..5c38788 100644 --- a/src/views/classes/ClassFormView.vue +++ b/src/views/classes/ClassFormView.vue @@ -40,6 +40,31 @@ +
+ + +
+ +
+
+
+ + +
+
+
+ + +
+
+ + شهریه نهایی: {{ toPersianDigits(finalTuitionFee.toLocaleString()) }} تومان + +
+
+
+
+
@@ -50,9 +75,19 @@
-
- - +
+
+ + +
+
+ +
+
+ + +
+ مستقل از «فعال بودن» — کلاس غیرفعال می‌تواند در سایت پنهان یا نمایش داده شود.
@@ -259,6 +294,10 @@ const form = reactive({ professor: null, capacity: 20, tuitionFee: 0, + hasDiscount: false, + discount: 0, + freeSpots: null, + showOnFrontend: true, startDate: '', endDate: '', days: [], @@ -269,6 +308,12 @@ const form = reactive({ }); const weekdays = WEEKDAYS; +const finalTuitionFee = computed(() => { + const tuition = Number(form.tuitionFee) || 0; + if (!form.hasDiscount) return tuition; + return Math.max(0, tuition - (Number(form.discount) || 0)); +}); + const removeDialogMessage = computed(() => { const name = studentToRemove.value?.name; return name @@ -346,6 +391,10 @@ const fetchData = async () => { professor: data.professor?._id || data.professor || null, capacity: data.capacity || 20, tuitionFee: data.tuitionFee || 0, + hasDiscount: Boolean(data.hasDiscount), + discount: data.discount || 0, + freeSpots: data.freeSpots ?? null, + showOnFrontend: data.showOnFrontend !== false, startDate: toJalaliDisplay(data.startDate), endDate: toJalaliDisplay(data.endDate), days: Array.isArray(data.days) ? data.days.map(Number).filter((day) => day >= 0 && day <= 6) : [], @@ -385,6 +434,10 @@ const handleSubmit = async () => { professor: form.professor || undefined, capacity: form.capacity, tuitionFee: form.tuitionFee, + hasDiscount: form.hasDiscount, + discount: form.hasDiscount ? form.discount : 0, + freeSpots: form.freeSpots, + showOnFrontend: form.showOnFrontend, startDate: toGregorianIso(form.startDate), endDate: toGregorianIso(form.endDate), days: form.days || [], diff --git a/src/views/courses/CourseListView.vue b/src/views/courses/CourseListView.vue index a2717e2..8c8e7ea 100644 --- a/src/views/courses/CourseListView.vue +++ b/src/views/courses/CourseListView.vue @@ -45,13 +45,6 @@ - - - - - + - + + + + + - + - + + + + + + + + + + + + + + + + + @@ -52,7 +85,7 @@