Compare commits
91 Commits
bugfix/dev
...
01cd8b2607
| Author | SHA1 | Date | |
|---|---|---|---|
| 01cd8b2607 | |||
| 310d2efc6e | |||
| e5402bafc9 | |||
| f517ab4cfb | |||
| 6d63f9db2b | |||
| 46c7c31e03 | |||
| 8f6db435bb | |||
| 9bf7676464 | |||
| d9556c18ca | |||
| 5b7157f422 | |||
| 119ee3ec16 | |||
| b536b31a4b | |||
| a80efee075 | |||
| 86d6daafbd | |||
| aefa1a8883 | |||
| b3e7f77165 | |||
| bac9bfd036 | |||
| 6effb8a0d6 | |||
| a9ff0d88f2 | |||
| 0fdfe991ea | |||
| 7fc2c14f9c | |||
| 5098deedd1 | |||
| 2e634361c5 | |||
| 60ebebc0d8 | |||
| c2d8b6531c | |||
| 665266457f | |||
| 14d581acac | |||
| eb533a1dc2 | |||
| 36025fad7b | |||
| 0606efabf9 | |||
| 2cb1e266f7 | |||
| 35c1374b9c | |||
| feaea1626b | |||
| babd96200a | |||
| f9cfcf1f19 | |||
| ffb9e07466 | |||
| 5384a08905 | |||
| dda5ff28e1 | |||
| 043349a47f | |||
| c36f7ccf98 | |||
| cf3e85bcd7 | |||
| 77379265c2 | |||
| 9b68c09b0b | |||
| cd6bf05352 | |||
| b2c205b160 | |||
| 33439f4a65 | |||
| b5cdf79799 | |||
| 72915ac001 | |||
| e4d7a0d8f3 | |||
| d5f9de06f3 | |||
| bbc129178f | |||
| 40c95100ff | |||
| 1b2731b4b2 | |||
| ae56902758 | |||
| e80059d34e | |||
| a2443032c5 | |||
| 3d2fe532e5 | |||
| 5e83aa26c9 | |||
| 2c789cd4c0 | |||
| 9ecfe08e2e | |||
| 74da6e37b0 | |||
| 10f65e583a | |||
| 0cdc8f1191 | |||
| 56ccab6377 | |||
| 4d069cdaa0 | |||
| bbbfa4de01 | |||
| 3ff3373b27 | |||
| 2af8815cf6 | |||
| ca24a96084 | |||
| db368b889a | |||
| 8f451b9c2c | |||
| 6120e6062e | |||
| cc2aea90ed | |||
| 762a9e8bca | |||
| 6ed4caea4f | |||
| d94821433a | |||
| 278b9964f1 | |||
| e6722803bb | |||
| 47bc7675c9 | |||
| 789e312316 | |||
| 2a9bbb3fe5 | |||
| bc34317720 | |||
| 76ff3e47e1 | |||
| 2d22bfcd06 | |||
| 185c783824 | |||
| b957b4b4bb | |||
| df154d83cc | |||
| 49ec9fbead | |||
| 01fc29f59e | |||
| 733b70cca2 | |||
| 8f4b751303 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -365,3 +365,8 @@ FodyWeavers.xsd
|
||||
/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/.vscode
|
||||
/EnvelopeGenerator.Tests.Application/Services/BugFixTests.cs
|
||||
/EnvelopeGenerator.Tests.Application/annotations.json
|
||||
/EnvelopeGenerator.Server/EnvelopeGenerator.Server/TekH - SoftHSM Test.md
|
||||
/EnvelopeGenerator.Server/EnvelopeGenerator.Server/tekh_softHSM_test.md
|
||||
/EnvelopeGenerator.Server/EnvelopeGenerator.Server/publish-output
|
||||
/EnvelopeGenerator.Server/EnvelopeGenerator.Server/tekh_softHSM_test.md
|
||||
/ignore/EnvelopeGenerator.Form
|
||||
|
||||
@@ -214,6 +214,10 @@ public class EnvelopeReceiverController : ControllerBase
|
||||
if (reader.Read())
|
||||
{
|
||||
bool outSuccess = reader.GetBoolean(0);
|
||||
if (!outSuccess)
|
||||
_logger.LogWarning(
|
||||
"PRSIG_API_ADD_DOC_RECEIVER_ELEM returned OUT_SUCCESS=false. DOC_ID={DocId}, RECEIVER_ID={ReceiverId}, Page={Page}",
|
||||
document.Id, rcv.Id, sign.Page);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -221,8 +225,6 @@ public class EnvelopeReceiverController : ControllerBase
|
||||
#region Create history
|
||||
// ENV_UID, STATUS_ID, USER_ID,
|
||||
string sql_hist = @"
|
||||
USE [DD_ECM]
|
||||
|
||||
DECLARE @OUT_SUCCESS bit;
|
||||
|
||||
EXEC [dbo].[PRSIG_API_ADD_HISTORY_STATE]
|
||||
@@ -244,6 +246,10 @@ public class EnvelopeReceiverController : ControllerBase
|
||||
if (reader.Read())
|
||||
{
|
||||
bool outSuccess = reader.GetBoolean(0);
|
||||
if (!outSuccess)
|
||||
_logger.LogWarning(
|
||||
"PRSIG_API_ADD_HISTORY_STATE returned OUT_SUCCESS=false. EnvelopeUuid={EnvelopeUuid}",
|
||||
envelope.Uuid);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -11,7 +11,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<ProjectGuid>5e0e17c0-ff5a-4246-bf87-1add85376a27</ProjectGuid>
|
||||
<DesktopBuildPackageLocation>M:\App&Service\0 DD - Smart UP\signFLOW\API\net8\$(Version)\EnvelopeGenerator.API.zip</DesktopBuildPackageLocation>
|
||||
<DesktopBuildPackageLocation>M:\App&Service\0 DD - Smart UP\signFLOW\PreRelease\API\net8\$(Version)\EnvelopeGenerator.API.zip</DesktopBuildPackageLocation>
|
||||
<PackageAsSingleFile>true</PackageAsSingleFile>
|
||||
<DeployIisAppPath>EnvelopeGenerator</DeployIisAppPath>
|
||||
<_TargetId>IISWebDeployPackage</_TargetId>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
namespace EnvelopeGenerator.Application.Common.Dto;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a user's UI preferences stored in the distributed cache (dbo.TBDD_CACHE).
|
||||
/// </summary>
|
||||
public sealed record UserPreferencesDto
|
||||
{
|
||||
/// <summary>
|
||||
/// The active DevExpress theme name.
|
||||
/// Allowed values: "blazing-berry", "fluent", "purple"
|
||||
/// </summary>
|
||||
public string ThemeName { get; set; } = "blazing-berry";
|
||||
|
||||
/// <summary>
|
||||
/// Whether dark mode is active.
|
||||
/// Default: false (light mode).
|
||||
/// </summary>
|
||||
public bool IsDarkMode { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Persisted DxGrid layout states, keyed by a stable grid identifier.
|
||||
/// Example keys: "sender.active-envelopes", "sender.completed-envelopes"
|
||||
/// Values are opaque JSON strings produced by DxGrid.SaveLayoutAsync().
|
||||
/// </summary>
|
||||
public Dictionary<string, string> GridLayouts { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// The authenticated user's display name ("{GivenName} {Surname}").
|
||||
/// Populated by the server on GET responses from JWT claims.
|
||||
/// NOT persisted in cache — injected at read time by UserPreferencesController.
|
||||
/// Ignored on PUT requests.
|
||||
/// </summary>
|
||||
public string? DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static UserPreferencesDto Default { get; } = new UserPreferencesDto();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using EnvelopeGenerator.Application.Common.Dto;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Common.Interfaces.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Manages per-user UI preferences (theme, dark mode, grid layouts).
|
||||
/// Preferences are stored in the distributed cache (dbo.TBDD_CACHE) as JSON.
|
||||
/// Cache key schema: "signflow.user-preferences:{username}"
|
||||
/// </summary>
|
||||
public interface IUserPreferencesService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves preferences for the given user.
|
||||
/// Always returns a valid object — never throws, never returns null.
|
||||
/// Returns defaults if no entry exists in cache.
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="ct">Cancellation token.</param>
|
||||
Task<UserPreferencesDto> GetOrCreateAsync(string id, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Persists the given preferences for the user in the distributed cache.
|
||||
/// Failures are non-fatal and silently ignored.
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="preferences">The preferences to persist.</param>
|
||||
/// <param name="ct">Cancellation token.</param>
|
||||
Task SaveAsync(string id, UserPreferencesDto preferences, CancellationToken ct = default);
|
||||
}
|
||||
@@ -28,7 +28,9 @@ public class MappingProfile : Profile
|
||||
CreateMap<DocReceiverElement, DocReceiverElementDto>();
|
||||
CreateMap<DocumentStatus, DocumentStatusDto>();
|
||||
CreateMap<EmailTemplate, EmailTemplateDto>();
|
||||
CreateMap<Envelope, EnvelopeDto>();
|
||||
CreateMap<Envelope, EnvelopeDto>()
|
||||
.ForMember(dest => dest.EnvelopeTypeTitle,
|
||||
opt => opt.MapFrom(src => src.Type != null ? src.Type.Title : null));
|
||||
CreateMap<Document, DocumentDto>();
|
||||
CreateMap<History, HistoryDto>().ForMember(dest => dest.ActionDate, opt => opt.MapFrom(src => src.ChangedWhen));
|
||||
CreateMap<History, HistoryCreateDto>().ForMember(dest => dest.ActionDate, opt => opt.MapFrom(src => src.ChangedWhen));
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace EnvelopeGenerator.Application.Common.Query;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Common.Query;
|
||||
|
||||
/// <summary>
|
||||
/// Stellt eine Abfrage dar, um die Details eines Empfängers zu lesen.
|
||||
@@ -29,5 +31,6 @@ public record ReceiverQueryBase
|
||||
/// <see cref="Id"/>, <see cref="EmailAddress"/>, or <see cref="Signature"/> is not null.
|
||||
/// <para>Usage example: The query can be executed only if at least one criterion is specified.</para>
|
||||
/// </remarks>
|
||||
public bool HasAnyCriteria => Id is not null || EmailAddress is not null || Signature is not null;
|
||||
[NotMapped]
|
||||
public virtual bool HasAnyCriteria => Id is not null || EmailAddress is not null || Signature is not null;
|
||||
}
|
||||
@@ -13,7 +13,7 @@ public class EnvelopeReceiverAddReadSQL : ISQL<Envelope>
|
||||
/// ENV_UID, EMAIL_ADRESS, SALUTATION, PHONE,
|
||||
/// </summary>
|
||||
public string Raw => @"
|
||||
DECLARE @OUT_RECEIVER_ID int
|
||||
DECLARE @OUT_RECEIVER_ID bigint
|
||||
|
||||
EXEC [dbo].[PRSIG_API_CREATE_RECEIVER]
|
||||
{0},
|
||||
|
||||
@@ -5,6 +5,7 @@ using EnvelopeGenerator.Application.Common.Query;
|
||||
using MediatR;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Receivers.Queries;
|
||||
|
||||
@@ -12,7 +13,24 @@ namespace EnvelopeGenerator.Application.Receivers.Queries;
|
||||
/// Stellt eine Abfrage dar, um die Details eines Empfängers zu lesen.
|
||||
/// um spezifische Informationen über einen Empfänger abzurufen.
|
||||
/// </summary>
|
||||
public record ReadReceiverQuery : ReceiverQueryBase, IRequest<IEnumerable<ReceiverDto>>;
|
||||
public record ReadReceiverQuery : ReceiverQueryBase, IRequest<IEnumerable<ReceiverDto>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Suchbegriff für eine teilweise Übereinstimmung in der E-Mail Adresse des Empfängers
|
||||
/// </summary>
|
||||
public virtual string? EmailAddressSearch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether any of the specified query criteria have a value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This property returns <c>true</c> if at least one of the fields
|
||||
/// <see cref="ReceiverQueryBase.Id"/>, <see cref="ReceiverQueryBase.EmailAddress"/>, <see cref="EmailAddressSearch"/>, or <see cref="ReceiverQueryBase.Signature"/> is not null.
|
||||
/// <para>Usage example: The query can be executed only if at least one criterion is specified.</para>
|
||||
/// </remarks>
|
||||
[NotMapped]
|
||||
public override bool HasAnyCriteria => EmailAddressSearch is not null || base.HasAnyCriteria;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -53,6 +71,11 @@ public class ReadReceiverQueryHandler : IRequestHandler<ReadReceiverQuery, IEnum
|
||||
query = query.Where(r => r.EmailAddress == email);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.EmailAddressSearch))
|
||||
{
|
||||
query = query.Where(r => EF.Functions.Like(r.EmailAddress, $"%{request.EmailAddressSearch}%"));
|
||||
}
|
||||
|
||||
if (request.Signature is string signature)
|
||||
{
|
||||
query = query.Where(r => r.Signature == signature);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports EnvelopeGenerator.CommonServices
|
||||
Imports EnvelopeGenerator.CommonServices.Jobs
|
||||
Imports EnvelopeGenerator.CommonServices.Jobs.FinalizeDocument
|
||||
Imports GdPicture14
|
||||
@@ -145,64 +146,91 @@ Public Class frmFinalizePDF
|
||||
log.AppendLine($"Document bytes: {oBuffer.Length}")
|
||||
|
||||
' 3. Check what BurnAnnotsToPDF will do internally
|
||||
Dim oEnvelopeEntity As Envelope = Nothing
|
||||
Using scope = Factory.Shared.ScopeFactory.CreateScope()
|
||||
Dim envRepo = scope.ServiceProvider.Repository(Of Envelope)()
|
||||
Dim envelope = envRepo.Where(Function(env) env.Id = envelopeId).FirstOrDefault()
|
||||
oEnvelopeEntity = envRepo.Where(Function(env) env.Id = envelopeId).FirstOrDefault()
|
||||
|
||||
If envelope Is Nothing Then
|
||||
If oEnvelopeEntity Is Nothing Then
|
||||
log.AppendLine("ERROR: Envelope not found in EF Core!")
|
||||
txtResult.Text = log.ToString()
|
||||
Return
|
||||
End If
|
||||
|
||||
log.AppendLine($"Envelope found: Id={envelope.Id}, EnvelopeTypeId={envelope.EnvelopeTypeId}")
|
||||
log.AppendLine($"ReadOnly (IsReadAndConfirm): {envelope.ReadOnly}")
|
||||
log.AppendLine($"Envelope found: Id={oEnvelopeEntity.Id}, EnvelopeTypeId={oEnvelopeEntity.EnvelopeTypeId}")
|
||||
log.AppendLine($"ReadOnly (IsReadAndConfirm): {oEnvelopeEntity.ReadOnly}")
|
||||
|
||||
If envelope.ReadOnly Then
|
||||
log.AppendLine(">>> EARLY RETURN: ReadOnly=True, original PDF returned without burning")
|
||||
txtResult.Text = log.ToString()
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim sigRepo = scope.ServiceProvider.Repository(Of DocReceiverElement)()
|
||||
Dim elements = sigRepo _
|
||||
.Where(Function(sig) sig.Document.EnvelopeId = envelopeId) _
|
||||
.Include(Function(sig) sig.Annotations) _
|
||||
.ToList()
|
||||
|
||||
log.AppendLine($"Elements (Signature) count: {elements.Count}")
|
||||
|
||||
If elements.Any() Then
|
||||
log.AppendLine(">>> PATH: BurnElementAnnotsToPDF (new element-based path)")
|
||||
For Each elem In elements
|
||||
Dim annotCount = If(elem.Annotations IsNot Nothing, elem.Annotations.Count(), 0)
|
||||
log.AppendLine($" Element Id={elem.Id}, Page={elem.Page}, X={elem.X}, Y={elem.Y}, W={elem.Width}, H={elem.Height}, Annotations={annotCount}")
|
||||
If elem.Annotations IsNot Nothing Then
|
||||
For Each annot In elem.Annotations
|
||||
log.AppendLine($" Annot: Name={annot.Name}, Type={annot.Type}, X={annot.X}, Y={annot.Y}, W={annot.Width}, H={annot.Height}")
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
If oEnvelopeEntity.ReadOnly Then
|
||||
log.AppendLine(">>> ReadOnly=True: original PDF will be used without burning (annotations skipped)")
|
||||
Else
|
||||
log.AppendLine(">>> PATH: BurnInstantJSONAnnotsToPDF (old JSON-based path)")
|
||||
Dim sigRepo = scope.ServiceProvider.Repository(Of DocReceiverElement)()
|
||||
Dim elements = sigRepo _
|
||||
.Where(Function(sig) sig.Document.EnvelopeId = envelopeId) _
|
||||
.Include(Function(sig) sig.Annotations) _
|
||||
.ToList()
|
||||
|
||||
log.AppendLine($"Elements (Signature) count: {elements.Count}")
|
||||
|
||||
If elements.Any() Then
|
||||
log.AppendLine(">>> PATH: BurnElementAnnotsToPDF (new element-based path)")
|
||||
For Each elem In elements
|
||||
Dim annotCount = If(elem.Annotations IsNot Nothing, elem.Annotations.Count(), 0)
|
||||
log.AppendLine($" Element Id={elem.Id}, Page={elem.Page}, X={elem.X}, Y={elem.Y}, W={elem.Width}, H={elem.Height}, Annotations={annotCount}")
|
||||
If elem.Annotations IsNot Nothing Then
|
||||
For Each annot In elem.Annotations
|
||||
log.AppendLine($" Annot: Name={annot.Name}, Type={annot.Type}, X={annot.X}, Y={annot.Y}, W={annot.Width}, H={annot.Height}")
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
log.AppendLine(">>> PATH: BurnInstantJSONAnnotsToPDF (old JSON-based path)")
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
|
||||
' 4. Actually call BurnAnnotsToPDF (same as Service)
|
||||
' 4. Burn annotations (ReadOnly envelopes return original PDF unchanged)
|
||||
log.AppendLine("")
|
||||
log.AppendLine("Calling BurnAnnotsToPDF...")
|
||||
Dim oNewBuffer = PDFBurner.BurnAnnotsToPDF(oBuffer, oJsonList, envelopeId)
|
||||
log.AppendLine($"Result bytes: {oNewBuffer.Length}")
|
||||
log.AppendLine($"Same as input: {oBuffer.Length = oNewBuffer.Length AndAlso oBuffer.SequenceEqual(oNewBuffer)}")
|
||||
Dim oBurnedBuffer As Byte() = PDFBurner.BurnAnnotsToPDF(oBuffer, oJsonList, envelopeId)
|
||||
log.AppendLine($"Burned bytes: {oBurnedBuffer.Length}")
|
||||
log.AppendLine($"Unchanged (ReadOnly): {oBuffer.Length = oBurnedBuffer.Length AndAlso oBuffer.SequenceEqual(oBurnedBuffer)}")
|
||||
|
||||
' 5. Write output
|
||||
' 5. Build State and load Envelope domain model for ReportCreator
|
||||
log.AppendLine("")
|
||||
log.AppendLine("Loading envelope domain model for report...")
|
||||
Dim oState As New State() With {
|
||||
.Database = Database,
|
||||
.LogConfig = LogConfig
|
||||
}
|
||||
Dim oEnvelopeModel As New EnvelopeModel(oState)
|
||||
Dim oEnvelope = oEnvelopeModel.GetById(envelopeId)
|
||||
If oEnvelope Is Nothing Then
|
||||
log.AppendLine("ERROR: Envelope not found via EnvelopeModel!")
|
||||
txtResult.Text = log.ToString()
|
||||
Return
|
||||
End If
|
||||
log.AppendLine($"Envelope loaded: {oEnvelope.Id}")
|
||||
|
||||
' 6. Create signing certificate report
|
||||
log.AppendLine("Creating signing certificate report...")
|
||||
Dim oReportCreator As New ReportCreator(LogConfig, oState)
|
||||
Dim oReportBuffer As Byte() = oReportCreator.CreateReport(oEnvelope)
|
||||
log.AppendLine($"Report bytes: {oReportBuffer.Length}")
|
||||
|
||||
' 7. Merge burned document + report (last page)
|
||||
log.AppendLine("Merging documents...")
|
||||
Dim oMerger As New PDFMerger(LogConfig, pGDPictureLicenseKey)
|
||||
Dim oMergedBuffer As Byte() = oMerger.MergeDocuments(oBurnedBuffer, oReportBuffer)
|
||||
log.AppendLine($"Merged bytes: {oMergedBuffer.Length}")
|
||||
|
||||
' 8. Save and open
|
||||
Dim desktopPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
|
||||
Dim oNewPath = Path.Combine(desktopPath, $"E{txtEnvelope.Text}_FullTest.burned.pdf")
|
||||
File.WriteAllBytes(oNewPath, oNewBuffer)
|
||||
log.AppendLine($"Output: {oNewPath}")
|
||||
Dim oMergedPath = Path.Combine(desktopPath, $"E{txtEnvelope.Text}_FullTest.merged.pdf")
|
||||
File.WriteAllBytes(oMergedPath, oMergedBuffer)
|
||||
log.AppendLine($"Output: {oMergedPath}")
|
||||
|
||||
txtResult.Text = log.ToString()
|
||||
Process.Start(oNewPath)
|
||||
Process.Start(oMergedPath)
|
||||
|
||||
Catch ex As Exception
|
||||
txtResult.Text = $"ERROR: {ex.Message}{vbCrLf}{vbCrLf}{ex.ToString()}"
|
||||
|
||||
@@ -119,7 +119,7 @@ Namespace Jobs.FinalizeDocument
|
||||
Dim y = frameY + yOffsetofFF
|
||||
|
||||
If annot.Type = AnnotationType.FormField Then
|
||||
AddFormFieldValue(annot.X / inchFactor, y, annot.Width / inchFactor, annot.Height / inchFactor, element.Page, annot.Value)
|
||||
AddFormFieldValue(annot.X / inchFactor, y, annot.Width / inchFactor, annot.Height / inchFactor, element.Page, annot.Value, annot.Name)
|
||||
ElseIf annot.Type = AnnotationType.Image Then
|
||||
AddImageAnnotation(
|
||||
annot.X / inchFactor,
|
||||
@@ -269,11 +269,14 @@ Namespace Jobs.FinalizeDocument
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub AddFormFieldValue(x As Double, y As Double, width As Double, height As Double, page As Integer, value As String)
|
||||
Private Sub AddFormFieldValue(x As Double, y As Double, width As Double, height As Double, page As Integer, value As String, Optional egName As String = "")
|
||||
Manager.SelectPage(page)
|
||||
|
||||
' Truncate if needed
|
||||
Dim displayValue As String = TruncateText(value, egName)
|
||||
|
||||
' Add the text annotation
|
||||
Dim ant = Manager.AddTextAnnot(x, y, width, height, value)
|
||||
Dim ant = Manager.AddTextAnnot(x, y, width, height, displayValue)
|
||||
|
||||
' Set the font properties
|
||||
ant.FontName = _pdfBurnerParams.FontName
|
||||
@@ -294,8 +297,9 @@ Namespace Jobs.FinalizeDocument
|
||||
Dim oHeight = oBounds.Item(3)
|
||||
|
||||
Manager.SelectPage(pAnnotation.pageIndex + 1)
|
||||
' Add the text annotation
|
||||
Dim ant = Manager.AddTextAnnot(oX, oY, oWidth, oHeight, formFieldValue.value)
|
||||
' Add the text annotation (truncate if needed)
|
||||
Dim displayValue As String = TruncateText(formFieldValue.value, pAnnotation.egName)
|
||||
Dim ant = Manager.AddTextAnnot(oX, oY, oWidth, oHeight, displayValue)
|
||||
|
||||
' Set the font properties
|
||||
ant.FontName = _pdfBurnerParams.FontName
|
||||
@@ -306,6 +310,48 @@ Namespace Jobs.FinalizeDocument
|
||||
#End Region
|
||||
|
||||
#Region "Helpers"
|
||||
''' <summary>
|
||||
''' Truncates a field value so its rendered width fits within the configured max width (inches).
|
||||
''' Uses Graphics.MeasureString with the configured font for pixel-accurate measurement.
|
||||
''' Appends TruncationSuffix when the value is cut.
|
||||
''' </summary>
|
||||
Private Function TruncateText(value As String, fieldEgName As String) As String
|
||||
If String.IsNullOrEmpty(value) Then Return value
|
||||
If _pdfBurnerParams.TextMaxWidths Is Nothing Then Return value
|
||||
|
||||
Dim maxWidthInches As Single = 0
|
||||
If Not _pdfBurnerParams.TextMaxWidths.TryGetValue(fieldEgName, maxWidthInches) Then Return value
|
||||
If maxWidthInches <= 0 Then Return value
|
||||
|
||||
Dim suffix As String = If(_pdfBurnerParams.TruncationSuffix, "")
|
||||
|
||||
Using bmp As New Bitmap(1, 1)
|
||||
Using g As Graphics = Graphics.FromImage(bmp)
|
||||
Dim font As New Font(_pdfBurnerParams.FontName, _pdfBurnerParams.FontSize, _pdfBurnerParams.FontStyle, GraphicsUnit.Point)
|
||||
Dim maxWidthPx As Single = maxWidthInches * g.DpiX
|
||||
|
||||
' Already fits — no truncation needed
|
||||
If g.MeasureString(value, font).Width <= maxWidthPx Then Return value
|
||||
|
||||
' Binary search for the longest prefix that fits (with suffix)
|
||||
Dim lo As Integer = 0
|
||||
Dim hi As Integer = value.Length
|
||||
While lo < hi
|
||||
Dim mid As Integer = (lo + hi + 1) \ 2
|
||||
Dim candidate As String = value.Substring(0, mid) & suffix
|
||||
If g.MeasureString(candidate, font).Width <= maxWidthPx Then
|
||||
lo = mid
|
||||
Else
|
||||
hi = mid - 1
|
||||
End If
|
||||
End While
|
||||
|
||||
Return value.Substring(0, lo) & suffix
|
||||
End Using
|
||||
End Using
|
||||
End Function
|
||||
|
||||
|
||||
Private Function ToPointF(pPoints As List(Of Single)) As PointF
|
||||
Dim oPoints = pPoints.Select(AddressOf ToInches).ToList()
|
||||
Return New PointF(oPoints.Item(0), oPoints.Item(1))
|
||||
|
||||
@@ -12,5 +12,24 @@ Namespace Jobs.FinalizeDocument
|
||||
Public Property FontSize As Integer = 8
|
||||
|
||||
Public Property FontStyle As FontStyle = FontStyle.Italic
|
||||
|
||||
''' <summary>
|
||||
''' The suffix appended to a truncated field value. Defaults to "..".
|
||||
''' Can be changed to any string (e.g. "…", "...", "").
|
||||
''' </summary>
|
||||
Public Property TruncationSuffix As String = ".."
|
||||
|
||||
''' <summary>
|
||||
''' Per-field maximum render width in inches.
|
||||
''' Text is measured using the configured Font/FontSize via Graphics.MeasureString (pixel-accurate).
|
||||
''' If the rendered width exceeds the limit, the text is cut and TruncationSuffix is appended.
|
||||
''' Keys must match egName values used in PDFBurner (e.g. "name", "position", "city", "date").
|
||||
''' Set a value to 0 to disable truncation for that field.
|
||||
''' </summary>
|
||||
Public Property TextMaxWidths As New Dictionary(Of String, Single) From {
|
||||
{"position", 1.41F},
|
||||
{"city", 1.41F},
|
||||
{"date", 2.0F}
|
||||
}
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -1,5 +1,6 @@
|
||||
Imports EnvelopeGenerator.Domain.Constants
|
||||
Imports EnvelopeGenerator.Domain.Entities
|
||||
Imports EnvelopeGenerator.Domain.Interfaces
|
||||
|
||||
Public Class ReportItem
|
||||
|
||||
@@ -11,8 +12,15 @@ Public Class ReportItem
|
||||
Public Property ItemStatus As EnvelopeStatus
|
||||
Public ReadOnly Property ItemStatusTranslated As String
|
||||
Get
|
||||
Dim oStatus = ItemStatus.ToString()
|
||||
Return My.Resources.Model.ResourceManager.GetString(oStatus)
|
||||
Dim oStatusKey = ItemStatus.ToString()
|
||||
|
||||
If ItemStatus = EnvelopeStatus.DocumentSigned AndAlso
|
||||
Envelope IsNot Nothing AndAlso
|
||||
Envelope.IsReadAndConfirm() Then
|
||||
oStatusKey = "DocumentSignedRaC"
|
||||
End If
|
||||
|
||||
Return My.Resources.Model.ResourceManager.GetString(oStatusKey)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
@@ -168,6 +168,9 @@
|
||||
<data name="DocumentSigned" xml:space="preserve">
|
||||
<value>Document signed</value>
|
||||
</data>
|
||||
<data name="DocumentSignedRaC" xml:space="preserve">
|
||||
<value>Read and confirmed</value>
|
||||
</data>
|
||||
<data name="Draft" xml:space="preserve">
|
||||
<value>Draft</value>
|
||||
</data>
|
||||
|
||||
@@ -168,6 +168,9 @@
|
||||
<data name="DocumentSigned" xml:space="preserve">
|
||||
<value>Dokument unterzeichnet</value>
|
||||
</data>
|
||||
<data name="DocumentSignedRaC" xml:space="preserve">
|
||||
<value>Gelesen und bestätigt</value>
|
||||
</data>
|
||||
<data name="Draft" xml:space="preserve">
|
||||
<value>Entwurf</value>
|
||||
</data>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#if NETFRAMEWORK
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#endif
|
||||
|
||||
namespace EnvelopeGenerator.Domain.Constants
|
||||
@@ -15,7 +16,11 @@ namespace EnvelopeGenerator.Domain.Constants
|
||||
public static class Receiver
|
||||
{
|
||||
public const string TFA = "EGReceiverTFA";
|
||||
|
||||
[Obsolete("Use Receiver.Authorized")]
|
||||
public const string Full = "EGReceiver";
|
||||
|
||||
public static readonly IReadOnlyList<string> Authorized = new[] { "receiver", "EGReceiver" };
|
||||
}
|
||||
|
||||
public const string Sender = "EGSender";
|
||||
|
||||
@@ -213,6 +213,15 @@ namespace My.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Gelesen und bestätigt.
|
||||
/// </summary>
|
||||
public static string DocumentSignedRaC {
|
||||
get {
|
||||
return ResourceManager.GetString("DocumentSignedRaC", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Entwurf.
|
||||
/// </summary>
|
||||
|
||||
@@ -168,6 +168,9 @@
|
||||
<data name="DocumentSigned" xml:space="preserve">
|
||||
<value>Dokument unterzeichnet</value>
|
||||
</data>
|
||||
<data name="DocumentSignedRaC" xml:space="preserve">
|
||||
<value>Gelesen und bestätigt</value>
|
||||
</data>
|
||||
<data name="Draft" xml:space="preserve">
|
||||
<value>Entwurf</value>
|
||||
</data>
|
||||
|
||||
@@ -14,6 +14,7 @@ using EnvelopeGenerator.Infrastructure.Repositories;
|
||||
using EnvelopeGenerator.Infrastructure.Executor;
|
||||
using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
|
||||
using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor;
|
||||
using EnvelopeGenerator.Application.Common.Interfaces.Services;
|
||||
using DigitalData.EmailProfilerDispatcher.Abstraction.Entities;
|
||||
#elif NETFRAMEWORK
|
||||
using System;
|
||||
@@ -55,6 +56,9 @@ namespace EnvelopeGenerator.Infrastructure
|
||||
services.TryAddScoped<IEnvelopeTypeRepository, EnvelopeTypeRepository>();
|
||||
services.TryAddScoped<IReceiverRepository, ReceiverRepository>();
|
||||
services.TryAddScoped<IEnvelopeReceiverReadOnlyRepository, EnvelopeReceiverReadOnlyRepository>();
|
||||
|
||||
// User Preferences — distributed cache (dbo.TBDD_CACHE)
|
||||
services.TryAddScoped<IUserPreferencesService, UserPreferencesService>();
|
||||
#endif
|
||||
|
||||
services.AddDbRepository(opt =>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
<PackageReference Include="DigitalData.Core.Infrastructure" Version="2.6.1" />
|
||||
<PackageReference Include="HtmlSanitizer" Version="9.0.892" />
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.6" />
|
||||
<PackageReference Include="Microsoft.Identity.Client" Version="4.82.1" />
|
||||
<PackageReference Include="QuestPDF" Version="2025.7.1" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
|
||||
|
||||
46
EnvelopeGenerator.Infrastructure/UserPreferencesService.cs
Normal file
46
EnvelopeGenerator.Infrastructure/UserPreferencesService.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
#if NET
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.Caching.Distributed;
|
||||
using EnvelopeGenerator.Application.Common.Dto;
|
||||
using EnvelopeGenerator.Application.Common.Interfaces.Services;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// Implements user preferences storage using the distributed cache (dbo.TBDD_CACHE).
|
||||
/// No DB schema changes required — uses the existing SQL Server distributed cache table.
|
||||
/// Cache key schema: "signflow.user-preferences:{username}"
|
||||
/// Expiration: indefinite (no TTL) — preferences persist until explicitly overwritten.
|
||||
/// </summary>
|
||||
public sealed class UserPreferencesService(IDistributedCache cache) : IUserPreferencesService
|
||||
{
|
||||
private const string KeyPrefix = "signflow.user-preferences:";
|
||||
|
||||
private static string BuildKey(string id) => $"{KeyPrefix}{id}";
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<UserPreferencesDto> GetOrCreateAsync(string id, CancellationToken ct = default)
|
||||
{
|
||||
var json = await cache.GetStringAsync(BuildKey(id), ct);
|
||||
if(json is not null && JsonSerializer.Deserialize<UserPreferencesDto>(json) is UserPreferencesDto pref)
|
||||
{
|
||||
return pref;
|
||||
}
|
||||
else
|
||||
{
|
||||
// init new
|
||||
await SaveAsync(id, UserPreferencesDto.Default, ct);
|
||||
return UserPreferencesDto.Default;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task SaveAsync(string id, UserPreferencesDto preferences, CancellationToken ct = default)
|
||||
{
|
||||
var json = JsonSerializer.Serialize(preferences);
|
||||
|
||||
// No expiration — preferences are stored indefinitely.
|
||||
await cache.SetStringAsync(BuildKey(id), json, new DistributedCacheEntryOptions(), ct);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -9,7 +9,7 @@
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<ProjectGuid>fb2d306b-1042-4a70-31ed-f991a1599371</ProjectGuid>
|
||||
<DesktopBuildPackageLocation>M:\App&Service\0 DD - Smart UP\signFLOW\ReceiverUI\net8\$(Version)\EnvelopeGenerator.ReceiverUI.zip</DesktopBuildPackageLocation>
|
||||
<DesktopBuildPackageLocation>M:\App&Service\0 DD - Smart UP\signFLOW\PreRelease\ReceiverUI\net8\$(Version)\EnvelopeGenerator.ReceiverUI.zip</DesktopBuildPackageLocation>
|
||||
<PackageAsSingleFile>true</PackageAsSingleFile>
|
||||
<DeployIisAppPath>EnvelopeGenerator.ReceiverUI</DeployIisAppPath>
|
||||
<_TargetId>IISWebDeployPackage</_TargetId>
|
||||
|
||||
@@ -1,28 +1,43 @@
|
||||
@using EnvelopeGenerator.Server.Client.Services;
|
||||
@using EnvelopeGenerator.Server.Client.Services
|
||||
@inherits LayoutComponentBase
|
||||
@implements IDisposable
|
||||
|
||||
<div class="page">
|
||||
<main>
|
||||
@inject ThemeService ThemeService
|
||||
|
||||
<HeadContent>
|
||||
<link href="@ThemeService.ThemeCssHref" rel="stylesheet" />
|
||||
</HeadContent>
|
||||
|
||||
<div class="page" data-bs-theme="@ThemeService.BootstrapTheme">
|
||||
<main>
|
||||
<article class="content">
|
||||
@Body
|
||||
</article>
|
||||
</main>
|
||||
<footer class="receiver-footer">
|
||||
<span>© SignFlow 2023-2024 <a href="https://digitaldata.works" target="_blank" rel="noopener">Digital Data GmbH</a></span>
|
||||
<span class="receiver-footer__sep">|</span>
|
||||
<a href="docs/privacy-policy.de-DE.html" target="_blank" rel="noopener">Datenschutz</a>
|
||||
<div class="receiver-footer__left">
|
||||
<span>© SignFlow 2023-2024 <a href="https://digitaldata.works" target="_blank" rel="noopener">Digital Data GmbH</a></span>
|
||||
<span class="receiver-footer__sep">|</span>
|
||||
<a href="docs/privacy-policy.de-DE.html" target="_blank" rel="noopener">Datenschutz</a>
|
||||
</div>
|
||||
|
||||
<ThemeControls />
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Inject] IHttpClientFactory HttpClientFactory { get; set; } = default!;
|
||||
|
||||
List<string> RequiredFonts = new() {
|
||||
"opensans.ttf"
|
||||
};
|
||||
|
||||
protected async override Task OnInitializedAsync() {
|
||||
await FontLoader.LoadFonts(HttpClientFactory, RequiredFonts);
|
||||
private Action? _themeChangeHandler;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await FontLoader.LoadFonts(HttpClientFactory, ["opensans.ttf"]);
|
||||
_themeChangeHandler = () => InvokeAsync(StateHasChanged);
|
||||
ThemeService.OnChange += _themeChangeHandler;
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
=> ThemeService.OnChange -= _themeChangeHandler;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
@using EnvelopeGenerator.Server.Client.Services
|
||||
@rendermode InteractiveWebAssembly
|
||||
@implements IDisposable
|
||||
|
||||
@inject ThemeService ThemeService
|
||||
|
||||
<div class="sf-theme-slider">
|
||||
|
||||
@* Moon — left end (blazing-dark) *@
|
||||
<svg class="sf-theme-icon @(ThemeService.ThemeName == "blazing-dark" ? "sf-theme-icon--active" : "")"
|
||||
xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" viewBox="0 0 24 24"
|
||||
title="Blazing Dark">
|
||||
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
|
||||
</svg>
|
||||
|
||||
@* Track wrapper: range input + left/mid/right ticks *@
|
||||
<div class="sf-theme-track-wrapper">
|
||||
@* Left tick *@
|
||||
<div class="sf-theme-tick sf-theme-tick--left"></div>
|
||||
@* Mid tick (marks the middle position) *@
|
||||
<div class="sf-theme-tick sf-theme-tick--mid"></div>
|
||||
@* Right tick *@
|
||||
<div class="sf-theme-tick sf-theme-tick--right"></div>
|
||||
|
||||
<input type="range"
|
||||
class="sf-theme-range"
|
||||
min="0" max="2" step="1"
|
||||
value="@SliderValue"
|
||||
@oninput="OnSliderChanged"
|
||||
title="@ThemeService.AvailableThemes[SliderValue].Label" />
|
||||
</div>
|
||||
|
||||
@* Sun — right end (purple) *@
|
||||
<svg class="sf-theme-icon @(ThemeService.ThemeName == "purple" ? "sf-theme-icon--active" : (ThemeService.ThemeName == "blazing-berry" ? "sf-theme-icon--mid" : ""))"
|
||||
xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" viewBox="0 0 24 24"
|
||||
stroke="currentColor" stroke-width="1.5"
|
||||
title="Blazing Berry / Purple">
|
||||
<circle cx="12" cy="12" r="4" fill="currentColor" stroke="none"/>
|
||||
<line x1="12" y1="2" x2="12" y2="5"/>
|
||||
<line x1="12" y1="19" x2="12" y2="22"/>
|
||||
<line x1="4.22" y1="4.22" x2="6.34" y2="6.34"/>
|
||||
<line x1="17.66" y1="17.66" x2="19.78" y2="19.78"/>
|
||||
<line x1="2" y1="12" x2="5" y2="12"/>
|
||||
<line x1="19" y1="12" x2="22" y2="12"/>
|
||||
<line x1="4.22" y1="19.78" x2="6.34" y2="17.66"/>
|
||||
<line x1="17.66" y1="6.34" x2="19.78" y2="4.22"/>
|
||||
</svg>
|
||||
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private Action? _themeChangeHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Maps the active theme to a 0-based slider step.
|
||||
/// 0 = blazing-dark (🌙 left)
|
||||
/// 1 = blazing-berry (middle)
|
||||
/// 2 = purple (☀️ right)
|
||||
/// </summary>
|
||||
private int SliderValue => ThemeService.ThemeName switch
|
||||
{
|
||||
"blazing-dark" => 0,
|
||||
"purple" => 2,
|
||||
_ => 1
|
||||
};
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
_themeChangeHandler = () => InvokeAsync(StateHasChanged);
|
||||
ThemeService.OnChange += _themeChangeHandler;
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
await ThemeService.InitializeAsync();
|
||||
}
|
||||
|
||||
private async Task OnSliderChanged(ChangeEventArgs e)
|
||||
{
|
||||
if (!int.TryParse(e.Value?.ToString(), out var step)) return;
|
||||
|
||||
var themeName = step switch
|
||||
{
|
||||
0 => "blazing-dark",
|
||||
2 => "purple",
|
||||
_ => "blazing-berry"
|
||||
};
|
||||
|
||||
await ThemeService.SetThemeAsync(themeName);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
=> ThemeService.OnChange -= _themeChangeHandler;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace EnvelopeGenerator.Server.Client.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Client-side DTO mirroring CustomImageEntry on the server.
|
||||
/// Height is a CSS value string (e.g. "28px") set in appsettings.json.
|
||||
/// </summary>
|
||||
public sealed record CustomImageDto(string Src, string Height, Dictionary<string, string> Classes)
|
||||
{
|
||||
public CustomImageDto() : this(string.Empty, "28px", new()) { }
|
||||
|
||||
/// <summary>Returns the CSS class for the given context key, or empty string if absent.</summary>
|
||||
public string GetClass(string key) =>
|
||||
Classes.TryGetValue(key, out var cls) && cls is not null ? cls : string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>Client-side DTO for the full CustomImages config (App + Company logos).</summary>
|
||||
public sealed record CustomImagesDto(CustomImageDto App, CustomImageDto Company)
|
||||
{
|
||||
public CustomImagesDto() : this(new(), new()) { }
|
||||
}
|
||||
@@ -5,19 +5,16 @@
|
||||
@using EnvelopeGenerator.Server.Client.Models
|
||||
@using DevExpress.Blazor
|
||||
@using EnvelopeGenerator.Server.Client.Services
|
||||
@inject EnvelopeGenerator.Server.Client.Services.EnvelopeService EnvelopeService
|
||||
@inject EnvelopeGenerator.Server.Client.Services.AuthService AuthService
|
||||
@inject NavigationManager Navigation
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject AppVersionService AppVersion
|
||||
@using EnvelopeGenerator.Application.Common.Dto
|
||||
@inject EnvelopeGenerator.Server.Client.Services.EnvelopeService EnvelopeService
|
||||
@inject EnvelopeGenerator.Server.Client.Services.AuthService AuthService
|
||||
@inject EnvelopeGenerator.Server.Client.Services.ThemeService ThemeService
|
||||
@inject EnvelopeGenerator.Server.Client.Services.UserPreferencesService UserPreferencesService
|
||||
@inject EnvelopeGenerator.Server.Client.Services.CustomImagesService CustomImagesService
|
||||
@inject NavigationManager Navigation
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject AppVersionService AppVersion
|
||||
|
||||
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
||||
<link href="@AppVersion.GetVersionedUrl("css/envelope-viewer.css")" rel="stylesheet" />
|
||||
<link href="@AppVersion.GetVersionedUrl("css/sender-page.css")" rel="stylesheet" />
|
||||
|
||||
@@ -26,53 +23,84 @@
|
||||
<div class="sender-action-bar__inner">
|
||||
<div class="sender-title-section">
|
||||
<div class="sender-logo">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4Zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1H2Zm13 2.383-4.708 2.825L15 11.105V5.383Zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741ZM1 11.105l4.708-2.897L1 5.383v5.722Z"/>
|
||||
</svg>
|
||||
@* signFLOW logo from appsettings.json — fallback to envelope SVG if not loaded *@
|
||||
@if (_appLogo is not null && !string.IsNullOrEmpty(_appLogo.Src))
|
||||
{
|
||||
<img src="@_appLogo.Src"
|
||||
style="height: @_appLogo.Height"
|
||||
class="@_appLogo.GetClass("Main")"
|
||||
alt="signFLOW" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4Zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1H2Zm13 2.383-4.708 2.825L15 11.105V5.383Zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741ZM1 11.105l4.708-2.897L1 5.383v5.722Z" />
|
||||
</svg>
|
||||
}
|
||||
</div>
|
||||
<div class="sender-title">Umschlag-Übersicht</div>
|
||||
</div>
|
||||
|
||||
@* ── Kunden-Logo (Mitte) ───────────────────────────────────────── *@
|
||||
<div class="sender-customer-logo-area">
|
||||
@if (_companyLogo is not null && !string.IsNullOrEmpty(_companyLogo.Src))
|
||||
{
|
||||
<img src="@_companyLogo.Src"
|
||||
style="height: @_companyLogo.Height"
|
||||
class="@_companyLogo.GetClass("Show")"
|
||||
alt="Kunden-Logo" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="sf-customer-logo-placeholder">Kunden-Logo</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@* ── Toolbar (rechts) ─────────────────────────────────────────── *@
|
||||
<div class="sender-toolbar">
|
||||
<button class="sender-btn sender-btn--primary" @onclick="CreateEnvelope" title="Neuen Umschlag erstellen">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"/>
|
||||
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z" />
|
||||
</svg>
|
||||
Neuer Umschlag
|
||||
</button>
|
||||
|
||||
<button class="sender-btn" @onclick="EditEnvelope" disabled="@(_selectedEnvelope == null || IsEnvelopeSent(_selectedEnvelope))" title="Ausgewählten Umschlag bearbeiten">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/>
|
||||
<path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z" />
|
||||
</svg>
|
||||
Bearbeiten
|
||||
</button>
|
||||
|
||||
<button class="sender-btn sender-btn--danger" @onclick="DeleteEnvelope" disabled="@(_selectedEnvelope == null)" title="Ausgewählten Umschlag löschen">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/>
|
||||
<path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/>
|
||||
<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z" />
|
||||
<path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z" />
|
||||
</svg>
|
||||
Löschen
|
||||
</button>
|
||||
|
||||
<button class="sender-btn" @onclick="RefreshEnvelopes" disabled="@_isLoading" title="Aktualisieren">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z"/>
|
||||
<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z"/>
|
||||
<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
|
||||
<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
|
||||
</svg>
|
||||
@if (_isLoading) {
|
||||
@if (_isLoading)
|
||||
{
|
||||
<span class="spinner-border spinner-border-sm" style="width: 14px; height: 14px;"></span>
|
||||
}
|
||||
</button>
|
||||
|
||||
<button class="sender-btn sender-btn--logout" @onclick="LogoutAsync" disabled="@_isLoggingOut" title="Abmelden">
|
||||
@if (_isLoggingOut) {
|
||||
@if (_isLoggingOut)
|
||||
{
|
||||
<span class="spinner-border spinner-border-sm" style="width: 14px; height: 14px;"></span>
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z"/>
|
||||
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z"/>
|
||||
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z" />
|
||||
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" />
|
||||
</svg>
|
||||
}
|
||||
</button>
|
||||
@@ -81,7 +109,8 @@
|
||||
</div>
|
||||
|
||||
<div class="sender-content">
|
||||
@if (_isLoading && _allEnvelopes == null) {
|
||||
@if (_isLoading && _allEnvelopes == null)
|
||||
{
|
||||
<div class="d-flex justify-content-center align-items-center h-100">
|
||||
<div class="text-center">
|
||||
<div class="spinner-border text-white mb-3" style="width: 3.5rem; height: 3.5rem;" role="status">
|
||||
@@ -90,13 +119,15 @@
|
||||
<p class="text-white fw-semibold">Umschläge werden geladen...</p>
|
||||
</div>
|
||||
</div>
|
||||
} else if (_errorMessage != null) {
|
||||
}
|
||||
else if (_errorMessage != null)
|
||||
{
|
||||
<div class="error-container">
|
||||
<div class="alert alert-danger shadow-lg">
|
||||
<div class="d-flex align-items-start">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" fill="currentColor" class="me-3 flex-shrink-0" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
|
||||
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z"/>
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z" />
|
||||
</svg>
|
||||
<div>
|
||||
<h5 class="mb-2">Fehler beim Laden der Umschläge</h5>
|
||||
@@ -105,25 +136,39 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="sender-grid-container">
|
||||
<div class="sender-tabs">
|
||||
<button class="sender-tab @(_activeTab == "active" ? "sender-tab--active" : "")" @onclick='() => _activeTab = "active"'>
|
||||
<span>Aktive Umschläge</span>
|
||||
@if (_activeEnvelopes != null) {
|
||||
@if (_activeEnvelopes != null)
|
||||
{
|
||||
<span style="opacity: 0.6; margin-left: 0.5rem;">(@_activeEnvelopes.Count())</span>
|
||||
}
|
||||
</button>
|
||||
<button class="sender-tab @(_activeTab == "completed" ? "sender-tab--active" : "")" @onclick='() => _activeTab = "completed"'>
|
||||
<span>Abgeschlossene Umschläge</span>
|
||||
@if (_completedEnvelopes != null) {
|
||||
@if (_completedEnvelopes != null)
|
||||
{
|
||||
<span style="opacity: 0.6; margin-left: 0.5rem;">(@_completedEnvelopes.Count())</span>
|
||||
}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="sender-grid-wrapper">
|
||||
@if (_activeTab == "active") {
|
||||
|
||||
@* Grid persistence hint — informs users their layout is auto-saved *@
|
||||
<div class="sf-grid-persistence-hint">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
|
||||
</svg>
|
||||
Die Größe und Position der Spalten wird automatisch für Sie gespeichert.
|
||||
</div>
|
||||
@if (_activeTab == "active")
|
||||
{
|
||||
<DxGrid Data="@_activeEnvelopes"
|
||||
@ref="_gridActive"
|
||||
ShowFilterRow="true"
|
||||
@@ -136,9 +181,13 @@
|
||||
SelectionMode="GridSelectionMode.Single"
|
||||
SelectedDataItem="@_selectedEnvelope"
|
||||
SelectedDataItemChanged="@OnSelectedEnvelopeChanged"
|
||||
CustomizeElement="OnCustomizeElement">
|
||||
CustomizeElement="OnCustomizeElement"
|
||||
LayoutAutoLoading="OnActiveGridLayoutAutoLoading"
|
||||
LayoutAutoSaving="OnActiveGridLayoutAutoSaving">
|
||||
<Columns>
|
||||
<DxGridDataColumn FieldName="Id" Caption="ID">
|
||||
<DxGridDataColumn FieldName="Id" Caption="ID"
|
||||
SortIndex="0"
|
||||
SortOrder="GridColumnSortOrder.Descending">
|
||||
<CellDisplayTemplate Context="cellContext">
|
||||
@((cellContext.DataItem as EnvelopeDto)?.Id)
|
||||
</CellDisplayTemplate>
|
||||
@@ -152,7 +201,8 @@
|
||||
<CellDisplayTemplate Context="cellContext">
|
||||
@{
|
||||
var envelope = cellContext.DataItem as EnvelopeDto;
|
||||
if (envelope != null) {
|
||||
if (envelope != null)
|
||||
{
|
||||
var statusInfo = GetStatusInfo(envelope.Status);
|
||||
<div class="status-badge status-badge--@statusInfo.CssClass">
|
||||
<span class="status-dot status-dot--@statusInfo.DotColor"></span>
|
||||
@@ -166,7 +216,8 @@
|
||||
<CellDisplayTemplate Context="cellContext">
|
||||
@{
|
||||
var envelope = cellContext.DataItem as EnvelopeDto;
|
||||
if (envelope != null) {
|
||||
if (envelope != null)
|
||||
{
|
||||
var receivers = envelope.EnvelopeReceivers?.ToList() ?? [];
|
||||
var signed = receivers.Count(r => r.Signed);
|
||||
var total = receivers.Count;
|
||||
@@ -174,7 +225,8 @@
|
||||
<span style="font-size: 0.875rem; color: #6b7280;">
|
||||
@signed / @total unterschrieben
|
||||
</span>
|
||||
@if (total > 0) {
|
||||
@if (total > 0)
|
||||
{
|
||||
<div style="flex: 1; min-width: 60px; max-width: 120px; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden;">
|
||||
<div style="height: 100%; background: linear-gradient(90deg, #81c784 0%, #66bb6a 100%); width: @((signed * 100.0 / total).ToString("F0"))%;"></div>
|
||||
</div>
|
||||
@@ -184,26 +236,37 @@
|
||||
}
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn FieldName="EnvelopeTypeTitle" Caption="Typ"
|
||||
Width="120px" AllowSort="true" />
|
||||
<DxGridDataColumn FieldName="AddedWhen" Caption="Erstellt"
|
||||
DisplayFormat="{0:dd.MM.yyyy}" Width="110px" AllowSort="true" />
|
||||
<DxGridDataColumn FieldName="ChangedWhen" Caption="Geändert am"
|
||||
DisplayFormat="{0:dd.MM.yyyy}" Width="110px" AllowSort="true" />
|
||||
</Columns>
|
||||
<DetailRowTemplate Context="detailContext">
|
||||
<div style="padding: 1rem; background: #f9fafb;">
|
||||
<h6 style="font-weight: 600; color: #374151; margin-bottom: 0.75rem;">Empfänger</h6>
|
||||
@{
|
||||
var envelope = detailContext.DataItem as EnvelopeDto;
|
||||
if (envelope?.EnvelopeReceivers?.Any() == true) {
|
||||
if (envelope?.EnvelopeReceivers?.Any() == true)
|
||||
{
|
||||
<div style="display: flex; flex-direction: column; gap: 0.5rem;">
|
||||
@foreach (var receiver in envelope.EnvelopeReceivers) {
|
||||
@foreach (var receiver in envelope.EnvelopeReceivers)
|
||||
{
|
||||
<div style="display: flex; align-items: center; gap: 1rem; padding: 0.5rem; background: white; border-radius: 6px; border: 1px solid #e5e7eb;">
|
||||
<span class="receiver-badge receiver-badge--@(receiver.Signed ? "signed" : "unsigned")" style="min-width: 100px;">
|
||||
@if (receiver.Signed) {
|
||||
@if (receiver.Signed)
|
||||
{
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>
|
||||
<path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z" />
|
||||
</svg>
|
||||
<span>Unterschrieben</span>
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
|
||||
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" />
|
||||
</svg>
|
||||
<span>Ausstehend</span>
|
||||
}
|
||||
@@ -215,14 +278,18 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
<p style="color: #9ca3af; font-size: 0.875rem; margin: 0;">Keine Empfänger</p>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</DetailRowTemplate>
|
||||
</DxGrid>
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
<DxGrid Data="@_completedEnvelopes"
|
||||
@ref="_gridCompleted"
|
||||
ShowFilterRow="true"
|
||||
@@ -232,9 +299,13 @@
|
||||
SelectionMode="GridSelectionMode.Single"
|
||||
SelectedDataItem="@_selectedEnvelope"
|
||||
SelectedDataItemChanged="@OnSelectedEnvelopeChanged"
|
||||
CustomizeElement="OnCustomizeElement">
|
||||
CustomizeElement="OnCustomizeElement"
|
||||
LayoutAutoLoading="OnCompletedGridLayoutAutoLoading"
|
||||
LayoutAutoSaving="OnCompletedGridLayoutAutoSaving">
|
||||
<Columns>
|
||||
<DxGridDataColumn FieldName="Id" Caption="ID">
|
||||
<DxGridDataColumn FieldName="Id" Caption="ID"
|
||||
SortIndex="0"
|
||||
SortOrder="GridColumnSortOrder.Descending">
|
||||
<CellDisplayTemplate Context="cellContext">
|
||||
@((cellContext.DataItem as EnvelopeDto)?.Id)
|
||||
</CellDisplayTemplate>
|
||||
@@ -248,7 +319,8 @@
|
||||
<CellDisplayTemplate Context="cellContext">
|
||||
@{
|
||||
var envelope = cellContext.DataItem as EnvelopeDto;
|
||||
if (envelope != null) {
|
||||
if (envelope != null)
|
||||
{
|
||||
var statusInfo = GetStatusInfo(envelope.Status);
|
||||
<div class="status-badge status-badge--@statusInfo.CssClass">
|
||||
<span class="status-dot status-dot--@statusInfo.DotColor"></span>
|
||||
@@ -262,7 +334,8 @@
|
||||
<CellDisplayTemplate Context="cellContext">
|
||||
@{
|
||||
var envelope = cellContext.DataItem as EnvelopeDto;
|
||||
if (envelope != null) {
|
||||
if (envelope != null)
|
||||
{
|
||||
var receivers = envelope.EnvelopeReceivers?.ToList() ?? [];
|
||||
var signed = receivers.Count(r => r.Signed);
|
||||
var total = receivers.Count;
|
||||
@@ -270,7 +343,8 @@
|
||||
<span style="font-size: 0.875rem; color: #6b7280;">
|
||||
@signed / @total unterschrieben
|
||||
</span>
|
||||
@if (total > 0) {
|
||||
@if (total > 0)
|
||||
{
|
||||
<div style="flex: 1; min-width: 60px; max-width: 120px; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden;">
|
||||
<div style="height: 100%; background: linear-gradient(90deg, #81c784 0%, #66bb6a 100%); width: @((signed * 100.0 / total).ToString("F0"))%;"></div>
|
||||
</div>
|
||||
@@ -280,26 +354,37 @@
|
||||
}
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn FieldName="EnvelopeTypeTitle" Caption="Typ"
|
||||
Width="120px" AllowSort="true" />
|
||||
<DxGridDataColumn FieldName="AddedWhen" Caption="Erstellt"
|
||||
DisplayFormat="{0:dd.MM.yyyy}" Width="110px" AllowSort="true" />
|
||||
<DxGridDataColumn FieldName="ChangedWhen" Caption="Geändert am"
|
||||
DisplayFormat="{0:dd.MM.yyyy}" Width="110px" AllowSort="true" />
|
||||
</Columns>
|
||||
<DetailRowTemplate Context="detailContext">
|
||||
<div style="padding: 1rem; background: #f9fafb;">
|
||||
<h6 style="font-weight: 600; color: #374151; margin-bottom: 0.75rem;">Empfänger</h6>
|
||||
@{
|
||||
var envelope = detailContext.DataItem as EnvelopeDto;
|
||||
if (envelope?.EnvelopeReceivers?.Any() == true) {
|
||||
if (envelope?.EnvelopeReceivers?.Any() == true)
|
||||
{
|
||||
<div style="display: flex; flex-direction: column; gap: 0.5rem;">
|
||||
@foreach (var receiver in envelope.EnvelopeReceivers) {
|
||||
@foreach (var receiver in envelope.EnvelopeReceivers)
|
||||
{
|
||||
<div style="display: flex; align-items: center; gap: 1rem; padding: 0.5rem; background: white; border-radius: 6px; border: 1px solid #e5e7eb;">
|
||||
<span class="receiver-badge receiver-badge--@(receiver.Signed ? "signed" : "unsigned")" style="min-width: 100px;">
|
||||
@if (receiver.Signed) {
|
||||
@if (receiver.Signed)
|
||||
{
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>
|
||||
<path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z" />
|
||||
</svg>
|
||||
<span>Unterschrieben</span>
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
|
||||
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" />
|
||||
</svg>
|
||||
<span>Ausstehend</span>
|
||||
}
|
||||
@@ -311,7 +396,9 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
<p style="color: #9ca3af; font-size: 0.875rem; margin: 0;">Keine Empfänger</p>
|
||||
}
|
||||
}
|
||||
@@ -337,6 +424,14 @@
|
||||
private DxGrid? _gridActive;
|
||||
private DxGrid? _gridCompleted;
|
||||
|
||||
// Logo config loaded from /api/CustomImages after auth
|
||||
private EnvelopeGenerator.Server.Client.Services.CustomImageDto? _appLogo;
|
||||
private EnvelopeGenerator.Server.Client.Services.CustomImageDto? _companyLogo;
|
||||
|
||||
// Stable keys used to store/restore each grid's layout in UserPreferences.GridLayouts
|
||||
private const string GridKeyActive = "sender.active-envelopes";
|
||||
private const string GridKeyCompleted = "sender.completed-envelopes";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var hasAccess = await AuthService.CheckSenderAccessAsync();
|
||||
@@ -346,6 +441,17 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Load theme + DisplayName from server after authentication.
|
||||
// Non-fatal: if this fails the page still loads with default theme.
|
||||
// ThemeService.ScheduleSaveAsync() already logs errors internally.
|
||||
try { await ThemeService.LoadFromServerAsync(); }
|
||||
catch { /* swallow — default theme remains active */ }
|
||||
|
||||
// Load logo config — authenticated, so this should succeed
|
||||
var logos = await CustomImagesService.GetAsync();
|
||||
_appLogo = logos.App;
|
||||
_companyLogo = logos.Company;
|
||||
|
||||
await LoadEnvelopesAsync();
|
||||
}
|
||||
|
||||
@@ -358,18 +464,15 @@
|
||||
try
|
||||
{
|
||||
_allEnvelopes = await EnvelopeService.GetAsync() ?? [];
|
||||
|
||||
|
||||
// Split into active and completed based on status
|
||||
var envelopes = _allEnvelopes.ToList();
|
||||
_activeEnvelopes = envelopes.Where(e => ((EnvelopeStatus)e.Status).IsActive()).ToList();
|
||||
_completedEnvelopes = envelopes.Where(e => ((EnvelopeStatus)e.Status).IsCompleted()).ToList();
|
||||
|
||||
await JSRuntime.InvokeVoidAsync("console.log", $"Loaded {_activeEnvelopes.Count()} active and {_completedEnvelopes.Count()} completed envelopes");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_errorMessage = ex.Message;
|
||||
await JSRuntime.InvokeVoidAsync("console.error", "Fehler beim Laden der Umschläge:", ex.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -385,28 +488,26 @@
|
||||
|
||||
void CreateEnvelope()
|
||||
{
|
||||
// TODO: Navigate to envelope creation page
|
||||
JSRuntime.InvokeVoidAsync("console.log", "Create envelope clicked - not yet implemented");
|
||||
Navigation.NavigateTo("/sender/editor");
|
||||
}
|
||||
|
||||
void EditEnvelope()
|
||||
{
|
||||
if (_selectedEnvelope == null) return;
|
||||
// TODO: Navigate to envelope editor
|
||||
JSRuntime.InvokeVoidAsync("console.log", $"Edit envelope {_selectedEnvelope.Id} clicked - not yet implemented");
|
||||
}
|
||||
|
||||
void DeleteEnvelope()
|
||||
{
|
||||
if (_selectedEnvelope == null) return;
|
||||
// TODO: Show delete confirmation dialog
|
||||
JSRuntime.InvokeVoidAsync("console.log", $"Delete envelope {_selectedEnvelope.Id} clicked - not yet implemented");
|
||||
}
|
||||
|
||||
async Task LogoutAsync()
|
||||
{
|
||||
_isLoggingOut = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
UserPreferencesService.InvalidateCache();
|
||||
await AuthService.LogoutSenderAsync();
|
||||
Navigation.NavigateTo("/sender/login", forceLoad: true);
|
||||
}
|
||||
@@ -443,4 +544,45 @@
|
||||
{
|
||||
_selectedEnvelope = envelope as EnvelopeDto;
|
||||
}
|
||||
|
||||
// ── Grid Layout Persistence ───────────────────────────────────────────────
|
||||
// LayoutAutoLoading fires when the grid initializes — restore saved layout.
|
||||
// LayoutAutoSaving fires when the user changes column order/width/sort — persist it.
|
||||
// UserPreferencesService.GetAsync() uses the 1h in-memory cache → 0 HTTP on restore.
|
||||
// UserPreferencesService.SaveGridLayoutAsync() merges the single key → 1 PUT.
|
||||
|
||||
async Task OnActiveGridLayoutAutoLoading(GridPersistentLayoutEventArgs e)
|
||||
{
|
||||
// Use cached preferences only — avoid HTTP during grid initialization.
|
||||
// If cache is empty (LoadFromServerAsync failed), skip layout restore silently.
|
||||
var prefs = UserPreferencesService.GetCached();
|
||||
if (prefs is not null && prefs.GridLayouts.TryGetValue(GridKeyActive, out var json))
|
||||
e.Layout = JsonSerializer.Deserialize<GridPersistentLayout>(json);
|
||||
}
|
||||
|
||||
async Task OnActiveGridLayoutAutoSaving(GridPersistentLayoutEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var json = JsonSerializer.Serialize(e.Layout);
|
||||
await UserPreferencesService.SaveGridLayoutAsync(GridKeyActive, json);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("console.warn", $"[Sender] Grid layout save failed: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
async Task OnCompletedGridLayoutAutoLoading(GridPersistentLayoutEventArgs e)
|
||||
{
|
||||
var prefs = UserPreferencesService.GetCached();
|
||||
if (prefs is not null && prefs.GridLayouts.TryGetValue(GridKeyCompleted, out var json))
|
||||
e.Layout = JsonSerializer.Deserialize<GridPersistentLayout>(json);
|
||||
}
|
||||
|
||||
async Task OnCompletedGridLayoutAutoSaving(GridPersistentLayoutEventArgs e)
|
||||
{
|
||||
var json = JsonSerializer.Serialize(e.Layout);
|
||||
await UserPreferencesService.SaveGridLayoutAsync(GridKeyCompleted, json);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,27 @@
|
||||
@page "/"
|
||||
@inject IJSRuntime JS
|
||||
|
||||
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
||||
@inject NavigationManager Navigation
|
||||
@inject EnvelopeGenerator.Server.Client.Services.CustomImagesService CustomImagesService
|
||||
@rendermode InteractiveWebAssembly
|
||||
|
||||
<div class="home-page-wrapper">
|
||||
|
||||
<div class="home-hero-header">
|
||||
<div class="home-hero-header__inner">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="home-hero-header__icon" viewBox="0 0 16 16">
|
||||
<path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4Zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1H2Zm13 2.383-4.708 2.825L15 11.105V5.383Zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741ZM1 11.105l4.708-2.897L1 5.383v5.722Z"/>
|
||||
</svg>
|
||||
@* signFLOW logo from appsettings.json CustomImages.App — fallback to SVG if not loaded *@
|
||||
@if (_appLogo is not null && !string.IsNullOrEmpty(_appLogo.Src))
|
||||
{
|
||||
<img src="@_appLogo.Src"
|
||||
style="height: @_appLogo.Height"
|
||||
class="home-hero-header__icon @_appLogo.GetClass("Main")"
|
||||
alt="signFLOW" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="home-hero-header__icon" viewBox="0 0 16 16">
|
||||
<path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4Zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1H2Zm13 2.383-4.708 2.825L15 11.105V5.383Zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741ZM1 11.105l4.708-2.897L1 5.383v5.722Z"/>
|
||||
</svg>
|
||||
}
|
||||
<div>
|
||||
<h1 class="home-hero-header__title">SignFlow</h1>
|
||||
<p class="home-hero-header__subtitle">Willkommen im eSign-Portal</p>
|
||||
@@ -25,7 +37,18 @@
|
||||
<span id="home-description"></span>
|
||||
</p>
|
||||
|
||||
<div class="mt-4 pt-3 border-top">
|
||||
<div class="mt-4 pt-3 border-top d-flex flex-column align-items-center gap-4">
|
||||
|
||||
<button class="home-btn-primary btn px-4 py-2 d-flex align-items-center gap-2" @onclick='() => Navigation.NavigateTo("/sender")'>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4Zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1H2Zm13 2.383-4.708 2.825L15 11.105V5.383Zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741ZM1 11.105l4.708-2.897L1 5.383v5.722Z"/>
|
||||
</svg>
|
||||
Zur Umschlag-Übersicht
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div class="d-flex flex-wrap justify-content-center gap-3">
|
||||
<div class="home-feature-badge">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" class="me-1" viewBox="0 0 16 16">
|
||||
@@ -47,6 +70,7 @@
|
||||
PDF-Export
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -61,11 +85,18 @@
|
||||
"Mit seiner benutzerfreundlichen Oberfläche können Sie Ihre Dokumente schnell hochladen, die Unterschriftsprozesse verfolgen und Ihre digitalen Unterschriftenanwendungen einfach durchführen. " +
|
||||
"Dieses Portal beschleunigt Ihren Arbeitsablauf mit rechtlich gültigen Unterschriften und erhöht gleichzeitig die Sicherheit Ihrer Dokumente.";
|
||||
|
||||
private EnvelopeGenerator.Server.Client.Services.CustomImageDto? _appLogo;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// Load logo config early — 401 here is normal (not yet logged in), service returns defaults silently
|
||||
var logos = await CustomImagesService.GetAsync();
|
||||
_appLogo = logos.App;
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await JS.InvokeVoidAsync("receiverSignature.startTyped", "home-description", HomePageDescription, 15);
|
||||
}
|
||||
if (!firstRender) return;
|
||||
await JS.InvokeVoidAsync("receiverSignature.startTyped", "home-description", HomePageDescription, 15);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
@inject AuthService AuthService
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
||||
|
||||
<div class="login-page-wrapper d-flex align-items-center justify-content-center min-vh-100">
|
||||
<div class="login-card card shadow border-0" style="max-width: 440px; width: 100%;">
|
||||
|
||||
@@ -15,14 +13,14 @@
|
||||
<path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z" />
|
||||
</svg>
|
||||
</div>
|
||||
<h5 class="mb-0 fw-semibold">Dokument öffnen</h5>
|
||||
<h5 class="mb-0 fw-semibold">Dokument öffnen</h5>
|
||||
<p class="mb-0 mt-1 opacity-75" style="font-size: 0.85rem;">Sicherer Zugang mit Zugangscode</p>
|
||||
</div>
|
||||
|
||||
<div class="card-body p-4">
|
||||
|
||||
<p class="text-muted mb-4" style="font-size: 0.875rem; line-height: 1.5;">
|
||||
Bitte geben Sie den Zugangscode ein, den Sie per E-Mail erhalten haben, um das Dokument sicher zu öffnen.
|
||||
Bitte geben Sie den Zugangscode ein, den Sie per E-Mail erhalten haben, um das Dokument sicher zu öffnen.
|
||||
</p>
|
||||
|
||||
@if (LoginResult == EnvelopeLoginResult.NotFound)
|
||||
@@ -33,7 +31,7 @@
|
||||
</svg>
|
||||
<div>
|
||||
<strong>Dokument nicht gefunden.</strong><br />
|
||||
<span style="font-size:0.85rem;">Der angegebene Zugangscode konnte keinem Dokument zugeordnet werden. Bitte prüfen Sie den Link in Ihrer E-Mail.</span>
|
||||
<span style="font-size:0.85rem;">Der angegebene Zugangscode konnte keinem Dokument zugeordnet werden. Bitte prüfen Sie den Link in Ihrer E-Mail.</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -44,7 +42,7 @@
|
||||
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z" />
|
||||
</svg>
|
||||
<div>
|
||||
<strong>Ungültiger Zugangscode.</strong><br />
|
||||
<strong>Ungültiger Zugangscode.</strong><br />
|
||||
<span style="font-size:0.85rem;">Der eingegebene Code ist falsch. Bitte versuchen Sie es erneut.</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -58,7 +56,7 @@
|
||||
</svg>
|
||||
<div>
|
||||
<strong>Serverfehler.</strong><br />
|
||||
<span style="font-size:0.85rem;">Ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.</span>
|
||||
<span style="font-size:0.85rem;">Ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -115,14 +113,14 @@
|
||||
@if (IsLoading)
|
||||
{
|
||||
<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>
|
||||
<span>Überprüfen …</span>
|
||||
<span>Überprüfen …</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="me-2" viewBox="0 0 16 16">
|
||||
<path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z" />
|
||||
</svg>
|
||||
<span>Dokument öffnen</span>
|
||||
<span>Dokument öffnen</span>
|
||||
}
|
||||
</button>
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
@inject AuthService AuthService
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
||||
|
||||
<div class="login-page-wrapper d-flex align-items-center justify-content-center min-vh-100">
|
||||
<div class="login-card card shadow border-0" style="max-width: 440px; width: 100%;">
|
||||
|
||||
@@ -32,7 +30,7 @@
|
||||
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z"/>
|
||||
</svg>
|
||||
<div>
|
||||
<strong>Ungültige Anmeldedaten.</strong><br />
|
||||
<strong>Ungültige Anmeldedaten.</strong><br />
|
||||
<span style="font-size:0.85rem;">Benutzername oder Passwort ist falsch. Bitte versuchen Sie es erneut.</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,7 +42,7 @@
|
||||
</svg>
|
||||
<div>
|
||||
<strong>Serverfehler.</strong><br />
|
||||
<span style="font-size:0.85rem;">Ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.</span>
|
||||
<span style="font-size:0.85rem;">Ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -120,7 +118,7 @@
|
||||
disabled="@(IsLoading || string.IsNullOrWhiteSpace(Username) || string.IsNullOrWhiteSpace(Password))">
|
||||
@if (IsLoading) {
|
||||
<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>
|
||||
<span>Anmelden …</span>
|
||||
<span>Anmelden …</span>
|
||||
} else {
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="me-2" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/>
|
||||
|
||||
@@ -34,6 +34,13 @@ builder.Services.AddScoped<SignatureCacheService>();
|
||||
builder.Services.AddSingleton<AppVersionService>();
|
||||
builder.Services.AddScoped<EnvelopeService>();
|
||||
|
||||
// UI Preferences & Theme
|
||||
builder.Services.AddScoped<UserPreferencesService>();
|
||||
builder.Services.AddScoped<ThemeService>();
|
||||
|
||||
// Logo configuration (loaded once after login, in-memory cached)
|
||||
builder.Services.AddScoped<CustomImagesService>();
|
||||
|
||||
// DevExpress WASM
|
||||
builder.Services.AddDevExpressWebAssemblyBlazorPdfViewer();
|
||||
builder.Services.AddDevExpressWebAssemblyBlazorReportViewer();
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace EnvelopeGenerator.Server.Client.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Fetches and caches the CustomImages configuration (signFLOW + company logos)
|
||||
/// from GET /api/CustomImages.
|
||||
///
|
||||
/// Config changes rarely (deployment-time only), so results are cached in-memory
|
||||
/// for the lifetime of the service (WASM app session). No TTL needed.
|
||||
/// </summary>
|
||||
public class CustomImagesService(IHttpClientFactory clientFactory)
|
||||
{
|
||||
private static readonly JsonSerializerOptions _json = new(JsonSerializerDefaults.Web);
|
||||
private const string Endpoint = "/api/CustomImages";
|
||||
|
||||
private CustomImagesDto? _cached;
|
||||
|
||||
/// <summary>
|
||||
/// Returns logo configuration. Fetches once from server; all subsequent calls
|
||||
/// are served from memory with zero network overhead.
|
||||
/// Returns defaults (empty Src) on auth failure (401) — components must handle gracefully.
|
||||
/// </summary>
|
||||
public async Task<CustomImagesDto> GetAsync(CancellationToken ct = default)
|
||||
{
|
||||
if (_cached is not null)
|
||||
return _cached;
|
||||
|
||||
try
|
||||
{
|
||||
var client = clientFactory.CreateClient("EnvelopeGenerator.Server");
|
||||
var response = await client.GetAsync(Endpoint, ct);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
// Not authenticated yet (login page) — return defaults silently.
|
||||
_cached = new CustomImagesDto();
|
||||
return _cached;
|
||||
}
|
||||
|
||||
_cached = await response.Content.ReadFromJsonAsync<CustomImagesDto>(_json, ct)
|
||||
?? new CustomImagesDto();
|
||||
return _cached;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// Network error or server unavailable — return defaults so UI still renders.
|
||||
return new CustomImagesDto();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Call after logout to force re-fetch on next login.</summary>
|
||||
public void Invalidate() => _cached = null;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
using EnvelopeGenerator.Application.EnvelopeReceivers.Commands;
|
||||
using EnvelopeGenerator.Server.Client.Models;
|
||||
|
||||
namespace EnvelopeGenerator.Server.Client.Services;
|
||||
@@ -9,6 +10,7 @@ namespace EnvelopeGenerator.Server.Client.Services;
|
||||
/// <summary>
|
||||
/// Retrieves the <see cref="EnvelopeReceiverDto"/> for the authenticated receiver
|
||||
/// from <c>GET /api/EnvelopeReceiver/{envelopeKey}</c>.
|
||||
/// Also creates new envelopes via <c>POST /api/EnvelopeReceiver</c>.
|
||||
/// </summary>
|
||||
public class EnvelopeReceiverService(IHttpClientFactory httpClientFactory)
|
||||
{
|
||||
@@ -37,4 +39,28 @@ public class EnvelopeReceiverService(IHttpClientFactory httpClientFactory)
|
||||
|
||||
return await response.Content.ReadFromJsonAsync<EnvelopeReceiverDto>(_jsonOptions, cancel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new envelope with document and receivers via <c>POST /api/EnvelopeReceiver</c>.
|
||||
/// Requires sender authentication cookie to be present in the request.
|
||||
/// </summary>
|
||||
/// <exception cref="HttpRequestException">Thrown when the API request fails.</exception>
|
||||
public async Task<CreateEnvelopeReceiverResponse?> CreateAsync(
|
||||
CreateEnvelopeReceiverCommand request,
|
||||
CancellationToken cancel = default)
|
||||
{
|
||||
using var http = httpClientFactory.CreateClient("EnvelopeGenerator.Server");
|
||||
var response = await http.PostAsJsonAsync("/api/EnvelopeReceiver", request, _jsonOptions, cancel);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
var body = await response.Content.ReadAsStringAsync(cancel);
|
||||
throw new HttpRequestException(
|
||||
$"Fehler beim Erstellen des Umschlags. Status: {(int)response.StatusCode} – {body}",
|
||||
null,
|
||||
response.StatusCode);
|
||||
}
|
||||
|
||||
return await response.Content.ReadFromJsonAsync<CreateEnvelopeReceiverResponse>(_jsonOptions, cancel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
using Microsoft.JSInterop;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using EnvelopeGenerator.Application.Common.Dto;
|
||||
|
||||
namespace EnvelopeGenerator.Server.Client.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Manages the active DevExpress theme for the WASM client.
|
||||
///
|
||||
/// Theme selection is the sole UI control — no separate dark/light toggle.
|
||||
/// Themes ordered dark → light: blazing-dark | blazing-berry | purple
|
||||
///
|
||||
/// Initialization:
|
||||
/// 1. InitializeAsync() — reads localStorage["signflow.theme"], falls back to
|
||||
/// system prefers-color-scheme (dark → blazing-dark, light → blazing-berry).
|
||||
/// 2. LoadFromServerAsync() — called after login, syncs theme from server cache.
|
||||
///
|
||||
/// Persistence:
|
||||
/// - SetThemeAsync() → debounced 500ms PUT /api/UserPreferences.
|
||||
/// - ScheduleSaveAsync() uses GetCached() — no extra GET before each save.
|
||||
///
|
||||
/// Consumers subscribe to OnChange and call StateHasChanged (e.g. MainLayout).
|
||||
/// </summary>
|
||||
public class ThemeService : IAsyncDisposable
|
||||
{
|
||||
// ── Allowed themes (ordered dark → light for range slider) ───────────────
|
||||
// DevExpress.Blazor.Themes 25.2.3: blazing-berry, blazing-dark, purple
|
||||
public static readonly IReadOnlyList<ThemeOption> AvailableThemes =
|
||||
[
|
||||
new("Blazing Dark", "blazing-dark"), // index 0 — 🌙
|
||||
new("Blazing Berry", "blazing-berry"), // index 1 — middle
|
||||
new("Purple", "purple"), // index 2 — ☀️
|
||||
];
|
||||
|
||||
private const string LocalStorageThemeKey = "signflow.theme";
|
||||
|
||||
// ── State ─────────────────────────────────────────────────────────────────
|
||||
private string _themeName = "blazing-berry";
|
||||
private bool _initialized = false;
|
||||
|
||||
// ── Dependencies ──────────────────────────────────────────────────────────
|
||||
private readonly IJSRuntime _js;
|
||||
private readonly UserPreferencesService _preferencesService;
|
||||
private readonly ILogger<ThemeService> _logger;
|
||||
|
||||
// ── Debounce ──────────────────────────────────────────────────────────────
|
||||
private CancellationTokenSource? _saveCts;
|
||||
|
||||
// ── Change & error notification ───────────────────────────────────────────
|
||||
/// <summary>Fired whenever theme changes. Subscribers call StateHasChanged.</summary>
|
||||
public event Action? OnChange;
|
||||
|
||||
/// <summary>
|
||||
/// Set when a background save fails. UI layer can surface this as a warning.
|
||||
/// Cleared on the next successful save or theme change.
|
||||
/// </summary>
|
||||
public Exception? SaveError { get; private set; }
|
||||
|
||||
public ThemeService(IJSRuntime js, UserPreferencesService preferencesService, ILogger<ThemeService> logger)
|
||||
{
|
||||
_js = js;
|
||||
_preferencesService = preferencesService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
// ── Public state ──────────────────────────────────────────────────────────
|
||||
|
||||
public string ThemeName => _themeName;
|
||||
|
||||
/// <summary>True when blazing-dark is active — used for Bootstrap data-bs-theme.</summary>
|
||||
public bool IsDarkMode => _themeName == "blazing-dark";
|
||||
|
||||
public string? DisplayName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// CSS href for the active DevExpress theme.
|
||||
/// Example: "_content/DevExpress.Blazor.Themes/blazing-dark.bs5.min.css"
|
||||
/// </summary>
|
||||
public string ThemeCssHref =>
|
||||
$"_content/DevExpress.Blazor.Themes/{_themeName}.bs5.min.css";
|
||||
|
||||
/// <summary>Bootstrap 5 data-bs-theme value. Only "dark" for blazing-dark.</summary>
|
||||
public string BootstrapTheme => _themeName == "blazing-dark" ? "dark" : "light";
|
||||
|
||||
// ── Initialization ────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Called once in OnAfterRenderAsync(firstRender: true).
|
||||
/// Reads theme from localStorage; falls back to system dark-mode preference.
|
||||
/// Safe to call multiple times — subsequent calls are no-ops.
|
||||
/// </summary>
|
||||
public async Task InitializeAsync()
|
||||
{
|
||||
if (_initialized) return;
|
||||
_initialized = true;
|
||||
|
||||
var stored = await _js.InvokeAsync<string?>("localStorage.getItem", LocalStorageThemeKey);
|
||||
|
||||
if (stored is not null && AvailableThemes.Any(t => t.Value == stored))
|
||||
{
|
||||
_themeName = stored;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No stored theme — use system preference to pick dark or light
|
||||
var prefersDark = await _js.InvokeAsync<bool>(
|
||||
"eval",
|
||||
"(function(){ return window.matchMedia('(prefers-color-scheme: dark)').matches; })()");
|
||||
|
||||
_themeName = prefersDark ? "blazing-dark" : "blazing-berry";
|
||||
}
|
||||
|
||||
await ApplyThemeToDocumentAsync();
|
||||
OnChange?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called after successful sender login.
|
||||
/// Syncs theme from the server cache; on first login propagates local theme to server.
|
||||
/// </summary>
|
||||
public async Task LoadFromServerAsync(CancellationToken ct = default)
|
||||
{
|
||||
var prefs = await _preferencesService.GetAsync(ct);
|
||||
|
||||
var isFirstLogin = prefs.GridLayouts.Count == 0
|
||||
&& prefs.ThemeName == "blazing-berry"
|
||||
&& !prefs.IsDarkMode;
|
||||
|
||||
if (isFirstLogin && _themeName != "blazing-berry")
|
||||
{
|
||||
// Propagate locally-detected theme to server on first login
|
||||
prefs.ThemeName = _themeName;
|
||||
prefs.IsDarkMode = IsDarkMode;
|
||||
prefs = await _preferencesService.SaveAsync(prefs, ct);
|
||||
}
|
||||
|
||||
ApplyPreferences(prefs);
|
||||
|
||||
// Persist resolved theme to localStorage
|
||||
await _js.InvokeVoidAsync("localStorage.setItem", LocalStorageThemeKey, _themeName);
|
||||
|
||||
DisplayName = prefs.DisplayName;
|
||||
await ApplyThemeToDocumentAsync();
|
||||
OnChange?.Invoke();
|
||||
}
|
||||
|
||||
// ── Mutation ──────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Sets the active theme, applies it immediately, and schedules a server save.
|
||||
/// State change is applied regardless of whether the save succeeds.
|
||||
/// </summary>
|
||||
public async Task SetThemeAsync(string themeName)
|
||||
{
|
||||
if (themeName == _themeName) return;
|
||||
if (!AvailableThemes.Any(t => t.Value == themeName))
|
||||
throw new ArgumentException($"Theme '{themeName}' is not allowed.", nameof(themeName));
|
||||
|
||||
_themeName = themeName;
|
||||
SaveError = null;
|
||||
|
||||
await _js.InvokeVoidAsync("localStorage.setItem", LocalStorageThemeKey, _themeName);
|
||||
await ApplyThemeToDocumentAsync();
|
||||
OnChange?.Invoke();
|
||||
await ScheduleSaveAsync();
|
||||
}
|
||||
|
||||
// ── Private helpers ───────────────────────────────────────────────────────
|
||||
|
||||
private void ApplyPreferences(UserPreferencesDto prefs)
|
||||
{
|
||||
_themeName = AvailableThemes.Any(t => t.Value == prefs.ThemeName)
|
||||
? prefs.ThemeName
|
||||
: "blazing-berry";
|
||||
|
||||
// Legacy: if IsDarkMode flag was saved but ThemeName wasn't updated
|
||||
if (prefs.IsDarkMode && _themeName == "blazing-berry")
|
||||
_themeName = "blazing-dark";
|
||||
}
|
||||
|
||||
private async Task ApplyThemeToDocumentAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
await _js.InvokeVoidAsync("signflowTheme.apply", ThemeCssHref, BootstrapTheme, _themeName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// JS unavailable during server prerender — <HeadContent> link is the SSR fallback.
|
||||
_logger.LogDebug(ex, "[ThemeService] ApplyThemeToDocumentAsync skipped (JS unavailable).");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ScheduleSaveAsync()
|
||||
{
|
||||
_saveCts?.Cancel();
|
||||
_saveCts = new CancellationTokenSource();
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Delay(500, _saveCts.Token);
|
||||
|
||||
var prefs = _preferencesService.GetCached() ?? new UserPreferencesDto();
|
||||
prefs.ThemeName = _themeName;
|
||||
prefs.IsDarkMode = IsDarkMode;
|
||||
|
||||
await _preferencesService.SaveAsync(prefs, _saveCts.Token);
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
{
|
||||
// Newer save scheduled — intentionally cancelled.
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Background save of user preferences failed.");
|
||||
SaveError = ex;
|
||||
OnChange?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
_saveCts?.Cancel();
|
||||
_saveCts?.Dispose();
|
||||
return ValueTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Describes a selectable DevExpress theme.</summary>
|
||||
/// <param name="Label">User-facing display name.</param>
|
||||
/// <param name="Value">CSS theme identifier.</param>
|
||||
public sealed record ThemeOption(string Label, string Value);
|
||||
@@ -0,0 +1,136 @@
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
using EnvelopeGenerator.Application.Common.Dto;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace EnvelopeGenerator.Server.Client.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves and persists user UI preferences via the server API.
|
||||
/// The server stores preferences in the distributed cache (dbo.TBDD_CACHE).
|
||||
///
|
||||
/// Client-side memory cache:
|
||||
/// Preferences are cached in-memory for <see cref="CacheDuration"/> after the first fetch.
|
||||
/// All reads (GetAsync, GetCachedAsync) are served from cache after the first load.
|
||||
/// Writes (SaveAsync) update both the cache and the server atomically.
|
||||
/// Cache is invalidated explicitly via InvalidateCache().
|
||||
/// </summary>
|
||||
public class UserPreferencesService(
|
||||
IHttpClientFactory clientFactory,
|
||||
ILogger<UserPreferencesService> logger)
|
||||
{
|
||||
private static readonly JsonSerializerOptions _jsonOptions = new(JsonSerializerDefaults.Web);
|
||||
private const string Endpoint = "/api/UserPreferences";
|
||||
|
||||
// ── Client-side memory cache ──────────────────────────────────────────────
|
||||
private static readonly TimeSpan CacheDuration = TimeSpan.FromHours(1);
|
||||
private UserPreferencesDto? _cached;
|
||||
private DateTimeOffset _cachedAt = DateTimeOffset.MinValue;
|
||||
|
||||
private bool IsCacheValid => _cached is not null
|
||||
&& DateTimeOffset.UtcNow - _cachedAt < CacheDuration;
|
||||
|
||||
/// <summary>
|
||||
/// Returns preferences from in-memory cache if valid; otherwise fetches from the server.
|
||||
/// On first call after login this issues one HTTP GET — all subsequent calls within
|
||||
/// <see cref="CacheDuration"/> are served from memory with zero network overhead.
|
||||
/// </summary>
|
||||
public async Task<UserPreferencesDto> GetAsync(CancellationToken ct = default)
|
||||
{
|
||||
if (IsCacheValid)
|
||||
return _cached!;
|
||||
|
||||
try
|
||||
{
|
||||
var client = clientFactory.CreateClient("EnvelopeGenerator.Server");
|
||||
var response = await client.GetAsync(Endpoint, ct);
|
||||
|
||||
// Not authenticated yet (login page) or no preferences saved — return defaults.
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.NotFound ||
|
||||
response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
||||
{
|
||||
SetCache(new UserPreferencesDto());
|
||||
return _cached!;
|
||||
}
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var dto = await response.Content.ReadFromJsonAsync<UserPreferencesDto>(_jsonOptions, ct)
|
||||
?? new UserPreferencesDto();
|
||||
|
||||
SetCache(dto);
|
||||
return _cached!;
|
||||
}
|
||||
catch (Exception ex) when (ex is not TaskCanceledException)
|
||||
{
|
||||
logger.LogError(ex, "Failed to load user preferences from server.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached preferences without hitting the network.
|
||||
/// Returns null if the cache has not been populated yet (before first GetAsync call).
|
||||
/// </summary>
|
||||
public UserPreferencesDto? GetCached() => IsCacheValid ? _cached : null;
|
||||
|
||||
/// <summary>
|
||||
/// Persists the given preferences on the server and updates the in-memory cache.
|
||||
/// </summary>
|
||||
public async Task<UserPreferencesDto> SaveAsync(UserPreferencesDto preferences, CancellationToken ct = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
var client = clientFactory.CreateClient("EnvelopeGenerator.Server");
|
||||
var response = await client.PutAsJsonAsync(Endpoint, preferences, _jsonOptions, ct);
|
||||
|
||||
// Not authenticated (login page) — skip save, keep local state only.
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
||||
return preferences;
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var saved = await response.Content.ReadFromJsonAsync<UserPreferencesDto>(_jsonOptions, ct)
|
||||
?? preferences;
|
||||
|
||||
SetCache(saved);
|
||||
return saved;
|
||||
}
|
||||
catch (Exception ex) when (ex is not TaskCanceledException)
|
||||
{
|
||||
logger.LogError(ex, "Failed to save user preferences to server.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates a single grid layout key without a network read.
|
||||
/// Uses the in-memory cache for the current state, merges the new layout, then saves.
|
||||
/// If the cache is empty (cold start), fetches from server first.
|
||||
/// </summary>
|
||||
/// <param name="gridKey">Stable grid identifier, e.g. "sender.active-envelopes".</param>
|
||||
/// <param name="layoutJson">Opaque layout JSON produced by DxGrid.SaveLayoutAsync().</param>
|
||||
public async Task SaveGridLayoutAsync(string gridKey, string layoutJson, CancellationToken ct = default)
|
||||
{
|
||||
// Use cached copy — avoids a GET before every grid layout save.
|
||||
var prefs = GetCached() ?? await GetAsync(ct);
|
||||
prefs.GridLayouts[gridKey] = layoutJson;
|
||||
await SaveAsync(prefs, ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invalidates the in-memory cache, forcing the next GetAsync to fetch from the server.
|
||||
/// Call this after logout or when a forced refresh is needed.
|
||||
/// </summary>
|
||||
public void InvalidateCache()
|
||||
{
|
||||
_cached = null;
|
||||
_cachedAt = DateTimeOffset.MinValue;
|
||||
}
|
||||
|
||||
private void SetCache(UserPreferencesDto dto)
|
||||
{
|
||||
_cached = dto;
|
||||
_cachedAt = DateTimeOffset.UtcNow;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,23 @@
|
||||
<link rel="stylesheet" href="css/envelope-viewer.css" />
|
||||
<link rel="stylesheet" href="EnvelopeGenerator.Server.styles.css" />
|
||||
<HeadOutlet />
|
||||
<!-- Apply saved theme immediately on page load — before WASM boots.
|
||||
Reads localStorage["signflow.theme"] to avoid flash of default theme. -->
|
||||
<script>
|
||||
(function () {
|
||||
var allowed = { 'blazing-dark': true, 'blazing-berry': true, 'purple': true };
|
||||
var theme = localStorage.getItem('signflow.theme');
|
||||
if (!theme || !allowed[theme]) theme = 'blazing-berry';
|
||||
var bsTheme = theme === 'blazing-dark' ? 'dark' : 'light';
|
||||
document.documentElement.setAttribute('data-sf-theme', theme);
|
||||
document.documentElement.setAttribute('data-bs-theme', bsTheme);
|
||||
var link = document.createElement('link');
|
||||
link.id = 'dx-theme-link';
|
||||
link.rel = 'stylesheet';
|
||||
link.href = '_content/DevExpress.Blazor.Themes/' + theme + '.bs5.min.css';
|
||||
document.head.appendChild(link);
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -17,6 +34,8 @@
|
||||
<script src="_content/DevExpress.Blazor.Resources/js/preload-script.js"></script>
|
||||
<script src="js/typed.umd.js"></script>
|
||||
<script src="js/receiver-signature.js?v=9"></script>
|
||||
<script src="js/signflow-theme.js"></script>
|
||||
<script src="js/envelope-editor.js"></script>
|
||||
<script src="_framework/blazor.web.js"></script>
|
||||
</body>
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,723 @@
|
||||
@page "/envelope/{EnvelopeKey}"
|
||||
@rendermode InteractiveServer
|
||||
@using DevExpress.Blazor.Reporting
|
||||
@using DevExpress.XtraReports.UI
|
||||
@using EnvelopeGenerator.Server.Client.Models
|
||||
@using EnvelopeGenerator.Server.Client.Models.Constants
|
||||
@using EnvelopeGenerator.Server.Client.Services
|
||||
@using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver
|
||||
@using Microsoft.JSInterop
|
||||
@using DevExpress.Blazor
|
||||
@using System.Drawing
|
||||
@using System.Security.Claims
|
||||
@using Microsoft.Extensions.Caching.Memory
|
||||
@inject NavigationManager Navigation
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject EnvelopeGenerator.Server.Client.Services.AuthService AuthService
|
||||
@inject EnvelopeGenerator.Server.Services.EnvelopeReceiverAuthorizationService ReceiverAuthorizationService
|
||||
@inject EnvelopeGenerator.Server.Services.EnvelopeReceiverPageDataService PageDataService
|
||||
@inject AppVersionService AppVersion
|
||||
@inject IMemoryCache MemoryCache
|
||||
@inject ILogger<ReceiverPage> Logger
|
||||
@implements IDisposable
|
||||
|
||||
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
||||
<link href="_content/DevExpress.Blazor.Reporting.Viewer/css/dx-blazor-reporting-components.bs5.css" rel="stylesheet" />
|
||||
<link href="@AppVersion.GetVersionedUrl("css/envelope-viewer.css")" rel="stylesheet" />
|
||||
<script src="@AppVersion.GetVersionedUrl("js/receiver-signature.js")"></script>
|
||||
|
||||
<div class="envelope-viewer-layout">
|
||||
<div class="envelope-action-bar">
|
||||
<div class="envelope-action-bar__inner" style="flex-direction: column; align-items: stretch; padding: 0.35rem 1.5rem; gap: 0.35rem;">
|
||||
@* Row 1: Title + Sender + Badges *@
|
||||
<div style="display: flex; align-items: center; justify-content: space-between; gap: 1rem;">
|
||||
@* Left: Title + Sender *@
|
||||
<div style="flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 0.75rem;">
|
||||
@if (_envelopeReceiver is not null)
|
||||
{
|
||||
<div style="font-size: 0.9rem; font-weight: 600; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
||||
@(_envelopeReceiver.Envelope?.Title ?? "Dokument")
|
||||
</div>
|
||||
@if (!string.IsNullOrWhiteSpace(_envelopeReceiver.Envelope?.User?.FullName) || !string.IsNullOrWhiteSpace(_envelopeReceiver.Envelope?.User?.Email))
|
||||
{
|
||||
<span style="font-size: 0.7rem; color: #6b7280; white-space: nowrap;">
|
||||
Von
|
||||
@if (!string.IsNullOrWhiteSpace(_envelopeReceiver.Envelope?.User?.FullName))
|
||||
{
|
||||
<span style="font-weight: 500; color: #374151;">@_envelopeReceiver.Envelope.User.FullName</span>
|
||||
}
|
||||
@if (!string.IsNullOrWhiteSpace(_envelopeReceiver.Envelope?.User?.Email))
|
||||
{
|
||||
<span><@_envelopeReceiver.Envelope.User.Email></span>
|
||||
}
|
||||
@if (_envelopeReceiver.Envelope?.AddedWhen != null)
|
||||
{
|
||||
<span> · @_envelopeReceiver.Envelope.AddedWhen.ToString("dd.MM.yyyy")</span>
|
||||
}
|
||||
</span>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<div style="font-size: 0.9rem; font-weight: 600; color: #1f2937;">Dokumentenansicht</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@* Right: Badges + Signature status *@
|
||||
<div class="d-flex align-items-center" style="gap: 0.75rem; flex: 0 0 auto;">
|
||||
@if (_envelopeReceiver is not null)
|
||||
{
|
||||
<div class="d-flex flex-wrap align-items-center" style="gap: 0.3rem; font-size: 0.7rem;">
|
||||
@if (!string.IsNullOrWhiteSpace(_envelopeReceiver.Name))
|
||||
{
|
||||
<span style="display: inline-flex; align-items: center; padding: 0.125rem 0.4rem; background: #f3f4f6; border-radius: 0.25rem; color: #374151; white-space: nowrap;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="9" height="9" fill="currentColor" class="me-1" viewBox="0 0 16 16">
|
||||
<path d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4Z" />
|
||||
</svg>
|
||||
@_envelopeReceiver.Name
|
||||
</span>
|
||||
}
|
||||
@if (_signatures.Count > 0)
|
||||
{
|
||||
<span style="display: inline-flex; align-items: center; padding: 0.125rem 0.4rem; background: @(_capturedSignature is not null ? "#d1fae5" : "#ede9fe"); border-radius: 0.25rem; color: @(_capturedSignature is not null ? "#065f46" : "#6d28d9"); font-weight: 500; white-space: nowrap;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="9" height="9" fill="currentColor" class="me-1" viewBox="0 0 16 16">
|
||||
<path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z" />
|
||||
</svg>
|
||||
@_signatures.Count Unterschrift@(_signatures.Count != 1 ? "en" : "")
|
||||
@if (_capturedSignature is not null)
|
||||
{
|
||||
<span class="ms-1">✓</span>
|
||||
}
|
||||
</span>
|
||||
}
|
||||
@if (_envelopeReceiver.Envelope?.UseAccessCode ?? false)
|
||||
{
|
||||
<span style="display: inline-flex; align-items: center; padding: 0.125rem 0.4rem; background: #fef3c7; border-radius: 0.25rem; color: #92400e; font-weight: 500; white-space: nowrap;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="9" height="9" fill="currentColor" class="me-1" viewBox="0 0 16 16">
|
||||
<path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z" />
|
||||
</svg>
|
||||
Code
|
||||
</span>
|
||||
}
|
||||
@if (_envelopeReceiver.Envelope?.TFAEnabled ?? false)
|
||||
{
|
||||
<span style="display: inline-flex; align-items: center; padding: 0.125rem 0.4rem; background: #dbeafe; border-radius: 0.25rem; color: #1e40af; font-weight: 500; white-space: nowrap;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="9" height="9" fill="currentColor" class="me-1" viewBox="0 0 16 16">
|
||||
<path d="M5.338 1.59a61.44 61.44 0 0 0-2.837.856.481.481 0 0 0-.328.39c-.554 4.157.726 7.19 2.253 9.188a10.725 10.725 0 0 0 2.287 2.233c.346.244.652.42.893.533.12.057.218.095.293.118a.55.55 0 0 0 .101.025.615.615 0 0 0 .1-.025c.076-.023.174-.061.294-.118.24-.113.547-.29.893-.533a10.726 10.726 0 0 0 2.287-2.233c1.527-1.997 2.807-5.031 2.253-9.188a.48.48 0 0 0-.328-.39c-.651-.213-1.75-.56-2.837-.855C9.552 1.29 8.531 1.067 8 1.067c-.53 0-1.552.223-2.662.524zM5.072.56C6.157.265 7.31 0 8 0s1.843.265 2.928.56c1.11.3 2.229.655 2.887.87a1.54 1.54 0 0 1 1.044 1.262c.596 4.477-.787 7.795-2.465 9.99a11.775 11.775 0 0 1-2.517 2.453 7.159 7.159 0 0 1-1.048.625c-.28.132-.581.24-.829.24s-.548-.108-.829-.24a7.158 7.158 0 0 1-1.048-.625 11.777 11.777 0 0 1-2.517-2.453C1.928 10.487.545 7.169 1.141 2.692A1.54 1.54 0 0 1 2.185 1.43 62.456 62.456 0 0 1 5.072.56z" />
|
||||
<path d="M10.854 5.146a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7.5 7.793l2.646-2.647a.5.5 0 0 1 .708 0z" />
|
||||
</svg>
|
||||
2FA
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@* Unterschreiben button — visible only when signature fields exist *@
|
||||
@if (_signatures.Count > 0)
|
||||
{
|
||||
<button class="pdf-toolbar__btn pdf-toolbar__btn--signature-change pdf-toolbar__btn--signature-change-active"
|
||||
@onclick="OpenSignaturePopup"
|
||||
title="Unterschreiben"
|
||||
style="flex-shrink: 0;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z" />
|
||||
</svg>
|
||||
<span class="pdf-toolbar__btn-text">Unterschreiben</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Row 2: Messages *@
|
||||
@if (_envelopeReceiver is not null && (!string.IsNullOrWhiteSpace(_envelopeReceiver.Envelope?.Message) || !string.IsNullOrWhiteSpace(_envelopeReceiver.PrivateMessage)))
|
||||
{
|
||||
<div style="display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.7rem; padding-top: 0.15rem; border-top: 1px solid #e5e7eb;">
|
||||
@if (!string.IsNullOrWhiteSpace(_envelopeReceiver.Envelope?.Message))
|
||||
{
|
||||
<div style="flex: 1; min-width: 0; padding: 0.2rem 0.4rem; background: #f9fafb; border-radius: 0.25rem; border-left: 2px solid #9ca3af; display: flex; align-items: flex-start; gap: 0.25rem;">
|
||||
<span style="font-weight: 500; color: #374151; flex-shrink: 0;">📧</span>
|
||||
<span style="color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">@_envelopeReceiver.Envelope.Message</span>
|
||||
</div>
|
||||
}
|
||||
@if (!string.IsNullOrWhiteSpace(_envelopeReceiver.PrivateMessage))
|
||||
{
|
||||
<div style="flex: 1; min-width: 0; padding: 0.2rem 0.4rem; background: #fef3c7; border-radius: 0.25rem; border-left: 2px solid #f59e0b; display: flex; align-items: flex-start; gap: 0.25rem;">
|
||||
<span style="font-weight: 500; color: #92400e; flex-shrink: 0;">🔒</span>
|
||||
<span style="color: #92400e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">@_envelopeReceiver.PrivateMessage</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="envelope-content" style="padding: 0; overflow: hidden;">
|
||||
@if (_isLoading)
|
||||
{
|
||||
<div class="d-flex justify-content-center align-items-center h-100">
|
||||
<div class="text-center">
|
||||
<div class="spinner-border text-white mb-3" style="width: 3.5rem; height: 3.5rem;" role="status">
|
||||
<span class="visually-hidden">Lädt...</span>
|
||||
</div>
|
||||
<p class="text-white fw-semibold">Dokument wird geladen...</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (_errorMessage is not null)
|
||||
{
|
||||
<div class="error-container">
|
||||
<div class="alert alert-danger shadow-lg">
|
||||
<div class="d-flex align-items-start">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" fill="currentColor" class="me-3 flex-shrink-0" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z" />
|
||||
</svg>
|
||||
<div>
|
||||
<h5 class="mb-2">Fehler beim Laden des Dokuments</h5>
|
||||
<p class="mb-0">@_errorMessage</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (_report is not null)
|
||||
{
|
||||
<DxReportViewer @ref="_reportViewer"
|
||||
Report="_report"
|
||||
RootCssClasses="w-100 h-100" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Signature Popup *@
|
||||
<DxPopup @bind-Visible="_signaturePopupVisible"
|
||||
HeaderText="Unterschrift erstellen"
|
||||
Width="620px"
|
||||
MaxWidth="95vw"
|
||||
ShowFooter="true"
|
||||
CloseOnOutsideClick="false"
|
||||
ShowCloseButton="false"
|
||||
CloseOnEscape="false"
|
||||
Shown="OnPopupShownAsync">
|
||||
<BodyContentTemplate>
|
||||
<ul class="nav nav-tabs mb-3" style="border-bottom: 2px solid #e9ecef;">
|
||||
<li class="nav-item">
|
||||
<button type="button"
|
||||
class="nav-link @(_activeSignatureTab == SignatureTabDraw ? "active" : "")"
|
||||
style="@(_activeSignatureTab == SignatureTabDraw ? "border-bottom: 3px solid #4F46E5; color: #4F46E5; font-weight: 600;" : "color: #6c757d;")"
|
||||
@onclick="() => SetSignatureTabAsync(SignatureTabDraw)">
|
||||
Zeichnen
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button type="button"
|
||||
class="nav-link @(_activeSignatureTab == SignatureTabText ? "active" : "")"
|
||||
style="@(_activeSignatureTab == SignatureTabText ? "border-bottom: 3px solid #4F46E5; color: #4F46E5; font-weight: 600;" : "color: #6c757d;")"
|
||||
@onclick="() => SetSignatureTabAsync(SignatureTabText)">
|
||||
Text
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button type="button"
|
||||
class="nav-link @(_activeSignatureTab == SignatureTabImage ? "active" : "")"
|
||||
style="@(_activeSignatureTab == SignatureTabImage ? "border-bottom: 3px solid #4F46E5; color: #4F46E5; font-weight: 600;" : "color: #6c757d;")"
|
||||
@onclick="() => SetSignatureTabAsync(SignatureTabImage)">
|
||||
Bild
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@if (_activeSignatureTab == SignatureTabDraw)
|
||||
{
|
||||
<p style="color: #6c757d; font-size: 0.875rem; margin-bottom: 0.75rem;">Bitte unterschreiben Sie im folgenden Feld.</p>
|
||||
<canvas id="rp-signature-pad"
|
||||
width="560"
|
||||
height="180"
|
||||
style="border: 2px solid #e9ecef; border-radius: 8px; background: white; width: 100%; max-width: 560px; touch-action: none; box-shadow: 0 1px 3px rgba(0,0,0,0.1);"></canvas>
|
||||
}
|
||||
else if (_activeSignatureTab == SignatureTabText)
|
||||
{
|
||||
<p style="color: #6c757d; font-size: 0.875rem; margin-bottom: 0.75rem;">Geben Sie Ihre Unterschrift als Text ein und wählen Sie eine Schriftart.</p>
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-12 col-md-7">
|
||||
<input class="form-control"
|
||||
placeholder="Ihre Unterschrift"
|
||||
value="@_typedSignatureText"
|
||||
@oninput="OnTypedSignatureChanged"
|
||||
style="border: 2px solid #e9ecef; border-radius: 6px; padding: 0.625rem;" />
|
||||
</div>
|
||||
<div class="col-12 col-md-5">
|
||||
<select class="form-select"
|
||||
value="@_typedSignatureFont"
|
||||
@onchange="OnTypedSignatureFontChanged"
|
||||
style="border: 2px solid #e9ecef; border-radius: 6px; padding: 0.625rem;">
|
||||
@foreach (var font in TypedSignatureFonts)
|
||||
{
|
||||
<option value="@font.Value" style="font-family: @font.Value">@font.Text</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<canvas id="rp-typed-signature-pad"
|
||||
width="560"
|
||||
height="180"
|
||||
style="border: 2px solid #e9ecef; border-radius: 8px; background: white; width: 100%; max-width: 560px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);"></canvas>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p style="color: #6c757d; font-size: 0.875rem; margin-bottom: 0.75rem;">Laden Sie ein Bild Ihrer Unterschrift hoch.</p>
|
||||
<input id="rp-signature-image-input"
|
||||
class="form-control mb-3"
|
||||
type="file"
|
||||
accept="image/png,image/jpeg,image/webp"
|
||||
style="border: 2px solid #e9ecef; border-radius: 6px; padding: 0.625rem;" />
|
||||
<canvas id="rp-image-signature-pad"
|
||||
width="560"
|
||||
height="180"
|
||||
style="border: 2px solid #e9ecef; border-radius: 8px; background: white; width: 100%; max-width: 560px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);"></canvas>
|
||||
}
|
||||
|
||||
<div style="border-top: 2px solid #e9ecef; margin-top: 1.5rem; padding-top: 1.5rem;">
|
||||
<div class="row g-3">
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label" for="rp-signer-name" style="font-size: 0.875rem; font-weight: 500; color: #495057;">
|
||||
Vor- und Nachname <span style="color: #dc3545;">*</span>
|
||||
</label>
|
||||
<input id="rp-signer-name"
|
||||
class="form-control"
|
||||
value="@_signerFullName"
|
||||
@oninput="args => _signerFullName = args.Value?.ToString() ?? string.Empty"
|
||||
style="border: 2px solid #e9ecef; border-radius: 6px; padding: 0.625rem;" />
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label" for="rp-signer-position" style="font-size: 0.875rem; font-weight: 500; color: #495057;">
|
||||
Position <span style="color: #6c757d; font-weight: 400;">(optional)</span>
|
||||
</label>
|
||||
<input id="rp-signer-position"
|
||||
class="form-control"
|
||||
value="@_signerPosition"
|
||||
@oninput="args => _signerPosition = args.Value?.ToString() ?? string.Empty"
|
||||
style="border: 2px solid #e9ecef; border-radius: 6px; padding: 0.625rem;" />
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label" for="rp-signature-place" style="font-size: 0.875rem; font-weight: 500; color: #495057;">
|
||||
Ort <span style="color: #dc3545;">*</span>
|
||||
</label>
|
||||
<input id="rp-signature-place"
|
||||
class="form-control"
|
||||
value="@_signaturePlace"
|
||||
@oninput="args => _signaturePlace = args.Value?.ToString() ?? string.Empty"
|
||||
style="border: 2px solid #e9ecef; border-radius: 6px; padding: 0.625rem;" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(_popupValidationMessage))
|
||||
{
|
||||
<div style="background: #fee; border-left: 4px solid #dc3545; padding: 0.75rem 1rem; margin-top: 1rem; border-radius: 4px;">
|
||||
<span style="color: #dc3545; font-size: 0.875rem; font-weight: 500;">@_popupValidationMessage</span>
|
||||
</div>
|
||||
}
|
||||
</BodyContentTemplate>
|
||||
<FooterContentTemplate>
|
||||
<div class="d-flex gap-2 justify-content-between w-100" style="padding: 0.5rem 0;">
|
||||
<button class="btn btn-outline-secondary"
|
||||
@onclick="RenewSignatureAsync"
|
||||
style="border-radius: 6px; padding: 0.625rem 1.25rem; font-weight: 500;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" class="me-1" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
|
||||
<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
|
||||
</svg>
|
||||
Erneuern
|
||||
</button>
|
||||
<button class="btn btn-primary"
|
||||
@onclick="SaveSignatureAsync"
|
||||
style="background: linear-gradient(135deg, #4F46E5 0%, #4338CA 100%); border: none; border-radius: 6px; padding: 0.625rem 2rem; font-weight: 600; box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" class="me-1" viewBox="0 0 16 16">
|
||||
<path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z" />
|
||||
</svg>
|
||||
Speichern
|
||||
</button>
|
||||
</div>
|
||||
</FooterContentTemplate>
|
||||
</DxPopup>
|
||||
|
||||
@code {
|
||||
// ----- Constants -----
|
||||
const string SignatureTabDraw = "draw";
|
||||
const string SignatureTabText = "text";
|
||||
const string SignatureTabImage = "image";
|
||||
const string DrawCanvasId = "rp-signature-pad";
|
||||
const string TypedCanvasId = "rp-typed-signature-pad";
|
||||
const string ImageInputId = "rp-signature-image-input";
|
||||
const string ImageCanvasId = "rp-image-signature-pad";
|
||||
|
||||
readonly (string Text, string Value)[] TypedSignatureFonts =
|
||||
[
|
||||
("Brush Script", "'Brush Script MT', cursive"),
|
||||
("Segoe Script", "'Segoe Script', cursive"),
|
||||
("Lucida Handwriting", "'Lucida Handwriting', cursive"),
|
||||
("Comic Sans", "'Comic Sans MS', cursive"),
|
||||
("Cursive", "cursive"),
|
||||
];
|
||||
|
||||
// ----- Parameters -----
|
||||
[Parameter] public string? EnvelopeKey { get; set; }
|
||||
|
||||
// ----- Page state -----
|
||||
bool _isLoading = true;
|
||||
string? _errorMessage;
|
||||
byte[]? _pdfBytes;
|
||||
IReadOnlyList<SignatureDto> _signatures = [];
|
||||
EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver.EnvelopeReceiverDto? _envelopeReceiver;
|
||||
ClaimsPrincipal? _receiverUser;
|
||||
|
||||
// ----- Report viewer -----
|
||||
DxReportViewer? _reportViewer;
|
||||
XtraReport? _report;
|
||||
|
||||
// ----- Signature popup state -----
|
||||
SignatureCaptureDto? _capturedSignature;
|
||||
bool _signaturePopupVisible = false;
|
||||
string? _popupValidationMessage;
|
||||
string _activeSignatureTab = SignatureTabDraw;
|
||||
string _typedSignatureText = string.Empty;
|
||||
string _typedSignatureFont = "'Brush Script MT', cursive";
|
||||
string _signerFullName = string.Empty;
|
||||
string _signerPosition = string.Empty;
|
||||
string _signaturePlace = string.Empty;
|
||||
|
||||
// ----- Lifecycle -----
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(EnvelopeKey))
|
||||
{
|
||||
_errorMessage = "Envelope-Schlüssel fehlt.";
|
||||
_isLoading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Authorization — same pattern as EnvelopeReceiverPage
|
||||
_receiverUser = await ReceiverAuthorizationService.AuthorizeAsync(EnvelopeKey);
|
||||
if (_receiverUser is null)
|
||||
{
|
||||
Navigation.NavigateTo($"/envelope/login/{Uri.EscapeDataString(EnvelopeKey)}");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Load PDF bytes via MediatR (uses authenticated user's claims)
|
||||
_pdfBytes = await PageDataService.GetDocumentAsync(_receiverUser);
|
||||
if (_pdfBytes is not { Length: > 0 })
|
||||
{
|
||||
_errorMessage = "Dokument konnte nicht geladen werden: Keine Daten empfangen.";
|
||||
_isLoading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Load signature fields for this receiver
|
||||
_signatures = await PageDataService.GetSignaturesAsync(_receiverUser);
|
||||
|
||||
// Load envelope receiver metadata
|
||||
_envelopeReceiver = await PageDataService.GetEnvelopeReceiverAsync(EnvelopeKey);
|
||||
if (_envelopeReceiver is null)
|
||||
Logger.LogWarning("Envelope receiver data is null for {EnvelopeKey}", EnvelopeKey);
|
||||
|
||||
// Build initial report (no signature image yet)
|
||||
_report = BuildReport(_pdfBytes, _signatures, capturedSignature: null);
|
||||
|
||||
// Try to restore cached signature
|
||||
try
|
||||
{
|
||||
var cachedSignature = await PageDataService.GetCachedSignatureAsync(_receiverUser);
|
||||
if (cachedSignature is not null)
|
||||
{
|
||||
_capturedSignature = cachedSignature;
|
||||
_signerFullName = cachedSignature.FullName;
|
||||
_signerPosition = cachedSignature.Position;
|
||||
_signaturePlace = cachedSignature.Place;
|
||||
_signaturePopupVisible = false;
|
||||
|
||||
// Rebuild with cached signature overlaid
|
||||
_report = BuildReport(_pdfBytes, _signatures, _capturedSignature);
|
||||
}
|
||||
else
|
||||
{
|
||||
_activeSignatureTab = SignatureTabDraw;
|
||||
_signaturePopupVisible = false;
|
||||
_popupValidationMessage = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogWarning(ex, "Failed to load cached signature for {EnvelopeKey}", EnvelopeKey);
|
||||
_activeSignatureTab = SignatureTabDraw;
|
||||
_signaturePopupVisible = false;
|
||||
_popupValidationMessage = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_errorMessage = $"Fehler beim Laden des Dokuments: {ex.Message}";
|
||||
Logger.LogError(ex, "Unexpected error for {EnvelopeKey}", EnvelopeKey);
|
||||
}
|
||||
|
||||
_isLoading = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
// ----- Report builder -----
|
||||
/// <summary>
|
||||
/// Builds an XtraReport wrapping the PDF bytes.
|
||||
/// If a signature is captured and there are signature fields, the signature image is
|
||||
/// first burned into the PDF via DevExpress PdfDocumentProcessor, then the modified
|
||||
/// PDF is handed to XRPdfContent with GenerateOwnPages = true so that all pages appear.
|
||||
/// </summary>
|
||||
static XtraReport BuildReport(
|
||||
byte[] pdfBytes,
|
||||
IReadOnlyList<SignatureDto> signatures,
|
||||
SignatureCaptureDto? capturedSignature)
|
||||
{
|
||||
// Always draw placeholder boxes on signature fields so the user knows where to sign.
|
||||
// When a captured signature exists, it will be applied in the Signed page instead.
|
||||
byte[] sourcePdf = pdfBytes;
|
||||
if (signatures.Count > 0)
|
||||
{
|
||||
sourcePdf = DrawSignaturePlaceholders(pdfBytes, signatures);
|
||||
}
|
||||
|
||||
var report = new XtraReport
|
||||
{
|
||||
PaperKind = DevExpress.Drawing.Printing.DXPaperKind.A4,
|
||||
Landscape = false,
|
||||
Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0),
|
||||
};
|
||||
|
||||
var detail = new DetailBand { HeightF = 0f };
|
||||
report.Bands.Add(detail);
|
||||
|
||||
detail.Controls.Add(new XRPdfContent
|
||||
{
|
||||
Source = sourcePdf,
|
||||
GenerateOwnPages = true,
|
||||
});
|
||||
|
||||
return report;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uses PdfSharp to draw a visible signature placeholder box on every signature field.
|
||||
/// sig.X / sig.Y come from GetSignaturesAsync(UnitOfLength.Point) → already in PDF points.
|
||||
/// PdfSharp coordinate origin: bottom-left, Y up. Conversion: pdfY = pageH - sigY - sigH
|
||||
/// Signature field size (fixed): 1.77" × 1.96" = 127.44pt × 141.12pt
|
||||
/// </summary>
|
||||
static byte[] DrawSignaturePlaceholders(
|
||||
byte[] pdfBytes,
|
||||
IReadOnlyList<SignatureDto> signatures)
|
||||
{
|
||||
if (signatures.Count == 0) return pdfBytes;
|
||||
|
||||
using var inputMs = new System.IO.MemoryStream(pdfBytes);
|
||||
using var outputMs = new System.IO.MemoryStream();
|
||||
|
||||
var document = PdfSharp.Pdf.IO.PdfReader.Open(
|
||||
inputMs,
|
||||
PdfSharp.Pdf.IO.PdfDocumentOpenMode.Modify);
|
||||
|
||||
const double sigW = 1.77 * 72; // 127.44 pt
|
||||
const double sigH = 1.96 * 72; // 141.12 pt
|
||||
|
||||
foreach (var sig in signatures)
|
||||
{
|
||||
int pageIndex = sig.Page - 1;
|
||||
if (pageIndex < 0 || pageIndex >= document.PageCount) continue;
|
||||
|
||||
var page = document.Pages[pageIndex];
|
||||
|
||||
// PdfSharp XGraphics uses top-left origin, Y down — same as sig.X/sig.Y
|
||||
// No coordinate conversion needed.
|
||||
using var gfx = PdfSharp.Drawing.XGraphics.FromPdfPage(page);
|
||||
|
||||
var rect = new PdfSharp.Drawing.XRect(sig.X, sig.Y, sigW, sigH);
|
||||
|
||||
// Filled semi-transparent rectangle
|
||||
var fillBrush = new PdfSharp.Drawing.XSolidBrush(
|
||||
PdfSharp.Drawing.XColor.FromArgb(40, 60, 80, 160));
|
||||
var borderPen = new PdfSharp.Drawing.XPen(
|
||||
PdfSharp.Drawing.XColor.FromArgb(200, 60, 80, 200), 1.5);
|
||||
|
||||
gfx.DrawRectangle(fillBrush, rect);
|
||||
gfx.DrawRectangle(borderPen, rect);
|
||||
|
||||
// "UNTERSCHRIFT" label centred in the box
|
||||
var font = new PdfSharp.Drawing.XFont("Arial", 9,
|
||||
PdfSharp.Drawing.XFontStyleEx.Bold);
|
||||
var textBrush = new PdfSharp.Drawing.XSolidBrush(
|
||||
PdfSharp.Drawing.XColor.FromArgb(200, 40, 60, 140));
|
||||
|
||||
var textFmt = new PdfSharp.Drawing.XStringFormat
|
||||
{
|
||||
Alignment = PdfSharp.Drawing.XStringAlignment.Center,
|
||||
LineAlignment = PdfSharp.Drawing.XLineAlignment.Center,
|
||||
};
|
||||
gfx.DrawString("UNTERSCHRIFT", font, textBrush, rect, textFmt);
|
||||
}
|
||||
|
||||
document.Save(outputMs);
|
||||
return outputMs.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>Converts a base64 data URL (data:image/...;base64,...) to raw bytes.</summary>
|
||||
static byte[]? DataUrlToBytes(string dataUrl)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commaIndex = dataUrl.IndexOf(',');
|
||||
if (commaIndex < 0) return null;
|
||||
return Convert.FromBase64String(dataUrl[(commaIndex + 1)..]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ----- Signature popup handlers -----
|
||||
void OpenSignaturePopup()
|
||||
{
|
||||
_activeSignatureTab = SignatureTabDraw;
|
||||
_signaturePopupVisible = true;
|
||||
_popupValidationMessage = null;
|
||||
}
|
||||
|
||||
async Task OnPopupShownAsync()
|
||||
{
|
||||
await InitializeActiveSignatureTabAsync();
|
||||
}
|
||||
|
||||
async Task SetSignatureTabAsync(string tab)
|
||||
{
|
||||
_activeSignatureTab = tab;
|
||||
_popupValidationMessage = null;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await Task.Delay(50);
|
||||
await InitializeActiveSignatureTabAsync();
|
||||
}
|
||||
|
||||
async Task InitializeActiveSignatureTabAsync()
|
||||
{
|
||||
if (_activeSignatureTab == SignatureTabDraw)
|
||||
await JSRuntime.InvokeVoidAsync("receiverSignature.initialize", DrawCanvasId);
|
||||
else if (_activeSignatureTab == SignatureTabText)
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("receiverSignature.initializeTyped", TypedCanvasId);
|
||||
await RenderTypedSignatureAsync();
|
||||
}
|
||||
else
|
||||
await JSRuntime.InvokeVoidAsync("receiverSignature.initializeImage", ImageInputId, ImageCanvasId);
|
||||
}
|
||||
|
||||
async Task RenewSignatureAsync()
|
||||
{
|
||||
_popupValidationMessage = null;
|
||||
if (_activeSignatureTab == SignatureTabDraw)
|
||||
await JSRuntime.InvokeVoidAsync("receiverSignature.clear", DrawCanvasId);
|
||||
else if (_activeSignatureTab == SignatureTabText)
|
||||
{
|
||||
_typedSignatureText = string.Empty;
|
||||
await JSRuntime.InvokeVoidAsync("receiverSignature.clearTyped", TypedCanvasId);
|
||||
}
|
||||
else
|
||||
await JSRuntime.InvokeVoidAsync("receiverSignature.clearImage", ImageInputId, ImageCanvasId);
|
||||
}
|
||||
|
||||
async Task OnTypedSignatureChanged(Microsoft.AspNetCore.Components.ChangeEventArgs args)
|
||||
{
|
||||
_typedSignatureText = args.Value?.ToString() ?? string.Empty;
|
||||
await RenderTypedSignatureAsync();
|
||||
}
|
||||
|
||||
async Task OnTypedSignatureFontChanged(Microsoft.AspNetCore.Components.ChangeEventArgs args)
|
||||
{
|
||||
_typedSignatureFont = args.Value?.ToString() ?? _typedSignatureFont;
|
||||
await RenderTypedSignatureAsync();
|
||||
}
|
||||
|
||||
async Task RenderTypedSignatureAsync()
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("receiverSignature.renderTypedSignature",
|
||||
TypedCanvasId, _typedSignatureText, _typedSignatureFont);
|
||||
}
|
||||
|
||||
async Task SaveSignatureAsync()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_signerFullName))
|
||||
{
|
||||
_popupValidationMessage = "Bitte geben Sie Vor- und Nachname ein.";
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(_signaturePlace))
|
||||
{
|
||||
_popupValidationMessage = "Bitte geben Sie den Ort ein.";
|
||||
return;
|
||||
}
|
||||
|
||||
var signatureDataUrl = await GetActiveSignatureDataUrlAsync();
|
||||
if (string.IsNullOrWhiteSpace(signatureDataUrl))
|
||||
{
|
||||
_popupValidationMessage = "Die Unterschrift ist erforderlich.";
|
||||
return;
|
||||
}
|
||||
|
||||
_popupValidationMessage = null;
|
||||
_capturedSignature = new SignatureCaptureDto
|
||||
{
|
||||
DataUrl = signatureDataUrl,
|
||||
FullName = _signerFullName.Trim(),
|
||||
Position = _signerPosition.Trim(),
|
||||
Place = _signaturePlace.Trim(),
|
||||
};
|
||||
_signaturePopupVisible = false;
|
||||
|
||||
// Store signature in IMemoryCache with a Guid key (1 minute TTL)
|
||||
var sid = Guid.NewGuid().ToString("N");
|
||||
MemoryCache.Set(
|
||||
sid,
|
||||
_capturedSignature,
|
||||
TimeSpan.FromMinutes(1));
|
||||
|
||||
Logger.LogInformation(
|
||||
"Signature cached with sid={Sid} for envelope {EnvelopeKey}", sid, EnvelopeKey);
|
||||
|
||||
// Null the report → DxReportViewer removed from DOM → no crash on dispose
|
||||
_report = null;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await Task.Delay(50);
|
||||
|
||||
// Navigate — forceLoad:true for clean circuit teardown
|
||||
Navigation.NavigateTo(
|
||||
$"/envelope/{Uri.EscapeDataString(EnvelopeKey!)}/signed?sid={sid}",
|
||||
forceLoad: true);
|
||||
}
|
||||
|
||||
async Task<string?> GetActiveSignatureDataUrlAsync()
|
||||
{
|
||||
if (_activeSignatureTab == SignatureTabDraw)
|
||||
return await JSRuntime.InvokeAsync<string?>("receiverSignature.getDataUrl", DrawCanvasId);
|
||||
|
||||
if (_activeSignatureTab == SignatureTabText)
|
||||
{
|
||||
await RenderTypedSignatureAsync();
|
||||
return await JSRuntime.InvokeAsync<string?>("receiverSignature.getTypedDataUrl", TypedCanvasId);
|
||||
}
|
||||
|
||||
return await JSRuntime.InvokeAsync<string?>("receiverSignature.getImageDataUrl", ImageCanvasId);
|
||||
}
|
||||
|
||||
// ----- Disposal -----
|
||||
public void Dispose()
|
||||
{
|
||||
_report?.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,396 @@
|
||||
@page "/envelope/{EnvelopeKey}/signed"
|
||||
@rendermode InteractiveServer
|
||||
@using DevExpress.Blazor.Reporting
|
||||
@using DevExpress.XtraReports.UI
|
||||
@using EnvelopeGenerator.Server.Client.Models
|
||||
@using EnvelopeGenerator.Server.Client.Services
|
||||
@using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver
|
||||
@using Microsoft.Extensions.Caching.Memory
|
||||
@using System.Security.Claims
|
||||
@inject NavigationManager Navigation
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject EnvelopeGenerator.Server.Client.Services.AuthService AuthService
|
||||
@inject EnvelopeGenerator.Server.Services.EnvelopeReceiverAuthorizationService ReceiverAuthorizationService
|
||||
@inject EnvelopeGenerator.Server.Services.EnvelopeReceiverPageDataService PageDataService
|
||||
@inject AppVersionService AppVersion
|
||||
@inject IMemoryCache MemoryCache
|
||||
@inject ILogger<ReceiverSignedPage> Logger
|
||||
@implements IDisposable
|
||||
|
||||
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
||||
<link href="_content/DevExpress.Blazor.Reporting.Viewer/css/dx-blazor-reporting-components.bs5.css" rel="stylesheet" />
|
||||
<link href="@AppVersion.GetVersionedUrl("css/envelope-viewer.css")" rel="stylesheet" />
|
||||
|
||||
<div class="envelope-viewer-layout">
|
||||
<div class="envelope-action-bar">
|
||||
<div class="envelope-action-bar__inner" style="flex-direction: column; align-items: stretch; padding: 0.35rem 1.5rem; gap: 0.35rem;">
|
||||
<div style="display: flex; align-items: center; justify-content: space-between; gap: 1rem;">
|
||||
<div style="flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 0.75rem;">
|
||||
@if (_envelopeReceiver is not null)
|
||||
{
|
||||
<div style="font-size: 0.9rem; font-weight: 600; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
||||
@(_envelopeReceiver.Envelope?.Title ?? "Dokument")
|
||||
</div>
|
||||
@if (!string.IsNullOrWhiteSpace(_envelopeReceiver.Envelope?.User?.FullName))
|
||||
{
|
||||
<span style="font-size: 0.7rem; color: #6b7280; white-space: nowrap;">
|
||||
Von <span style="font-weight: 500; color: #374151;">@_envelopeReceiver.Envelope.User.FullName</span>
|
||||
</span>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<div style="font-size: 0.9rem; font-weight: 600; color: #1f2937;">Signiertes Dokument</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@* Right: Submit button *@
|
||||
<div style="flex: 0 0 auto;">
|
||||
<button class="pdf-toolbar__btn pdf-toolbar__btn--signature-change pdf-toolbar__btn--signature-change-active"
|
||||
@onclick="OpenSubmitConfirmPopup"
|
||||
disabled="@_isLoggingOut"
|
||||
title="Abschließen"
|
||||
style="flex-shrink: 0;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>
|
||||
</svg>
|
||||
<span class="pdf-toolbar__btn-text">Abschließen</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="envelope-content" style="padding: 0; overflow: hidden;">
|
||||
@if (_isLoading)
|
||||
{
|
||||
<div class="d-flex justify-content-center align-items-center h-100">
|
||||
<div class="text-center">
|
||||
<div class="spinner-border text-white mb-3" style="width: 3.5rem; height: 3.5rem;" role="status">
|
||||
<span class="visually-hidden">Lädt...</span>
|
||||
</div>
|
||||
<p class="text-white fw-semibold">Dokument wird geladen...</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (_errorMessage is not null)
|
||||
{
|
||||
<div class="error-container">
|
||||
<div class="alert alert-danger shadow-lg">
|
||||
<div class="d-flex align-items-start">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" fill="currentColor" class="me-3 flex-shrink-0" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z" />
|
||||
</svg>
|
||||
<div>
|
||||
<h5 class="mb-2">Fehler</h5>
|
||||
<p class="mb-0">@_errorMessage</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (_report is not null)
|
||||
{
|
||||
<DxReportViewer Report="_report" RootCssClasses="w-100 h-100" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Submit confirmation popup *@
|
||||
<DxPopup @bind-Visible="_submitConfirmVisible"
|
||||
HeaderText="Unterschrift bestätigen"
|
||||
Width="440px"
|
||||
MaxWidth="95vw"
|
||||
ShowFooter="true"
|
||||
CloseOnOutsideClick="false"
|
||||
ShowCloseButton="false"
|
||||
CloseOnEscape="false">
|
||||
<BodyContentTemplate>
|
||||
<div style="display: flex; align-items: flex-start; gap: 1rem; padding: 0.5rem 0;">
|
||||
<div style="flex-shrink: 0; width: 40px; height: 40px; background: #d1fae5; border-radius: 50%; display: flex; align-items: center; justify-content: center;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#065f46" viewBox="0 0 16 16">
|
||||
<path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
<p style="margin: 0 0 0.4rem; font-weight: 600; color: #1f2937; font-size: 0.95rem;">
|
||||
Möchten Sie das Dokument verbindlich unterschreiben?
|
||||
</p>
|
||||
<p style="margin: 0; color: #6b7280; font-size: 0.85rem; line-height: 1.5;">
|
||||
Diese Aktion kann nicht rückgängig gemacht werden. Mit der Bestätigung erklären Sie, das oben angezeigte Dokument elektronisch unterzeichnet zu haben. Das unterzeichnete Dokument wird anschließend an alle beteiligten Parteien übermittelt.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</BodyContentTemplate>
|
||||
<FooterContentTemplate>
|
||||
<div class="d-flex gap-2 justify-content-end w-100" style="padding: 0.5rem 0;">
|
||||
<button class="btn btn-outline-secondary"
|
||||
@onclick="() => _submitConfirmVisible = false"
|
||||
style="border-radius: 6px; padding: 0.5rem 1.25rem; font-weight: 500;">
|
||||
Abbrechen
|
||||
</button>
|
||||
<button class="btn btn-primary"
|
||||
@onclick="SubmitAndLogoutAsync"
|
||||
disabled="@_isLoggingOut"
|
||||
style="background: linear-gradient(135deg, #059669 0%, #047857 100%); border: none; border-radius: 6px; padding: 0.5rem 1.5rem; font-weight: 600; box-shadow: 0 2px 4px rgba(5, 150, 105, 0.3);">
|
||||
@if (_isLoggingOut)
|
||||
{
|
||||
<span class="spinner-border spinner-border-sm me-1" role="status"></span>
|
||||
}
|
||||
Abschließen
|
||||
</button>
|
||||
</div>
|
||||
</FooterContentTemplate>
|
||||
</DxPopup>
|
||||
|
||||
@code {
|
||||
[Parameter] public string? EnvelopeKey { get; set; }
|
||||
|
||||
[SupplyParameterFromQuery(Name = "sid")]
|
||||
public string? Sid { get; set; }
|
||||
|
||||
bool _isLoading = true;
|
||||
string? _errorMessage;
|
||||
ClaimsPrincipal? _receiverUser;
|
||||
EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver.EnvelopeReceiverDto? _envelopeReceiver;
|
||||
IReadOnlyList<SignatureDto> _signatures = [];
|
||||
XtraReport? _report;
|
||||
SignatureCaptureDto? _sig;
|
||||
|
||||
// ----- Submit / logout state -----
|
||||
bool _isLoggingOut = false;
|
||||
bool _submitConfirmVisible = false;
|
||||
|
||||
void OpenSubmitConfirmPopup() => _submitConfirmVisible = true;
|
||||
|
||||
async Task SubmitAndLogoutAsync()
|
||||
{
|
||||
if (_isLoggingOut) return;
|
||||
_isLoggingOut = true;
|
||||
_submitConfirmVisible = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await AuthService.LogoutEnvelopeReceiverAsync(EnvelopeKey!);
|
||||
Navigation.NavigateTo("/", forceLoad: true);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(EnvelopeKey))
|
||||
{
|
||||
_errorMessage = "Envelope-Schlüssel fehlt.";
|
||||
_isLoading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
_receiverUser = await ReceiverAuthorizationService.AuthorizeAsync(EnvelopeKey);
|
||||
if (_receiverUser is null)
|
||||
{
|
||||
Navigation.NavigateTo($"/envelope/login/{Uri.EscapeDataString(EnvelopeKey)}");
|
||||
return;
|
||||
}
|
||||
|
||||
// Read signature from IMemoryCache
|
||||
if (!string.IsNullOrWhiteSpace(Sid)
|
||||
&& MemoryCache.TryGetValue(Sid, out SignatureCaptureDto? cached)
|
||||
&& cached is not null)
|
||||
{
|
||||
_sig = cached;
|
||||
}
|
||||
|
||||
// Cache miss or missing sid — redirect back to report page
|
||||
if (_sig is null)
|
||||
{
|
||||
Logger.LogWarning(
|
||||
"[SignedPage] Cache miss or no sid={Sid} for {EnvelopeKey}, redirecting to report page.",
|
||||
Sid, EnvelopeKey);
|
||||
Navigation.NavigateTo(
|
||||
$"/envelope/{Uri.EscapeDataString(EnvelopeKey)}",
|
||||
forceLoad: true);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var pdfBytes = await PageDataService.GetDocumentAsync(_receiverUser);
|
||||
if (pdfBytes is not { Length: > 0 })
|
||||
{
|
||||
_errorMessage = "Dokument konnte nicht geladen werden.";
|
||||
_isLoading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
_envelopeReceiver = await PageDataService.GetEnvelopeReceiverAsync(EnvelopeKey);
|
||||
_signatures = await PageDataService.GetSignaturesAsync(_receiverUser);
|
||||
|
||||
// Burn signature image + info onto PDF via PdfSharp
|
||||
if (_sig is not null && _signatures.Count > 0)
|
||||
pdfBytes = DrawSignaturesOnPdf(pdfBytes, _signatures, _sig);
|
||||
|
||||
var report = new XtraReport
|
||||
{
|
||||
PaperKind = DevExpress.Drawing.Printing.DXPaperKind.A4,
|
||||
Landscape = false,
|
||||
Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0),
|
||||
};
|
||||
var detail = new DetailBand();
|
||||
report.Bands.Add(detail);
|
||||
detail.Controls.Add(new XRPdfContent
|
||||
{
|
||||
Source = pdfBytes,
|
||||
GenerateOwnPages = true,
|
||||
});
|
||||
_report = report;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_errorMessage = $"Fehler: {ex.Message}";
|
||||
Logger.LogError(ex, "Error loading signed page for {EnvelopeKey}", EnvelopeKey);
|
||||
}
|
||||
|
||||
_isLoading = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (!firstRender) return;
|
||||
|
||||
if (_sig is not null)
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("console.log",
|
||||
$"[SignedPage] sid={Sid} | FullName={_sig.FullName} | Place={_sig.Place} | Position={_sig.Position} | DataUrl.Length={_sig.DataUrl?.Length ?? 0}");
|
||||
}
|
||||
else
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("console.log",
|
||||
$"[SignedPage] Cache miss or no sid. sid={Sid}");
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_report?.Dispose();
|
||||
}
|
||||
|
||||
// ----- PDF signature rendering -----
|
||||
|
||||
/// <summary>
|
||||
/// Uses PdfSharp to burn the captured signature onto the PDF at each signature field.
|
||||
/// Layout per field (top-left origin, Y down, units = PDF points):
|
||||
/// [top 65%] signature image
|
||||
/// [separator line]
|
||||
/// [bottom 35%] FullName (bold) / Position (optional) / Place, Date
|
||||
/// </summary>
|
||||
static byte[] DrawSignaturesOnPdf(
|
||||
byte[] pdfBytes,
|
||||
IReadOnlyList<SignatureDto> signatures,
|
||||
SignatureCaptureDto sig)
|
||||
{
|
||||
var imgBytes = DataUrlToBytes(sig.DataUrl);
|
||||
if (imgBytes is not { Length: > 0 }) return pdfBytes;
|
||||
|
||||
using var inputMs = new System.IO.MemoryStream(pdfBytes);
|
||||
using var outputMs = new System.IO.MemoryStream();
|
||||
|
||||
var document = PdfSharp.Pdf.IO.PdfReader.Open(
|
||||
inputMs, PdfSharp.Pdf.IO.PdfDocumentOpenMode.Modify);
|
||||
|
||||
const double sigW = 1.77 * 72; // 127.44 pt
|
||||
const double sigH = 1.96 * 72; // 141.12 pt
|
||||
const double imgRatio = 0.52; // top 52% = image
|
||||
const double lineH = 11.5; // fixed row height matching font size (bold 7.5pt + normal 6.5pt)
|
||||
const double bgPad = 3.0; // background box padding around content (pt)
|
||||
|
||||
var black = PdfSharp.Drawing.XColor.FromArgb(255, 20, 20, 20);
|
||||
var darkGray = PdfSharp.Drawing.XColor.FromArgb(255, 80, 80, 80);
|
||||
var lineColor = PdfSharp.Drawing.XColor.FromArgb(180, 100, 100, 120);
|
||||
|
||||
var bgColor = PdfSharp.Drawing.XColor.FromArgb(255, 255, 253, 240);
|
||||
var bgBrush = new PdfSharp.Drawing.XSolidBrush(bgColor);
|
||||
|
||||
var fontBold = new PdfSharp.Drawing.XFont("Arial", 7.5, PdfSharp.Drawing.XFontStyleEx.Bold);
|
||||
var fontNormal = new PdfSharp.Drawing.XFont("Arial", 6.5, PdfSharp.Drawing.XFontStyleEx.Regular);
|
||||
var linePen = new PdfSharp.Drawing.XPen(lineColor, 0.5);
|
||||
|
||||
var fmtLeft = new PdfSharp.Drawing.XStringFormat
|
||||
{
|
||||
Alignment = PdfSharp.Drawing.XStringAlignment.Near,
|
||||
LineAlignment = PdfSharp.Drawing.XLineAlignment.Near,
|
||||
};
|
||||
|
||||
var date = DateTime.Now.ToString("dd.MM.yyyy");
|
||||
|
||||
foreach (var field in signatures)
|
||||
{
|
||||
int pageIndex = field.Page - 1;
|
||||
if (pageIndex < 0 || pageIndex >= document.PageCount) continue;
|
||||
|
||||
var page = document.Pages[pageIndex];
|
||||
|
||||
using var gfx = PdfSharp.Drawing.XGraphics.FromPdfPage(page);
|
||||
|
||||
double x = field.X;
|
||||
double y = field.Y;
|
||||
|
||||
// --- Calculate layout positions first (needed for bg rect) ---
|
||||
double imgH = sigH * imgRatio;
|
||||
double lineY = y + imgH + 1.0; // 1pt gap between image and separator
|
||||
double textY = lineY + 1.5; // 1.5pt gap below separator line
|
||||
double padding = 3;
|
||||
|
||||
// Row 1: FullName
|
||||
double row1Y = textY;
|
||||
// Row 2: Position (optional)
|
||||
double row2Y = row1Y + lineH;
|
||||
// Row 3: Place, Date — immediately after row2 regardless of position
|
||||
double row3Y = !string.IsNullOrWhiteSpace(sig.Position) ? row2Y + lineH : row2Y;
|
||||
double contentBottom = row3Y + lineH;
|
||||
|
||||
// --- Background rectangle sized to actual content (not full sigH) ---
|
||||
var bgRect = new PdfSharp.Drawing.XRect(
|
||||
x - bgPad,
|
||||
y - bgPad,
|
||||
sigW + bgPad * 2,
|
||||
(contentBottom - y) + bgPad * 2);
|
||||
gfx.DrawRectangle(bgBrush, bgRect);
|
||||
|
||||
// --- Image area ---
|
||||
var imgRect = new PdfSharp.Drawing.XRect(x, y, sigW, imgH);
|
||||
using var imgStream = new System.IO.MemoryStream(imgBytes);
|
||||
var xImg = PdfSharp.Drawing.XImage.FromStream(imgStream);
|
||||
gfx.DrawImage(xImg, imgRect);
|
||||
|
||||
// --- Separator line ---
|
||||
gfx.DrawLine(linePen, x + 2, lineY, x + sigW - 2, lineY);
|
||||
|
||||
// --- Text rows ---
|
||||
// Row 1: FullName (bold)
|
||||
var nameRect = new PdfSharp.Drawing.XRect(x + padding, row1Y, sigW - padding * 2, lineH);
|
||||
gfx.DrawString(sig.FullName, fontBold, new PdfSharp.Drawing.XSolidBrush(black), nameRect, fmtLeft);
|
||||
|
||||
// Row 2: Position (optional)
|
||||
if (!string.IsNullOrWhiteSpace(sig.Position))
|
||||
{
|
||||
var posRect = new PdfSharp.Drawing.XRect(x + padding, row2Y, sigW - padding * 2, lineH);
|
||||
gfx.DrawString(sig.Position, fontNormal, new PdfSharp.Drawing.XSolidBrush(darkGray), posRect, fmtLeft);
|
||||
}
|
||||
|
||||
// Row 3: Place, Date
|
||||
var placeDate = $"{sig.Place}, {date}";
|
||||
var dateRect = new PdfSharp.Drawing.XRect(x + padding, row3Y, sigW - padding * 2, lineH);
|
||||
gfx.DrawString(placeDate, fontNormal, new PdfSharp.Drawing.XSolidBrush(darkGray), dateRect, fmtLeft);
|
||||
}
|
||||
|
||||
document.Save(outputMs);
|
||||
return outputMs.ToArray();
|
||||
}
|
||||
|
||||
static byte[]? DataUrlToBytes(string? dataUrl)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(dataUrl)) return null;
|
||||
var comma = dataUrl.IndexOf(',');
|
||||
if (comma < 0) return null;
|
||||
return Convert.FromBase64String(dataUrl[(comma + 1)..]);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/envelope/{EnvelopeKey}"
|
||||
@page "/envelope/{EnvelopeKey}/deprc"
|
||||
@rendermode InteractiveServer
|
||||
@using EnvelopeGenerator.Server.Client.Models
|
||||
@using EnvelopeGenerator.Server.Client.Models.Constants
|
||||
@@ -40,7 +40,7 @@ public partial class AuthController(IOptions<AuthTokenKeys> authTokenKeyOptions,
|
||||
/// <response code="401">Wenn es kein zugelassenes Cookie gibt, wird „nicht zugelassen“ zurückgegeben.</response>
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||
[Authorize(Policy = AuthPolicy.Sender)]
|
||||
[Authorize(AuthenticationSchemes = AuthScheme.Sender)]
|
||||
[HttpPost("logout")]
|
||||
public IActionResult Logout()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Server.Models;
|
||||
|
||||
namespace EnvelopeGenerator.Server.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Exposes the CustomImages configuration (signFLOW logo + company logo) to WASM clients.
|
||||
/// Values are sourced from appsettings.json "CustomImages" section via Options Pattern.
|
||||
///
|
||||
/// To change logos per deployment: update "CustomImages.App.Src", "App.Height",
|
||||
/// "Company.Src", "Company.Height" in appsettings.json — no code change required.
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
[Authorize(Policy = AuthPolicy.SenderOrReceiver)]
|
||||
public class CustomImagesController(IOptions<CustomImagesOptions> options) : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the signFLOW app logo and company logo configuration.
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public ActionResult<CustomImagesOptions> Get() => Ok(options.Value);
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class DocumentController(IMediator mediator, IAuthorizationService authSe
|
||||
/// <param name="query">Encoded envelope key.</param>
|
||||
/// <param name="cancel">Cancellation token.</param>
|
||||
[HttpGet]
|
||||
[Authorize(Policy = AuthPolicy.Sender)]
|
||||
[Authorize(AuthenticationSchemes = AuthScheme.Sender)]
|
||||
public async Task<IActionResult> GetDocument(CancellationToken cancel, [FromQuery] ReadDocumentQuery? query = null)
|
||||
{
|
||||
if (query is null)
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace EnvelopeGenerator.Server.Controllers;
|
||||
/// </param>
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Authorize(Policy = AuthPolicy.Sender)]
|
||||
[Authorize(AuthenticationSchemes = AuthScheme.Sender)]
|
||||
public class EmailTemplateController(IMediator mediator) : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -150,7 +150,7 @@ public class EnvelopeReceiverController : ControllerBase
|
||||
/// <response code="400">Wenn ein Fehler im HTTP-Body auftritt</response>
|
||||
/// <response code="401">Wenn kein autorisierter Token vorhanden ist</response>
|
||||
/// <response code="500">Es handelt sich um einen unerwarteten Fehler. Die Protokolle sollten überprüft werden.</response>
|
||||
[Authorize]
|
||||
[Authorize(AuthenticationSchemes = AuthScheme.Sender)]
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> CreateAsync([FromBody] CreateEnvelopeReceiverCommand request, CancellationToken cancel)
|
||||
{
|
||||
@@ -214,6 +214,10 @@ public class EnvelopeReceiverController : ControllerBase
|
||||
if (reader.Read())
|
||||
{
|
||||
bool outSuccess = reader.GetBoolean(0);
|
||||
if (!outSuccess)
|
||||
_logger.LogWarning(
|
||||
"PRSIG_API_ADD_DOC_RECEIVER_ELEM returned OUT_SUCCESS=false. DOC_ID={DocId}, RECEIVER_ID={ReceiverId}, Page={Page}",
|
||||
document.Id, rcv.Id, sign.Page);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -221,8 +225,6 @@ public class EnvelopeReceiverController : ControllerBase
|
||||
#region Create history
|
||||
// ENV_UID, STATUS_ID, USER_ID,
|
||||
string sql_hist = @"
|
||||
USE [DD_ECM]
|
||||
|
||||
DECLARE @OUT_SUCCESS bit;
|
||||
|
||||
EXEC [dbo].[PRSIG_API_ADD_HISTORY_STATE]
|
||||
@@ -244,6 +246,10 @@ public class EnvelopeReceiverController : ControllerBase
|
||||
if (reader.Read())
|
||||
{
|
||||
bool outSuccess = reader.GetBoolean(0);
|
||||
if (!outSuccess)
|
||||
_logger.LogWarning(
|
||||
"PRSIG_API_ADD_HISTORY_STATE returned OUT_SUCCESS=false. EnvelopeUuid={EnvelopeUuid}",
|
||||
envelope.Uuid);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -3,7 +3,7 @@ using EnvelopeGenerator.Application.Receivers.Queries;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.GeneratorAPI.Controllers;
|
||||
namespace EnvelopeGenerator.Server.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Controller für die Verwaltung von Empfängern.
|
||||
@@ -33,15 +33,16 @@ public class ReceiverController : ControllerBase
|
||||
/// <param name="receiver">Die Abfrageparameter, einschließlich E-Mail-Adresse und Signatur.</param>
|
||||
/// <returns>Eine Liste von Empfängern oder ein Fehlerstatus.</returns>
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get([FromQuery] ReadReceiverQuery receiver)
|
||||
[Authorize(AuthenticationSchemes = AuthScheme.Sender)]
|
||||
public async Task<IActionResult> Get([FromQuery] ReadReceiverQuery? receiver = null, [FromQuery] bool onlyEmailAddress = false)
|
||||
{
|
||||
if (!receiver.HasAnyCriteria)
|
||||
{
|
||||
var all = await _mediator.Send(new ReadReceiverQuery());
|
||||
return Ok(all);
|
||||
}
|
||||
var result = await _mediator.Send(receiver ?? new ReadReceiverQuery());
|
||||
|
||||
var result = await _mediator.Send(receiver);
|
||||
return result is null ? NotFound() : Ok(result);
|
||||
if (result is null)
|
||||
return NotFound();
|
||||
else if (onlyEmailAddress)
|
||||
return Ok(result.Select(r => r.EmailAddress).ToList());
|
||||
else
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Server.Extensions;
|
||||
using EnvelopeGenerator.Application.Common.Dto;
|
||||
using EnvelopeGenerator.Application.Common.Interfaces.Services;
|
||||
|
||||
namespace EnvelopeGenerator.Server.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Manages per-user UI preferences (theme, dark mode, grid layouts).
|
||||
/// Preferences are stored in the distributed cache (dbo.TBDD_CACHE).
|
||||
/// Accessible by both Sender and Receiver roles.
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
[Authorize(Policy = AuthPolicy.SenderOrReceiver)]
|
||||
public class UserPreferencesController(IUserPreferencesService preferencesService) : ControllerBase
|
||||
{
|
||||
private static readonly HashSet<string> AllowedThemes =
|
||||
["blazing-berry", "blazing-dark", "purple"];
|
||||
|
||||
/// <summary>
|
||||
/// Returns the current user's UI preferences.
|
||||
/// Always returns 200 with defaults if no preferences have been saved yet.
|
||||
/// DisplayName is populated from JWT claims for senders only.
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<UserPreferencesDto>> Get(CancellationToken ct)
|
||||
{
|
||||
bool isReceiver = User.IsReceiver();
|
||||
|
||||
var userId = isReceiver ? User.ReceiverMail() : User.GetUsername();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(userId))
|
||||
return Unauthorized();
|
||||
|
||||
var prefs = await preferencesService.GetOrCreateAsync(userId, ct);
|
||||
|
||||
// Populate DisplayName for sender only (receiver has no given/surname claims)
|
||||
if (!isReceiver)
|
||||
prefs.DisplayName = $"{User.GetPrename()} {User.GetName()}".Trim();
|
||||
|
||||
return Ok(prefs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves (full replace) the current user's UI preferences.
|
||||
/// </summary>
|
||||
[HttpPut]
|
||||
public async Task<ActionResult<UserPreferencesDto>> Put(
|
||||
[FromBody] UserPreferencesDto dto,
|
||||
CancellationToken ct)
|
||||
{
|
||||
if (!AllowedThemes.Contains(dto.ThemeName))
|
||||
return BadRequest($"Invalid theme '{dto.ThemeName}'. Allowed: {string.Join(", ", AllowedThemes)}.");
|
||||
|
||||
var userId = User.IsReceiver() ? User.ReceiverMail() : User.GetUsername();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(userId))
|
||||
return Unauthorized();
|
||||
|
||||
await preferencesService.SaveAsync(userId, dto, ct);
|
||||
return Ok(dto);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFrameworks>net8.0</TargetFrameworks>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageId>EnvelopeGenerator.Server</PackageId>
|
||||
<Title></Title>
|
||||
<Authors>Digital Data GmbH</Authors>
|
||||
<Company>Digital Data GmbH</Company>
|
||||
<Product>EnvelopeGenerator.Server</Product>
|
||||
<Version>1.1.0-beta</Version>
|
||||
<FileVersion>1.1.0.0</FileVersion>
|
||||
<AssemblyVersion>1.1.0.0</AssemblyVersion>
|
||||
<Copyright>Copyright © 2026 Digital Data GmbH. All rights reserved.</Copyright>
|
||||
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -28,13 +39,12 @@
|
||||
<PackageReference Include="DigitalData.Core.API" Version="2.2.1" />
|
||||
<PackageReference Include="HtmlSanitizer" Version="9.0.892" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="8.0.11" />
|
||||
<PackageReference Include="itext" Version="8.0.5" />
|
||||
<PackageReference Include="itext.bouncy-castle-adapter" Version="8.0.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.17" />
|
||||
<PackageReference Include="Microsoft.Identity.Client" Version="4.82.1" />
|
||||
<PackageReference Include="NLog" Version="5.2.5" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.0" />
|
||||
<PackageReference Include="PDFsharp" Version="6.2.4" />
|
||||
<PackageReference Include="Scalar.AspNetCore" Version="2.2.1" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.1" />
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using DigitalData.Auth.Claims;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
using Microsoft.IdentityModel.JsonWebTokens;
|
||||
using System.Security.Claims;
|
||||
|
||||
@@ -93,4 +95,14 @@ public static class ReceiverClaimExtensions
|
||||
else
|
||||
throw new InvalidOperationException($"Claim '{EnvelopeClaimNames.ReceiverId}' is not a valid integer.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsReceiver(this ClaimsPrincipal user)
|
||||
{
|
||||
return Role.Receiver.Authorized.Any(user.IsInRole);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
namespace EnvelopeGenerator.Server.Handlers;
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="DelegatingHandler"/> that forwards the incoming HTTP request's
|
||||
/// <c>Cookie</c> header to all outgoing <see cref="System.Net.Http.HttpClient"/> calls
|
||||
/// made by Blazor Server components.
|
||||
///
|
||||
/// Problem it solves:
|
||||
/// Blazor Server runs on the server process. When a component calls an API endpoint
|
||||
/// that requires cookie-based JWT authentication (AuthScheme.Sender), the HttpClient
|
||||
/// does not automatically include the browser's cookies — those only travel with
|
||||
/// browser-initiated requests. This handler copies the <c>Cookie</c> header from the
|
||||
/// current <see cref="IHttpContextAccessor.HttpContext"/> into every outgoing request
|
||||
/// so that the API's JwtBearer <c>OnMessageReceived</c> callback can extract the token.
|
||||
///
|
||||
/// Thread safety:
|
||||
/// The handler is registered as Transient and is resolved per-request by the
|
||||
/// IHttpClientFactory pipeline, so there is no shared state between requests.
|
||||
/// </summary>
|
||||
public class SenderAuthCookieHandler(IHttpContextAccessor httpContextAccessor) : DelegatingHandler
|
||||
{
|
||||
protected override Task<HttpResponseMessage> SendAsync(
|
||||
HttpRequestMessage request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var cookieHeader = httpContextAccessor.HttpContext?.Request.Headers["Cookie"].ToString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(cookieHeader))
|
||||
request.Headers.TryAddWithoutValidation("Cookie", cookieHeader);
|
||||
|
||||
return base.SendAsync(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,36 @@
|
||||
namespace EnvelopeGenerator.Server.Models;
|
||||
|
||||
public class CustomImages : Dictionary<string, Image>
|
||||
/// <summary>
|
||||
/// A single image asset entry — source path and optional per-context CSS classes.
|
||||
/// Height controls the rendered size in CSS units (e.g. "28px", "2rem").
|
||||
/// Change Src and Height in appsettings.json per deployment; no code change required.
|
||||
/// </summary>
|
||||
public sealed class CustomImageEntry
|
||||
{
|
||||
public new Image this[string key] => TryGetValue(key, out var img) && img is not null ? img : new();
|
||||
}
|
||||
public string Src { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// CSS height value, e.g. "28px" or "2rem".
|
||||
/// Allows different-sized logos across deployments without CSS changes.
|
||||
/// </summary>
|
||||
public string Height { get; set; } = "28px";
|
||||
|
||||
public Dictionary<string, string> Classes { get; set; } = new();
|
||||
|
||||
/// <summary>Returns the CSS class for the given context key, or empty string if absent.</summary>
|
||||
public string GetClass(string key) =>
|
||||
Classes.TryGetValue(key, out var cls) && cls is not null ? cls : string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bound from appsettings.json "CustomImages" section via Options Pattern.
|
||||
/// App = signFLOW application logo.
|
||||
/// Company = customer/company logo (Digital Data GmbH by default).
|
||||
/// </summary>
|
||||
public sealed class CustomImagesOptions
|
||||
{
|
||||
public const string SectionName = "CustomImages";
|
||||
|
||||
public CustomImageEntry App { get; set; } = new();
|
||||
public CustomImageEntry Company { get; set; } = new();
|
||||
}
|
||||
|
||||
@@ -69,6 +69,9 @@ try
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
|
||||
// Named HttpClient for internal API calls
|
||||
// SenderAuthCookieHandler forwards the browser's Cookie header so that
|
||||
// Blazor Server components can call cookie-authenticated endpoints (AuthScheme.Sender).
|
||||
builder.Services.AddTransient<EnvelopeGenerator.Server.Handlers.SenderAuthCookieHandler>();
|
||||
builder.Services.AddHttpClient("EnvelopeGenerator.Server", (sp, client) =>
|
||||
{
|
||||
var httpContextAccessor = sp.GetRequiredService<IHttpContextAccessor>();
|
||||
@@ -79,7 +82,8 @@ try
|
||||
// Set base address to current host for SSR scenarios
|
||||
client.BaseAddress = new Uri($"{request.Scheme}://{request.Host}");
|
||||
}
|
||||
});
|
||||
})
|
||||
.AddHttpMessageHandler<EnvelopeGenerator.Server.Handlers.SenderAuthCookieHandler>();
|
||||
|
||||
// CORS Policy
|
||||
var allowedOrigins = config.GetSection("AllowedOrigins").Get<string[]>() ??
|
||||
@@ -104,7 +108,7 @@ try
|
||||
{
|
||||
Version = "v1",
|
||||
Title = "signFLOW Absender-API",
|
||||
Description = "Eine API zur Verwaltung der Erstellung, des Versands und der Nachverfolgung von Umschlägen in der signFLOW-Anwendung.",
|
||||
Description = "Eine API zur Verwaltung der Erstellung, des Versands und der Nachverfolgung von Umschl<EFBFBD>gen in der signFLOW-Anwendung.",
|
||||
Contact = new OpenApiContact
|
||||
{
|
||||
Name = "Digital Data GmbH",
|
||||
@@ -267,7 +271,12 @@ try
|
||||
.AddAuthenticationSchemes(AuthScheme.Receiver)
|
||||
.RequireAuthenticatedUser()
|
||||
.RequireRole(Role.Receiver.Full, "receiver"))
|
||||
.AddPolicy(AuthPolicy.ReceiverTFA, policy => policy.RequireRole(Role.Receiver.TFA));
|
||||
.AddPolicy(AuthPolicy.ReceiverTFA, policy => policy.RequireRole(Role.Receiver.TFA))
|
||||
// Combined policy: accepts both Sender and Receiver tokens.
|
||||
// Used by endpoints accessible to both roles (e.g. UserPreferences).
|
||||
.AddPolicy(AuthPolicy.SenderOrReceiver, policy => policy
|
||||
.AddAuthenticationSchemes(AuthScheme.Sender, AuthScheme.Receiver)
|
||||
.RequireAuthenticatedUser());
|
||||
|
||||
// User Manager
|
||||
#pragma warning disable CS0618
|
||||
@@ -314,6 +323,21 @@ try
|
||||
.AddEnvelopeGeneratorServices(config);
|
||||
#pragma warning restore CS0618
|
||||
|
||||
// User Preferences (theme, dark mode, grid layouts — stored in TBDD_CACHE)
|
||||
// Registration handled by Infrastructure DependencyInjection (AddEnvelopeGeneratorInfrastructureServices)
|
||||
|
||||
// CustomImages — logo sources and heights, configurable per deployment via appsettings.json
|
||||
builder.Services.Configure<EnvelopeGenerator.Server.Models.CustomImagesOptions>(
|
||||
config.GetSection(EnvelopeGenerator.Server.Models.CustomImagesOptions.SectionName));
|
||||
|
||||
// Client-side services that MainLayout depends on must also be registered here
|
||||
// so that Blazor Auto prerender (SSR pass) can resolve them on the server.
|
||||
// ThemeService.InitializeAsync() uses IJSRuntime but is only called in OnAfterRenderAsync
|
||||
// (never during prerender), so registering it server-side is safe.
|
||||
builder.Services.AddScoped<EnvelopeGenerator.Server.Client.Services.UserPreferencesService>();
|
||||
builder.Services.AddScoped<EnvelopeGenerator.Server.Client.Services.ThemeService>();
|
||||
builder.Services.AddScoped<EnvelopeGenerator.Server.Client.Services.CustomImagesService>();
|
||||
|
||||
// Business Services (Server specific)
|
||||
builder.Services.AddScoped<DocumentService>();
|
||||
builder.Services.AddScoped<AuthService>();
|
||||
@@ -338,6 +362,10 @@ try
|
||||
builder.Services.AddDevExpressBlazor();
|
||||
builder.Services.AddDevExpressServerSideBlazorPdfViewer();
|
||||
|
||||
// PdfSharp font resolver — required for .NET 8 (no system font access without it)
|
||||
PdfSharp.Fonts.GlobalFontSettings.FontResolver =
|
||||
EnvelopeGenerator.Server.Services.PdfSharpFontResolver.Instance;
|
||||
|
||||
// Configuration Options
|
||||
builder.Services.Configure<EnvelopeGenerator.Server.Client.Options.ApiOptions>(
|
||||
builder.Configuration.GetSection("ApiOptions"));
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>Package</WebPublishMethod>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<ProjectGuid>5e0e17c0-ff5a-4246-bf87-1add85376a27</ProjectGuid>
|
||||
<DesktopBuildPackageLocation>M:\App&Service\0 DD - Smart UP\signFLOW\PreRelease\API\net8\$(Version)\EnvelopeGenerator.Server.zip</DesktopBuildPackageLocation>
|
||||
<PackageAsSingleFile>true</PackageAsSingleFile>
|
||||
<DeployIisAppPath>EnvelopeGenerator</DeployIisAppPath>
|
||||
<_TargetId>IISWebDeployPackage</_TargetId>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<SelfContained>true</SelfContained>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<EnvironmentName>Production</EnvironmentName>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
225
EnvelopeGenerator.Server/EnvelopeGenerator.Server/README.md
Normal file
225
EnvelopeGenerator.Server/EnvelopeGenerator.Server/README.md
Normal file
@@ -0,0 +1,225 @@
|
||||
# EnvelopeGenerator.Server — Publish & Deployment Guide
|
||||
|
||||
## Inhaltsverzeichnis
|
||||
|
||||
1. [Unterschied zu einer normalen ASP.NET Core API](#unterschied-zu-einer-normalen-aspnet-core-api)
|
||||
2. [Warum Self-Contained Publish?](#warum-self-contained-publish)
|
||||
3. [Publish-Befehl (Terminal)](#publish-befehl-terminal)
|
||||
4. [IIS-Konfiguration](#iis-konfiguration)
|
||||
5. [Verzeichnisstruktur nach dem Publish](#verzeichnisstruktur-nach-dem-publish)
|
||||
6. [Häufige Fehler](#häufige-fehler)
|
||||
|
||||
---
|
||||
|
||||
## Unterschied zu einer normalen ASP.NET Core API
|
||||
|
||||
`EnvelopeGenerator.Server` ist **keine** gewöhnliche ASP.NET Core Web API. Es handelt sich um eine **Blazor Auto (Server + WebAssembly Hybrid)**-Anwendung.
|
||||
|
||||
| Merkmal | Normale ASP.NET Core API | EnvelopeGenerator.Server (Blazor Auto) |
|
||||
|---|---|---|
|
||||
| Projekttyp | `Microsoft.NET.Sdk.Web` | `Microsoft.NET.Sdk.Web` + WASM Client |
|
||||
| Frontend | Keins / Razor Pages | Blazor Server + Blazor WASM |
|
||||
| WASM-Komponente | Nein | Ja (`EnvelopeGenerator.Server.Client`) |
|
||||
| Framework-DLL-Bindung | Tolerant gegenüber Runtime-Versionen | **Strikt**: WASM erwartet exakte Assembly-Versionen |
|
||||
| Publish ohne .NET auf Zielserver | Nicht nötig (FDD reicht meist) | **Self-Contained Pflicht** empfohlen |
|
||||
| IIS Application Pool | `.NET CLR v4.0` oder `No Managed Code` | **Zwingend: `No Managed Code`** |
|
||||
| Publish-Paketgröße | ~5–20 MB | **~500 MB** (enthält .NET Runtime) |
|
||||
| `web.config processPath` | `dotnet` + `.dll` | **`.\EnvelopeGenerator.Server.exe`** |
|
||||
|
||||
### Warum die WASM-Komponente den Unterschied macht
|
||||
|
||||
Die WASM-Seite der Anwendung (`EnvelopeGenerator.Server.Client`) bindet Assemblies wie
|
||||
`Microsoft.Extensions.DependencyInjection.Abstractions` in einer **fest definierten Version**.
|
||||
Bei einem **Framework-Dependent Deployment** werden diese Assemblies nicht mitgeliefert und
|
||||
müssen auf dem Zielserver vorhanden sein — in der exakt passenden Version.
|
||||
|
||||
Fehlt die passende .NET-Runtime auf dem Zielserver, erscheint folgender Fehler beim Start:
|
||||
|
||||
```
|
||||
Unhandled exception. System.IO.FileNotFoundException:
|
||||
Could not load file or assembly
|
||||
'Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Warum Self-Contained Publish?
|
||||
|
||||
Beim **Self-Contained Deployment** werden **alle benötigten .NET Runtime-DLLs** in das
|
||||
Ausgabeverzeichnis kopiert. Die Anwendung ist damit vollständig unabhängig von der auf dem
|
||||
Zielserver installierten .NET-Version.
|
||||
|
||||
| | Framework-Dependent | Self-Contained |
|
||||
|---|---|---|
|
||||
| .NET auf Zielserver nötig | Ja | **Nein** |
|
||||
| Paketgröße | ~20 MB | ~500 MB |
|
||||
| `runtimeconfig.json` | `frameworkVersion` vorhanden | `includedFrameworks` (Runtime eingebettet) |
|
||||
| Fehleranfälligkeit auf Fremd-PC | Hoch | Minimal |
|
||||
|
||||
---
|
||||
|
||||
## Publish-Befehl (Terminal)
|
||||
|
||||
### Empfohlener Befehl (Self-Contained, win-x64)
|
||||
|
||||
```bat
|
||||
dotnet publish EnvelopeGenerator.Server\EnvelopeGenerator.Server\EnvelopeGenerator.Server.csproj ^
|
||||
-c Release ^
|
||||
-f net8.0 ^
|
||||
--self-contained true ^
|
||||
--runtime win-x64 ^
|
||||
-o .\publish-output
|
||||
```
|
||||
|
||||
> Dieser Befehl muss vom **Solution-Root-Verzeichnis** aus ausgefuehrt werden.
|
||||
> Alternativ: `publish.bat` im selben Verzeichnis wie diese README ausfuehren.
|
||||
|
||||
### Parameter-Erklaerung
|
||||
|
||||
| Parameter | Bedeutung |
|
||||
|---|---|
|
||||
| `-c Release` | Release-Konfiguration (optimiert, kein Debug-Code) |
|
||||
| `-f net8.0` | Ziel-Framework explizit angeben (Pflicht, da `<TargetFrameworks>` mehrere Werte haben kann) |
|
||||
| `--self-contained true` | Alle .NET Runtime-DLLs ins Ausgabeverzeichnis kopieren |
|
||||
| `--runtime win-x64` | Zielplattform: Windows 64-Bit |
|
||||
| `-o .\publish-output` | Ausgabeverzeichnis |
|
||||
|
||||
### Überprüfung nach dem Publish
|
||||
|
||||
Nach erfolgreichem Publish folgende Dateien im Ausgabeverzeichnis prüfen:
|
||||
|
||||
```powershell
|
||||
# Diese Dateien MÜSSEN vorhanden sein (Self-Contained-Nachweis):
|
||||
Test-Path ".\publish-output\hostfxr.dll" # .NET Host
|
||||
Test-Path ".\publish-output\coreclr.dll" # .NET Core Runtime
|
||||
Test-Path ".\publish-output\Microsoft.Extensions.DependencyInjection.Abstractions.dll"
|
||||
Test-Path ".\publish-output\EnvelopeGenerator.Server.exe"
|
||||
Test-Path ".\publish-output\web.config"
|
||||
```
|
||||
|
||||
Alle Ergebnisse müssen `True` sein.
|
||||
|
||||
---
|
||||
|
||||
## IIS-Konfiguration
|
||||
|
||||
> **WICHTIG:** Diese Einstellungen unterscheiden sich von einer normalen ASP.NET Core API
|
||||
> und sind zwingend erforderlich.
|
||||
|
||||
### 1. Application Pool — `No Managed Code`
|
||||
|
||||
ASP.NET Core (und damit auch Blazor) verwaltet seinen eigenen Runtime-Lifecycle.
|
||||
IIS darf **keinen** .NET CLR-Managed-Code-Kontext aktivieren.
|
||||
|
||||
**Einstellung:**
|
||||
|
||||
```
|
||||
IIS Manager
|
||||
→ Application Pools
|
||||
→ [Pool-Name der Anwendung] → Basic Settings
|
||||
→ .NET CLR Version: "No Managed Code" ← ZWINGEND
|
||||
```
|
||||
|
||||
> **Fehler bei falscher Einstellung:** HTTP 500.30 — ASP.NET Core app failed to start
|
||||
> (sc-win32-status: 574 in IIS-Logs)
|
||||
|
||||
### 2. ASP.NET Core Module V2
|
||||
|
||||
Das IIS-Modul `AspNetCoreModuleV2` muss installiert sein.
|
||||
Es wird über das **.NET Hosting Bundle** mitgeliefert.
|
||||
|
||||
Prüfen:
|
||||
```
|
||||
IIS Manager → Modules → "AspNetCoreModuleV2" vorhanden?
|
||||
```
|
||||
|
||||
Falls nicht installiert: [.NET 8 Hosting Bundle herunterladen](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
|
||||
und nach der Installation IIS neu starten:
|
||||
|
||||
```cmd
|
||||
net stop was /y && net start w3svc
|
||||
```
|
||||
|
||||
### 3. web.config — Korrekte Konfiguration für Self-Contained
|
||||
|
||||
Nach dem Publish wird `web.config` automatisch generiert. Für Self-Contained muss sie so aussehen:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*"
|
||||
modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath=".\EnvelopeGenerator.Server.exe"
|
||||
stdoutLogEnabled="false"
|
||||
stdoutLogFile=".\logs\stdout"
|
||||
hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
</configuration>
|
||||
```
|
||||
|
||||
**Kritische Unterschiede zu Framework-Dependent:**
|
||||
|
||||
| Eigenschaft | Framework-Dependent (FALSCH) | Self-Contained (RICHTIG) |
|
||||
|---|---|---|
|
||||
| `processPath` | `dotnet` | `.\EnvelopeGenerator.Server.exe` |
|
||||
| `arguments` | `.\EnvelopeGenerator.Server.dll` | *(leer oder weggelassen)* |
|
||||
|
||||
### 4. Berechtigungen für das `logs`-Verzeichnis
|
||||
|
||||
Wenn `stdoutLogEnabled="true"` gesetzt wird (zur Fehlerdiagnose), muss das `logs`-Verzeichnis
|
||||
existieren und der IIS-Prozess muss Schreibrechte haben:
|
||||
|
||||
```powershell
|
||||
New-Item -ItemType Directory -Path "C:\inetpub\wwwroot\<App-Pfad>\logs" -Force
|
||||
icacls "C:\inetpub\wwwroot\<App-Pfad>\logs" /grant "IIS_IUSRS:(OI)(CI)F"
|
||||
```
|
||||
|
||||
> Ohne dieses Verzeichnis kann die Anwendung bei aktiviertem Logging **nicht starten**.
|
||||
|
||||
### 5. Application Pool Recycle nach Deployment
|
||||
|
||||
Nach jedem Deployment den Application Pool neu starten:
|
||||
|
||||
```cmd
|
||||
# IIS Manager → Application Pools → [Pool] → Recycle
|
||||
# oder per Kommandozeile (als Administrator):
|
||||
%windir%\system32\inetsrv\appcmd recycle apppool /apppool.name:"<Pool-Name>"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Verzeichnisstruktur nach dem Publish
|
||||
|
||||
```
|
||||
publish-output\
|
||||
├── EnvelopeGenerator.Server.exe ← Startpunkt (Self-Contained)
|
||||
├── EnvelopeGenerator.Server.dll ← Managed Assembly
|
||||
├── EnvelopeGenerator.Server.runtimeconfig.json
|
||||
├── EnvelopeGenerator.Server.deps.json
|
||||
├── web.config ← IIS-Konfiguration (auto-generiert)
|
||||
├── hostfxr.dll ← .NET Host (Self-Contained-Nachweis)
|
||||
├── coreclr.dll ← .NET Core Runtime
|
||||
├── Microsoft.Extensions.*.dll ← Framework-DLLs (jetzt enthalten!)
|
||||
├── DevExpress.*.dll ← UI-Komponenten
|
||||
├── wwwroot\ ← Statische Web-Assets
|
||||
│ ├── _framework\ ← WASM-Binaries
|
||||
│ └── ...
|
||||
└── logs\ ← Stdout-Logs (manuell anlegen!)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Häufige Fehler
|
||||
|
||||
| Fehler | Ursache | Lösung |
|
||||
|---|---|---|
|
||||
| `FileNotFoundException: Microsoft.Extensions.DependencyInjection.Abstractions` | Framework-Dependent Publish auf Server ohne .NET 8 | Self-Contained Publish verwenden |
|
||||
| `HTTP 500.30` in IIS | App startet nicht | Application Pool auf `No Managed Code` setzen |
|
||||
| `HTTP 500.30` + `sc-win32-status: 574` | App Pool falsch oder `AspNetCoreModuleV2` fehlt | Pool prüfen + Hosting Bundle installieren |
|
||||
| App startet per `.exe`, aber nicht in IIS | `web.config` hat noch `processPath="dotnet"` | `web.config` auf `.\EnvelopeGenerator.Server.exe` korrigieren |
|
||||
| Logs-Verzeichnis fehlt → App startet nicht | `stdoutLogEnabled="true"` aber `logs\` existiert nicht | `logs\`-Ordner anlegen + IIS_IUSRS Schreibrecht geben |
|
||||
@@ -4,12 +4,14 @@ using EnvelopeGenerator.Application.Common.Dto;
|
||||
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
|
||||
using EnvelopeGenerator.Application.Documents.Queries;
|
||||
using EnvelopeGenerator.Application.EnvelopeReceivers.Queries;
|
||||
using EnvelopeGenerator.Application.Receivers.Queries;
|
||||
using EnvelopeGenerator.Server.Client.Models;
|
||||
using EnvelopeGenerator.Server.Client.Models.Constants;
|
||||
using EnvelopeGenerator.Server.Extensions;
|
||||
using EnvelopeGenerator.Server.Options;
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.Caching.Distributed;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Options;
|
||||
using ApplicationEnvelopeReceiverDto = EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver.EnvelopeReceiverDto;
|
||||
|
||||
@@ -21,7 +23,8 @@ namespace EnvelopeGenerator.Server.Services;
|
||||
public class EnvelopeReceiverPageDataService(
|
||||
IMediator mediator,
|
||||
IDistributedCache cache,
|
||||
IOptions<CacheOptions> cacheOptions)
|
||||
IOptions<CacheOptions> cacheOptions,
|
||||
IMemoryCache memoryCache)
|
||||
{
|
||||
private const string SignatureCacheKeyPrefix = "envelope-generator.receiver-ui.signature:";
|
||||
|
||||
@@ -101,4 +104,23 @@ public class EnvelopeReceiverPageDataService(
|
||||
Page = element.Page,
|
||||
SenderAppType = (EnvelopeGenerator.Server.Client.Models.Constants.SenderAppType)element.SenderAppType
|
||||
};
|
||||
|
||||
private static readonly string ReceiverEmailSearchCacheKey = Guid.NewGuid().ToString();
|
||||
|
||||
public async Task<IEnumerable<string>> SearchReceiverEMailsAsync(string emailSearchTerm, CancellationToken cancellationToken = default)
|
||||
{
|
||||
|
||||
return await memoryCache.GetOrCreateAsync(ReceiverEmailSearchCacheKey + emailSearchTerm, async entry =>
|
||||
{
|
||||
var query = new ReadReceiverQuery { EmailAddressSearch = emailSearchTerm };
|
||||
var receivers = await mediator.Send(query, cancellationToken);
|
||||
|
||||
if(receivers.Any())
|
||||
entry.AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(30);
|
||||
else
|
||||
entry.AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(10);
|
||||
|
||||
return receivers.Select(r => r.EmailAddress);
|
||||
}) ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using PdfSharp.Fonts;
|
||||
|
||||
namespace EnvelopeGenerator.Server.Services;
|
||||
|
||||
/// <summary>
|
||||
/// PdfSharp 6.x IFontResolver for .NET 8.
|
||||
/// PdfSharp cannot access system fonts on .NET Core/8 without an explicit resolver.
|
||||
/// This implementation reads fonts directly from the Windows Fonts folder.
|
||||
/// Register once at startup: GlobalFontSettings.FontResolver = PdfSharpFontResolver.Instance;
|
||||
/// </summary>
|
||||
public class PdfSharpFontResolver : IFontResolver
|
||||
{
|
||||
public static readonly PdfSharpFontResolver Instance = new();
|
||||
|
||||
private static readonly string FontsFolder =
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.Fonts);
|
||||
|
||||
public FontResolverInfo? ResolveTypeface(string familyName, bool isBold, bool isItalic)
|
||||
{
|
||||
var key = familyName.ToLowerInvariant() switch
|
||||
{
|
||||
"arial" => isBold ? "arialbd" : "arial",
|
||||
_ => null
|
||||
};
|
||||
|
||||
return key is null ? null : new FontResolverInfo(key);
|
||||
}
|
||||
|
||||
public byte[] GetFont(string faceName)
|
||||
{
|
||||
var fileName = faceName switch
|
||||
{
|
||||
"arialbd" => "arialbd.ttf",
|
||||
_ => "arial.ttf",
|
||||
};
|
||||
|
||||
var path = Path.Combine(FontsFolder, fileName);
|
||||
|
||||
if (!File.Exists(path))
|
||||
throw new FileNotFoundException(
|
||||
$"Font file not found: {path}. " +
|
||||
"Ensure Arial is installed on the server.");
|
||||
|
||||
return File.ReadAllBytes(path);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
"http://localhost:7192"
|
||||
],
|
||||
"ConnectionStrings": {
|
||||
"Default": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;",
|
||||
"Default": "Server=SDD-VHP04-SQL19\\DD_TESTING01;Database=DD_ECM;User Id=sa;Password=123456789dD!;Encrypt=false;TrustServerCertificate=True;",
|
||||
"DbMigrationTest": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM_DATA_MIGR_TEST;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
||||
},
|
||||
"DirectorySearchOptions": {
|
||||
@@ -145,15 +145,17 @@
|
||||
"CustomImages": {
|
||||
"App": {
|
||||
"Src": "/img/DD_signFLOW_LOGO.png",
|
||||
"Height": "28px",
|
||||
"Classes": {
|
||||
"Main": "signFlow-logo"
|
||||
"Main": "signflow-app-logo"
|
||||
}
|
||||
},
|
||||
"Company": {
|
||||
"Src": "/img/digital_data.svg",
|
||||
"Height": "33px",
|
||||
"Classes": {
|
||||
"Show": "dd-show-logo",
|
||||
"Locked": "dd-locked-logo"
|
||||
"Show": "signflow-company-logo",
|
||||
"Locked": "signflow-company-logo"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "10.0.9",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -308,8 +308,8 @@ article {
|
||||
.home-btn-primary {
|
||||
background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
|
||||
border: none;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
color: #fff !important;
|
||||
font-weight: 700;
|
||||
border-radius: 8px;
|
||||
transition: filter 0.15s, box-shadow 0.15s;
|
||||
box-shadow: 0 2px 10px rgba(44,62,80,0.30);
|
||||
@@ -333,6 +333,24 @@ article {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* ── Logos ───────────────────────────────────────────────────────────────── */
|
||||
/* Heights are controlled by inline style="height: Xpx" from appsettings.json */
|
||||
|
||||
.signflow-app-logo {
|
||||
width: auto;
|
||||
object-fit: contain;
|
||||
display: block;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.signflow-company-logo {
|
||||
width: auto;
|
||||
object-fit: contain;
|
||||
display: block;
|
||||
opacity: 0.88;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* ── Footer ──────────────────────────────────────────────────────────────── */
|
||||
.receiver-footer {
|
||||
position: fixed;
|
||||
@@ -342,7 +360,7 @@ article {
|
||||
height: 36px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-content: space-between; /* ← left group | right group */
|
||||
gap: 10px;
|
||||
padding: 0 20px;
|
||||
background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
|
||||
@@ -363,6 +381,224 @@ article {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.receiver-footer__left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.receiver-footer__sep {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
/* ── Footer: Theme Slider ────────────────────────────────────────────────── */
|
||||
/* 🌙 blazing-dark ──◇──·──◇── purple ☀️ */
|
||||
/* Left group: copyright | datenschutz → Right group: slider */
|
||||
|
||||
.sf-theme-slider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* Moon / Sun SVG icons */
|
||||
.sf-theme-icon {
|
||||
display: block;
|
||||
opacity: 0.55; /* ↑ was 0.42 — more visible as base */
|
||||
flex-shrink: 0;
|
||||
transition: opacity 0.18s;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.sf-theme-icon--active {
|
||||
opacity: 0.92;
|
||||
}
|
||||
|
||||
.sf-theme-icon--mid {
|
||||
opacity: 0.62;
|
||||
}
|
||||
|
||||
/* ── Wrapper holds the range input + tick marks ───────────────────────────── */
|
||||
.sf-theme-track-wrapper {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 80px;
|
||||
height: 16px; /* enough height so ticks + thumb don't clip */
|
||||
}
|
||||
|
||||
/* Actual range input — fills the wrapper */
|
||||
.sf-theme-range {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background: rgba(255, 255, 255, 0.28);
|
||||
border-radius: 1px;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
margin: 0;
|
||||
/* no extra padding so ticks align correctly */
|
||||
}
|
||||
|
||||
.sf-theme-range:hover {
|
||||
background: rgba(255, 255, 255, 0.42);
|
||||
}
|
||||
|
||||
/* Thumb — white circle */
|
||||
.sf-theme-range::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.90);
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
|
||||
transition: transform 0.12s, box-shadow 0.12s;
|
||||
}
|
||||
|
||||
.sf-theme-range::-webkit-slider-thumb:hover {
|
||||
transform: scale(1.25);
|
||||
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.38);
|
||||
}
|
||||
|
||||
/* Firefox */
|
||||
.sf-theme-range::-moz-range-thumb {
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.90);
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
|
||||
}
|
||||
|
||||
.sf-theme-range::-moz-range-track {
|
||||
height: 2px;
|
||||
background: rgba(255, 255, 255, 0.28);
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
/* ── End ticks (left & right): thin vertical bars ────────────────────────── */
|
||||
.sf-theme-tick {
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
width: 2px;
|
||||
height: 7px;
|
||||
border-radius: 1px;
|
||||
background: rgba(255, 255, 255, 0.45);
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.sf-theme-tick--left { left: 0; }
|
||||
.sf-theme-tick--right { right: 0; }
|
||||
|
||||
/* Mid tick — thinner, subtler */
|
||||
.sf-theme-tick--mid {
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 1px;
|
||||
height: 5px;
|
||||
background: rgba(255, 255, 255, 0.50); /* ↑ was 0.22 */
|
||||
}
|
||||
|
||||
/* Sun icon: always visible regardless of active state */
|
||||
.sf-theme-icon--sun {
|
||||
opacity: 0.72; /* minimum visibility */
|
||||
}
|
||||
|
||||
/* ── Theme overrides: Home page & Login ──────────────────────────────────── */
|
||||
/* selector: [data-sf-theme="<name>"] on <html>, set by signflow-theme.js */
|
||||
|
||||
/* ── Purple ── */
|
||||
[data-sf-theme="purple"] .home-page-wrapper {
|
||||
background: linear-gradient(160deg, #1a0533 0%, #3b0764 45%, #6b21a8 100%);
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .home-btn-primary {
|
||||
background: linear-gradient(135deg, #6b21a8 0%, #9333ea 100%);
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .home-feature-badge {
|
||||
background: rgba(147, 51, 234, 0.10);
|
||||
color: #c084fc;
|
||||
border-color: rgba(147, 51, 234, 0.25);
|
||||
}
|
||||
|
||||
/* Login card header: set via a CSS rule so inline gradient can be overridden */
|
||||
.login-card .card-header {
|
||||
background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%) !important;
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .login-card .card-header {
|
||||
background: linear-gradient(135deg, #1a0533 0%, #6b21a8 100%) !important;
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .home-page-wrapper {
|
||||
background: linear-gradient(160deg, #0a0f1e 0%, #111827 50%, #1e1b4b 100%);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .home-btn-primary {
|
||||
background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .home-feature-badge {
|
||||
background: rgba(99, 102, 241, 0.12);
|
||||
color: #a5b4fc;
|
||||
border-color: rgba(99, 102, 241, 0.28);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .home-card {
|
||||
background: rgba(15, 20, 40, 0.92) !important;
|
||||
color: rgba(255, 255, 255, 0.85) !important;
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .home-card .text-muted {
|
||||
color: rgba(255, 255, 255, 0.55) !important;
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .login-card {
|
||||
background: rgba(15, 20, 40, 0.95) !important;
|
||||
color: rgba(255, 255, 255, 0.85) !important;
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .login-card .card-header {
|
||||
background: linear-gradient(135deg, #0a0f1e 0%, #1e1b4b 100%) !important;
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .login-card .card-body {
|
||||
background: rgba(15, 20, 40, 0.95);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .login-card .card-footer {
|
||||
background: rgba(15, 20, 40, 0.95) !important;
|
||||
color: rgba(255, 255, 255, 0.45) !important;
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .login-card .form-label {
|
||||
color: rgba(255, 255, 255, 0.75);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .login-card .form-control,
|
||||
[data-sf-theme="blazing-dark"] .login-card .input-group-text {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
border-color: rgba(255, 255, 255, 0.12);
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .login-card .btn-primary {
|
||||
background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%) !important;
|
||||
border-color: transparent !important;
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .login-card .text-muted {
|
||||
color: rgba(255, 255, 255, 0.50) !important;
|
||||
}
|
||||
@@ -51,6 +51,41 @@
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.pdf-editor-wrapper {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.sender-editor-pdf-viewer {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.sender-editor-pdf-viewer .dxbl-toolbar {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.sender-editor-pdf-viewer .dxbl-toolbar-left {
|
||||
margin-inline: auto;
|
||||
}
|
||||
|
||||
.sender-editor-pdf-viewer .dxbrv-document-surface {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.sender-editor-pdf-viewer .dxbrv-report-preview-content-flex-item {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.sender-editor-pdf-viewer .dxbrv-report-preview-content {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.pdf-viewer-container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
@@ -546,6 +581,285 @@ body.resizing {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sender-toolbar-action-btn {
|
||||
min-width: auto;
|
||||
padding: 0.5rem 0.75rem;
|
||||
}
|
||||
|
||||
.sender-toolbar-action-btn--compact {
|
||||
padding: 0.45rem 0.7rem;
|
||||
}
|
||||
|
||||
.sender-receivers-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.625rem;
|
||||
padding: 0.75rem 0.9rem;
|
||||
border-radius: 12px;
|
||||
background: linear-gradient(135deg, rgba(126, 34, 206, 0.05) 0%, rgba(42, 82, 152, 0.05) 100%);
|
||||
border: 1px solid rgba(126, 34, 206, 0.12);
|
||||
}
|
||||
|
||||
.sender-receivers-panel__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.sender-receivers-panel__title-wrap {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.sender-receivers-panel__title {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 700;
|
||||
color: #4c1d95;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.sender-receivers-panel__count {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 1.5rem;
|
||||
min-height: 1.5rem;
|
||||
padding: 0 0.45rem;
|
||||
border-radius: 999px;
|
||||
background: rgba(79, 70, 229, 0.12);
|
||||
color: #5b21b6;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.sender-receivers-panel__add-btn .dxbl-btn {
|
||||
border-radius: 8px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.pdf-toolbar-like-btn .dxbl-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.4rem;
|
||||
min-height: 34px;
|
||||
padding: 0.45rem 0.85rem;
|
||||
border-radius: 8px;
|
||||
border: 1px solid rgba(126, 34, 206, 0.2);
|
||||
background: linear-gradient(135deg, rgba(126, 34, 206, 0.05) 0%, rgba(42, 82, 152, 0.05) 100%);
|
||||
color: #1e293b;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
box-shadow: none;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.pdf-toolbar-like-btn .dxbl-btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, rgba(126, 34, 206, 0.1) 0%, rgba(42, 82, 152, 0.1) 100%);
|
||||
border-color: rgba(126, 34, 206, 0.4);
|
||||
color: #1e293b;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(126, 34, 206, 0.2);
|
||||
}
|
||||
|
||||
.pdf-toolbar-like-btn .dxbl-btn:active:not(:disabled) {
|
||||
transform: translateY(0);
|
||||
box-shadow: 0 2px 6px rgba(126, 34, 206, 0.15);
|
||||
}
|
||||
|
||||
.pdf-toolbar-like-btn--add .dxbl-btn::before,
|
||||
.pdf-toolbar-like-btn--signature .dxbl-btn::before {
|
||||
display: inline-block;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.pdf-toolbar-like-btn--add .dxbl-btn::before {
|
||||
content: '+';
|
||||
color: #7e22ce;
|
||||
}
|
||||
|
||||
.pdf-toolbar-like-btn--signature .dxbl-btn {
|
||||
color: #7e22ce;
|
||||
}
|
||||
|
||||
.pdf-toolbar-like-btn--signature .dxbl-btn::before {
|
||||
content: '?';
|
||||
color: #7e22ce;
|
||||
}
|
||||
|
||||
.pdf-toolbar-like-btn--signature .dxbl-btn:hover:not(:disabled) {
|
||||
color: #7e22ce;
|
||||
}
|
||||
|
||||
.sender-receivers-panel__empty {
|
||||
font-size: 0.78rem;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.sender-receivers-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.625rem;
|
||||
}
|
||||
|
||||
.sender-receiver-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
min-width: 220px;
|
||||
max-width: 100%;
|
||||
padding: 0.625rem 0.75rem;
|
||||
border-radius: 12px;
|
||||
background: rgba(255, 255, 255, 0.88);
|
||||
border: 1px solid rgba(126, 34, 206, 0.12);
|
||||
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
|
||||
}
|
||||
|
||||
.sender-receiver-chip__body {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.sender-receiver-chip__name {
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
color: #1f2937;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.sender-receiver-chip__email {
|
||||
margin-top: 0.15rem;
|
||||
font-size: 0.72rem;
|
||||
color: #64748b;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.sender-receiver-chip__phone {
|
||||
margin-top: 0.15rem;
|
||||
font-size: 0.72rem;
|
||||
color: #64748b;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.sender-receiver-popup .dxbl-modal {
|
||||
border-radius: 18px;
|
||||
}
|
||||
|
||||
.sender-receiver-popup .dxbl-popup {
|
||||
max-width: min(720px, calc(100vw - 2rem));
|
||||
}
|
||||
|
||||
.sender-receiver-popup .dxbl-popup-content {
|
||||
padding: 1rem 1.25rem 1.1rem;
|
||||
}
|
||||
|
||||
.sender-receiver-popup .dxbl-popup-header {
|
||||
padding: 0.95rem 1.25rem;
|
||||
}
|
||||
|
||||
.sender-receiver-popup .dxbl-popup-footer {
|
||||
padding: 0.75rem 1.25rem 1rem;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.9rem;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||
gap: 1rem 1.25rem;
|
||||
align-items: start;
|
||||
min-height: 250px;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__field {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__label {
|
||||
margin-bottom: 0.45rem;
|
||||
font-size: 0.82rem;
|
||||
font-weight: 600;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__field .dxbl-text-edit,
|
||||
.sender-receiver-popup__field .dxbl-dropdown-edit {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__field .dxbl-input-editor,
|
||||
.sender-receiver-popup__field .dxbl-text-edit-input {
|
||||
min-height: 38px;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__suggestions-shell {
|
||||
min-height: 188px;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__suggestions {
|
||||
border: 1px solid rgba(126, 34, 206, 0.12);
|
||||
border-radius: 10px;
|
||||
background: rgba(255, 255, 255, 0.98);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__suggestions .dxbl-listbox {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__suggestions .dxbl-listbox-scroll-viewer {
|
||||
max-height: 180px;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__hint {
|
||||
font-size: 0.78rem;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__loading {
|
||||
font-size: 0.78rem;
|
||||
color: #4f46e5;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__validation {
|
||||
padding: 0.625rem 0.75rem;
|
||||
border-radius: 10px;
|
||||
background: rgba(239, 68, 68, 0.08);
|
||||
color: #b91c1c;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 0.5rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__footer .dxbl-btn {
|
||||
min-width: 148px;
|
||||
border-radius: 8px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.pdf-frame {
|
||||
background: white;
|
||||
border-radius: 16px;
|
||||
@@ -748,6 +1062,30 @@ body.resizing {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.sender-receivers-panel {
|
||||
padding: 0.625rem 0.75rem;
|
||||
}
|
||||
|
||||
.sender-receiver-chip {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.sender-receiver-chip__action {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.sender-receiver-chip__action {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.sender-receiver-popup__form-grid {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 0.85rem;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.envelope-title {
|
||||
font-size: 1rem;
|
||||
}
|
||||
@@ -765,3 +1103,111 @@ body.resizing {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Theme overrides: Envelope Viewer / Editor / Receiver ───────────────── */
|
||||
/* selector: [data-sf-theme="<name>"] on <html>, set by signflow-theme.js */
|
||||
|
||||
/* ── Purple ─────────────────────────────────────────────────────────────── */
|
||||
[data-sf-theme="purple"] .envelope-viewer-layout {
|
||||
background: linear-gradient(135deg, #1a0533 0%, #3b0764 50%, #6b21a8 100%);
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .envelope-action-bar {
|
||||
border-bottom-color: rgba(147, 51, 234, 0.4);
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .envelope-logo svg {
|
||||
color: #9333ea;
|
||||
filter: drop-shadow(0 2px 4px rgba(147, 51, 234, 0.35));
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .pdf-toolbar__btn {
|
||||
border-color: rgba(147, 51, 234, 0.25);
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .pdf-toolbar__btn:hover {
|
||||
border-color: rgba(147, 51, 234, 0.5);
|
||||
box-shadow: 0 2px 8px rgba(147, 51, 234, 0.2);
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .pdf-text-layer ::selection,
|
||||
[data-sf-theme="purple"] .pdf-text-layer ::-moz-selection {
|
||||
background: rgba(147, 51, 234, 0.3);
|
||||
}
|
||||
|
||||
/* ── Blazing Dark ───────────────────────────────────────────────────────── */
|
||||
[data-sf-theme="blazing-dark"] .envelope-viewer-layout {
|
||||
background: linear-gradient(135deg, #0a0f1e 0%, #111827 55%, #1e1b4b 100%);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .envelope-action-bar {
|
||||
background: rgba(20, 20, 35, 0.92);
|
||||
border-bottom-color: rgba(99, 102, 241, 0.35);
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .envelope-title {
|
||||
color: rgba(255, 255, 255, 0.92);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .envelope-key {
|
||||
color: rgba(255, 255, 255, 0.45);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .envelope-logo svg {
|
||||
color: #818cf8;
|
||||
filter: drop-shadow(0 2px 4px rgba(129, 140, 248, 0.3));
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .pdf-toolbar__btn {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
border-color: rgba(255, 255, 255, 0.12);
|
||||
color: rgba(255, 255, 255, 0.82);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .pdf-toolbar__btn:hover {
|
||||
background: rgba(129, 140, 248, 0.15);
|
||||
border-color: rgba(129, 140, 248, 0.4);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .pdf-toolbar__btn--signature-change-active {
|
||||
background: rgba(99, 102, 241, 0.25);
|
||||
border-color: rgba(99, 102, 241, 0.5);
|
||||
color: #a5b4fc;
|
||||
}
|
||||
|
||||
/* Error container */
|
||||
[data-sf-theme="blazing-dark"] .error-container .alert-danger {
|
||||
background: rgba(239, 68, 68, 0.12);
|
||||
border-color: rgba(239, 68, 68, 0.3);
|
||||
color: #fca5a5;
|
||||
}
|
||||
|
||||
/* Receiver info header */
|
||||
[data-sf-theme="blazing-dark"] .receiver-info-header__gradient {
|
||||
background: linear-gradient(135deg, #0a0f1e 0%, #1e1b4b 100%);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .receiver-info-message {
|
||||
color: rgba(255, 255, 255, 0.70);
|
||||
border-bottom-color: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .receiver-info-private-message {
|
||||
background: rgba(245, 158, 11, 0.08);
|
||||
border-top-color: rgba(245, 158, 11, 0.18);
|
||||
color: #fde68a;
|
||||
}
|
||||
|
||||
/* Signature action bar */
|
||||
[data-sf-theme="blazing-dark"] .receiver-action-bar {
|
||||
background: rgba(20, 20, 35, 0.92);
|
||||
border-bottom-color: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
/* PDF text selection */
|
||||
[data-sf-theme="blazing-dark"] .pdf-text-layer ::selection,
|
||||
[data-sf-theme="blazing-dark"] .pdf-text-layer ::-moz-selection {
|
||||
background: rgba(99, 102, 241, 0.35);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,34 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
flex-shrink: 0; /* don't shrink — logo area in the middle gets the space */
|
||||
}
|
||||
|
||||
/* ── Customer logo area (middle of action bar) ──────────────────────────── */
|
||||
.sender-customer-logo-area {
|
||||
flex: 1; /* takes up remaining space between left and right */
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-width: 0; /* allow flex child to shrink below content size */
|
||||
}
|
||||
|
||||
/* Placeholder shown when no customer logo is configured */
|
||||
.sf-customer-logo-placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 28px;
|
||||
min-width: 90px;
|
||||
padding: 0 12px;
|
||||
border: 1px dashed rgba(126, 34, 206, 0.28);
|
||||
border-radius: 6px;
|
||||
font-size: 0.65rem;
|
||||
font-weight: 500;
|
||||
color: rgba(126, 34, 206, 0.38);
|
||||
white-space: nowrap;
|
||||
letter-spacing: 0.03em;
|
||||
text-transform: uppercase;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.sender-logo svg {
|
||||
@@ -171,7 +199,20 @@
|
||||
}
|
||||
|
||||
.sender-grid-wrapper {
|
||||
padding: 1.5rem 2rem 2rem;
|
||||
padding: 0 2rem 2rem; /* top padding removed — hint banner provides top spacing */
|
||||
}
|
||||
|
||||
/* ── Grid persistence hint banner ─────────────────────────────────────────── */
|
||||
.sf-grid-persistence-hint {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 2rem;
|
||||
font-size: 0.72rem;
|
||||
color: rgba(126, 34, 206, 0.65);
|
||||
background: rgba(126, 34, 206, 0.04);
|
||||
border-bottom: 1px solid rgba(126, 34, 206, 0.08);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/* Hide DevExpress empty cells */
|
||||
@@ -295,3 +336,146 @@
|
||||
font-size: 0.813rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Theme overrides ─────────────────────────────────────────────────────── */
|
||||
/* Selector: [data-sf-theme="<name>"] set on <html> by signflow-theme.js */
|
||||
|
||||
/* ── Purple theme ──────────────────────────────────────────────────────────
|
||||
Deeper violet, less blue — visually distinct from Blazing Berry */
|
||||
[data-sf-theme="purple"] .sender-dashboard-layout {
|
||||
background: linear-gradient(135deg, #1a0533 0%, #3b0764 50%, #6b21a8 100%);
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .sender-grid-container::before {
|
||||
background: linear-gradient(90deg, #9333ea 0%, #6b21a8 100%);
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .sender-action-bar {
|
||||
border-bottom-color: rgba(147, 51, 234, 0.4);
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .sender-logo svg {
|
||||
color: #9333ea;
|
||||
filter: drop-shadow(0 2px 4px rgba(147, 51, 234, 0.35));
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .sender-btn--primary {
|
||||
background: linear-gradient(135deg, #9333ea 0%, #6b21a8 100%);
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .sender-btn--primary:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7e22ce 0%, #581c87 100%);
|
||||
box-shadow: 0 4px 16px rgba(147, 51, 234, 0.35);
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .sender-btn:hover:not(:disabled) {
|
||||
border-color: rgba(147, 51, 234, 0.45);
|
||||
box-shadow: 0 4px 12px rgba(147, 51, 234, 0.22);
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .sender-tabs {
|
||||
border-bottom-color: rgba(147, 51, 234, 0.12);
|
||||
}
|
||||
|
||||
[data-sf-theme="purple"] .sender-tab--active {
|
||||
color: #9333ea;
|
||||
border-bottom-color: #9333ea;
|
||||
}
|
||||
|
||||
/* ── Blazing Dark theme ────────────────────────────────────────────────────
|
||||
Dark navy background, frosted glass surfaces turn semi-dark */
|
||||
[data-sf-theme="blazing-dark"] .sender-dashboard-layout {
|
||||
background: linear-gradient(135deg, #0a0f1e 0%, #111827 55%, #1e1b4b 100%);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-action-bar {
|
||||
background: rgba(20, 20, 35, 0.92);
|
||||
border-bottom-color: rgba(99, 102, 241, 0.35);
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-title {
|
||||
color: rgba(255, 255, 255, 0.92);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-logo svg {
|
||||
color: #818cf8;
|
||||
filter: drop-shadow(0 2px 4px rgba(129, 140, 248, 0.3));
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-btn {
|
||||
color: rgba(255, 255, 255, 0.82);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
border-color: rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-btn:hover:not(:disabled) {
|
||||
background: rgba(129, 140, 248, 0.15);
|
||||
border-color: rgba(129, 140, 248, 0.4);
|
||||
color: #fff;
|
||||
box-shadow: 0 4px 12px rgba(129, 140, 248, 0.2);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-btn:disabled {
|
||||
color: rgba(255, 255, 255, 0.25);
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border-color: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-btn--primary {
|
||||
background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
|
||||
color: white;
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-btn--primary:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
|
||||
box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-btn--danger {
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
border-color: rgba(239, 68, 68, 0.28);
|
||||
color: #fca5a5;
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-btn--danger:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
|
||||
color: white;
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-grid-container {
|
||||
background: rgba(15, 20, 40, 0.95);
|
||||
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-grid-container::before {
|
||||
background: linear-gradient(90deg, #6366f1 0%, #4338ca 100%);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-tabs {
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border-bottom-color: rgba(99, 102, 241, 0.12);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-tab {
|
||||
color: rgba(255, 255, 255, 0.45);
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-tab--active {
|
||||
color: #818cf8;
|
||||
border-bottom-color: #818cf8;
|
||||
}
|
||||
|
||||
[data-sf-theme="blazing-dark"] .sender-tab:hover:not(.sender-tab--active) {
|
||||
color: rgba(255, 255, 255, 0.72);
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
|
||||
/* Error container in dark mode */
|
||||
[data-sf-theme="blazing-dark"] .error-container .alert-danger {
|
||||
background: rgba(239, 68, 68, 0.12);
|
||||
border-color: rgba(239, 68, 68, 0.3);
|
||||
color: #fca5a5;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Ebene_1" data-name="Ebene 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 850 121.32">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1 {
|
||||
fill: #a52431;
|
||||
stroke-width: 0px;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<path class="cls-1" d="M83.01,60.66c0-35.12-12.77-57.47-41.51-57.47H0v114.94h39.91c30.33,0,43.1-20.75,43.1-57.47M49.49,60.66c0,19.16-1.6,28.73-15.96,28.73V31.93c14.37,0,15.96,12.77,15.96,28.73M126.11,3.19h-33.52v114.94h33.52V3.19ZM223.49,97.38v-46.29h-39.91l-1.6,23.95h12.77v9.58c-3.19,4.79-6.39,7.98-12.77,7.98-7.98,0-12.77-11.17-12.77-31.93s4.79-31.93,12.77-31.93c6.86,0,11.33,5.75,12.77,14.37l28.73-6.39C218.7,15.96,207.52,0,181.98,0c-33.52,0-46.29,28.73-46.29,60.66s12.77,60.66,46.29,60.66c17.56,0,31.93-7.98,41.51-23.94M268.18,3.19h-33.52v114.94h33.52V3.19ZM346.4,31.93l-3.19-28.74h-65.45l-3.19,28.74h19.16v86.2h33.52V31.93h19.16ZM427.81,118.13L399.07,3.19h-31.93l-28.73,114.94h35.12l1.6-14.37h15.96l1.6,14.37h35.12ZM387.58,76.62h-8.94l3.51-28.74c.32-3.19.64-6.38.8-9.58h.32c.16,3.19.48,6.38.8,9.58l3.51,28.74ZM493.26,89.4h-25.54V3.19h-33.52v114.94h55.87l3.19-28.74ZM614.58,60.66c0-35.12-12.77-57.47-41.51-57.47h-41.51v114.94h39.91c30.33,0,43.1-20.75,43.1-57.47M581.05,60.66c0,19.16-1.6,28.73-15.96,28.73V31.93c14.37,0,15.96,12.77,15.96,28.73M704.75,118.13l-28.73-114.94h-31.93l-28.74,114.94h35.12l1.6-14.37h15.96l1.6,14.37h35.12ZM664.52,76.62h-8.94l3.51-28.74c.32-3.19.64-6.38.8-9.58h.32c.16,3.19.48,6.38.8,9.58l3.51,28.74ZM768.59,31.93l-3.19-28.74h-65.45l-3.19,28.74h19.16v86.2h33.52V31.93h19.16ZM850,118.13l-28.73-114.94h-31.93l-28.73,114.94h35.12l1.6-14.37h15.96l1.6,14.37h35.12ZM809.77,76.62h-8.94l3.51-28.74c.32-3.19.64-6.38.8-9.58h.32c.16,3.19.48,6.38.8,9.58l3.51,28.74Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,95 @@
|
||||
window.envelopeEditor = {
|
||||
|
||||
/**
|
||||
* Returns the click position normalised to [0,1] relative to the rendered PDF page
|
||||
* element inside DxPdfViewer (or DxReportViewer as fallback).
|
||||
*
|
||||
* Normalising means the result is independent of zoom level: no matter how much the
|
||||
* user has zoomed in/out, the same physical spot on the PDF will always yield the same
|
||||
* normalised value. C# multiplies by the page's point dimensions to get PDF points.
|
||||
*
|
||||
* @param {string} viewerCssClass - CssClass set on DxPdfViewer (e.g. "sender-editor-pdf-viewer")
|
||||
* @param {number} clientX - MouseEvent.clientX from Blazor
|
||||
* @param {number} clientY - MouseEvent.clientY from Blazor
|
||||
* @returns {{ normX, normY, pageIndex } | null}
|
||||
* normX / normY : 0..1 fraction within the page element
|
||||
* pageIndex : 0-based index of the page the click landed on (-1 if not found)
|
||||
*/
|
||||
getClickCoordsOnPdfPage: function (viewerCssClass, clientX, clientY) {
|
||||
|
||||
// Find the viewer root element
|
||||
const viewer = document.querySelector('.' + viewerCssClass);
|
||||
if (!viewer) {
|
||||
console.warn('[envelopeEditor] viewer not found for class:', viewerCssClass);
|
||||
return null;
|
||||
}
|
||||
|
||||
// --- Candidate page elements (ordered by preference) ---
|
||||
// DxPdfViewer renders individual pages as .dxbl-pdfv-page elements.
|
||||
// DxReportViewer uses .dxbrv-report-preview-content-img as fallback.
|
||||
const pageSelectors = [
|
||||
'.dxbl-pdfv-page',
|
||||
'.dxbrv-report-preview-page',
|
||||
'.dxbrv-report-preview-content-img',
|
||||
];
|
||||
|
||||
let allPages = [];
|
||||
for (const sel of pageSelectors) {
|
||||
const found = Array.from(viewer.querySelectorAll(sel));
|
||||
if (found.length > 0) {
|
||||
allPages = found;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (allPages.length === 0) {
|
||||
console.warn('[envelopeEditor] no page elements found inside viewer');
|
||||
return null;
|
||||
}
|
||||
|
||||
// --- Find which page the click landed on ---
|
||||
// Walk through all pages; pick the one whose bounding rect contains the click.
|
||||
// If none contains it exactly, fall back to the page closest vertically.
|
||||
let targetPage = null;
|
||||
let targetIndex = -1;
|
||||
let minDist = Infinity;
|
||||
|
||||
for (let i = 0; i < allPages.length; i++) {
|
||||
const rect = allPages[i].getBoundingClientRect();
|
||||
|
||||
// Exact hit
|
||||
if (clientX >= rect.left && clientX <= rect.right &&
|
||||
clientY >= rect.top && clientY <= rect.bottom) {
|
||||
targetPage = allPages[i];
|
||||
targetIndex = i;
|
||||
break;
|
||||
}
|
||||
|
||||
// Track closest page (vertical centre distance) as fallback
|
||||
const cy = rect.top + rect.height / 2;
|
||||
const dist = Math.abs(clientY - cy);
|
||||
if (dist < minDist) {
|
||||
minDist = dist;
|
||||
targetPage = allPages[i];
|
||||
targetIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (!targetPage) return null;
|
||||
|
||||
const pageRect = targetPage.getBoundingClientRect();
|
||||
|
||||
// Clamp click inside page boundaries before normalising
|
||||
const clampedX = Math.max(pageRect.left, Math.min(clientX, pageRect.right));
|
||||
const clampedY = Math.max(pageRect.top, Math.min(clientY, pageRect.bottom));
|
||||
|
||||
const normX = (clampedX - pageRect.left) / pageRect.width;
|
||||
const normY = (clampedY - pageRect.top) / pageRect.height;
|
||||
|
||||
return {
|
||||
normX: normX,
|
||||
normY: normY,
|
||||
pageIndex: targetIndex
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* signFLOW Theme Helper
|
||||
* Called from ThemeService (Blazor WASM) to apply theme changes.
|
||||
*/
|
||||
window.signflowTheme = {
|
||||
|
||||
apply: function (href, bsTheme, themeName) {
|
||||
console.debug('[signflowTheme] apply', themeName, bsTheme);
|
||||
|
||||
// ── Bootstrap dark mode ─────────────────────────────────────────
|
||||
document.documentElement.setAttribute('data-bs-theme', bsTheme);
|
||||
|
||||
// ── Theme name attribute for CSS overrides ──────────────────────
|
||||
// Applied to <html> so any nested selector can use it:
|
||||
// [data-sf-theme="blazing-dark"] .sender-dashboard-layout { ... }
|
||||
document.documentElement.setAttribute('data-sf-theme', themeName);
|
||||
|
||||
// ── DevExpress theme CSS link ────────────────────────────────────
|
||||
document.querySelectorAll('link[href*="DevExpress.Blazor.Themes"]').forEach(function(el) {
|
||||
if (el.id !== 'dx-theme-link') el.parentNode.removeChild(el);
|
||||
});
|
||||
|
||||
let link = document.getElementById('dx-theme-link');
|
||||
if (!link) {
|
||||
link = document.createElement('link');
|
||||
link.id = 'dx-theme-link';
|
||||
link.rel = 'stylesheet';
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
|
||||
const currentRelative = link.getAttribute('href') || '';
|
||||
if (currentRelative !== href) {
|
||||
link.setAttribute('href', href);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
415
EnvelopeGenerator.Server/SF-74-PLAN.md
Normal file
415
EnvelopeGenerator.Server/SF-74-PLAN.md
Normal file
@@ -0,0 +1,415 @@
|
||||
# SF-74 — signFLOW: Theme, Dark Mode, Grid Persistence, Logo & Dashboard
|
||||
|
||||
**Ticket:** SF-74 | **Bearbeiter:** Hakan Tek | **Status:** In Bearbeitung
|
||||
**Letzte Aktualisierung:** 2026-09-03
|
||||
**Erstellt von:** Marlon Schreiber | **Verknüpft mit:** SF-71
|
||||
|
||||
---
|
||||
|
||||
## Originale Anforderungen
|
||||
|
||||
### Marlon Schreiber (Ticket-Text):
|
||||
1. **signFLOW-Logo** + **Kunden-Logo-Bereich** auf der Startseite
|
||||
2. **DevExpress Skin-Auswahl** — mindestens 3 Themes, vom User wählbar + gespeichert
|
||||
3. **Grid-Layout-Persistenz** — Spaltenbreite/Position pro User gespeichert
|
||||
|
||||
### Screenshot-Annotationen (`/sender`):
|
||||
```
|
||||
[signFLOW Logo] Umschlag-Übersicht [Kunden-Logo] [+Neuer Umschlag][Bearb.][Lösch.][↺][→|]
|
||||
signFLOW Portal-Übersicht [Zurückrufen/löschen][Dok.anzeigen][Excel]
|
||||
|
||||
[Info-Banner: "Die Größe und Position der Spalten muss verändert und für den User gespeichert..."]
|
||||
|
||||
ID ↓ Titel Status [Typ] Empfänger [Erstellt] [Geändert am]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Projektstruktur — Clean Architecture
|
||||
|
||||
```
|
||||
EnvelopeGenerator.Domain/ → Entities, Domain-Interfaces
|
||||
EnvelopeGenerator.Application/ → Service-Interfaces, DTOs, Use-Cases
|
||||
EnvelopeGenerator.Infrastructure/ → Cache, DB, Implementierungen
|
||||
EnvelopeGenerator.Server/ → Blazor SSR Host, Controller, Middleware
|
||||
EnvelopeGenerator.Server.Client/ → Blazor WASM Client
|
||||
```
|
||||
|
||||
**Abhängigkeitsregel:** `Domain ← Application ← Infrastructure ← Server / Server.Client`
|
||||
|
||||
---
|
||||
|
||||
## ✅ Abgeschlossene Phasen (1–5)
|
||||
|
||||
| Phase | Inhalt | Status |
|
||||
|-------|--------|--------|
|
||||
| 1 | Server: UserPreferences API (TBDD_CACHE, `IUserPreferencesService`) | ✅ |
|
||||
| 2 | WASM: `ThemeService`, `UserPreferencesService` (1h In-Memory-Cache) | ✅ |
|
||||
| 3 | Footer Theme Slider (🌙 blazing-dark ── blazing-berry ── purple ☀️) | ✅ |
|
||||
| 4 | Grid Layout Persistence (`LayoutAutoSaving`/`LayoutAutoLoading`) | ✅ |
|
||||
| 5 | Theme-CSS-Overrides für alle Seiten (`[data-sf-theme]`) | ✅ |
|
||||
|
||||
**Key decisions:** TBDD_CACHE statt eigener DB-Tabelle · `SenderOrReceiver` Policy · Slider statt Toggle · `signflow.theme` in localStorage · DevExpress 25.2.3 hat keine `.dark.`-Suffix-Dateien
|
||||
|
||||
---
|
||||
|
||||
## 🔲 Phase 6a — signFLOW-Logo
|
||||
|
||||
### Ziel
|
||||
signFLOW-App-Logo im Sender Dashboard (`/sender`) Action Bar links neben dem Titel, sowie auf der Startseite (`/`) im Hero-Header.
|
||||
|
||||
### Technischer Ansatz
|
||||
|
||||
**Options Pattern** — `appsettings.json` → `CustomImagesOptions` → DI → Controller → WASM Service.
|
||||
|
||||
```
|
||||
appsettings.json
|
||||
└── CustomImagesOptions (Options Pattern, IOptions<>)
|
||||
└── GET /api/CustomImages (neuer Controller, auth: SenderOrReceiver)
|
||||
└── CustomImagesService (WASM, in-memory cache, kein TTL)
|
||||
└── EnvelopeSenderPage + IndexPage
|
||||
```
|
||||
|
||||
**Warum kein `wwwroot/appsettings.json`?**
|
||||
Statische Assets sind public (keine Auth). Logo-Pfade sind deployment-spezifisch.
|
||||
Options Pattern erlaubt Produktionswechsel ohne Code-Änderung.
|
||||
|
||||
### Neue/geänderte Dateien
|
||||
|
||||
#### `Server/Models/CustomImages.cs` — NEU
|
||||
|
||||
```csharp
|
||||
public sealed class CustomImageEntry
|
||||
{
|
||||
public string Src { get; set; } = string.Empty;
|
||||
/// <summary>CSS height, e.g. "28px" or "2rem". Change per deployment in appsettings.</summary>
|
||||
public string Height { get; set; } = "28px";
|
||||
public Dictionary<string, string> Classes { get; set; } = new();
|
||||
public string GetClass(string key) =>
|
||||
Classes.TryGetValue(key, out var cls) ? cls ?? string.Empty : string.Empty;
|
||||
}
|
||||
|
||||
public sealed class CustomImagesOptions
|
||||
{
|
||||
public const string SectionName = "CustomImages";
|
||||
public CustomImageEntry App { get; set; } = new();
|
||||
public CustomImageEntry Company { get; set; } = new();
|
||||
}
|
||||
```
|
||||
|
||||
#### `appsettings.json` — Änderung (Zeile 145)
|
||||
|
||||
```json
|
||||
"CustomImages": {
|
||||
"App": { "Src": "/img/DD_signFLOW_LOGO.png", "Height": "28px",
|
||||
"Classes": { "Main": "signflow-app-logo" } },
|
||||
"Company": { "Src": "/img/digital_data.svg", "Height": "22px",
|
||||
"Classes": { "Show": "signflow-company-logo" } }
|
||||
}
|
||||
```
|
||||
|
||||
> **Deployment:** Nur `Src` + `Height` in `appsettings.json` ändern — keine Code-Anpassung nötig.
|
||||
|
||||
#### `Server/Controllers/CustomImagesController.cs` — NEU
|
||||
|
||||
```
|
||||
GET /api/CustomImages
|
||||
Auth: [Authorize(Policy = AuthPolicy.SenderOrReceiver)]
|
||||
Returns: CustomImagesOptions
|
||||
```
|
||||
|
||||
#### `Server/Program.cs` — DI
|
||||
|
||||
```csharp
|
||||
builder.Services.Configure<CustomImagesOptions>(
|
||||
config.GetSection(CustomImagesOptions.SectionName));
|
||||
```
|
||||
|
||||
#### `Server/wwwroot/img/` — Neue Dateien
|
||||
|
||||
Kopiert aus `EnvelopeGenerator.Web/wwwroot/img/`:
|
||||
- `DD_signFLOW_LOGO.png`
|
||||
- `digital_data.svg`
|
||||
|
||||
#### `Client/Services/CustomImagesService.cs` — NEU
|
||||
|
||||
```csharp
|
||||
// GET /api/CustomImages → einmalig laden, in-memory gecacht (Config ändert sich kaum)
|
||||
public class CustomImagesService(IHttpClientFactory factory)
|
||||
{
|
||||
private CustomImagesDto? _cached;
|
||||
public async Task<CustomImagesDto> GetAsync(CancellationToken ct = default) { ... }
|
||||
}
|
||||
```
|
||||
|
||||
#### `app.css` — Neue Klassen
|
||||
|
||||
```css
|
||||
.signflow-app-logo { height: var(--sf-app-height, 28px); width: auto; object-fit: contain; }
|
||||
.signflow-company-logo { height: var(--sf-company-height, 22px); width: auto; object-fit: contain; opacity: .88; }
|
||||
```
|
||||
|
||||
#### `IndexPage.razor` — Änderung
|
||||
|
||||
```razor
|
||||
<!-- Alt: <svg class="home-hero-header__icon"> -->
|
||||
<!-- Neu: -->
|
||||
<img src="@_appLogo.Src" style="height: @_appLogo.Height"
|
||||
class="home-hero-header__icon" alt="signFLOW" />
|
||||
```
|
||||
|
||||
#### `EnvelopeSenderPage.razor` — signFLOW Logo im Action Bar
|
||||
|
||||
```razor
|
||||
<div class="sender-branding">
|
||||
<img src="@_appLogo.Src" style="height: @_appLogo.Height"
|
||||
class="@_appLogo.GetClass("Main")" alt="signFLOW" />
|
||||
<div class="sender-title-block">
|
||||
<div class="sender-title">Umschlag-Übersicht</div>
|
||||
<div class="sender-subtitle">signFLOW Portal - Übersicht</div>
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔲 Phase 6b — Kunden-Logo Placeholder
|
||||
|
||||
### Ziel
|
||||
Mittlerer Bereich im Action Bar zeigt das Kunden-Logo (aus Config) oder einen Platzhalter.
|
||||
|
||||
### Implementierung
|
||||
|
||||
**Config-Quelle:** `CustomImagesOptions.Company` (aus Phase 6a bereits geladen)
|
||||
|
||||
```razor
|
||||
<!-- Mitte des Action Bars -->
|
||||
<div class="sender-customer-logo-area">
|
||||
@if (!string.IsNullOrEmpty(_companyLogo?.Src))
|
||||
{
|
||||
<img src="@_companyLogo.Src" style="height: @_companyLogo.Height"
|
||||
class="@_companyLogo.GetClass("Show")" alt="Kunden-Logo" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="sf-customer-logo-placeholder">Kunden-Logo</div>
|
||||
}
|
||||
</div>
|
||||
```
|
||||
|
||||
#### `app.css` — Neue Klasse
|
||||
|
||||
```css
|
||||
.sf-customer-logo-placeholder {
|
||||
height: 24px; min-width: 90px;
|
||||
border: 1px dashed rgba(126, 34, 206, 0.3); border-radius: 4px;
|
||||
display: flex; align-items: center; padding: 0 10px;
|
||||
font-size: 0.62rem; color: rgba(126, 34, 206, 0.4); white-space: nowrap;
|
||||
}
|
||||
```
|
||||
|
||||
#### `sender-page.css` — Neues Layout (3-Bereich-Action-Bar)
|
||||
|
||||
```css
|
||||
.sender-branding { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
|
||||
.sender-subtitle { font-size: .72rem; color: #6b7280; font-weight: 400; }
|
||||
.sender-customer-logo-area { flex: 1; display: flex; justify-content: center; }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔲 Phase 6c — Grid: Fehlende Spalten + Persistence Hint
|
||||
|
||||
### Fehlende Spalten (aus Screenshot-Annotationen)
|
||||
|
||||
**Verfügbarkeit in `EnvelopeDto`:**
|
||||
- `EnvelopeTypeTitle` (string?) → `spalte für "Typ"` ✅
|
||||
- `AddedWhen` (DateTime) → `spalte für "erstellt"` ✅
|
||||
- `ChangedWhen` (DateTime?) → `Spalte "zuletzt geändert am"` ✅
|
||||
|
||||
> ⚠️ **Vor Implementierung prüfen:** `EnvelopeTypeTitle` wird aus dem Navigation Property `EnvelopeType` gemappt. Mapping-Konfiguration in `Application/...MappingProfile.cs` verifizieren.
|
||||
|
||||
#### `EnvelopeSenderPage.razor` — Neue Spalten (beide Grids)
|
||||
|
||||
```razor
|
||||
<DxGridDataColumn FieldName="EnvelopeTypeTitle" Caption="Typ"
|
||||
Width="120px" AllowSort="true" />
|
||||
<DxGridDataColumn FieldName="AddedWhen" Caption="Erstellt"
|
||||
DisplayFormat="{0:dd.MM.yyyy}" Width="110px" AllowSort="true" />
|
||||
<DxGridDataColumn FieldName="ChangedWhen" Caption="Geändert am"
|
||||
DisplayFormat="{0:dd.MM.yyyy}" Width="110px" AllowSort="true" />
|
||||
```
|
||||
|
||||
### Grid Persistence Hint
|
||||
|
||||
Info-Banner über dem Grid:
|
||||
|
||||
```razor
|
||||
<div class="sf-grid-persistence-hint">
|
||||
<svg><!-- info icon --></svg>
|
||||
Die Größe und Position der Spalten wird automatisch für Sie gespeichert.
|
||||
</div>
|
||||
```
|
||||
|
||||
```css
|
||||
.sf-grid-persistence-hint {
|
||||
display: flex; align-items: center; gap: 6px;
|
||||
padding: 5px 16px; font-size: 0.72rem;
|
||||
color: rgba(126, 34, 206, 0.7);
|
||||
background: rgba(126, 34, 206, 0.04);
|
||||
border-bottom: 1px solid rgba(126, 34, 206, 0.08);
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔲 Phase 6d — Dokument anzeigen (PDF Preview)
|
||||
|
||||
### Anforderung
|
||||
Ausgewähltes Envelope-Dokument im Popup anzeigen. Envelope ist nach dem Senden **read-only** (Mails wurden gesendet — nachträgliche Änderungen würden Konsistenz brechen).
|
||||
|
||||
### Technischer Ansatz
|
||||
|
||||
`DxPdfViewer` erfordert **zwingend `@rendermode InteractiveServer`**.
|
||||
`EnvelopeSenderPage` ist WASM (`@rendermode InteractiveWebAssembly`).
|
||||
|
||||
**Lösung:** `DxPopup` im WASM-Parent mit einem Server-Component darin:
|
||||
|
||||
```
|
||||
EnvelopeSenderPage.razor (@rendermode WASM)
|
||||
└── <DxPopup>
|
||||
└── <EnvelopePdfPreviewComponent @rendermode InteractiveServer>
|
||||
└── <DxPdfViewer> (SSR-only)
|
||||
```
|
||||
|
||||
#### `Server/Components/Shared/EnvelopePdfPreviewComponent.razor` — NEU
|
||||
|
||||
```razor
|
||||
@rendermode InteractiveServer
|
||||
@inject IDocumentService DocumentService <!-- oder HTTP client -->
|
||||
|
||||
<DxPdfViewer DocumentContent="@_pdfBytes" />
|
||||
|
||||
@code {
|
||||
[Parameter] public int EnvelopeId { get; set; }
|
||||
byte[]? _pdfBytes;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (EnvelopeId > 0)
|
||||
_pdfBytes = await DocumentService.GetPdfBytesAsync(EnvelopeId);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Button: nur aktiv wenn Envelope ausgewählt UND Dokument vorhanden (`envelope.Documents?.Any() == true`).
|
||||
|
||||
---
|
||||
|
||||
## 🔲 Phase 6e — Export nach Excel
|
||||
|
||||
### Technischer Ansatz
|
||||
|
||||
`DxGrid.ExportToXlsxAsync(fileName, options)` — direkt im Razor-Code, keine Backend-Implementierung nötig.
|
||||
Download geht direkt an den Browser.
|
||||
|
||||
```csharp
|
||||
async Task ExportToExcelAsync()
|
||||
{
|
||||
var grid = _activeTab == "active" ? _gridActive : _gridCompleted;
|
||||
if (grid is null) return;
|
||||
var fileName = $"Umschlaege_{DateTime.Now:yyyy-MM-dd}.xlsx";
|
||||
await grid.ExportToXlsxAsync(fileName, new GridXlExportOptions());
|
||||
}
|
||||
```
|
||||
|
||||
> **Hinweis:** `CellDisplayTemplate`-Inhalte werden nicht exportiert (DevExpress-Limitierung).
|
||||
> Die Spalten `Status`, `EnvelopeReceivers` nutzen Templates → Wert im Export ist leer.
|
||||
> **Future Task:** Für vollständigen Export mit formatierten Zellen `CustomizeCell`-Event nutzen.
|
||||
|
||||
Button in Toolbar:
|
||||
```razor
|
||||
<button class="sender-btn" @onclick="ExportToExcelAsync"
|
||||
title="Aktuelle Ansicht als Excel exportieren">
|
||||
<!-- Excel-Icon SVG -->
|
||||
Export nach Excel
|
||||
</button>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔲 Phase 6f — Action Bar Redesign
|
||||
|
||||
### Ziel-Layout (aus Screenshot)
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────────────────┐
|
||||
│ [Logo] Umschlag-Übersicht │ [Kunden-Logo] │ [+Neu] [Bearb.] [Lösch.] │
|
||||
│ signFLOW Portal-Übers│ │ [↺] [→|] │
|
||||
│ │ │ [Zurückrufen?] [Dok.] [XLS] │
|
||||
└──────────────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Neue CSS-Klassen in `sender-page.css`
|
||||
|
||||
```css
|
||||
.sender-toolbar-right { display: flex; flex-direction: column; gap: .35rem; align-items: flex-end; }
|
||||
.sender-toolbar-row { display: flex; align-items: center; gap: .5rem; }
|
||||
.sender-toolbar-row--primary { /* Hauptbuttons */ }
|
||||
.sender-toolbar-row--secondary { /* Dokument anzeigen, Export */ }
|
||||
```
|
||||
|
||||
### `Zurückrufen/löschen` — Offene Frage ❓
|
||||
|
||||
> **Ticket-Kommentar-Entwurf (Deutsch, für Marlon Schreiber):**
|
||||
>
|
||||
> Hallo @Marlon Schreiber,
|
||||
>
|
||||
> im Screenshot sehe ich einen Button „Zurückrufen/löschen". Könntest du den
|
||||
> Unterschied zum bereits vorhandenen „Löschen"-Button erläutern?
|
||||
>
|
||||
> Meine Vermutung: „Zurückrufen" bedeutet das Widerrufen eines **bereits gesendeten**
|
||||
> Umschlags (Status → `EnvelopeWithdrawn`), während „Löschen" einen noch nicht
|
||||
> gesendeten Umschlag entfernt. Ist das korrekt? Und falls ja:
|
||||
> - Sollen Empfänger bei einem Widerruf automatisch benachrichtigt werden?
|
||||
> - Soll der Status auf `Zurückgerufen` gesetzt werden und der Umschlag
|
||||
> weiterhin in der Liste erscheinen (aber inaktiv)?
|
||||
>
|
||||
> Bitte kurz antworten, damit ich dies korrekt implementieren kann.
|
||||
|
||||
---
|
||||
|
||||
## Implementierungsreihenfolge Phase 6
|
||||
|
||||
```
|
||||
6a (Logo) → 6b (Kunden-Logo) → 6c (Grid-Spalten) → 6d (PDF Preview) → 6e (Excel) → 6f (Action Bar)
|
||||
```
|
||||
|
||||
Jede Teilphase ist unabhängig deploybar. `6f` fasst alle Layout-Änderungen zusammen
|
||||
und sollte zuletzt implementiert werden, wenn alle Komponenten fertig sind.
|
||||
|
||||
---
|
||||
|
||||
## Bekannte Einschränkungen & Offene Punkte
|
||||
|
||||
| # | Thema | Status |
|
||||
|---|-------|--------|
|
||||
| 1 | `DxPdfViewer` → InteractiveServer zwingend | Architektonisch gelöst (6d) |
|
||||
| 2 | Excel-Export: Template-Spalten leer im Export | Akzeptiert, Future Task (CustomizeCell) |
|
||||
| 3 | `Zurückrufen/löschen` — Bedeutung unklar | Kommentar-Frage vorbereitet (6f) |
|
||||
| 4 | `EnvelopeTypeTitle` Mapping prüfen | Vor 6c verifizieren |
|
||||
| 5 | Logo-Pfade produktionsspezifisch | Via `appsettings.json` konfigurierbar |
|
||||
| 6 | Server-seitige Pages — inline Farben bleiben | Out-of-scope |
|
||||
|
||||
---
|
||||
|
||||
## Nicht in diesem Ticket
|
||||
|
||||
- `Einstellungen`-Seite (separates Ticket)
|
||||
- Mobile Responsive (separates Ticket)
|
||||
- Excel CustomizeCell vollständige Implementierung (Future Task)
|
||||
- Widerruf-Backend (wartet auf Klärung)
|
||||
|
||||
---
|
||||
|
||||
*Erstellt: 2026-09-01 | Aktualisiert: 2026-09-03 | Ticket: SF-74 | Projekt: signFLOW*
|
||||
120
EnvelopeGenerator.Server/publish.bat
Normal file
120
EnvelopeGenerator.Server/publish.bat
Normal file
@@ -0,0 +1,120 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
echo ============================================================
|
||||
echo EnvelopeGenerator.Server - Self-Contained Publish
|
||||
echo Target: win-x64 / .NET 8 / Release
|
||||
echo ============================================================
|
||||
echo.
|
||||
|
||||
REM Must be run from the solution root directory.
|
||||
REM This file is located under: EnvelopeGenerator.Server\
|
||||
|
||||
set PROJECT=%~dp0EnvelopeGenerator.Server\EnvelopeGenerator.Server.csproj
|
||||
set RID=win-x64
|
||||
set FRAMEWORK=net8.0
|
||||
|
||||
REM ── Resolve project version from .csproj ──────────────────────────────────────
|
||||
REM Reads the <Version> element directly from the .csproj XML using findstr.
|
||||
REM Example: <Version>1.1.0-beta</Version> → VERSION=1.1.0-beta
|
||||
REM 'tokens=2 delims=>' splits on '>' and takes the second token (the value+tag),
|
||||
REM then 'delims=<' strips the closing '<' tag leaving the bare version string.
|
||||
for /f "tokens=2 delims=>< " %%v in ('findstr /i "<Version>" "%PROJECT%"') do (
|
||||
set VERSION=%%v
|
||||
)
|
||||
|
||||
if "%VERSION%"=="" (
|
||||
echo [ERROR] Could not read ^<Version^> from %PROJECT%. Aborting.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM ── Output path: network share / versioned subfolder ──────────────────────────
|
||||
REM Format: M:\App&Service\0 DD - Smart UP\signFLOW\Server\net8\{version}
|
||||
REM Note: the '&' in the path is literal — no escaping needed inside a set "..." assignment.
|
||||
set "OUTPUT=M:\App&Service\0 DD - Smart UP\signFLOW\Server\net8\%VERSION%"
|
||||
|
||||
echo [0/3] Resolved build parameters
|
||||
echo Project : %PROJECT%
|
||||
echo Version : %VERSION%
|
||||
echo Output : %OUTPUT%
|
||||
echo RID : %RID%
|
||||
echo Framework: %FRAMEWORK%
|
||||
echo.
|
||||
|
||||
echo [1/3] Cleaning previous publish output...
|
||||
if exist "%OUTPUT%" (
|
||||
rmdir /s /q "%OUTPUT%"
|
||||
echo Removed: %OUTPUT%
|
||||
) else (
|
||||
echo Nothing to clean.
|
||||
)
|
||||
echo.
|
||||
|
||||
echo [2/3] Publishing...
|
||||
echo.
|
||||
|
||||
dotnet publish "%PROJECT%" ^
|
||||
-c Release ^
|
||||
-f %FRAMEWORK% ^
|
||||
--self-contained true ^
|
||||
--runtime %RID% ^
|
||||
-o "%OUTPUT%"
|
||||
|
||||
if %ERRORLEVEL% neq 0 (
|
||||
echo.
|
||||
echo [ERROR] Publish failed! ERRORLEVEL=%ERRORLEVEL%
|
||||
pause
|
||||
exit /b %ERRORLEVEL%
|
||||
)
|
||||
|
||||
echo.
|
||||
echo [3/3] Verifying output...
|
||||
|
||||
set PASS=1
|
||||
|
||||
if not exist "!OUTPUT!\EnvelopeGenerator.Server.exe" (
|
||||
echo [FAIL] EnvelopeGenerator.Server.exe not found!
|
||||
set PASS=0
|
||||
) else ( echo [OK] EnvelopeGenerator.Server.exe )
|
||||
if not exist "!OUTPUT!\hostfxr.dll" (
|
||||
echo [FAIL] hostfxr.dll not found! (Not a self-contained publish?)
|
||||
set PASS=0
|
||||
) else ( echo [OK] hostfxr.dll )
|
||||
if not exist "!OUTPUT!\coreclr.dll" (
|
||||
echo [FAIL] coreclr.dll not found! (Not a self-contained publish?)
|
||||
set PASS=0
|
||||
) else ( echo [OK] coreclr.dll )
|
||||
if not exist "!OUTPUT!\Microsoft.Extensions.DependencyInjection.Abstractions.dll" (
|
||||
echo [FAIL] Microsoft.Extensions.DependencyInjection.Abstractions.dll not found!
|
||||
set PASS=0
|
||||
) else ( echo [OK] Microsoft.Extensions.DependencyInjection.Abstractions.dll )
|
||||
if not exist "!OUTPUT!\web.config" (
|
||||
echo [FAIL] web.config not found!
|
||||
set PASS=0
|
||||
) else ( echo [OK] web.config )
|
||||
|
||||
if "!PASS!"=="1" (
|
||||
echo.
|
||||
echo ============================================================
|
||||
echo PUBLISH SUCCEEDED
|
||||
echo Version : !VERSION!
|
||||
echo Output folder: !OUTPUT!
|
||||
echo ============================================================
|
||||
echo.
|
||||
echo Next steps:
|
||||
echo 1. Copy the contents of the output folder to the IIS application directory
|
||||
echo 2. Set the IIS Application Pool to 'No Managed Code'
|
||||
echo 3. Recycle the Application Pool
|
||||
echo.
|
||||
) else (
|
||||
echo.
|
||||
echo ============================================================
|
||||
echo PUBLISH COMPLETED BUT VERIFICATION FAILED
|
||||
echo Review the FAIL messages above.
|
||||
echo ============================================================
|
||||
echo.
|
||||
)
|
||||
|
||||
pause
|
||||
endlocal
|
||||
41
EnvelopeGenerator.Service/EnvelopeGenerator.Service.csproj
Normal file
41
EnvelopeGenerator.Service/EnvelopeGenerator.Service.csproj
Normal file
@@ -0,0 +1,41 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Worker">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net4.6.2</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>dotnet-EnvelopeGenerator.Service-816256a4-c636-4313-92c0-b62b04040c2b</UserSecretsId>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" />
|
||||
<PackageReference Include="NLog" Version="5.3.1" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.9" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- DigitalData & Quartz: local packages, must match CommonServices versions exactly -->
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Database">
|
||||
<HintPath>..\packages\DigitalData.Modules.Database.2.3.5.4\lib\net462\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Encryption">
|
||||
<HintPath>..\packages\DigitalData.Modules.Encryption.1.3.1\lib\net462\DigitalData.Modules.Encryption.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging">
|
||||
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<!-- Quartz 3.8.0 <20> must match CommonServices (same AppDomain, one version) -->
|
||||
<Reference Include="Quartz">
|
||||
<HintPath>..\packages\Quartz.3.8.0\lib\net462\Quartz.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EnvelopeGenerator.CommonServices\EnvelopeGenerator.CommonServices.vbproj" />
|
||||
<ProjectReference Include="..\EnvelopeGenerator.Domain\EnvelopeGenerator.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
28
EnvelopeGenerator.Service/LogConfigFactory.cs
Normal file
28
EnvelopeGenerator.Service/LogConfigFactory.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using DigitalData.Modules.Logging;
|
||||
|
||||
namespace EnvelopeGenerator.Service;
|
||||
|
||||
/// <summary>
|
||||
/// Builds a <see cref="LogConfig"/> from <see cref="ServiceConfig"/>.
|
||||
/// Required because CommonServices jobs have a hard dependency on <see cref="LogConfig"/>
|
||||
/// in their Quartz <c>JobDataMap</c>.
|
||||
/// Log path mirrors the legacy behavior: <c><BaseDirectory>\Log</c>.
|
||||
/// </summary>
|
||||
internal static class LogConfigFactory
|
||||
{
|
||||
public static LogConfig Create(ServiceConfig config)
|
||||
{
|
||||
var logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log");
|
||||
|
||||
var logConfig = new LogConfig(
|
||||
LogConfig.PathType.CustomPath,
|
||||
logPath,
|
||||
null,
|
||||
"Digital Data",
|
||||
"EnvelopeGenerator.Service");
|
||||
|
||||
logConfig.Debug = config.Debug;
|
||||
|
||||
return logConfig;
|
||||
}
|
||||
}
|
||||
315
EnvelopeGenerator.Service/MIGRATION_PLAN.md
Normal file
315
EnvelopeGenerator.Service/MIGRATION_PLAN.md
Normal file
@@ -0,0 +1,315 @@
|
||||
# Migration Plan: EnvelopeGenerator.Service_legacy ? EnvelopeGenerator.Service
|
||||
**Revision v3** — Full deep analysis complete
|
||||
|
||||
## Overview
|
||||
|
||||
Migrate the legacy VB.NET Windows Service (`EnvelopeGenerator.Service_legacy`) to a modern
|
||||
C# Worker Service (`EnvelopeGenerator.Service`) targeting **.NET Framework 4.6.2**, using
|
||||
`Microsoft.Extensions.Hosting`, `IConfiguration`, `ILogger<T>` and **NLog**.
|
||||
|
||||
---
|
||||
|
||||
## Deep Analysis Findings (vs. v1/v2)
|
||||
|
||||
### Finding 1 — Connection String: Plain Text, No Encryption Required
|
||||
`FinalizeDocumentJob` and `APIEnvelopeJob` call `MSSQLServer.DecryptConnectionString()` on the
|
||||
`JobDataMap[Value.DATABASE]` value. However, `MSSQLServer.DecryptConnectionString()` is a pass-through
|
||||
for plain-text strings — no wrapping/encryption step is needed.
|
||||
|
||||
**Resolution**: The connection string is read from `IConfiguration` via the standard
|
||||
`ConnectionStrings:Default` key (same key as `appsettings.Database.json` in `EnvelopeGenerator.Web`).
|
||||
It is passed **as-is** to both the Worker-level `MSSQLServer` and the `JobDataMap`. No
|
||||
`EncryptConnectionString()` call is made anywhere in the new service.
|
||||
|
||||
### Finding 2 — Dual TempFiles Architecture
|
||||
There are **two independent** `TempFiles` classes:
|
||||
- `EnvelopeGenerator.CommonServices.TempFiles` — used **inside each job** via `New TempFiles(LogConfig)`.
|
||||
This is called on every job execution and manages the job's own temp lifecycle. It expects `LogConfig`.
|
||||
**We do not touch this.**
|
||||
- `EnvelopeGenerator.Service_legacy.TempFiles` — used at the **service/host level** (startup cleanup,
|
||||
shutdown cleanup). This is the one we rewrite in C# in the Service project using `ILogger<TempFiles>`.
|
||||
|
||||
### Finding 3 — LogConfig is a Hard Dependency of All Jobs
|
||||
`FinalizeDocumentJob.Execute()` and `APIEnvelopeJob.Execute()` both do:
|
||||
```vb
|
||||
LogConfig = pContext.MergedJobDataMap.Item(Value.LOGCONFIG)
|
||||
Logger = LogConfig.GetLogger()
|
||||
myTempFiles = New TempFiles(LogConfig) ' ? CommonServices.TempFiles
|
||||
```
|
||||
`LogConfig` is **not optional**. The schedulers must construct a valid `LogConfig` and place it in the
|
||||
`JobDataMap`. It must carry the correct log path, debug flag, and application identity.
|
||||
|
||||
**Resolution**: A `LogConfigFactory` static helper class will be created in the Service project to
|
||||
build a `LogConfig` from `ServiceConfig` values:
|
||||
- `LogPath` = `Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log")` (mirrors legacy `My.Application.Info.DirectoryPath + "\Log"`)
|
||||
- `Debug` = `ServiceConfig.Debug`
|
||||
- Application name = `"EnvelopeGenerator.Service"`
|
||||
|
||||
### Finding 4 — ProjectInstaller is Obsolete
|
||||
`ProjectInstaller.vb` was the old `installutil.exe` mechanism for Windows Service registration.
|
||||
With `AddWindowsService()` + `sc create` / PowerShell `New-Service`, this is **completely replaced**.
|
||||
No equivalent is needed in the new project.
|
||||
|
||||
### Finding 5 — GDPicture License SQL
|
||||
The legacy service queries: `SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE' and ACTIVE = 1`
|
||||
This must be replicated exactly in the Worker startup sequence. If the result is null/empty, startup fails
|
||||
with a descriptive exception (matching legacy behavior).
|
||||
|
||||
### Finding 6 — Quartz Version Mismatch
|
||||
`CommonServices` uses `Quartz 3.8.0`. `Service_legacy` uses `Quartz 3.15.0`.
|
||||
The new `EnvelopeGenerator.Service` must use **Quartz 3.8.0** to match `CommonServices` (same AppDomain,
|
||||
same version must be loaded). The legacy version bump in `Service_legacy` was inconsistent.
|
||||
|
||||
---
|
||||
|
||||
## 1. Project File (`EnvelopeGenerator.Service.csproj`)
|
||||
|
||||
- Add **NuGet packages**:
|
||||
- `NLog` (5.x, matching CommonServices' `NLog.5.0.5`)
|
||||
- `NLog.Extensions.Logging` (latest net462-compatible)
|
||||
- `Quartz` (**3.8.0** — must match CommonServices)
|
||||
- `Microsoft.Extensions.Hosting.WindowsServices` (for `AddWindowsService()`)
|
||||
- Add **project reference** to `EnvelopeGenerator.CommonServices` (vbproj)
|
||||
- Add **project reference** to `EnvelopeGenerator.Domain` (csproj)
|
||||
|
||||
---
|
||||
|
||||
## 2. Configuration (`ServiceConfig.cs`)
|
||||
|
||||
```csharp
|
||||
public class ServiceConfig
|
||||
{
|
||||
public string ConnectionString { get; set; } = string.Empty;
|
||||
public bool Debug { get; set; } = false;
|
||||
public int IntervalInMin { get; set; } = 1;
|
||||
public PDFBurnerParams PDFBurnerParams { get; set; } = new PDFBurnerParams();
|
||||
}
|
||||
```
|
||||
|
||||
Connection string is read via the standard `ConnectionStrings:Default` key — consistent with
|
||||
`appsettings.Database.json` used by `EnvelopeGenerator.Web`:
|
||||
|
||||
`appsettings.json`:
|
||||
```json
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"Default": ""
|
||||
},
|
||||
"ServiceConfig": {
|
||||
"Debug": false,
|
||||
"IntervalInMin": 1,
|
||||
"PDFBurnerParams": {
|
||||
"IgnoredLabels": [ "Date", "Datum", "ZIP", "PLZ", "Place", "Ort", "Position", "Stellung" ],
|
||||
"TopMargin": 0.1,
|
||||
"YOffset": -0.3,
|
||||
"FontName": "Arial",
|
||||
"FontSize": 8,
|
||||
"FontStyle": 2,
|
||||
"TruncationSuffix": "..",
|
||||
"TextMaxWidths": {
|
||||
"position": 1.41,
|
||||
"city": 1.41,
|
||||
"date": 2.0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> `FontStyle` integer: Regular=0, Bold=1, **Italic=2**, Underline=4, Strikeout=8.
|
||||
> All values mirror `PDFBurnerParams.vb` defaults exactly.
|
||||
|
||||
---
|
||||
|
||||
## 3. NLog Setup
|
||||
|
||||
**`nlog.config`**: File target ? `${basedir}/Log/service-${shortdate}.log`, async wrapper,
|
||||
layout with timestamp + level + logger + message + exception.
|
||||
|
||||
**`Program.cs`**: Wire via `NLog.Extensions.Logging`:
|
||||
```csharp
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Logging.AddNLog("nlog.config");
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. LogConfigFactory (`LogConfigFactory.cs`)
|
||||
|
||||
New static helper — bridges `ServiceConfig` ? `LogConfig` (required by CommonServices jobs):
|
||||
|
||||
```csharp
|
||||
internal static class LogConfigFactory
|
||||
{
|
||||
public static LogConfig Create(ServiceConfig config)
|
||||
{
|
||||
var logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log");
|
||||
var logConfig = new LogConfig(
|
||||
LogConfig.PathType.CustomPath, logPath, null,
|
||||
"Digital Data", "EnvelopeGenerator.Service");
|
||||
logConfig.Debug = config.Debug;
|
||||
return logConfig;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This `LogConfig` instance is what gets placed into every `JobDataMap[Value.LOGCONFIG]`.
|
||||
|
||||
---
|
||||
|
||||
## 5. Quartz LogProvider (`QuartzLogProvider.cs`)
|
||||
|
||||
C# rewrite of `LogProvider.vb` — bridges Quartz `ILogProvider` ? `ILogger<T>`:
|
||||
|
||||
```csharp
|
||||
internal class QuartzLogProvider : ILogProvider
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
public QuartzLogProvider(ILogger logger) => _logger = logger;
|
||||
public Logger GetLogger(string name) => (level, func, ex, parameters) => { ... };
|
||||
// OpenNestedContext / OpenMappedContext ? NotImplementedException (same as legacy)
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. TempFiles (`TempFiles.cs`) — Service-level only
|
||||
|
||||
Service-level rewrite of `Service_legacy/TempFiles.vb` using `ILogger<TempFiles>`:
|
||||
- `Create()` ? create `%TEMP%\EnvelopeGenerator`, or clean existing files
|
||||
- `CleanUp()` ? delete the directory on service stop
|
||||
|
||||
> **Does NOT replace** `CommonServices.TempFiles` — that one continues to be used
|
||||
> inside each job via `LogConfig`.
|
||||
|
||||
---
|
||||
|
||||
## 7. Schedulers
|
||||
|
||||
### `Schedulers/SchedulerFinishEnvelope.cs`
|
||||
|
||||
```csharp
|
||||
public class SchedulerFinishEnvelope
|
||||
{
|
||||
// Constructor: ILogger<SchedulerFinishEnvelope>, IOptions<ServiceConfig>
|
||||
// Start(licenseKey, logConfig):
|
||||
// - Build JobDataMap:
|
||||
// [GDPICTURE] = licenseKey
|
||||
// [LOGCONFIG] = logConfig ? LogConfigFactory output
|
||||
// [DATABASE] = MSSQLServer.EncryptConnectionString(connectionString)
|
||||
// [PDF_BURNER_PARAMS] = config.PDFBurnerParams
|
||||
// - Schedule FinalizeDocumentJob with Quartz (interval from config)
|
||||
// - Register QuartzLogProvider
|
||||
// Stop(): Scheduler.Shutdown()
|
||||
}
|
||||
```
|
||||
|
||||
### `Schedulers/SchedulerEnvelopeTaskApi.cs`
|
||||
|
||||
```csharp
|
||||
public class SchedulerEnvelopeTaskApi
|
||||
{
|
||||
// Constructor: ILogger<SchedulerEnvelopeTaskApi>, IOptions<ServiceConfig>
|
||||
// Start(logConfig):
|
||||
// - Build JobDataMap:
|
||||
// [LOGCONFIG] = logConfig
|
||||
// [DATABASE] = MSSQLServer.EncryptConnectionString(connectionString)
|
||||
// - Schedule APIEnvelopeJob with Quartz (interval from config)
|
||||
// - Register QuartzLogProvider
|
||||
// Stop(): Scheduler.Shutdown()
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 8. Worker (`Worker.cs`)
|
||||
|
||||
Full lifecycle replacing the placeholder:
|
||||
|
||||
```
|
||||
ExecuteAsync:
|
||||
1. Read ServiceConfig from IOptions<ServiceConfig>
|
||||
2. Validate ConnectionString ? throw if empty
|
||||
3. Build LogConfig via LogConfigFactory
|
||||
4. Connect to DB (plain connection string — Worker-level only)
|
||||
5. Query: SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME='GDPICTURE' AND ACTIVE=1
|
||||
? throw if null/empty (matches legacy behavior)
|
||||
6. TempFiles.Create()
|
||||
7. await SchedulerFinishEnvelope.Start(licenseKey, logConfig)
|
||||
8. await Task.Delay(2500, stoppingToken) ? preserved from legacy
|
||||
9. await SchedulerEnvelopeTaskApi.Start(logConfig)
|
||||
10. await Task.Delay(Timeout.Infinite, stoppingToken) ? wait for cancellation
|
||||
|
||||
StopAsync override:
|
||||
11. await SchedulerFinishEnvelope.Stop()
|
||||
12. await SchedulerEnvelopeTaskApi.Stop()
|
||||
13. TempFiles.CleanUp()
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 9. Program.cs
|
||||
|
||||
```csharp
|
||||
var builder = Host.CreateApplicationBuilder(args);
|
||||
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Logging.AddNLog("nlog.config");
|
||||
|
||||
builder.Services.Configure<ServiceConfig>(
|
||||
builder.Configuration.GetSection("ServiceConfig"));
|
||||
|
||||
builder.Services.AddSingleton<TempFiles>();
|
||||
builder.Services.AddSingleton<SchedulerFinishEnvelope>();
|
||||
builder.Services.AddSingleton<SchedulerEnvelopeTaskApi>();
|
||||
builder.Services.AddHostedService<Worker>();
|
||||
builder.Services.AddWindowsService(o => o.ServiceName = "EnvelopeGenerator.Service");
|
||||
|
||||
var host = builder.Build();
|
||||
host.Run();
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 10. Files to Create / Modify
|
||||
|
||||
| File | Action | Notes |
|
||||
|------|--------|-------|
|
||||
| `EnvelopeGenerator.Service.csproj` | **Modify** | Add packages, project refs |
|
||||
| `Program.cs` | **Modify** | Full DI/NLog/WindowsService setup |
|
||||
| `Worker.cs` | **Modify** | Full service lifecycle |
|
||||
| `ServiceConfig.cs` | **Create** | |
|
||||
| `LogConfigFactory.cs` | **Create** | Critical bridge: ServiceConfig ? LogConfig |
|
||||
| `TempFiles.cs` | **Create** | Service-level only; CommonServices.TempFiles untouched |
|
||||
| `QuartzLogProvider.cs` | **Create** | |
|
||||
| `Schedulers/SchedulerFinishEnvelope.cs` | **Create** | |
|
||||
| `Schedulers/SchedulerEnvelopeTaskApi.cs` | **Create** | |
|
||||
| `appsettings.json` | **Create** | All PDFBurnerParams explicit |
|
||||
| `nlog.config` | **Create** | |
|
||||
|
||||
**Not created** (obsolete in new architecture):
|
||||
- ~~`ProjectInstaller`~~ ? replaced by `sc create` / `New-Service`
|
||||
- ~~`Service.Designer.vb`~~ ? BackgroundService handles this
|
||||
- ~~`Service.resx`~~ ? not applicable
|
||||
|
||||
---
|
||||
|
||||
## 11. Key Design Decisions
|
||||
|
||||
| Decision | Rationale |
|
||||
|----------|-----------|
|
||||
| **Quartz 3.8.0** (not 3.15.0) | Must match CommonServices; same AppDomain, one version |
|
||||
| **Connection string plain-text, no encryption** | `MSSQLServer.DecryptConnectionString()` is a pass-through for plain strings; `ConnectionStrings:Default` key used (same convention as Web project) |
|
||||
| **Connection string in `ConnectionStrings:Default`** | Consistent with rest of the solution (`appsettings.Database.json`); `ServiceConfig` holds only service-specific settings |
|
||||
| **LogConfigFactory** | Jobs have hard dependency on `LogConfig` in JobDataMap; this is the clean bridge without leaking LogConfig into the DI container |
|
||||
| **2500ms delay preserved** | Legacy behavior; ensures Scheduler1 is fully initialized before Scheduler2 starts |
|
||||
| **`AddWindowsService()`** | Native SCM integration; replaces ProjectInstaller/installutil entirely |
|
||||
| **NLog log path = BaseDirectory/Log** | Mirrors `My.Application.Info.DirectoryPath + "\Log"` from legacy |
|
||||
| **CommonServices.TempFiles untouched** | Jobs create their own TempFiles internally via LogConfig; service-level TempFiles is separate concern |
|
||||
|
||||
---
|
||||
|
||||
## Approval Required
|
||||
|
||||
> Please review this plan and confirm before implementation begins.
|
||||
|
||||
41
EnvelopeGenerator.Service/Program.cs
Normal file
41
EnvelopeGenerator.Service/Program.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using EnvelopeGenerator.Service;
|
||||
using EnvelopeGenerator.Service.Schedulers;
|
||||
using Microsoft.Extensions.Options;
|
||||
using NLog.Extensions.Logging;
|
||||
|
||||
var builder = Host.CreateApplicationBuilder(args);
|
||||
|
||||
// NLog
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Logging.AddNLog("nlog.config");
|
||||
|
||||
// Configuration
|
||||
builder.Services.Configure<ServiceConfig>(
|
||||
builder.Configuration.GetSection("ServiceConfig"));
|
||||
|
||||
// Resolve connection string once for singleton registrations
|
||||
var connectionString = builder.Configuration.GetConnectionString("Default")
|
||||
?? throw new InvalidOperationException("ConnectionStrings:Default is not configured.");
|
||||
|
||||
// Services
|
||||
builder.Services.AddSingleton<TempFiles>();
|
||||
|
||||
builder.Services.AddSingleton<SchedulerFinishEnvelope>(sp => new SchedulerFinishEnvelope(
|
||||
sp.GetRequiredService<ILogger<SchedulerFinishEnvelope>>(),
|
||||
sp.GetRequiredService<IOptions<ServiceConfig>>(),
|
||||
connectionString));
|
||||
|
||||
builder.Services.AddSingleton<SchedulerEnvelopeTaskApi>(sp => new SchedulerEnvelopeTaskApi(
|
||||
sp.GetRequiredService<ILogger<SchedulerEnvelopeTaskApi>>(),
|
||||
sp.GetRequiredService<IOptions<ServiceConfig>>(),
|
||||
connectionString));
|
||||
|
||||
builder.Services.AddHostedService<Worker>();
|
||||
|
||||
// Windows Service (SCM) support — replaces legacy ProjectInstaller/installutil
|
||||
builder.Services.AddWindowsService(options =>
|
||||
options.ServiceName = "EnvelopeGenerator.Service");
|
||||
|
||||
var host = builder.Build();
|
||||
host.Run();
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>bin\Release\net4.6.2\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
12
EnvelopeGenerator.Service/Properties/launchSettings.json
Normal file
12
EnvelopeGenerator.Service/Properties/launchSettings.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"EnvelopeGenerator.Service": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"environmentVariables": {
|
||||
"DOTNET_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
60
EnvelopeGenerator.Service/QuartzLogProvider.cs
Normal file
60
EnvelopeGenerator.Service/QuartzLogProvider.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using Quartz.Logging;
|
||||
using QuartzLogLevel = Quartz.Logging.LogLevel;
|
||||
|
||||
namespace EnvelopeGenerator.Service;
|
||||
|
||||
/// <summary>
|
||||
/// Bridges Quartz's <see cref="ILogProvider"/> to <see cref="ILogger"/>.
|
||||
/// Mirrors the legacy <c>LogProvider.vb</c> behavior.
|
||||
/// <c>OpenNestedContext</c> and <c>OpenMappedContext</c> are not implemented (same as legacy).
|
||||
/// </summary>
|
||||
internal sealed class QuartzLogProvider : ILogProvider
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public QuartzLogProvider(ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Logger GetLogger(string name)
|
||||
{
|
||||
return (level, func, exception, parameters) =>
|
||||
{
|
||||
if (exception != null)
|
||||
{
|
||||
_logger.LogError(exception, exception.Message);
|
||||
}
|
||||
else if (func != null)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case QuartzLogLevel.Trace:
|
||||
case QuartzLogLevel.Debug:
|
||||
if (_logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug))
|
||||
_logger.LogDebug(func(), parameters);
|
||||
break;
|
||||
case QuartzLogLevel.Info:
|
||||
if (_logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Information))
|
||||
_logger.LogInformation(func(), parameters);
|
||||
break;
|
||||
case QuartzLogLevel.Warn:
|
||||
if (_logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Warning))
|
||||
_logger.LogWarning(func(), parameters);
|
||||
break;
|
||||
case QuartzLogLevel.Error:
|
||||
case QuartzLogLevel.Fatal:
|
||||
if (_logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error))
|
||||
_logger.LogError(func(), parameters);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
public IDisposable OpenNestedContext(string message) => throw new NotImplementedException();
|
||||
|
||||
public IDisposable OpenMappedContext(string key, object value, bool destructure = false) => throw new NotImplementedException();
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using System.Collections.Specialized;
|
||||
using DigitalData.Modules.Logging;
|
||||
using EnvelopeGenerator.CommonServices.Jobs;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Quartz;
|
||||
using Quartz.Logging;
|
||||
|
||||
namespace EnvelopeGenerator.Service.Schedulers;
|
||||
|
||||
/// <summary>
|
||||
/// Schedules <see cref="APIEnvelopeJob"/> via Quartz.
|
||||
/// C# rewrite of the legacy <c>Scheduler_Envelopetask_API.vb</c>.
|
||||
/// </summary>
|
||||
public sealed class SchedulerEnvelopeTaskApi
|
||||
{
|
||||
private readonly ILogger<SchedulerEnvelopeTaskApi> _logger;
|
||||
private readonly ServiceConfig _config;
|
||||
private readonly string _connectionString;
|
||||
|
||||
private IScheduler? _scheduler;
|
||||
|
||||
private const string JobName = "SendInvitationMailsAPI";
|
||||
|
||||
public SchedulerEnvelopeTaskApi(
|
||||
ILogger<SchedulerEnvelopeTaskApi> logger,
|
||||
IOptions<ServiceConfig> config,
|
||||
string connectionString)
|
||||
{
|
||||
_logger = logger;
|
||||
_config = config.Value;
|
||||
_connectionString = connectionString;
|
||||
}
|
||||
|
||||
public async Task Start(LogConfig logConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogDebug("Starting SchedulerEnvelopeTaskApi...");
|
||||
|
||||
LogProvider.SetCurrentLogProvider(new QuartzLogProvider(_logger));
|
||||
|
||||
_scheduler = await SchedulerBuilder
|
||||
.Create(new NameValueCollection())
|
||||
.UseDefaultThreadPool(x => x.MaxConcurrency = 5)
|
||||
.BuildScheduler();
|
||||
|
||||
var jobKey = new JobKey(JobName);
|
||||
|
||||
var jobData = new JobDataMap
|
||||
{
|
||||
{ Value.LOGCONFIG, logConfig },
|
||||
{ Value.DATABASE, _connectionString }
|
||||
};
|
||||
|
||||
_logger.LogDebug("Initialized Job [{JobName}]", JobName);
|
||||
|
||||
var job = JobBuilder.Create<APIEnvelopeJob>()
|
||||
.UsingJobData(jobData)
|
||||
.WithIdentity(jobKey)
|
||||
.Build();
|
||||
|
||||
var trigger = TriggerBuilder.Create()
|
||||
.ForJob(jobKey)
|
||||
.WithIdentity($"{JobName}-trigger")
|
||||
.WithSimpleSchedule(s => s
|
||||
.RepeatForever()
|
||||
.WithIntervalInMinutes(_config.IntervalInMin))
|
||||
.StartNow()
|
||||
.Build();
|
||||
|
||||
_logger.LogDebug("{JobName}-trigger initialized", JobName);
|
||||
|
||||
await _scheduler.ScheduleJob(job, trigger);
|
||||
_logger.LogDebug("{JobName} scheduled", JobName);
|
||||
|
||||
await _scheduler.Start();
|
||||
_logger.LogInformation("{JobName} started", JobName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "SchedulerEnvelopeTaskApi failed to start");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task Stop()
|
||||
{
|
||||
if (_scheduler is null) return;
|
||||
_logger.LogInformation("Stopping SchedulerEnvelopeTaskApi...");
|
||||
await _scheduler.Shutdown();
|
||||
_logger.LogInformation("SchedulerEnvelopeTaskApi stopped!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using System.Collections.Specialized;
|
||||
using DigitalData.Modules.Logging;
|
||||
using EnvelopeGenerator.CommonServices.Jobs;
|
||||
using EnvelopeGenerator.CommonServices.Jobs.FinalizeDocument;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Quartz;
|
||||
using Quartz.Logging;
|
||||
|
||||
namespace EnvelopeGenerator.Service.Schedulers;
|
||||
|
||||
/// <summary>
|
||||
/// Schedules <see cref="FinalizeDocumentJob"/> via Quartz.
|
||||
/// C# rewrite of the legacy <c>Scheduler_FinishEnvelope.vb</c>.
|
||||
/// </summary>
|
||||
public sealed class SchedulerFinishEnvelope
|
||||
{
|
||||
private readonly ILogger<SchedulerFinishEnvelope> _logger;
|
||||
private readonly ServiceConfig _config;
|
||||
private readonly string _connectionString;
|
||||
|
||||
private IScheduler? _scheduler;
|
||||
|
||||
private const string JobName = "CertificateDocumentJob";
|
||||
|
||||
public SchedulerFinishEnvelope(
|
||||
ILogger<SchedulerFinishEnvelope> logger,
|
||||
IOptions<ServiceConfig> config,
|
||||
string connectionString)
|
||||
{
|
||||
_logger = logger;
|
||||
_config = config.Value;
|
||||
_connectionString = connectionString;
|
||||
}
|
||||
|
||||
public async Task Start(string licenseKey, LogConfig logConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogDebug("Starting SchedulerFinishEnvelope...");
|
||||
|
||||
LogProvider.SetCurrentLogProvider(new QuartzLogProvider(_logger));
|
||||
|
||||
_scheduler = await SchedulerBuilder
|
||||
.Create(new NameValueCollection())
|
||||
.UseDefaultThreadPool(x => x.MaxConcurrency = 5)
|
||||
.BuildScheduler();
|
||||
|
||||
var jobKey = new JobKey(JobName);
|
||||
|
||||
var jobData = new JobDataMap
|
||||
{
|
||||
{ Value.GDPICTURE, licenseKey },
|
||||
{ Value.LOGCONFIG, logConfig },
|
||||
{ Value.DATABASE, _connectionString },
|
||||
{ Value.PDF_BURNER_PARAMS, _config.PDFBurnerParams }
|
||||
};
|
||||
|
||||
_logger.LogDebug("Initialized Job [{JobName}]", JobName);
|
||||
|
||||
var job = JobBuilder.Create<FinalizeDocumentJob>()
|
||||
.UsingJobData(jobData)
|
||||
.WithIdentity(jobKey)
|
||||
.Build();
|
||||
|
||||
var trigger = TriggerBuilder.Create()
|
||||
.ForJob(jobKey)
|
||||
.WithIdentity($"{JobName}-trigger")
|
||||
.WithSimpleSchedule(s => s
|
||||
.RepeatForever()
|
||||
.WithIntervalInMinutes(_config.IntervalInMin))
|
||||
.StartNow()
|
||||
.Build();
|
||||
|
||||
_logger.LogDebug("Initialized Trigger");
|
||||
|
||||
await _scheduler.ScheduleJob(job, trigger);
|
||||
_logger.LogDebug("Job scheduled.");
|
||||
|
||||
await _scheduler.Start();
|
||||
_logger.LogDebug("Scheduler started!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "SchedulerFinishEnvelope failed to start");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task Stop()
|
||||
{
|
||||
if (_scheduler is null) return;
|
||||
_logger.LogInformation("Stopping SchedulerFinishEnvelope...");
|
||||
await _scheduler.Shutdown();
|
||||
_logger.LogInformation("SchedulerFinishEnvelope stopped!");
|
||||
}
|
||||
}
|
||||
14
EnvelopeGenerator.Service/ServiceConfig.cs
Normal file
14
EnvelopeGenerator.Service/ServiceConfig.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using EnvelopeGenerator.CommonServices.Jobs.FinalizeDocument;
|
||||
|
||||
namespace EnvelopeGenerator.Service;
|
||||
|
||||
/// <summary>
|
||||
/// Service-level configuration bound from the "ServiceConfig" section of appsettings.json.
|
||||
/// Connection string is read separately via the standard "ConnectionStrings:Default" key.
|
||||
/// </summary>
|
||||
public class ServiceConfig
|
||||
{
|
||||
public bool Debug { get; set; } = false;
|
||||
public int IntervalInMin { get; set; } = 1;
|
||||
public PDFBurnerParams PDFBurnerParams { get; set; } = new PDFBurnerParams();
|
||||
}
|
||||
75
EnvelopeGenerator.Service/TempFiles.cs
Normal file
75
EnvelopeGenerator.Service/TempFiles.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
namespace EnvelopeGenerator.Service;
|
||||
|
||||
/// <summary>
|
||||
/// Service-level temp file management. Mirrors <c>TempFiles.vb</c> from the legacy project.
|
||||
/// Manages <c>%TEMP%\EnvelopeGenerator</c> at host startup and shutdown.
|
||||
///
|
||||
/// NOTE: This is independent from <c>EnvelopeGenerator.CommonServices.TempFiles</c>, which is
|
||||
/// instantiated inside each Quartz job via <see cref="DigitalData.Modules.Logging.LogConfig"/>.
|
||||
/// Do not confuse the two.
|
||||
/// </summary>
|
||||
public sealed class TempFiles
|
||||
{
|
||||
private readonly ILogger<TempFiles> _logger;
|
||||
|
||||
public string TempPath { get; }
|
||||
|
||||
public TempFiles(ILogger<TempFiles> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
TempPath = Path.Combine(Path.GetTempPath(), "EnvelopeGenerator");
|
||||
}
|
||||
|
||||
public bool Create()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(TempPath))
|
||||
{
|
||||
Directory.CreateDirectory(TempPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
CleanUpFiles();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to create temp directory: {TempPath}", TempPath);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void CleanUpFiles()
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var file in Directory.GetFiles(TempPath))
|
||||
{
|
||||
_logger.LogDebug("Deleting temp file: {File}", file);
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to clean up temp files in: {TempPath}", TempPath);
|
||||
}
|
||||
}
|
||||
|
||||
public bool CleanUp()
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogDebug("Deleting temp directory: {TempPath}", TempPath);
|
||||
Directory.Delete(TempPath, recursive: true);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to delete temp directory: {TempPath}", TempPath);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
111
EnvelopeGenerator.Service/Worker.cs
Normal file
111
EnvelopeGenerator.Service/Worker.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using DigitalData.Modules.Database;
|
||||
using EnvelopeGenerator.Service.Schedulers;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace EnvelopeGenerator.Service;
|
||||
|
||||
public sealed class Worker : BackgroundService
|
||||
{
|
||||
private readonly ILogger<Worker> _logger;
|
||||
private readonly ServiceConfig _config;
|
||||
private readonly string _connectionString;
|
||||
private readonly TempFiles _tempFiles;
|
||||
private readonly SchedulerFinishEnvelope _schedulerFinishEnvelope;
|
||||
private readonly SchedulerEnvelopeTaskApi _schedulerEnvelopeTaskApi;
|
||||
|
||||
public Worker(
|
||||
ILogger<Worker> logger,
|
||||
IOptions<ServiceConfig> config,
|
||||
IConfiguration configuration,
|
||||
TempFiles tempFiles,
|
||||
SchedulerFinishEnvelope schedulerFinishEnvelope,
|
||||
SchedulerEnvelopeTaskApi schedulerEnvelopeTaskApi)
|
||||
{
|
||||
_logger = logger;
|
||||
_config = config.Value;
|
||||
_connectionString = configuration.GetConnectionString("Default")
|
||||
?? throw new InvalidOperationException("ConnectionStrings:Default is not configured.");
|
||||
_tempFiles = tempFiles;
|
||||
_schedulerFinishEnvelope = schedulerFinishEnvelope;
|
||||
_schedulerEnvelopeTaskApi = schedulerEnvelopeTaskApi;
|
||||
}
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("EnvelopeGenerator.Service starting...");
|
||||
|
||||
// 1. Validate connection string
|
||||
if (string.IsNullOrWhiteSpace(_connectionString))
|
||||
throw new InvalidOperationException("Connection string is empty!");
|
||||
|
||||
// 2. Build LogConfig (required by CommonServices jobs via JobDataMap)
|
||||
var logConfig = LogConfigFactory.Create(_config);
|
||||
_logger.LogInformation("DEBUG = {Debug}", _config.Debug);
|
||||
|
||||
// 3. Connect to DB and load GDPicture license
|
||||
_logger.LogDebug("Initializing Database...");
|
||||
var database = new MSSQLServer(logConfig, _connectionString);
|
||||
|
||||
if (!database.DBInitialized)
|
||||
throw new InvalidOperationException("Database connection could not be established!");
|
||||
|
||||
_logger.LogDebug("Database initialized.");
|
||||
|
||||
var licenseKey = database.GetScalarValue(
|
||||
"SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE' AND ACTIVE = 1") as string;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(licenseKey))
|
||||
throw new InvalidOperationException("GDPicture license could not be loaded!");
|
||||
|
||||
_logger.LogDebug("GDPicture license loaded.");
|
||||
|
||||
// 4. Create service-level temp directory
|
||||
_tempFiles.Create();
|
||||
|
||||
// 5. Start FinalizeDocument scheduler
|
||||
_logger.LogDebug("Initializing schedulers...");
|
||||
await _schedulerFinishEnvelope.Start(licenseKey!, logConfig);
|
||||
|
||||
// 6. Delay between schedulers (legacy behavior preserved)
|
||||
await Task.Delay(2500, stoppingToken);
|
||||
|
||||
// 7. Start API envelope scheduler
|
||||
await _schedulerEnvelopeTaskApi.Start(logConfig);
|
||||
|
||||
_logger.LogInformation("EnvelopeGenerator.Service started!");
|
||||
|
||||
// 8. Wait for cancellation (service runs until stopped)
|
||||
await Task.Delay(Timeout.Infinite, stoppingToken);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// Normal shutdown <20> not an error
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "EnvelopeGenerator.Service encountered a fatal error during startup.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogInformation("EnvelopeGenerator.Service stopping...");
|
||||
|
||||
try
|
||||
{
|
||||
await _schedulerFinishEnvelope.Stop();
|
||||
await _schedulerEnvelopeTaskApi.Stop();
|
||||
_tempFiles.CleanUp();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error during service shutdown.");
|
||||
}
|
||||
|
||||
await base.StopAsync(cancellationToken);
|
||||
_logger.LogInformation("EnvelopeGenerator.Service stopped!");
|
||||
}
|
||||
}
|
||||
8
EnvelopeGenerator.Service/appsettings.Development.json
Normal file
8
EnvelopeGenerator.Service/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
}
|
||||
}
|
||||
24
EnvelopeGenerator.Service/appsettings.json
Normal file
24
EnvelopeGenerator.Service/appsettings.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"Default": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
||||
},
|
||||
"ServiceConfig": {
|
||||
"Debug": false,
|
||||
"IntervalInMin": 1,
|
||||
"PDFBurnerParams": {
|
||||
"IgnoredLabels": [ "Date", "Datum", "ZIP", "PLZ", "Place", "Ort", "Position", "Stellung" ],
|
||||
"TopMargin": 0.1,
|
||||
"YOffset": -0.3,
|
||||
"FontName": "Arial",
|
||||
"FontSize": 8,
|
||||
"FontStyle": 2,
|
||||
"TruncationSuffix": "..",
|
||||
"TextMaxWidths": {
|
||||
"position": 1.41,
|
||||
"city": 1.41,
|
||||
"date": 2.0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
20
EnvelopeGenerator.Service/nlog.config
Normal file
20
EnvelopeGenerator.Service/nlog.config
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
autoReload="true">
|
||||
|
||||
<targets async="true">
|
||||
<target xsi:type="File"
|
||||
name="file"
|
||||
fileName="${basedir}/Log/service-${shortdate}.log"
|
||||
layout="${longdate} | ${level:uppercase=true} | ${logger} | ${message}${onexception:${newline}${exception:format=tostring}}" />
|
||||
<target xsi:type="Console"
|
||||
name="console"
|
||||
layout="${longdate} | ${level:uppercase=true} | ${logger} | ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<logger name="*" minlevel="Debug" writeTo="file,console" />
|
||||
</rules>
|
||||
|
||||
</nlog>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user