From 9a8789a7ae824d2ea7a0fb2e157b070acd39b48a Mon Sep 17 00:00:00 2001 From: Marc Wieland Date: Wed, 18 Mar 2026 23:00:44 +0100 Subject: [PATCH] =?UTF-8?q?DragnDrop=20+=20L=C3=B6schfunktion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OnProfNext.Client/Pages/Home.razor | 66 ++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 9 deletions(-) diff --git a/OnProfNext.Client/Pages/Home.razor b/OnProfNext.Client/Pages/Home.razor index 5c50732..0ff398b 100644 --- a/OnProfNext.Client/Pages/Home.razor +++ b/OnProfNext.Client/Pages/Home.razor @@ -162,6 +162,16 @@ + + +
+ + @(string.IsNullOrWhiteSpace(context.Item.ContactPerson) ? "?" : context.Item.ContactPerson[0].ToString().ToUpper()) + + @context.Item.ContactPerson +
+
+
@@ -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 _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 _dummyBookings = new(); protected override void OnInitialized() { @@ -235,7 +240,50 @@ _items.Add(new DropItem { Project = "00001", Task = "Gleitzeit", Hours = 0, Color = "#7e6fff", Status = "Backlog" }); _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)