Simplify EnvelopeReceiverPage logic and update settings
Removed redundant `EnvelopeKey` checks in `LogoutAsync` and `OnInitializedAsync` methods, simplifying logout and initialization logic. Updated navigation URL to `/envelope/login/`. Streamlined document fetching logic by removing unnecessary conditions. Added logging in `CreateReportInstance` to track report creation. Enabled `ForceToUseFakeDocument` in `appsettings.json` to default to using fake documents. These changes improve code clarity and align behavior with updated requirements.
This commit is contained in:
@@ -162,7 +162,6 @@
|
|||||||
</svg>
|
</svg>
|
||||||
PDF exportieren
|
PDF exportieren
|
||||||
</button>
|
</button>
|
||||||
@if (!string.IsNullOrWhiteSpace(EnvelopeKey)) {
|
|
||||||
<button class="btn btn-sm btn-outline-danger" @onclick="LogoutAsync" disabled="@IsLoggingOut" title="Abmelden">
|
<button class="btn btn-sm btn-outline-danger" @onclick="LogoutAsync" disabled="@IsLoggingOut" title="Abmelden">
|
||||||
@if (IsLoggingOut) {
|
@if (IsLoggingOut) {
|
||||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||||
@@ -173,7 +172,6 @@
|
|||||||
</svg>
|
</svg>
|
||||||
}
|
}
|
||||||
</button>
|
</button>
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -311,33 +309,29 @@ Shown="OnPopupShownAsync">
|
|||||||
int _lastOverlayViewerKey = -1;
|
int _lastOverlayViewerKey = -1;
|
||||||
|
|
||||||
async Task LogoutAsync() {
|
async Task LogoutAsync() {
|
||||||
if (string.IsNullOrWhiteSpace(EnvelopeKey) || IsLoggingOut) return;
|
if (IsLoggingOut) return;
|
||||||
IsLoggingOut = true;
|
IsLoggingOut = true;
|
||||||
await InvokeAsync(StateHasChanged);
|
await InvokeAsync(StateHasChanged);
|
||||||
await AuthService.LogoutEnvelopeReceiverAsync(EnvelopeKey);
|
await AuthService.LogoutEnvelopeReceiverAsync(EnvelopeKey);
|
||||||
Navigation.NavigateTo($"/login/{Uri.EscapeDataString(EnvelopeKey)}", forceLoad: true);
|
Navigation.NavigateTo($"/envelope/login/{Uri.EscapeDataString(EnvelopeKey)}", forceLoad: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync() {
|
protected override async Task OnInitializedAsync() {
|
||||||
if (!string.IsNullOrWhiteSpace(EnvelopeKey)) {
|
|
||||||
var hasAccess = await AuthService.CheckEnvelopeAccessAsync(EnvelopeKey);
|
var hasAccess = await AuthService.CheckEnvelopeAccessAsync(EnvelopeKey);
|
||||||
if (!hasAccess) {
|
if (!hasAccess) {
|
||||||
Navigation.NavigateTo($"/login/{Uri.EscapeDataString(EnvelopeKey)}");
|
Navigation.NavigateTo($"/envelope/login/{Uri.EscapeDataString(EnvelopeKey)}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
ActiveSignatureTab = SignatureTabDraw;
|
ActiveSignatureTab = SignatureTabDraw;
|
||||||
SignaturePopupVisible = true;
|
SignaturePopupVisible = true;
|
||||||
SignatureValidationMessage = null;
|
SignatureValidationMessage = null;
|
||||||
PopupValidationMessage = null;
|
PopupValidationMessage = null;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_annotations = await AnnotationService.GetAnnotationsAsync(EnvelopeKey ?? "fake");
|
_annotations = await AnnotationService.GetAnnotationsAsync(EnvelopeKey);
|
||||||
_envelopeReceiver = await EnvelopeReceiverService.GetAsync(EnvelopeKey ?? "fake");
|
_envelopeReceiver = await EnvelopeReceiverService.GetAsync(EnvelopeKey);
|
||||||
|
|
||||||
if (!AppOptions.Value.ForceToUseFakeDocument && !string.IsNullOrWhiteSpace(EnvelopeKey)) {
|
if (!AppOptions.Value.ForceToUseFakeDocument) {
|
||||||
var (pdfBytes, _) = await DocumentService.GetDocumentAsync(EnvelopeKey);
|
var (pdfBytes, _) = await DocumentService.GetDocumentAsync(EnvelopeKey);
|
||||||
if (pdfBytes is { Length: > 0 })
|
if (pdfBytes is { Length: > 0 })
|
||||||
_basePdfBytes = pdfBytes;
|
_basePdfBytes = pdfBytes;
|
||||||
@@ -574,6 +568,7 @@ Shown="OnPopupShownAsync">
|
|||||||
}
|
}
|
||||||
|
|
||||||
XtraReport CreateReportInstance() {
|
XtraReport CreateReportInstance() {
|
||||||
|
Console.WriteLine("Created with predefinedReports");
|
||||||
return ReportStorage.TryGetReport("LargeDatasetReport", out var savedReport)
|
return ReportStorage.TryGetReport("LargeDatasetReport", out var savedReport)
|
||||||
? savedReport
|
? savedReport
|
||||||
: PredefinedReports.ReportsFactory.GetReport("LargeDatasetReport");
|
: PredefinedReports.ReportsFactory.GetReport("LargeDatasetReport");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"Api": {
|
"Api": {
|
||||||
"BaseUrl": "",
|
"BaseUrl": "",
|
||||||
"ForceToUseFakeDocument": false
|
"ForceToUseFakeDocument": true
|
||||||
},
|
},
|
||||||
"PdfViewer": {
|
"PdfViewer": {
|
||||||
"ThumbnailBaseScale": 0.75,
|
"ThumbnailBaseScale": 0.75,
|
||||||
|
|||||||
Reference in New Issue
Block a user