diff --git a/Client/Pages/Index.razor b/Client/Pages/Index.razor index 8a33bd6..a3927a3 100644 --- a/Client/Pages/Index.razor +++ b/Client/Pages/Index.razor @@ -40,7 +40,14 @@ else } else { - @shift.Icon + @if (shift.IsPngIcon) + { + @shift.Name + } + else + { + @shift.Icon + } } @shift.Name diff --git a/Client/wwwroot/break-icon.png b/Client/wwwroot/break-icon.png new file mode 100644 index 0000000..d478627 Binary files /dev/null and b/Client/wwwroot/break-icon.png differ diff --git a/Server/appsettings.json b/Server/appsettings.json index 1d67124..bf1cd6c 100644 --- a/Server/appsettings.json +++ b/Server/appsettings.json @@ -28,6 +28,12 @@ "MorningTime": "", "AfternoonTime": "" }, + { + "Name": "Pause", + "Icon": "break-icon.png", + "MorningTime": "10:00-10:15", + "AfternoonTime": "15:00-15:15" + }, { "Name": "Früh", "Icon": "🌅", diff --git a/Services/PdfExportService.cs b/Services/PdfExportService.cs index 84e6b6d..37290f1 100644 --- a/Services/PdfExportService.cs +++ b/Services/PdfExportService.cs @@ -98,8 +98,28 @@ namespace ShiftScheduler.Services foreach (var day in Enumerable.Range(0, dayInWeek)) { var shiftWithTransport = shiftsWithTransport.GetValueOrDefault(weekDates.ElementAtOrDefault(day)); - var icon = shiftWithTransport?.Shift.Icon ?? ""; - table.Cell().Element(CellStyleMiddle).Text(icon); + var shift = shiftWithTransport?.Shift; + + if (shift != null && shift.IsPngIcon) + { + // For PNG icons, embed the image + var iconPath = Path.Combine(AppContext.BaseDirectory, "wwwroot", shift.Icon); + if (File.Exists(iconPath)) + { + table.Cell().Element(CellStyleMiddle).Image(iconPath).FitArea(); + } + else + { + // Fallback to shift name if PNG not found + table.Cell().Element(CellStyleMiddle).Text(shift.Name); + } + } + else + { + // For text/emoji icons, render as text + var icon = shift?.Icon ?? ""; + table.Cell().Element(CellStyleMiddle).Text(icon); + } } foreach (var day in Enumerable.Range(dayInWeek, 7 - dayInWeek)) { diff --git a/Shared/Shift.cs b/Shared/Shift.cs index 6312bc5..37a45da 100644 --- a/Shared/Shift.cs +++ b/Shared/Shift.cs @@ -6,5 +6,7 @@ namespace ShiftScheduler.Shared.Models public string Icon { get; set; } = string.Empty; public string MorningTime { get; set; } = string.Empty; public string AfternoonTime { get; set; } = string.Empty; + + public bool IsPngIcon => Icon.EndsWith(".png", StringComparison.OrdinalIgnoreCase); } }