DragnDrop + Löschfunktion

This commit is contained in:
2026-03-18 23:00:44 +01:00
parent 3c5a27512e
commit 9a8789a7ae

View File

@@ -162,6 +162,16 @@
</CellTemplate>
</TemplateColumn>
<PropertyColumn Property="x => x.Task" Title="Tätigkeit" />
<TemplateColumn T="BookingPlaceholder" Title="Ansprechpartner" SortBy="@(x => x.ContactPerson)">
<CellTemplate>
<div class="d-flex align-center">
<MudAvatar Size="Size.Small" Color="Color.Secondary" Class="mr-2" Style="width: 24px; height: 24px; font-size: 0.75rem;">
@(string.IsNullOrWhiteSpace(context.Item.ContactPerson) ? "?" : context.Item.ContactPerson[0].ToString().ToUpper())
</MudAvatar>
<MudText Typo="Typo.body2">@context.Item.ContactPerson</MudText>
</div>
</CellTemplate>
</TemplateColumn>
<TemplateColumn T="BookingPlaceholder" Title="Stunden" SortBy="@(x => x.Hours)">
<CellTemplate>
<div class="d-flex align-center">
@@ -211,15 +221,10 @@
}
public record DayInfo(string Name, DateTime Date, bool IsToday);
public record BookingPlaceholder(DateTime Date, string Project, string Task, double Hours);
public record BookingPlaceholder(DateTime Date, string Project, string Task, double Hours, string ContactPerson);
// Dummy Daten für das DataGrid
private List<BookingPlaceholder> _dummyBookings = new()
{
new(DateTime.Now, "00000001 - Gleitzeit", "Projektarbeit", 0.0),
new(DateTime.Now.AddDays(-1), "00000001 - Gleitzeit", "Meeting", 0.0),
new(DateTime.Now.AddDays(-2), "00000010 - Allg. Besprechung", "Jour Fixe", 0.0),
};
// Dummy Daten für das DataGrid (Monatsansicht)
private List<BookingPlaceholder> _dummyBookings = new();
protected override void OnInitialized()
{
@@ -236,6 +241,49 @@
_items.Add(new DropItem { Project = "00010", Task = "Meeting", Hours = 0, Color = "#3dcb6c", Status = "Backlog" });
_items.Add(new DropItem { Project = "00500", Task = "Entwicklung", Hours = 0, Color = "#ffb545", Status = "Backlog" });
// Generiere Beispieldaten für den gesamten aktuellen Monat
GenerateMonthlyDummyData();
}
private void GenerateMonthlyDummyData()
{
var year = DateTime.Now.Year;
var month = DateTime.Now.Month;
var daysInMonth = DateTime.DaysInMonth(year, month);
var random = new Random(42); // Fester Seed für konstante Dummy-Daten
string[] projects = { "00001 - Gleitzeit", "00010 - Allg. Besprechung", "00500 - Webentwicklung", "01234 - Fehlerbehebung", "09876 - Konzeptphase" };
string[] tasks = { "Projektarbeit", "Meeting", "Jour Fixe", "Bugfixing", "Code Review", "Dokumentation" };
string[] contacts = { "Max Mustermann", "Anna Schmidt", "John Doe", "Maria Mayer", "Peter Parker" };
for (int day = 1; day <= daysInMonth; day++)
{
var currentDate = new DateTime(year, month, day);
// Keine Buchungen am Wochenende als Standard-Dummy
if (currentDate.DayOfWeek == DayOfWeek.Saturday || currentDate.DayOfWeek == DayOfWeek.Sunday)
continue;
// 1 bis 3 Einträge pro Tag
int entriesCount = random.Next(1, 4);
for (int i = 0; i < entriesCount; i++)
{
var hours = Math.Round(random.NextDouble() * 4 + 1, 1); // 1.0 bis 5.0 Stunden
// Runden auf halbe Stunden
hours = Math.Round(hours * 2, MidpointRounding.AwayFromZero) / 2;
_dummyBookings.Add(new BookingPlaceholder(
currentDate,
projects[random.Next(projects.Length)],
tasks[random.Next(tasks.Length)],
hours,
contacts[random.Next(contacts.Length)]
));
}
}
// Sortiere absteigend nach Datum
_dummyBookings = _dummyBookings.OrderByDescending(b => b.Date).ToList();
}
private void OnBacklogSearchChanged(string newValue)