Improve signature UI and refactor ReportViewer.razor
Updated the signature button text and SVG icon for clarity. Enhanced the `DxPopup` component with better interaction properties (`CloseOnEscape` and `CloseOnOutsideClick`). Disabled the "Close" button in the popup when no signature is captured. Reformatted and restructured constants and fields in the `@code` block for readability. Reintroduced previously removed fields, constants, and methods to ensure functionality. Added a conditional block in `LogoutAsync` to open the signature popup when the user has access. Performed general cleanup and code reorganization to improve maintainability.
This commit is contained in:
@@ -54,7 +54,7 @@
|
|||||||
</svg>
|
</svg>
|
||||||
<span>Unterschrift gespeichert</span>
|
<span>Unterschrift gespeichert</span>
|
||||||
} else {
|
} else {
|
||||||
<span>Unterschrift erstellen</span>
|
<span>Unterschrift ändern</span>
|
||||||
}
|
}
|
||||||
</button>
|
</button>
|
||||||
@if (_annotations.Count > 0) {
|
@if (_annotations.Count > 0) {
|
||||||
@@ -91,11 +91,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DxPopup @bind-Visible="SignaturePopupVisible"
|
<DxPopup @bind-Visible="SignaturePopupVisible"
|
||||||
HeaderText="Unterschrift erfassen"
|
HeaderText="Unterschrift erfassen"
|
||||||
Width="620px"
|
Width="620px"
|
||||||
ShowFooter="true"
|
ShowFooter="true"
|
||||||
CloseOnEscape="true"
|
CloseOnEscape="true"
|
||||||
CloseOnOutsideClick="false">
|
CloseOnOutsideClick="false">
|
||||||
<BodyContentTemplate>
|
<BodyContentTemplate>
|
||||||
<ul class="nav nav-tabs mb-3">
|
<ul class="nav nav-tabs mb-3">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
@@ -160,7 +160,7 @@
|
|||||||
<div class="d-flex gap-2 flex-wrap justify-content-end w-100">
|
<div class="d-flex gap-2 flex-wrap justify-content-end w-100">
|
||||||
<button class="btn btn-outline-secondary" @onclick="RenewSignatureAsync">Unterschrift erneuern</button>
|
<button class="btn btn-outline-secondary" @onclick="RenewSignatureAsync">Unterschrift erneuern</button>
|
||||||
<button class="btn btn-primary" @onclick="SaveSignatureAsync">Speichern</button>
|
<button class="btn btn-primary" @onclick="SaveSignatureAsync">Speichern</button>
|
||||||
<button class="btn btn-secondary" @onclick="CloseSignaturePopup">Schliessen</button>
|
<button class="btn btn-secondary" @onclick="CloseSignaturePopup" disabled="@(_capturedSignature is null)">Schliessen</button>
|
||||||
</div>
|
</div>
|
||||||
</FooterContentTemplate>
|
</FooterContentTemplate>
|
||||||
</DxPopup>
|
</DxPopup>
|
||||||
@@ -175,15 +175,15 @@
|
|||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
||||||
const string SignatureTabDraw = "draw";
|
const string SignatureTabDraw = "draw";
|
||||||
const string SignatureTabText = "text";
|
const string SignatureTabText = "text";
|
||||||
const string SignatureTabImage = "image";
|
const string SignatureTabImage = "image";
|
||||||
const string DrawCanvasId = "receiver-signature-pad";
|
const string DrawCanvasId = "receiver-signature-pad";
|
||||||
const string TypedCanvasId = "receiver-typed-signature-pad";
|
const string TypedCanvasId = "receiver-typed-signature-pad";
|
||||||
const string ImageInputId = "receiver-signature-image-input";
|
const string ImageInputId = "receiver-signature-image-input";
|
||||||
const string ImageCanvasId = "receiver-image-signature-pad";
|
const string ImageCanvasId = "receiver-image-signature-pad";
|
||||||
|
|
||||||
readonly (string Text, string Value)[] TypedSignatureFonts = {
|
readonly (string Text, string Value)[] TypedSignatureFonts = {
|
||||||
("Brush Script", "'Brush Script MT', cursive"),
|
("Brush Script", "'Brush Script MT', cursive"),
|
||||||
("Segoe Script", "'Segoe Script', cursive"),
|
("Segoe Script", "'Segoe Script', cursive"),
|
||||||
("Lucida Handwriting", "'Lucida Handwriting', cursive"),
|
("Lucida Handwriting", "'Lucida Handwriting', cursive"),
|
||||||
@@ -191,31 +191,31 @@ readonly (string Text, string Value)[] TypedSignatureFonts = {
|
|||||||
("Cursive", "cursive")
|
("Cursive", "cursive")
|
||||||
};
|
};
|
||||||
|
|
||||||
[Parameter] public string? EnvelopeKey { get; set; }
|
[Parameter] public string? EnvelopeKey { get; set; }
|
||||||
|
|
||||||
DxReportViewer? reportViewer;
|
DxReportViewer? reportViewer;
|
||||||
XtraReport? Report;
|
XtraReport? Report;
|
||||||
bool SignatureApplied;
|
bool SignatureApplied;
|
||||||
bool SignaturePopupVisible;
|
bool SignaturePopupVisible;
|
||||||
string? SignatureValidationMessage;
|
string? SignatureValidationMessage;
|
||||||
string? PopupValidationMessage;
|
string? PopupValidationMessage;
|
||||||
string ActiveSignatureTab = SignatureTabDraw;
|
string ActiveSignatureTab = SignatureTabDraw;
|
||||||
string TypedSignatureText = string.Empty;
|
string TypedSignatureText = string.Empty;
|
||||||
string TypedSignatureFont = "'Brush Script MT', cursive";
|
string TypedSignatureFont = "'Brush Script MT', cursive";
|
||||||
string SignerFullName = string.Empty;
|
string SignerFullName = string.Empty;
|
||||||
string SignerPosition = string.Empty;
|
string SignerPosition = string.Empty;
|
||||||
string SignaturePlace = string.Empty;
|
string SignaturePlace = string.Empty;
|
||||||
int ViewerKey;
|
int ViewerKey;
|
||||||
bool IsLoggingOut;
|
bool IsLoggingOut;
|
||||||
|
|
||||||
IReadOnlyList<AnnotationDto> _annotations = [];
|
IReadOnlyList<AnnotationDto> _annotations = [];
|
||||||
record SignatureCapture(string DataUrl, string FullName, string Position, string Place);
|
record SignatureCapture(string DataUrl, string FullName, string Position, string Place);
|
||||||
SignatureCapture? _capturedSignature;
|
SignatureCapture? _capturedSignature;
|
||||||
byte[]? _basePdfBytes;
|
byte[]? _basePdfBytes;
|
||||||
// annotation IDs the user has checked via overlay checkboxes
|
// annotation IDs the user has checked via overlay checkboxes
|
||||||
readonly HashSet<long> _checkedAnnotations = [];
|
readonly HashSet<long> _checkedAnnotations = [];
|
||||||
DotNetObjectReference<ReportViewer>? _dotNetRef;
|
DotNetObjectReference<ReportViewer>? _dotNetRef;
|
||||||
int _lastOverlayViewerKey = -1;
|
int _lastOverlayViewerKey = -1;
|
||||||
|
|
||||||
async Task LogoutAsync() {
|
async Task LogoutAsync() {
|
||||||
if (string.IsNullOrWhiteSpace(EnvelopeKey) || IsLoggingOut) return;
|
if (string.IsNullOrWhiteSpace(EnvelopeKey) || IsLoggingOut) return;
|
||||||
@@ -233,6 +233,10 @@ int _lastOverlayViewerKey = -1;
|
|||||||
Navigation.NavigateTo($"/login/{Uri.EscapeDataString(EnvelopeKey)}");
|
Navigation.NavigateTo($"/login/{Uri.EscapeDataString(EnvelopeKey)}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await OpenSignaturePopupAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_annotations = await AnnotationService.GetAnnotationsAsync(EnvelopeKey ?? "fake");
|
_annotations = await AnnotationService.GetAnnotationsAsync(EnvelopeKey ?? "fake");
|
||||||
|
|||||||
Reference in New Issue
Block a user