|
|
@@ -4,7 +4,7 @@ import { CommonModule } from '@angular/common';
|
|
|
import { ChangeDetectionStrategy, Component, computed, inject, NgZone, OnDestroy, OnInit, signal } from '@angular/core';
|
|
|
import { FormsModule } from '@angular/forms';
|
|
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
|
-import { AlertCircle, BarChart3, BookOpen, CalendarDays, ChevronDown, ChevronRight, GraduationCap, LoaderCircle, LucideAngularModule, Search, X } from 'lucide-angular';
|
|
|
+import { AlertCircle, BarChart3, BookOpen, CalendarDays, ChevronDown, ChevronRight, GraduationCap, LoaderCircle, LucideAngularModule, Users, X } from 'lucide-angular';
|
|
|
import { catchError, finalize, map, of, Subscription, switchMap } from 'rxjs';
|
|
|
import { allFeeRows, lessonFeeSummary } from '../../core/fee-summary';
|
|
|
import { HomeDailyCacheService } from '../../core/home-daily-cache.service';
|
|
|
@@ -84,7 +84,6 @@ export class CourseCenterPageComponent implements OnInit, OnDestroy {
|
|
|
readonly feeSummaryError = signal('');
|
|
|
readonly earningsSummary = signal<{amount:number;pendingCount:number}|null>(null);
|
|
|
readonly historyMonth = signal('all');
|
|
|
- readonly historyStudentQuery = signal('');
|
|
|
readonly calendarMonth = signal(this.firstOfMonth(new Date()));
|
|
|
readonly loading = signal(false);
|
|
|
readonly liveChecking = signal(false);
|
|
|
@@ -93,8 +92,9 @@ export class CourseCenterPageComponent implements OnInit, OnDestroy {
|
|
|
readonly syncNoticeVisible = signal(false);
|
|
|
readonly error = signal('');
|
|
|
readonly studentOptions = computed(() => this.serverStudents().map(student => ({...student, id: String(student.id), name: String(student.name || '').trim() || `学员 ${student.id}`})));
|
|
|
+ readonly historyStudentName = computed(() => this.studentOptions().find(student => student.id === this.selectedStudent())?.name || '全部学员');
|
|
|
readonly historyMonthOptions = computed(() => this.buildHistoryMonthOptions());
|
|
|
- readonly historyFilterActive = computed(() => this.historyMonth() !== 'all' || Boolean(this.historyStudentQuery().trim()));
|
|
|
+ readonly historyFilterActive = computed(() => this.historyMonth() !== 'all' || this.selectedStudent() !== 'all');
|
|
|
readonly scopedSchedules = computed(() => this.schedules().filter((item) => this.matchesStudent(item)));
|
|
|
readonly filteredSchedulePool = computed(() => this.scopedSchedules().filter((item) => this.matchesStatus(item)));
|
|
|
readonly visibleSchedules = computed(() => this.filteredSchedulePool().filter((item) => this.matchesRange(item) && this.matchesHistoryFilters(item)));
|
|
|
@@ -107,7 +107,7 @@ export class CourseCenterPageComponent implements OnInit, OnDestroy {
|
|
|
if (this.scheduleRange() === 'week') return `${this.selectedDate()} 所在周`;
|
|
|
return this.selectedDate();
|
|
|
});
|
|
|
- readonly icons = { AlertCircle, BarChart3, BookOpen, CalendarDays, ChevronDown, ChevronRight, GraduationCap, LoaderCircle, Search, X };
|
|
|
+ readonly icons = { AlertCircle, BarChart3, BookOpen, CalendarDays, ChevronDown, ChevronRight, GraduationCap, LoaderCircle, Users, X };
|
|
|
|
|
|
private readonly api = inject(ApiService);
|
|
|
private readonly dailyCache = inject(HomeDailyCacheService);
|
|
|
@@ -176,7 +176,7 @@ export class CourseCenterPageComponent implements OnInit, OnDestroy {
|
|
|
uid,
|
|
|
mode: this.isCoach ? 'coach' : 'student',
|
|
|
history: this.isHistory,
|
|
|
- page:this.listPage(),pageSize:20,studentId:this.selectedStudent()==='all'?undefined:this.selectedStudent(),filter:this.scheduleFilter(),month:this.historyMonth()==='all'?undefined:this.historyMonth(),search:this.historyStudentQuery(),
|
|
|
+ page:this.listPage(),pageSize:20,studentId:this.selectedStudent()==='all'?undefined:this.selectedStudent(),filter:this.scheduleFilter(),month:this.historyMonth()==='all'?undefined:this.historyMonth(),
|
|
|
dateStart:this.isHistory||this.scheduleRange()==='all'?undefined:this.scheduleRange()==='week'?this.weekRange(this.selectedDate())[0]:this.selectedDate(),
|
|
|
dateEnd:this.isHistory||this.scheduleRange()==='all'?undefined:this.scheduleRange()==='week'?this.weekRange(this.selectedDate())[1]:this.selectedDate(),
|
|
|
rangeStart: range?.start,
|
|
|
@@ -353,11 +353,9 @@ export class CourseCenterPageComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
setHistoryMonth(value: string): void { this.historyMonth.set(value || 'all'); this.load(); }
|
|
|
|
|
|
- setHistoryStudentQuery(value: string): void { this.historyStudentQuery.set(value); this.load(); }
|
|
|
-
|
|
|
clearHistoryFilters(): void {
|
|
|
this.historyMonth.set('all');
|
|
|
- this.historyStudentQuery.set('');
|
|
|
+ this.selectedStudent.set('all');
|
|
|
this.load();
|
|
|
}
|
|
|
|
|
|
@@ -560,8 +558,7 @@ export class CourseCenterPageComponent implements OnInit, OnDestroy {
|
|
|
if (!this.isHistory) return true;
|
|
|
const selectedMonth = this.historyMonth();
|
|
|
if (selectedMonth !== 'all' && !this.itemDate(item).startsWith(`${selectedMonth}-`)) return false;
|
|
|
- const query = this.historyStudentQuery().trim().toLocaleLowerCase('zh-CN');
|
|
|
- return !query || this.studentName(item).toLocaleLowerCase('zh-CN').includes(query);
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
private sortedVisibleSchedules(): Item[] {
|