diff --git a/Client/Pages/Index.razor b/Client/Pages/Index.razor index 8a33bd6..bd65808 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/ShiftScheduler.Client.csproj b/Client/ShiftScheduler.Client.csproj index 822d92e..840e903 100644 --- a/Client/ShiftScheduler.Client.csproj +++ b/Client/ShiftScheduler.Client.csproj @@ -16,4 +16,31 @@ + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + diff --git a/Client/wwwroot/icons/Bg.png b/Client/wwwroot/icons/Bg.png new file mode 100644 index 0000000..a1b032e Binary files /dev/null and b/Client/wwwroot/icons/Bg.png differ diff --git a/Client/wwwroot/icons/F1.png b/Client/wwwroot/icons/F1.png new file mode 100644 index 0000000..ced0130 Binary files /dev/null and b/Client/wwwroot/icons/F1.png differ diff --git a/Client/wwwroot/icons/G1.png b/Client/wwwroot/icons/G1.png new file mode 100644 index 0000000..2dbc8c1 Binary files /dev/null and b/Client/wwwroot/icons/G1.png differ diff --git a/Client/wwwroot/icons/G2.png b/Client/wwwroot/icons/G2.png new file mode 100644 index 0000000..df0a6f7 Binary files /dev/null and b/Client/wwwroot/icons/G2.png differ diff --git a/Client/wwwroot/icons/G2TS.png b/Client/wwwroot/icons/G2TS.png new file mode 100644 index 0000000..c40ed23 Binary files /dev/null and b/Client/wwwroot/icons/G2TS.png differ diff --git a/Client/wwwroot/icons/Kompensation.png b/Client/wwwroot/icons/Kompensation.png new file mode 100644 index 0000000..a005d55 Binary files /dev/null and b/Client/wwwroot/icons/Kompensation.png differ diff --git a/Client/wwwroot/icons/break-icon.png b/Client/wwwroot/icons/break-icon.png new file mode 100644 index 0000000..d478627 Binary files /dev/null and b/Client/wwwroot/icons/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..2a211df 100644 --- a/Services/PdfExportService.cs +++ b/Services/PdfExportService.cs @@ -98,20 +98,27 @@ 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); - } - foreach (var day in Enumerable.Range(dayInWeek, 7 - dayInWeek)) - { - RenderEmptyCell(table); - } - - // Shifname - foreach (var day in Enumerable.Range(0, dayInWeek)) - { - var shiftWithTransport = shiftsWithTransport.GetValueOrDefault(weekDates.ElementAtOrDefault(day)); - var shiftName = shiftWithTransport?.Shift.Name ?? ""; - table.Cell().Element(CellStyleMiddle).Text(shiftName); + var shift = shiftWithTransport?.Shift; + + if (shift != null && shift.IsPngIcon) + { + // For PNG icons, embed the image + var iconPath = Path.Combine(AppContext.BaseDirectory, "wwwroot", "icons", shift.Icon); + if (File.Exists(iconPath)) + { + table.Cell().Height(24).Element(CellStyleMiddle).Image(iconPath).FitArea(); + } + else + { + table.Cell().Element(CellStyleMiddle).Text(shift.Name); + } + } + else + { + // For text/emoji icons, render as text + var icon = shift?.Icon ?? shift?.Name; + table.Cell().Element(CellStyleMiddle).Text(icon); + } } foreach (var day in Enumerable.Range(dayInWeek, 7 - dayInWeek)) { @@ -122,7 +129,7 @@ namespace ShiftScheduler.Services foreach (var day in Enumerable.Range(0, dayInWeek)) { var shiftWithTransport = shiftsWithTransport.GetValueOrDefault(weekDates.ElementAtOrDefault(day)); - var morningTime = $"πŸŒ… {shiftWithTransport?.Shift.MorningTime}"; + var morningTime = shiftWithTransport?.Shift.MorningTime.Length > 0 ? $"πŸŒ… {shiftWithTransport?.Shift.MorningTime}" : ""; table.Cell().Element(CellStyleMiddle).Text(morningTime); } foreach (var day in Enumerable.Range(dayInWeek, 7 - dayInWeek)) @@ -134,7 +141,7 @@ namespace ShiftScheduler.Services foreach (var day in Enumerable.Range(0, dayInWeek)) { var shiftWithTransport = shiftsWithTransport.GetValueOrDefault(weekDates.ElementAtOrDefault(day)); - var afternoonTime = $"πŸŒ† {shiftWithTransport?.Shift.AfternoonTime}"; + var afternoonTime = shiftWithTransport?.Shift.AfternoonTime.Length > 0 ? $"πŸŒ† {shiftWithTransport?.Shift.AfternoonTime}" : ""; table.Cell().Element(CellStyleMiddle).Text(afternoonTime); } foreach (var day in Enumerable.Range(dayInWeek, 7 - dayInWeek)) @@ -181,7 +188,7 @@ namespace ShiftScheduler.Services transportLines.Add(afternoonInfo); } - return transportLines.Count > 0 ? string.Join("\n", transportLines) : "-"; + return transportLines.Count > 0 ? string.Join("\n", transportLines) : ""; } private static string FormatTransportConnection(TransportConnection transport) 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); } }