Dashboard und Schnellnavigation fix
This commit is contained in:
@@ -56,6 +56,7 @@ public partial class DashboardViewModel : ObservableObject
|
||||
[ObservableProperty] private string _currentSchoolYear = "";
|
||||
[ObservableProperty] private DateOnly _calendarMonth = FirstOfMonth(DateTime.Today);
|
||||
[ObservableProperty] private string _selectedDayLabel = "";
|
||||
[ObservableProperty] private DateOnly _selectedCalendarDate = DateOnly.FromDateTime(DateTime.Today);
|
||||
[ObservableProperty] private bool _isDashboardSettingsOpen;
|
||||
[ObservableProperty] private bool _isWeatherPanelVisible;
|
||||
[ObservableProperty] private string _weatherSummary = "";
|
||||
@@ -196,7 +197,7 @@ public partial class DashboardViewModel : ObservableObject
|
||||
IsHighPriority = t.Priority == TaskPriority.High });
|
||||
|
||||
CurrentGroups.Clear();
|
||||
foreach (var g in groups.Values.OrderBy(g => g.Name))
|
||||
foreach (var g in groups.Values)
|
||||
CurrentGroups.Add(new()
|
||||
{
|
||||
GroupId = g.Id,
|
||||
@@ -749,9 +750,35 @@ public partial class DashboardViewModel : ObservableObject
|
||||
{
|
||||
if (day is null) return;
|
||||
foreach (var cell in CalendarDays) cell.IsSelected = cell == day;
|
||||
SelectedCalendarDate = day.Date;
|
||||
SelectedDayLabel = day.Date.ToString("dddd, d. MMMM", De);
|
||||
SelectedDayEvents.Clear();
|
||||
foreach (var item in day.Events) SelectedDayEvents.Add(item);
|
||||
SortCurrentGroups(day.Date);
|
||||
}
|
||||
|
||||
private void SortCurrentGroups(DateOnly date)
|
||||
{
|
||||
var schoolHolidays = _schoolHolidays.GetAll();
|
||||
var publicHolidays = _publicHolidays.GetHolidays(date.Year, _calendarSettings.State)
|
||||
.Select(h => h.Date).ToHashSet();
|
||||
var isFreeDay = IsFreeDay(date, schoolHolidays, publicHolidays);
|
||||
var cancelledPeriods = _substitutions.GetByDate(date)
|
||||
.Where(s => s.Kind == SubstitutionKind.Cancelled)
|
||||
.Select(s => s.PeriodNumber).ToHashSet();
|
||||
|
||||
foreach (var chip in CurrentGroups)
|
||||
{
|
||||
var hasLesson = _lessons.GetByGroupAndDate(chip.GroupId, date).Count > 0;
|
||||
var hasActiveSlot = !isFreeDay && _timetableSlots.GetByGroup(chip.GroupId)
|
||||
.Any(s => s.Weekday == date.DayOfWeek && !cancelledPeriods.Contains(s.PeriodNumber));
|
||||
chip.IsOnSelectedDay = hasLesson || hasActiveSlot;
|
||||
}
|
||||
|
||||
var sorted = CurrentGroups.OrderByDescending(g => g.IsOnSelectedDay)
|
||||
.ThenBy(g => g.Name, StringComparer.CurrentCultureIgnoreCase).ToList();
|
||||
CurrentGroups.Clear();
|
||||
foreach (var chip in sorted) CurrentGroups.Add(chip);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
@@ -891,7 +918,13 @@ public class LessonItem
|
||||
public bool HasRoom => !string.IsNullOrWhiteSpace(Room);
|
||||
}
|
||||
public class TaskItem { public string Title { get; set; } = ""; public string DueDate { get; set; } = ""; public bool IsOverdue { get; set; } public bool IsReminder { get; set; } public bool IsHighPriority { get; set; } }
|
||||
public class GroupChip { public Guid GroupId { get; set; } public string Name { get; set; } = ""; public string Subject { get; set; } = ""; }
|
||||
public class GroupChip
|
||||
{
|
||||
public Guid GroupId { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
public string Subject { get; set; } = "";
|
||||
public bool IsOnSelectedDay { get; set; }
|
||||
}
|
||||
|
||||
// ── Offene Entschuldigungen (aus Mitarbeit-Fehltagen) ────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user