Arbeitszeit: Zeiterfassung (Kapitel 6.2)
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.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user