Neuer Tab "Zeiterfassung" neben "Aufgaben" (WorkloadViewModel als Tab-Container, gleiches Muster wie GroupDetailViewModel): Timer mit Zuordnung zu Aufgabe/Kategorie, manuelle Nacherfassung (Von-Bis oder Dauer), Wochenübersicht nach Kategorie, sowie "X / Y min erfasst" direkt in der Aufgabenliste als Ist-vs-Soll-Vergleich.
33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using Avalonia.Controls;
|
|
using LehrerApp.Core.Interfaces;
|
|
using LehrerApp.Core.Models;
|
|
using LehrerApp.Desktop.ViewModels.Workload;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace LehrerApp.Desktop.Views.Workload;
|
|
|
|
public partial class TimeTrackingView : UserControl
|
|
{
|
|
public TimeTrackingView() => InitializeComponent();
|
|
|
|
protected override void OnDataContextChanged(EventArgs e)
|
|
{
|
|
base.OnDataContextChanged(e);
|
|
if (DataContext is TimeTrackingViewModel vm)
|
|
vm.OnAddEntry = ShowAddEntryDialog;
|
|
}
|
|
|
|
private async Task<TimeEntry?> ShowAddEntryDialog()
|
|
{
|
|
var owner = TopLevel.GetTopLevel(this) as Window;
|
|
if (owner is null) return null;
|
|
|
|
var tasks = App.Services.GetRequiredService<IWorkTaskRepository>()
|
|
.GetAll().Where(t => t.Status != WorkTaskStatus.Done).ToList();
|
|
var vm = new AddTimeEntryDialogViewModel(tasks);
|
|
var dialog = new AddTimeEntryDialog { DataContext = vm };
|
|
await dialog.ShowDialog<bool>(owner);
|
|
return vm.Result;
|
|
}
|
|
}
|