init 1.0.0
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="LehrerApp.Desktop.App"
|
||||
RequestedThemeVariant="Default">
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
@@ -0,0 +1,61 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using LehrerApp.Desktop.ViewModels;
|
||||
using LehrerApp.Desktop.ViewModels.Groups;
|
||||
using LehrerApp.Desktop.ViewModels.Students;
|
||||
using LehrerApp.Desktop.Views;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace LehrerApp.Desktop;
|
||||
|
||||
public class App : Application
|
||||
{
|
||||
public static IServiceProvider Services { get; private set; } = null!;
|
||||
|
||||
public override void Initialize() => AvaloniaXamlLoader.Load(this);
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
Services = AppBootstrapper.BuildServices();
|
||||
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
var mainVm = Services.GetRequiredService<MainWindowViewModel>();
|
||||
WireCallbacks(mainVm);
|
||||
desktop.MainWindow = new MainWindow { DataContext = mainVm };
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
|
||||
private static void WireCallbacks(MainWindowViewModel main)
|
||||
{
|
||||
// GroupList → GroupDetail
|
||||
var gl = Services.GetRequiredService<GroupListViewModel>();
|
||||
gl.OnNavigateToDetail = id => main.NavigateToGroupDetail(id);
|
||||
gl.OnAddGroup = () => ShowAddGroupDialog(gl);
|
||||
|
||||
// Dashboard → GroupDetail (Chips)
|
||||
var dash = Services.GetRequiredService<DashboardViewModel>();
|
||||
dash.OnNavigateToGroup = id => main.NavigateToGroupDetail(id);
|
||||
|
||||
// StudentList → StudentDetail
|
||||
var sl = Services.GetRequiredService<StudentListViewModel>();
|
||||
sl.OnNavigateToDetail = id => main.NavigateToStudent(id);
|
||||
}
|
||||
|
||||
private static async void ShowAddGroupDialog(GroupListViewModel groupList)
|
||||
{
|
||||
var vm = new ViewModels.Groups.AddGroupDialogViewModel(
|
||||
Services.GetRequiredService<Core.Interfaces.IGroupRepository>(),
|
||||
Services.GetRequiredService<Core.Services.SchoolYearService>());
|
||||
var dialog = new Views.Groups.AddGroupDialog { DataContext = vm };
|
||||
|
||||
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime { MainWindow: { } owner })
|
||||
{
|
||||
var ok = await dialog.ShowDialog<bool>(owner);
|
||||
if (ok) groupList.LoadGroups();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
using LehrerApp.Core.Interfaces;
|
||||
using LehrerApp.Core.Services;
|
||||
using LehrerApp.Data;
|
||||
using LehrerApp.Data.Repositories;
|
||||
using LehrerApp.Desktop.ViewModels;
|
||||
using LehrerApp.Desktop.ViewModels.Groups;
|
||||
using LehrerApp.Desktop.ViewModels.Students;
|
||||
using LehrerApp.Sync;
|
||||
using LehrerApp.Sync.Crypto;
|
||||
using LehrerApp.Sync.Models;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace LehrerApp.Desktop;
|
||||
|
||||
/// <summary>
|
||||
/// Konfiguriert den DI-Container für den Desktop-Client.
|
||||
///
|
||||
/// WICHTIG: Alle Repositories sind Singleton – eine LiteDB-Datei pro Nutzer.
|
||||
/// Sync-Services werden nur registriert wenn eine Server-URL konfiguriert ist.
|
||||
/// </summary>
|
||||
public static class AppBootstrapper
|
||||
{
|
||||
public static string DbPath { get; private set; } = "";
|
||||
public static string AppDataPath { get; private set; } = "";
|
||||
|
||||
public static IServiceProvider BuildServices()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
|
||||
// ── Pfade ─────────────────────────────────────────────────────────────
|
||||
var appData = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
"LehrerApp");
|
||||
Directory.CreateDirectory(appData);
|
||||
AppDataPath = appData;
|
||||
DbPath = Path.Combine(appData, "lehrerapp.db");
|
||||
var queuePath = Path.Combine(appData, "syncqueue.db");
|
||||
var keyPath = Path.Combine(appData, "sync.key");
|
||||
|
||||
// ── Datenbank ─────────────────────────────────────────────────────────
|
||||
services.AddSingleton(_ => new LiteDbContext(DbPath));
|
||||
|
||||
// ── Repositories ──────────────────────────────────────────────────────
|
||||
services.AddSingleton<IStudentRepository, StudentRepository>();
|
||||
services.AddSingleton<IGroupRepository, GroupRepository>();
|
||||
services.AddSingleton<IEnrollmentRepository, EnrollmentRepository>();
|
||||
services.AddSingleton<IExamRepository, ExamRepository>();
|
||||
services.AddSingleton<IExamResultRepository, ExamResultRepository>();
|
||||
services.AddSingleton<IGradeRepository, GradeRepository>();
|
||||
services.AddSingleton<IUnitRepository, UnitRepository>();
|
||||
services.AddSingleton<ILessonRepository, LessonRepository>();
|
||||
services.AddSingleton<IDocumentationRepository, DocumentationRepository>();
|
||||
services.AddSingleton<IWorkTaskRepository, WorkTaskRepository>();
|
||||
services.AddSingleton<ITimeEntryRepository, TimeEntryRepository>();
|
||||
|
||||
// ── Services ──────────────────────────────────────────────────────────
|
||||
services.AddSingleton<GradingService>();
|
||||
services.AddSingleton<SchoolYearService>();
|
||||
|
||||
// ── Sync (optional – nur wenn Server konfiguriert) ────────────────────
|
||||
services.AddSingleton(_ => new EventQueue(queuePath));
|
||||
services.AddSingleton(sp => new ConflictResolver(sp.GetRequiredService<EventQueue>()));
|
||||
services.AddSingleton<byte[]>(_ =>
|
||||
{
|
||||
var key = SyncCrypto.LoadKey(keyPath) ?? SyncCrypto.GenerateKey();
|
||||
SyncCrypto.SaveKey(key, keyPath);
|
||||
return key;
|
||||
});
|
||||
|
||||
var serverUrl = LoadServerUrl(appData);
|
||||
var deviceId = LoadOrCreateDeviceId(appData);
|
||||
|
||||
if (!string.IsNullOrEmpty(serverUrl))
|
||||
{
|
||||
services.AddSingleton<SyncEngine>(sp => new SyncEngine(
|
||||
sp.GetRequiredService<EventQueue>(),
|
||||
sp.GetRequiredService<ConflictResolver>(),
|
||||
BuildHttp(serverUrl, appData),
|
||||
new SyncConfig
|
||||
{
|
||||
ServerUrl = serverUrl,
|
||||
DeviceId = deviceId,
|
||||
DeviceType = DeviceType.Desktop,
|
||||
AutoSyncIntervalMinutes = 5,
|
||||
}));
|
||||
|
||||
services.AddSingleton<SnapshotService>(sp => new SnapshotService(
|
||||
BuildHttp(serverUrl, appData),
|
||||
sp.GetRequiredService<LiteDbContext>(),
|
||||
sp.GetRequiredService<byte[]>(),
|
||||
DeviceType.Desktop, DbPath, keyPath));
|
||||
}
|
||||
|
||||
// ── ViewModels ────────────────────────────────────────────────────────
|
||||
// Singleton: einmal erstellt, überall dieselbe Instanz
|
||||
services.AddSingleton<MainWindowViewModel>();
|
||||
services.AddSingleton<DashboardViewModel>();
|
||||
services.AddSingleton<SyncStatusViewModel>();
|
||||
services.AddSingleton<GroupListViewModel>();
|
||||
services.AddSingleton<StudentListViewModel>();
|
||||
|
||||
// Transient: neue Instanz pro Navigation (für Detailseiten)
|
||||
services.AddTransient<GroupDetailViewModel>();
|
||||
services.AddTransient<StudentDetailViewModel>();
|
||||
|
||||
return services.BuildServiceProvider();
|
||||
}
|
||||
|
||||
// ── Hilfsmethoden ─────────────────────────────────────────────────────────
|
||||
|
||||
private static HttpClient BuildHttp(string url, string appData)
|
||||
{
|
||||
var http = new HttpClient { BaseAddress = new Uri(url) };
|
||||
var tokenPath = Path.Combine(appData, "auth.token");
|
||||
if (File.Exists(tokenPath))
|
||||
http.DefaultRequestHeaders.Authorization =
|
||||
new System.Net.Http.Headers.AuthenticationHeaderValue(
|
||||
"Bearer", File.ReadAllText(tokenPath).Trim());
|
||||
return http;
|
||||
}
|
||||
|
||||
public static string LoadServerUrl(string? path = null) =>
|
||||
File.Exists(Path.Combine(path ?? AppDataPath, "server.txt"))
|
||||
? File.ReadAllText(Path.Combine(path ?? AppDataPath, "server.txt")).Trim()
|
||||
: "";
|
||||
|
||||
public static void SaveServerUrl(string url) =>
|
||||
File.WriteAllText(Path.Combine(AppDataPath, "server.txt"), url);
|
||||
|
||||
private static string LoadOrCreateDeviceId(string appData)
|
||||
{
|
||||
var p = Path.Combine(appData, "device.id");
|
||||
if (File.Exists(p)) return File.ReadAllText(p).Trim();
|
||||
var id = Guid.NewGuid().ToString();
|
||||
File.WriteAllText(p, id);
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
LehrerApp Assets – Icons und Bilder hier ablegen.
|
||||
@@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LehrerApp.Core\LehrerApp.Core.csproj" />
|
||||
<ProjectReference Include="..\LehrerApp.Data\LehrerApp.Data.csproj" />
|
||||
<ProjectReference Include="..\LehrerApp.Sync\LehrerApp.Sync.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" />
|
||||
<PackageReference Include="Avalonia.Desktop" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" />
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,16 @@
|
||||
using Avalonia;
|
||||
|
||||
namespace LehrerApp.Desktop;
|
||||
|
||||
class Program
|
||||
{
|
||||
[STAThread]
|
||||
public static void Main(string[] args) =>
|
||||
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
||||
|
||||
public static AppBuilder BuildAvaloniaApp() =>
|
||||
AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.WithInterFont()
|
||||
.LogToTrace();
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using LehrerApp.Core.Interfaces;
|
||||
using LehrerApp.Core.Models;
|
||||
using LehrerApp.Core.Services;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace LehrerApp.Desktop.ViewModels;
|
||||
|
||||
public partial class DashboardViewModel : ObservableObject
|
||||
{
|
||||
private readonly IGroupRepository _groups;
|
||||
private readonly ILessonRepository _lessons;
|
||||
private readonly IWorkTaskRepository _tasks;
|
||||
private readonly SchoolYearService _sy;
|
||||
|
||||
[ObservableProperty] private string _greeting = "";
|
||||
[ObservableProperty] private string _currentDate = "";
|
||||
[ObservableProperty] private string _currentSchoolYear = "";
|
||||
|
||||
public ObservableCollection<LessonItem> TodaysLessons { get; } = [];
|
||||
public ObservableCollection<TaskItem> OpenTasks { get; } = [];
|
||||
public ObservableCollection<GroupChip> CurrentGroups { get; } = [];
|
||||
|
||||
// Navigation-Callback – wird von App.axaml.cs verdrahtet
|
||||
public Action<Guid>? OnNavigateToGroup { get; set; }
|
||||
|
||||
public DashboardViewModel(IGroupRepository groups, ILessonRepository lessons,
|
||||
IWorkTaskRepository tasks, SchoolYearService sy)
|
||||
{
|
||||
_groups = groups; _lessons = lessons; _tasks = tasks; _sy = sy;
|
||||
Load();
|
||||
}
|
||||
|
||||
private void Load()
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
var today = DateOnly.FromDateTime(now);
|
||||
CurrentDate = now.ToString("dddd, d. MMMM yyyy", new CultureInfo("de-DE"));
|
||||
CurrentSchoolYear = _sy.CurrentSchoolYear();
|
||||
Greeting = now.Hour < 12 ? "Guten Morgen" : now.Hour < 18 ? "Guten Tag" : "Guten Abend";
|
||||
|
||||
TodaysLessons.Clear();
|
||||
var groups = _groups.GetBySchoolYear(_sy.CurrentSchoolYear()).ToDictionary(g => g.Id);
|
||||
foreach (var l in groups.Keys.SelectMany(gid => _lessons.GetByGroupAndDate(gid, today))
|
||||
.OrderBy(l => l.LessonNumber))
|
||||
{
|
||||
if (groups.TryGetValue(l.GroupId, out var g))
|
||||
TodaysLessons.Add(new() { GroupName = g.Name, Topic = l.Topic });
|
||||
}
|
||||
|
||||
OpenTasks.Clear();
|
||||
foreach (var t in _tasks.GetByStatus(WorkTaskStatus.Open)
|
||||
.Concat(_tasks.GetByStatus(WorkTaskStatus.InProgress))
|
||||
.OrderBy(t => t.DueDate ?? DateOnly.MaxValue).Take(5))
|
||||
OpenTasks.Add(new() { Title = t.Title,
|
||||
DueDate = t.DueDate?.ToString("dd.MM.") ?? "",
|
||||
IsOverdue = t.DueDate.HasValue && t.DueDate < today });
|
||||
|
||||
CurrentGroups.Clear();
|
||||
foreach (var g in groups.Values.OrderBy(g => g.Name))
|
||||
CurrentGroups.Add(new() { GroupId = g.Id, Name = g.Name, Subject = g.Subject ?? "" });
|
||||
}
|
||||
|
||||
[RelayCommand] private void OpenGroup(GroupChip? c) { if (c is not null) OnNavigateToGroup?.Invoke(c.GroupId); }
|
||||
[RelayCommand] private void Refresh() => Load();
|
||||
}
|
||||
|
||||
public class LessonItem { public string GroupName { get; set; } = ""; public string Topic { get; set; } = ""; }
|
||||
public class TaskItem { public string Title { get; set; } = ""; public string DueDate { get; set; } = ""; public bool IsOverdue { get; set; } }
|
||||
public class GroupChip { public Guid GroupId { get; set; } public string Name { get; set; } = ""; public string Subject { get; set; } = ""; }
|
||||
@@ -0,0 +1,196 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using LehrerApp.Core.Interfaces;
|
||||
using LehrerApp.Core.Models;
|
||||
using LehrerApp.Core.Services;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace LehrerApp.Desktop.ViewModels.Groups;
|
||||
|
||||
// ── Gruppenliste ──────────────────────────────────────────────────────────────
|
||||
|
||||
public partial class GroupListViewModel : ObservableObject
|
||||
{
|
||||
private readonly IGroupRepository _groups;
|
||||
private readonly SchoolYearService _sy;
|
||||
|
||||
public Action<Guid>? OnNavigateToDetail { get; set; }
|
||||
public Action? OnAddGroup { get; set; }
|
||||
|
||||
[ObservableProperty] private string _selectedSchoolYear = "";
|
||||
[ObservableProperty] private string _searchText = "";
|
||||
[ObservableProperty] private GroupListItem? _selectedGroup;
|
||||
|
||||
public ObservableCollection<string> SchoolYears { get; } = [];
|
||||
public ObservableCollection<GroupListItem> Groups { get; } = [];
|
||||
|
||||
public GroupListViewModel(IGroupRepository groups, SchoolYearService sy)
|
||||
{
|
||||
_groups = groups; _sy = sy;
|
||||
foreach (var y in sy.RecentSchoolYears()) SchoolYears.Add(y);
|
||||
SelectedSchoolYear = sy.CurrentSchoolYear();
|
||||
}
|
||||
|
||||
partial void OnSelectedSchoolYearChanged(string value) => LoadGroups();
|
||||
partial void OnSearchTextChanged(string value) => LoadGroups();
|
||||
partial void OnSelectedGroupChanged(GroupListItem? value)
|
||||
{
|
||||
if (value is not null) OnNavigateToDetail?.Invoke(value.Id);
|
||||
}
|
||||
|
||||
public void LoadGroups()
|
||||
{
|
||||
Groups.Clear();
|
||||
var all = _groups.GetBySchoolYear(SelectedSchoolYear);
|
||||
var filtered = string.IsNullOrWhiteSpace(SearchText) ? all
|
||||
: all.Where(g => g.Name.Contains(SearchText, StringComparison.OrdinalIgnoreCase)
|
||||
|| (g.Subject?.Contains(SearchText, StringComparison.OrdinalIgnoreCase) ?? false));
|
||||
foreach (var g in filtered.OrderBy(g => g.Name))
|
||||
Groups.Add(new GroupListItem(g));
|
||||
}
|
||||
|
||||
[RelayCommand] private void AddGroup() => OnAddGroup?.Invoke();
|
||||
[RelayCommand] private void Refresh() => LoadGroups();
|
||||
}
|
||||
|
||||
public class GroupListItem
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public string Name { get; }
|
||||
public string Subject { get; }
|
||||
public string DisplayName { get; }
|
||||
public string TypeLabel { get; }
|
||||
public string GradingLabel { get; }
|
||||
|
||||
public GroupListItem(LearningGroup g)
|
||||
{
|
||||
Id = g.Id;
|
||||
Name = g.Name;
|
||||
Subject = g.Subject ?? "";
|
||||
TypeLabel = g.Type == GroupType.Class ? "Klasse" : "Kurs";
|
||||
GradingLabel = g.GradingSystem == GradingSystem.Grades1To6 ? "1–6" : "0–15";
|
||||
DisplayName = string.IsNullOrEmpty(Subject) ? Name : $"{Name} · {Subject}";
|
||||
}
|
||||
}
|
||||
|
||||
// ── Gruppendetail ─────────────────────────────────────────────────────────────
|
||||
|
||||
public partial class GroupDetailViewModel : ObservableObject
|
||||
{
|
||||
private readonly IGroupRepository _groups;
|
||||
private readonly IStudentRepository _students;
|
||||
private readonly IExamRepository _exams;
|
||||
private readonly IGradeRepository _grades;
|
||||
|
||||
[ObservableProperty] private LearningGroup? _group;
|
||||
[ObservableProperty] private string _groupTitle = "";
|
||||
[ObservableProperty] private string _groupSubtitle = "";
|
||||
[ObservableProperty] private int _studentCount;
|
||||
|
||||
public ObservableCollection<StudentSummary> Students { get; } = [];
|
||||
public ObservableCollection<ExamSummary> Exams { get; } = [];
|
||||
|
||||
public GroupDetailViewModel(IGroupRepository groups, IStudentRepository students,
|
||||
IExamRepository exams, IGradeRepository grades)
|
||||
{
|
||||
_groups = groups; _students = students; _exams = exams; _grades = grades;
|
||||
}
|
||||
|
||||
public void LoadGroup(Guid id)
|
||||
{
|
||||
Group = _groups.GetById(id);
|
||||
if (Group is null) return;
|
||||
GroupTitle = Group.Name;
|
||||
GroupSubtitle = $"{Group.SchoolYear} · " +
|
||||
$"{(Group.Type == GroupType.Class ? "Klasse" : "Kurs")} · " +
|
||||
$"Stufe {Group.GradeLevel} · Noten {(Group.GradingSystem == GradingSystem.Grades1To6 ? "1–6" : "0–15")}";
|
||||
|
||||
Students.Clear();
|
||||
var enrolled = _students.GetByGroup(Group.Id, Group.SchoolYear);
|
||||
StudentCount = enrolled.Count;
|
||||
foreach (var s in enrolled) Students.Add(new StudentSummary(s));
|
||||
|
||||
Exams.Clear();
|
||||
foreach (var e in _exams.GetByGroup(Group.Id)) Exams.Add(new ExamSummary(e));
|
||||
}
|
||||
|
||||
[RelayCommand] private void AddStudent() { /* TODO */ }
|
||||
[RelayCommand] private void AddExam() { /* TODO */ }
|
||||
[RelayCommand] private void Refresh() { if (Group is not null) LoadGroup(Group.Id); }
|
||||
}
|
||||
|
||||
public class StudentSummary
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public string FullName { get; }
|
||||
public StudentSummary(Core.Models.Student s) { Id = s.Id; FullName = s.FullName; }
|
||||
}
|
||||
|
||||
public class ExamSummary
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public string Title { get; }
|
||||
public string Date { get; }
|
||||
public string StatusLabel { get; }
|
||||
public ExamSummary(Core.Models.Exam e)
|
||||
{
|
||||
Id = e.Id; Title = e.Title; Date = e.Date.ToString("dd.MM.yyyy");
|
||||
StatusLabel = e.Status switch
|
||||
{
|
||||
ExamStatus.Planned => "Geplant",
|
||||
ExamStatus.Conducted => "Durchgeführt",
|
||||
ExamStatus.Graded => "Korrigiert",
|
||||
ExamStatus.Returned => "Zurückgegeben",
|
||||
_ => "",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// ── Dialog: Neue Lerngruppe anlegen ──────────────────────────────────────────
|
||||
|
||||
public partial class AddGroupDialogViewModel : ObservableObject
|
||||
{
|
||||
private readonly IGroupRepository _groups;
|
||||
private readonly SchoolYearService _sy;
|
||||
|
||||
[ObservableProperty] private string _name = "";
|
||||
[ObservableProperty] private string _subject = "";
|
||||
[ObservableProperty] private int _gradeLevel = 10;
|
||||
[ObservableProperty] private GradingSystem _gradingSystem = GradingSystem.Grades1To6;
|
||||
[ObservableProperty] private string _selectedSchoolYear = "";
|
||||
[ObservableProperty] private string _validationMessage = "";
|
||||
|
||||
public List<string> SchoolYears { get; }
|
||||
public LearningGroup? Result { get; private set; }
|
||||
|
||||
public AddGroupDialogViewModel(IGroupRepository groups, SchoolYearService sy)
|
||||
{
|
||||
_groups = groups; _sy = sy;
|
||||
SchoolYears = sy.RecentSchoolYears(3);
|
||||
SelectedSchoolYear = sy.CurrentSchoolYear();
|
||||
// Notensystem automatisch nach Klassenstufe
|
||||
PropertyChanged += (_, e) =>
|
||||
{
|
||||
if (e.PropertyName == nameof(GradeLevel))
|
||||
GradingSystem = GradeLevel >= 11 ? GradingSystem.Points0To15
|
||||
: GradingSystem.Grades1To6;
|
||||
};
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void Save()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Name)) { ValidationMessage = "Name erforderlich."; return; }
|
||||
if (GradeLevel is < 1 or > 13) { ValidationMessage = "Klassenstufe 1–13."; return; }
|
||||
Result = new LearningGroup
|
||||
{
|
||||
Name = Name.Trim(),
|
||||
Subject = string.IsNullOrWhiteSpace(Subject) ? null : Subject.Trim(),
|
||||
Type = GroupType.Course,
|
||||
GradeLevel = GradeLevel,
|
||||
GradingSystem = GradingSystem,
|
||||
SchoolYear = SelectedSchoolYear,
|
||||
};
|
||||
_groups.Save(Result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using LehrerApp.Core.Services;
|
||||
using LehrerApp.Desktop.ViewModels.Groups;
|
||||
using LehrerApp.Desktop.ViewModels.Students;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace LehrerApp.Desktop.ViewModels;
|
||||
|
||||
public partial class MainWindowViewModel : ObservableObject
|
||||
{
|
||||
private readonly IServiceProvider _services;
|
||||
|
||||
[ObservableProperty] private ObservableObject? _currentPage;
|
||||
[ObservableProperty] private NavItem _activeNavItem = NavItem.Dashboard;
|
||||
[ObservableProperty] private string _currentSchoolYear = "";
|
||||
|
||||
public MainWindowViewModel(IServiceProvider services,
|
||||
DashboardViewModel dashboard, SchoolYearService sy)
|
||||
{
|
||||
_services = services;
|
||||
CurrentSchoolYear = sy.CurrentSchoolYear();
|
||||
CurrentPage = dashboard;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void NavigateTo(NavItem item)
|
||||
{
|
||||
ActiveNavItem = item;
|
||||
CurrentPage = item switch
|
||||
{
|
||||
NavItem.Dashboard => _services.GetRequiredService<DashboardViewModel>(),
|
||||
NavItem.Groups => _services.GetRequiredService<GroupListViewModel>(),
|
||||
NavItem.Students => _services.GetRequiredService<StudentListViewModel>(),
|
||||
NavItem.Exams => new PlaceholderViewModel { Title = "Klausuren", Icon = "📝" },
|
||||
NavItem.Planner => new PlaceholderViewModel { Title = "Unterrichtsplanung", Icon = "📅" },
|
||||
NavItem.Workload => new PlaceholderViewModel { Title = "Arbeitszeit", Icon = "⏱" },
|
||||
NavItem.Settings => new PlaceholderViewModel { Title = "Einstellungen", Icon = "⚙️" },
|
||||
_ => CurrentPage,
|
||||
};
|
||||
}
|
||||
|
||||
public void NavigateToGroupDetail(Guid groupId)
|
||||
{
|
||||
ActiveNavItem = NavItem.Groups;
|
||||
var vm = _services.GetRequiredService<GroupDetailViewModel>();
|
||||
vm.LoadGroup(groupId);
|
||||
CurrentPage = vm;
|
||||
}
|
||||
|
||||
public void NavigateToStudent(Guid studentId)
|
||||
{
|
||||
ActiveNavItem = NavItem.Students;
|
||||
var vm = _services.GetRequiredService<StudentDetailViewModel>();
|
||||
vm.LoadStudent(studentId);
|
||||
CurrentPage = vm;
|
||||
}
|
||||
}
|
||||
|
||||
public enum NavItem { Dashboard, Groups, Students, Exams, Planner, Workload, Settings }
|
||||
|
||||
public partial class PlaceholderViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty] private string _title = "";
|
||||
[ObservableProperty] private string _icon = "";
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using LehrerApp.Core.Interfaces;
|
||||
using LehrerApp.Core.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace LehrerApp.Desktop.ViewModels.Students;
|
||||
|
||||
public partial class StudentListViewModel : ObservableObject
|
||||
{
|
||||
private readonly IStudentRepository _students;
|
||||
public Action<Guid>? OnNavigateToDetail { get; set; }
|
||||
|
||||
[ObservableProperty] private string _searchText = "";
|
||||
[ObservableProperty] private bool _showInactive;
|
||||
[ObservableProperty] private StudentListItem? _selectedStudent;
|
||||
|
||||
public ObservableCollection<StudentListItem> Students { get; } = [];
|
||||
|
||||
public StudentListViewModel(IStudentRepository students)
|
||||
{
|
||||
_students = students;
|
||||
LoadStudents();
|
||||
}
|
||||
|
||||
partial void OnSearchTextChanged(string value) => LoadStudents();
|
||||
partial void OnShowInactiveChanged(bool value) => LoadStudents();
|
||||
partial void OnSelectedStudentChanged(StudentListItem? value)
|
||||
{
|
||||
if (value is not null) OnNavigateToDetail?.Invoke(value.Id);
|
||||
}
|
||||
|
||||
public void LoadStudents()
|
||||
{
|
||||
Students.Clear();
|
||||
var all = _students.GetAll(ShowInactive);
|
||||
var f = string.IsNullOrWhiteSpace(SearchText) ? all
|
||||
: all.Where(s => s.LastName.Contains(SearchText, StringComparison.OrdinalIgnoreCase)
|
||||
|| s.FirstName.Contains(SearchText, StringComparison.OrdinalIgnoreCase));
|
||||
foreach (var s in f) Students.Add(new StudentListItem(s));
|
||||
}
|
||||
|
||||
[RelayCommand] private void AddStudent() { /* TODO */ }
|
||||
[RelayCommand] private void Refresh() => LoadStudents();
|
||||
}
|
||||
|
||||
public class StudentListItem
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public string FullName { get; }
|
||||
public string DateOfBirth { get; }
|
||||
public StudentListItem(Student s)
|
||||
{
|
||||
Id = s.Id; FullName = s.FullName;
|
||||
DateOfBirth = s.DateOfBirth?.ToString("dd.MM.yyyy") ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
public partial class StudentDetailViewModel : ObservableObject
|
||||
{
|
||||
private readonly IStudentRepository _students;
|
||||
private readonly IEnrollmentRepository _enrollments;
|
||||
private readonly IGroupRepository _groups;
|
||||
private readonly IDocumentationRepository _docs;
|
||||
|
||||
[ObservableProperty] private Student? _student;
|
||||
[ObservableProperty] private string _studentTitle = "";
|
||||
[ObservableProperty] private bool _isEditing;
|
||||
[ObservableProperty] private string _editFirstName = "";
|
||||
[ObservableProperty] private string _editLastName = "";
|
||||
|
||||
public ObservableCollection<EnrollmentEntry> Enrollments { get; } = [];
|
||||
public ObservableCollection<DocEntry> Documentation { get; } = [];
|
||||
|
||||
public StudentDetailViewModel(IStudentRepository students,
|
||||
IEnrollmentRepository enrollments, IGroupRepository groups,
|
||||
IDocumentationRepository docs)
|
||||
{
|
||||
_students = students; _enrollments = enrollments;
|
||||
_groups = groups; _docs = docs;
|
||||
}
|
||||
|
||||
public void LoadStudent(Guid id)
|
||||
{
|
||||
Student = _students.GetById(id);
|
||||
if (Student is null) return;
|
||||
StudentTitle = Student.FullName;
|
||||
EditFirstName = Student.FirstName;
|
||||
EditLastName = Student.LastName;
|
||||
|
||||
Enrollments.Clear();
|
||||
foreach (var e in _enrollments.GetByStudent(Student.Id))
|
||||
{
|
||||
var g = _groups.GetById(e.GroupId);
|
||||
if (g is null) continue;
|
||||
Enrollments.Add(new() { SchoolYear = e.SchoolYear, GroupName = g.Name, Subject = g.Subject ?? "" });
|
||||
}
|
||||
|
||||
Documentation.Clear();
|
||||
foreach (var d in _docs.GetByStudent(Student.Id))
|
||||
Documentation.Add(new() { Date = d.Date.ToString("dd.MM.yyyy"), Title = d.Title,
|
||||
TypeLabel = d.Type switch
|
||||
{
|
||||
DocumentationType.Conversation => "Gespräch",
|
||||
DocumentationType.Incident => "Vorkommnis",
|
||||
DocumentationType.SupportPlan => "Förderplan",
|
||||
DocumentationType.Absence => "Fehlzeit",
|
||||
_ => "",
|
||||
},
|
||||
IsConfidential = d.IsConfidential });
|
||||
}
|
||||
|
||||
[RelayCommand] private void StartEdit() => IsEditing = true;
|
||||
[RelayCommand] private void CancelEdit()
|
||||
{
|
||||
if (Student is null) return;
|
||||
EditFirstName = Student.FirstName; EditLastName = Student.LastName;
|
||||
IsEditing = false;
|
||||
}
|
||||
[RelayCommand] private void SaveEdit()
|
||||
{
|
||||
if (Student is null) return;
|
||||
Student.FirstName = EditFirstName; Student.LastName = EditLastName;
|
||||
_students.Save(Student);
|
||||
StudentTitle = Student.FullName;
|
||||
IsEditing = false;
|
||||
}
|
||||
}
|
||||
|
||||
public class EnrollmentEntry { public string SchoolYear { get; set; } = ""; public string GroupName { get; set; } = ""; public string Subject { get; set; } = ""; }
|
||||
public class DocEntry { public string Date { get; set; } = ""; public string Title { get; set; } = ""; public string TypeLabel { get; set; } = ""; public bool IsConfidential { get; set; } }
|
||||
@@ -0,0 +1,43 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using LehrerApp.Sync;
|
||||
using LehrerApp.Sync.Models;
|
||||
|
||||
namespace LehrerApp.Desktop.ViewModels;
|
||||
|
||||
public partial class SyncStatusViewModel : ObservableObject
|
||||
{
|
||||
private readonly SyncEngine? _engine;
|
||||
|
||||
[ObservableProperty] private string _statusText = "Kein Server konfiguriert";
|
||||
[ObservableProperty] private string _lastSyncText = "";
|
||||
[ObservableProperty] private bool _isSyncing;
|
||||
[ObservableProperty] private bool _isServerConfigured;
|
||||
[ObservableProperty] private int _pendingCount;
|
||||
|
||||
public SyncStatusViewModel(SyncEngine? engine)
|
||||
{
|
||||
_engine = engine;
|
||||
IsServerConfigured = engine is not null;
|
||||
if (_engine is not null) _engine.StatusChanged += OnStatus;
|
||||
}
|
||||
|
||||
private void OnStatus(SyncStatus s)
|
||||
{
|
||||
IsSyncing = s.State == SyncState.Syncing;
|
||||
PendingCount = s.PendingEvents;
|
||||
StatusText = s.State switch
|
||||
{
|
||||
SyncState.Idle => PendingCount > 0 ? $"{PendingCount} ausstehend" : "Synchronisiert",
|
||||
SyncState.Syncing => "Synchronisiere…",
|
||||
SyncState.Offline => "Offline",
|
||||
SyncState.Error => $"Fehler: {s.ErrorMessage}",
|
||||
_ => "",
|
||||
};
|
||||
LastSyncText = s.LastSyncAt.HasValue ? $"Zuletzt: {s.LastSyncAt:HH:mm}" : "Noch nie";
|
||||
}
|
||||
|
||||
[RelayCommand(CanExecute = nameof(CanSync))]
|
||||
private async Task SyncNow() { if (_engine is not null) await _engine.SyncNowAsync(); }
|
||||
private bool CanSync() => _engine is not null && !IsSyncing;
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels"
|
||||
x:Class="LehrerApp.Desktop.Views.Dashboard.DashboardView"
|
||||
x:DataType="vm:DashboardViewModel">
|
||||
|
||||
<ScrollViewer Padding="24">
|
||||
<StackPanel Spacing="20">
|
||||
|
||||
<!-- Begrüßung -->
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Greeting}" FontSize="14" Opacity="0.6"/>
|
||||
<TextBlock Text="{Binding CurrentDate}" FontSize="24" FontWeight="SemiBold"/>
|
||||
</StackPanel>
|
||||
|
||||
<Grid ColumnDefinitions="*,*" RowDefinitions="Auto,Auto">
|
||||
|
||||
<!-- Heutige Stunden -->
|
||||
<Border Grid.Column="0" Grid.Row="0" Margin="0,0,8,8"
|
||||
Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
|
||||
CornerRadius="8" Padding="16">
|
||||
<StackPanel>
|
||||
<TextBlock Text="HEUTE" FontSize="11" FontWeight="Bold"
|
||||
Opacity="0.5" Margin="0,0,0,10"/>
|
||||
<ItemsControl ItemsSource="{Binding TodaysLessons}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="vm:LessonItem">
|
||||
<Grid ColumnDefinitions="4,*" Margin="0,4">
|
||||
<Border Grid.Column="0" Width="4" CornerRadius="2"
|
||||
Background="{DynamicResource SystemAccentColor}"
|
||||
Margin="0,0,10,0"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock Text="{Binding GroupName}" FontWeight="SemiBold" FontSize="13"/>
|
||||
<TextBlock Text="{Binding Topic}" FontSize="12" Opacity="0.7"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<TextBlock Text="Keine Stunden heute" Opacity="0.4" FontSize="13"
|
||||
IsVisible="{Binding !TodaysLessons.Count}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Offene Aufgaben -->
|
||||
<Border Grid.Column="1" Grid.Row="0" Margin="8,0,0,8"
|
||||
Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
|
||||
CornerRadius="8" Padding="16">
|
||||
<StackPanel>
|
||||
<TextBlock Text="OFFENE AUFGABEN" FontSize="11" FontWeight="Bold"
|
||||
Opacity="0.5" Margin="0,0,0,10"/>
|
||||
<ItemsControl ItemsSource="{Binding OpenTasks}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="vm:TaskItem">
|
||||
<Grid ColumnDefinitions="*,Auto" Margin="0,3">
|
||||
<TextBlock Grid.Column="0" Text="{Binding Title}"
|
||||
FontSize="13" TextTrimming="CharacterEllipsis"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding DueDate}"
|
||||
FontSize="12" Opacity="0.6" Margin="8,0,0,0"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<TextBlock Text="Keine offenen Aufgaben" Opacity="0.4" FontSize="13"
|
||||
IsVisible="{Binding !OpenTasks.Count}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Meine Lerngruppen -->
|
||||
<Border Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2"
|
||||
Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
|
||||
CornerRadius="8" Padding="16">
|
||||
<StackPanel>
|
||||
<TextBlock Text="MEINE LERNGRUPPEN" FontSize="11" FontWeight="Bold"
|
||||
Opacity="0.5" Margin="0,0,0,10"/>
|
||||
<ItemsControl ItemsSource="{Binding CurrentGroups}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="vm:GroupChip">
|
||||
<Button Command="{Binding $parent[ItemsControl].((vm:DashboardViewModel)DataContext).OpenGroupCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
Background="{DynamicResource SystemAccentColorLight2}"
|
||||
CornerRadius="6" Padding="12,6" Margin="0,0,8,8">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Name}" FontWeight="SemiBold" FontSize="13"/>
|
||||
<TextBlock Text="{Binding Subject}" FontSize="11" Opacity="0.7"
|
||||
IsVisible="{Binding Subject, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<TextBlock Text="Noch keine Lerngruppen." Opacity="0.4" FontSize="13"
|
||||
IsVisible="{Binding !CurrentGroups.Count}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
using Avalonia.Controls;
|
||||
namespace LehrerApp.Desktop.Views.Dashboard;
|
||||
public partial class DashboardView : UserControl { public DashboardView() => InitializeComponent(); }
|
||||
@@ -0,0 +1,41 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.Groups"
|
||||
x:Class="LehrerApp.Desktop.Views.Groups.AddGroupDialog"
|
||||
x:DataType="vm:AddGroupDialogViewModel"
|
||||
Title="Neue Lerngruppe"
|
||||
Width="420" SizeToContent="Height"
|
||||
CanResize="False" WindowStartupLocation="CenterOwner">
|
||||
|
||||
<Grid RowDefinitions="*,Auto" Margin="24">
|
||||
<StackPanel Grid.Row="0" Spacing="14">
|
||||
<TextBlock Text="Neue Lerngruppe anlegen" FontSize="18" FontWeight="SemiBold"/>
|
||||
<StackPanel Spacing="4">
|
||||
<TextBlock Text="Name *" FontSize="12" Opacity="0.7"/>
|
||||
<TextBox Text="{Binding Name}" Watermark="z.B. 10E, Q1 Chemie, 5a"/>
|
||||
</StackPanel>
|
||||
<StackPanel Spacing="4">
|
||||
<TextBlock Text="Fach" FontSize="12" Opacity="0.7"/>
|
||||
<TextBox Text="{Binding Subject}" Watermark="z.B. Chemie, Mathematik"/>
|
||||
</StackPanel>
|
||||
<Grid ColumnDefinitions="*,12,*">
|
||||
<StackPanel Grid.Column="0" Spacing="4">
|
||||
<TextBlock Text="Klassenstufe *" FontSize="12" Opacity="0.7"/>
|
||||
<NumericUpDown Value="{Binding GradeLevel}" Minimum="1" Maximum="13" FormatString="0"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Spacing="4">
|
||||
<TextBlock Text="Schuljahr" FontSize="12" Opacity="0.7"/>
|
||||
<ComboBox ItemsSource="{Binding SchoolYears}"
|
||||
SelectedItem="{Binding SelectedSchoolYear}"
|
||||
HorizontalAlignment="Stretch"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding ValidationMessage}" Foreground="Red" FontSize="12"
|
||||
IsVisible="{Binding ValidationMessage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1" ColumnDefinitions="*,8,*" Margin="0,20,0,0">
|
||||
<Button Grid.Column="0" Content="Abbrechen" HorizontalAlignment="Stretch" Click="OnCancel"/>
|
||||
<Button Grid.Column="2" Content="Anlegen" HorizontalAlignment="Stretch" Click="OnSave"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,17 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using LehrerApp.Desktop.ViewModels.Groups;
|
||||
namespace LehrerApp.Desktop.Views.Groups;
|
||||
public partial class AddGroupDialog : Window
|
||||
{
|
||||
public AddGroupDialog() => InitializeComponent();
|
||||
private void OnSave(object? s, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is AddGroupDialogViewModel vm && vm.SaveCommand.CanExecute(null))
|
||||
{
|
||||
vm.SaveCommand.Execute(null);
|
||||
if (vm.Result is not null) Close(true);
|
||||
}
|
||||
}
|
||||
private void OnCancel(object? s, RoutedEventArgs e) => Close(false);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.Groups"
|
||||
x:Class="LehrerApp.Desktop.Views.Groups.GroupDetailView"
|
||||
x:DataType="vm:GroupDetailViewModel">
|
||||
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
|
||||
<!-- Header -->
|
||||
<Border Grid.Row="0" Padding="20,16"
|
||||
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="0,0,0,1">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Text="{Binding GroupTitle}" FontSize="22" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="{Binding GroupSubtitle}" FontSize="12" Opacity="0.5"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="8">
|
||||
<TextBlock VerticalAlignment="Center" Opacity="0.6" FontSize="13">
|
||||
<Run Text="{Binding StudentCount}"/>
|
||||
<Run Text=" Schüler"/>
|
||||
</TextBlock>
|
||||
<Button Content="+ Schüler" Command="{Binding AddStudentCommand}"/>
|
||||
<Button Content="+ Klausur" Command="{Binding AddExamCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!--
|
||||
Avalonia 12: TabbedPage ersetzt manuelles Tab-System.
|
||||
Kein ActiveTab-Property, kein IsVisible-Binding, keine eigenen Tab-Buttons.
|
||||
TabPlacement="Top" → Tabs oben (wie Browser-Tabs).
|
||||
-->
|
||||
<TabbedPage Grid.Row="1" TabPlacement="Top">
|
||||
|
||||
<!-- Tab: Übersicht -->
|
||||
<ContentPage Header="Übersicht">
|
||||
<ScrollViewer Padding="20">
|
||||
<StackPanel Spacing="12">
|
||||
<TextBlock Text="{Binding GroupSubtitle}" Opacity="0.7" FontSize="14"/>
|
||||
<TextBlock Text="Hier erscheint später eine Zusammenfassung der Lerngruppe."
|
||||
Opacity="0.4"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</ContentPage>
|
||||
|
||||
<!-- Tab: Schüler -->
|
||||
<ContentPage Header="Schüler">
|
||||
<DataGrid ItemsSource="{Binding Students}"
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="True"
|
||||
GridLinesVisibility="Horizontal"
|
||||
CanUserReorderColumns="False"
|
||||
CanUserResizeColumns="True"
|
||||
Margin="0">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Name"
|
||||
Binding="{Binding FullName}"
|
||||
Width="*"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</ContentPage>
|
||||
|
||||
<!-- Tab: Klausuren -->
|
||||
<ContentPage Header="Klausuren">
|
||||
<DataGrid ItemsSource="{Binding Exams}"
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="True"
|
||||
GridLinesVisibility="Horizontal"
|
||||
CanUserReorderColumns="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Datum" Binding="{Binding Date}" Width="110"/>
|
||||
<DataGridTextColumn Header="Titel" Binding="{Binding Title}" Width="*"/>
|
||||
<DataGridTextColumn Header="Status" Binding="{Binding StatusLabel}" Width="130"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</ContentPage>
|
||||
|
||||
<!-- Tab: Noten -->
|
||||
<ContentPage Header="Noten">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Text="Notenübersicht" FontSize="16" Opacity="0.4"
|
||||
HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="Wird implementiert." FontSize="12" Opacity="0.3"
|
||||
HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</ContentPage>
|
||||
|
||||
<!-- Tab: Planung -->
|
||||
<ContentPage Header="Planung">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Text="Unterrichtseinheiten" FontSize="16" Opacity="0.4"
|
||||
HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="Wird implementiert." FontSize="12" Opacity="0.3"
|
||||
HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</ContentPage>
|
||||
|
||||
<!-- Tab: Dokumentation -->
|
||||
<ContentPage Header="Dokumentation">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Text="Schülerdokumentation" FontSize="16" Opacity="0.4"
|
||||
HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="Wird implementiert." FontSize="12" Opacity="0.3"
|
||||
HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</ContentPage>
|
||||
|
||||
</TabbedPage>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
using Avalonia.Controls;
|
||||
namespace LehrerApp.Desktop.Views.Groups;
|
||||
public partial class GroupDetailView : UserControl { public GroupDetailView() => InitializeComponent(); }
|
||||
@@ -0,0 +1,71 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.Groups"
|
||||
x:Class="LehrerApp.Desktop.Views.Groups.GroupListView"
|
||||
x:DataType="vm:GroupListViewModel">
|
||||
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border Grid.Row="0" Padding="20,16"
|
||||
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="0,0,0,1">
|
||||
<Grid ColumnDefinitions="*,Auto,Auto">
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Text="Lerngruppen" FontSize="22" FontWeight="SemiBold"/>
|
||||
<TextBlock FontSize="12" Opacity="0.5">
|
||||
<Run Text="{Binding Groups.Count}"/>
|
||||
<Run Text=" Gruppen · "/>
|
||||
<Run Text="{Binding SelectedSchoolYear}"/>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<ComboBox Grid.Column="1" ItemsSource="{Binding SchoolYears}"
|
||||
SelectedItem="{Binding SelectedSchoolYear}"
|
||||
Width="100" Margin="0,0,8,0" VerticalAlignment="Center"/>
|
||||
<Button Grid.Column="2" Content="+ Neue Gruppe"
|
||||
Command="{Binding AddGroupCommand}" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="1" ColumnDefinitions="260,*">
|
||||
<Border Grid.Column="0"
|
||||
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="0,0,1,0">
|
||||
<DockPanel>
|
||||
<TextBox DockPanel.Dock="Top" Text="{Binding SearchText}"
|
||||
PlaceholderText="Suchen…" Margin="12,8"/>
|
||||
<ListBox ItemsSource="{Binding Groups}"
|
||||
SelectedItem="{Binding SelectedGroup}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="vm:GroupListItem">
|
||||
<Grid ColumnDefinitions="4,*" Margin="2,4">
|
||||
<Border Grid.Column="0" Width="4" CornerRadius="2"
|
||||
Background="{DynamicResource SystemAccentColor}"
|
||||
Margin="0,0,10,0"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<TextBlock Grid.Column="0" Text="{Binding Name}"
|
||||
FontWeight="SemiBold" FontSize="13"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding TypeLabel}"
|
||||
FontSize="11" Opacity="0.5"/>
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding Subject}" FontSize="12" Opacity="0.65"
|
||||
IsVisible="{Binding Subject, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
<TextBlock Text="{Binding GradingLabel}" FontSize="11" Opacity="0.4"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
|
||||
<StackPanel Grid.Column="1" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" Spacing="8"
|
||||
IsVisible="{Binding !SelectedGroup}">
|
||||
<TextBlock Text="Gruppe auswählen" FontSize="16" Opacity="0.4"
|
||||
HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="oder + Neue Gruppe anlegen" FontSize="12" Opacity="0.3"
|
||||
HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
using Avalonia.Controls;
|
||||
namespace LehrerApp.Desktop.Views.Groups;
|
||||
public partial class GroupListView : UserControl { public GroupListView() => InitializeComponent(); }
|
||||
@@ -0,0 +1,119 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels"
|
||||
xmlns:vmg="clr-namespace:LehrerApp.Desktop.ViewModels.Groups"
|
||||
xmlns:vms="clr-namespace:LehrerApp.Desktop.ViewModels.Students"
|
||||
xmlns:views="clr-namespace:LehrerApp.Desktop.Views"
|
||||
xmlns:vd="clr-namespace:LehrerApp.Desktop.Views.Dashboard"
|
||||
xmlns:vg="clr-namespace:LehrerApp.Desktop.Views.Groups"
|
||||
xmlns:vs="clr-namespace:LehrerApp.Desktop.Views.Students"
|
||||
x:Class="LehrerApp.Desktop.Views.MainWindow"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
Title="LehrerApp"
|
||||
Width="1280" Height="800"
|
||||
MinWidth="900" MinHeight="600">
|
||||
|
||||
<!--
|
||||
Avalonia 12: DrawerPage ersetzt die selbstgebaute Sidebar.
|
||||
DrawerBreakpointWidth="900" → Sidebar ab 900px dauerhaft sichtbar,
|
||||
darunter als Overlay-Drawer mit Hamburger-Button (automatisch).
|
||||
Kein eigener Code nötig.
|
||||
-->
|
||||
<DrawerPage DrawerLength="220"
|
||||
DrawerBehavior="Auto">
|
||||
|
||||
<DrawerPage.Drawer>
|
||||
<DockPanel>
|
||||
|
||||
<Border DockPanel.Dock="Top" Padding="16,20,16,14"
|
||||
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="0,0,0,1">
|
||||
<StackPanel>
|
||||
<TextBlock Text="LehrerApp" FontSize="20" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="{Binding CurrentSchoolYear}"
|
||||
FontSize="12" Opacity="0.55" Margin="0,2,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border DockPanel.Dock="Bottom" Padding="12,8"
|
||||
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="0,1,0,0">
|
||||
<views:SyncStatusBar/>
|
||||
</Border>
|
||||
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="8,12,8,0" Spacing="2">
|
||||
<Button Content="📊 Dashboard" HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Left" Background="Transparent"
|
||||
Padding="10,8" CornerRadius="6"
|
||||
Command="{Binding NavigateToCommand}"
|
||||
CommandParameter="{x:Static vm:NavItem.Dashboard}"/>
|
||||
|
||||
<TextBlock Text="UNTERRICHT" FontSize="10" FontWeight="Bold"
|
||||
Opacity="0.4" Margin="10,14,0,4"/>
|
||||
|
||||
<Button Content="🏫 Lerngruppen" HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Left" Background="Transparent"
|
||||
Padding="10,8" CornerRadius="6"
|
||||
Command="{Binding NavigateToCommand}"
|
||||
CommandParameter="{x:Static vm:NavItem.Groups}"/>
|
||||
<Button Content="👤 Schüler" HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Left" Background="Transparent"
|
||||
Padding="10,8" CornerRadius="6"
|
||||
Command="{Binding NavigateToCommand}"
|
||||
CommandParameter="{x:Static vm:NavItem.Students}"/>
|
||||
<Button Content="📝 Klausuren" HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Left" Background="Transparent"
|
||||
Padding="10,8" CornerRadius="6"
|
||||
Command="{Binding NavigateToCommand}"
|
||||
CommandParameter="{x:Static vm:NavItem.Exams}"/>
|
||||
<Button Content="📅 Planung" HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Left" Background="Transparent"
|
||||
Padding="10,8" CornerRadius="6"
|
||||
Command="{Binding NavigateToCommand}"
|
||||
CommandParameter="{x:Static vm:NavItem.Planner}"/>
|
||||
|
||||
<TextBlock Text="VERWALTUNG" FontSize="10" FontWeight="Bold"
|
||||
Opacity="0.4" Margin="10,14,0,4"/>
|
||||
|
||||
<Button Content="⏱ Arbeitszeit" HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Left" Background="Transparent"
|
||||
Padding="10,8" CornerRadius="6"
|
||||
Command="{Binding NavigateToCommand}"
|
||||
CommandParameter="{x:Static vm:NavItem.Workload}"/>
|
||||
<Button Content="⚙️ Einstellungen" HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Left" Background="Transparent"
|
||||
Padding="10,8" CornerRadius="6"
|
||||
Command="{Binding NavigateToCommand}"
|
||||
CommandParameter="{x:Static vm:NavItem.Settings}"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</DrawerPage.Drawer>
|
||||
|
||||
<!-- DataTemplates verbinden ViewModels mit ihren Views -->
|
||||
<ContentControl Content="{Binding CurrentPage}">
|
||||
<ContentControl.DataTemplates>
|
||||
<DataTemplate DataType="vm:DashboardViewModel">
|
||||
<vd:DashboardView/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="vmg:GroupListViewModel">
|
||||
<vg:GroupListView/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="vmg:GroupDetailViewModel">
|
||||
<vg:GroupDetailView/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="vms:StudentListViewModel">
|
||||
<vs:StudentListView/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="vms:StudentDetailViewModel">
|
||||
<vs:StudentDetailView/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="vm:PlaceholderViewModel">
|
||||
<views:PlaceholderView/>
|
||||
</DataTemplate>
|
||||
</ContentControl.DataTemplates>
|
||||
</ContentControl>
|
||||
|
||||
</DrawerPage>
|
||||
</Window>
|
||||
@@ -0,0 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace LehrerApp.Desktop.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels"
|
||||
x:Class="LehrerApp.Desktop.Views.PlaceholderView"
|
||||
x:DataType="vm:PlaceholderViewModel">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="12">
|
||||
<TextBlock Text="{Binding Icon}" FontSize="48" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding Title}" FontSize="24" FontWeight="SemiBold"
|
||||
HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="Wird in einer späteren Version implementiert."
|
||||
Opacity="0.5" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
using Avalonia.Controls;
|
||||
namespace LehrerApp.Desktop.Views;
|
||||
public partial class PlaceholderView : UserControl { public PlaceholderView() => InitializeComponent(); }
|
||||
@@ -0,0 +1,100 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.Students"
|
||||
x:Class="LehrerApp.Desktop.Views.Students.StudentDetailView"
|
||||
x:DataType="vm:StudentDetailViewModel">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
|
||||
<!-- Header -->
|
||||
<Border Grid.Row="0" Padding="20,16"
|
||||
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="0,0,0,1">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Column="0" IsVisible="{Binding !IsEditing}">
|
||||
<TextBlock Text="{Binding StudentTitle}" FontSize="22" FontWeight="SemiBold"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="0" Spacing="6" IsVisible="{Binding IsEditing}">
|
||||
<Grid ColumnDefinitions="*,8,*">
|
||||
<TextBox Grid.Column="0" Text="{Binding EditFirstName}" PlaceholderText="Vorname"/>
|
||||
<TextBox Grid.Column="2" Text="{Binding EditLastName}" PlaceholderText="Nachname"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="8" VerticalAlignment="Top">
|
||||
<Button Content="Bearbeiten" Command="{Binding StartEditCommand}"
|
||||
IsVisible="{Binding !IsEditing}"/>
|
||||
<Button Content="Speichern" Command="{Binding SaveEditCommand}"
|
||||
IsVisible="{Binding IsEditing}"/>
|
||||
<Button Content="Abbrechen" Command="{Binding CancelEditCommand}"
|
||||
IsVisible="{Binding IsEditing}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!--
|
||||
Avalonia 12: TabbedPage für Schüler-Tabs.
|
||||
Kein manuelles Tab-Management nötig.
|
||||
-->
|
||||
<TabbedPage Grid.Row="1" TabPlacement="Top">
|
||||
|
||||
<ContentPage Header="Übersicht">
|
||||
<ScrollViewer Padding="20">
|
||||
<StackPanel Spacing="12">
|
||||
<TextBlock Text="Lerngruppen" FontSize="15" FontWeight="SemiBold"/>
|
||||
<ItemsControl ItemsSource="{Binding Enrollments}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="vm:EnrollmentEntry">
|
||||
<Border Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
|
||||
CornerRadius="6" Padding="12,8" Margin="0,0,0,6">
|
||||
<Grid ColumnDefinitions="70,*,Auto">
|
||||
<TextBlock Grid.Column="0" Text="{Binding SchoolYear}" FontWeight="SemiBold"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding GroupName}" Margin="8,0"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Subject}" Opacity="0.5" FontSize="12"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<TextBlock Text="Keine Einschreibungen vorhanden." Opacity="0.4"
|
||||
IsVisible="{Binding !Enrollments.Count}"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</ContentPage>
|
||||
|
||||
<ContentPage Header="Noten">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Text="Notenübersicht" FontSize="16" Opacity="0.4" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="Wird implementiert." FontSize="12" Opacity="0.3" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</ContentPage>
|
||||
|
||||
<ContentPage Header="Dokumentation">
|
||||
<ScrollViewer Padding="20">
|
||||
<StackPanel>
|
||||
<ItemsControl ItemsSource="{Binding Documentation}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="vm:DocEntry">
|
||||
<Border Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
|
||||
CornerRadius="6" Padding="12,10" Margin="0,0,0,8">
|
||||
<Grid ColumnDefinitions="80,*,Auto">
|
||||
<TextBlock Grid.Column="0" Text="{Binding Date}" Opacity="0.5" FontSize="12"/>
|
||||
<StackPanel Grid.Column="1" Margin="8,0">
|
||||
<TextBlock Text="{Binding Title}" FontWeight="SemiBold" FontSize="13"/>
|
||||
<TextBlock Text="{Binding TypeLabel}" FontSize="11" Opacity="0.5"/>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="2" Text="🔒" FontSize="14"
|
||||
IsVisible="{Binding IsConfidential}"
|
||||
ToolTip.Tip="Vertraulich"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<TextBlock Text="Keine Dokumentation vorhanden." Opacity="0.4"
|
||||
IsVisible="{Binding !Documentation.Count}"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</ContentPage>
|
||||
|
||||
</TabbedPage>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
using Avalonia.Controls;
|
||||
namespace LehrerApp.Desktop.Views.Students;
|
||||
public partial class StudentDetailView : UserControl { public StudentDetailView() => InitializeComponent(); }
|
||||
@@ -0,0 +1,40 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.Students"
|
||||
x:Class="LehrerApp.Desktop.Views.Students.StudentListView"
|
||||
x:DataType="vm:StudentListViewModel">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border Grid.Row="0" Padding="20,16"
|
||||
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="0,0,0,1">
|
||||
<Grid ColumnDefinitions="*,Auto,Auto">
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Text="Schüler" FontSize="22" FontWeight="SemiBold"/>
|
||||
<TextBlock FontSize="12" Opacity="0.5">
|
||||
<Run Text="{Binding Students.Count}"/>
|
||||
<Run Text=" Schüler gesamt"/>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<CheckBox Grid.Column="1" Content="Inaktive anzeigen"
|
||||
IsChecked="{Binding ShowInactive}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,0"/>
|
||||
<Button Grid.Column="2" Content="+ Neuer Schüler"
|
||||
Command="{Binding AddStudentCommand}" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DockPanel Grid.Row="1">
|
||||
<TextBox DockPanel.Dock="Top" Text="{Binding SearchText}"
|
||||
PlaceholderText="Name suchen…" Margin="16,10,16,4"/>
|
||||
<DataGrid ItemsSource="{Binding Students}"
|
||||
SelectedItem="{Binding SelectedStudent}"
|
||||
AutoGenerateColumns="False" IsReadOnly="True"
|
||||
GridLinesVisibility="Horizontal"
|
||||
CanUserReorderColumns="False" Margin="16,4">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Name" Binding="{Binding FullName}" Width="*"/>
|
||||
<DataGridTextColumn Header="Geburtsdatum" Binding="{Binding DateOfBirth}" Width="130"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
using Avalonia.Controls;
|
||||
namespace LehrerApp.Desktop.Views.Students;
|
||||
public partial class StudentListView : UserControl { public StudentListView() => InitializeComponent(); }
|
||||
@@ -0,0 +1,18 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels"
|
||||
x:Class="LehrerApp.Desktop.Views.SyncStatusBar"
|
||||
x:DataType="vm:SyncStatusViewModel">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Text="{Binding StatusText}" FontSize="12" Opacity="0.7"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
<TextBlock Text="{Binding LastSyncText}" FontSize="10" Opacity="0.4"/>
|
||||
</StackPanel>
|
||||
<Button Grid.Column="1" Content="↻" FontSize="14"
|
||||
Command="{Binding SyncNowCommand}"
|
||||
IsVisible="{Binding IsServerConfigured}"
|
||||
Background="Transparent" Padding="6,4"
|
||||
ToolTip.Tip="Jetzt synchronisieren"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,16 @@
|
||||
using Avalonia.Controls;
|
||||
using LehrerApp.Desktop.ViewModels;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
namespace LehrerApp.Desktop.Views;
|
||||
public partial class SyncStatusBar : UserControl
|
||||
{
|
||||
public SyncStatusBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += (_, _) =>
|
||||
{
|
||||
if (DataContext is null)
|
||||
DataContext = App.Services.GetRequiredService<SyncStatusViewModel>();
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="LehrerApp.Desktop"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
Reference in New Issue
Block a user