From 656fc97e74c41e70fab96fa7996201c9ff4156f4 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 8 Jun 2026 00:23:25 +0200 Subject: [PATCH] Enhance signature navigation with current index display Added functionality to display the current signature index in the signature counter UI in `EnvelopeViewer.razor`, including a new state variable `_currentSignatureIndex` to track the currently viewed signature. Updated the logic to fetch and set this value from the `SignatureNavState` object provided by the JavaScript runtime. Modified `pdf-viewer.js` to calculate the current signature index based on the last viewed signature ID (`_lastViewedSignatureId`) and return it as part of the `SignatureNavState`. This replaces the previously hardcoded `signed` value. These changes improve the user experience by providing a clear indication of the currently viewed signature in the navigation UI. --- .../Pages/EnvelopeViewer.razor | 6 ++++++ EnvelopeGenerator.ReceiverUI/wwwroot/js/pdf-viewer.js | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/EnvelopeGenerator.ReceiverUI/Pages/EnvelopeViewer.razor b/EnvelopeGenerator.ReceiverUI/Pages/EnvelopeViewer.razor index f3bc445d..4e11446d 100644 --- a/EnvelopeGenerator.ReceiverUI/Pages/EnvelopeViewer.razor +++ b/EnvelopeGenerator.ReceiverUI/Pages/EnvelopeViewer.razor @@ -131,6 +131,10 @@ + @if (_currentSignatureIndex > 0) { + #@_currentSignatureIndex + | + } @_signedSignatures  /  @_totalSignatures @@ -380,6 +384,7 @@ IReadOnlyList _signatures = []; int _totalSignatures = 0; int _signedSignatures = 0; int _unsignedSignatures = 0; +int _currentSignatureIndex = 0; // Şu an hangi imzada (1-based) // Signature state record SignatureCapture(string DataUrl, string FullName, string Position, string Place); @@ -628,6 +633,7 @@ const int MaxThumbnailWidth = 400; _totalSignatures = state.Total; _signedSignatures = state.Signed; _unsignedSignatures = state.Unsigned; + _currentSignatureIndex = state.CurrentIndex; // Şu an hangi imzada await InvokeAsync(StateHasChanged); } catch { // Ignore errors during counter update diff --git a/EnvelopeGenerator.ReceiverUI/wwwroot/js/pdf-viewer.js b/EnvelopeGenerator.ReceiverUI/wwwroot/js/pdf-viewer.js index 55e3275d..f6284233 100644 --- a/EnvelopeGenerator.ReceiverUI/wwwroot/js/pdf-viewer.js +++ b/EnvelopeGenerator.ReceiverUI/wwwroot/js/pdf-viewer.js @@ -505,11 +505,18 @@ window.pdfViewer = { const signed = this.appliedSignatures.length; // ?mzalananlar const unsigned = total - signed; // Hesaplanan: ?mzalanmayanlar + // Mevcut görüntülenen imzanın sıra numarasını bul + let currentIndex = 0; + if (this._lastViewedSignatureId) { + const index = this._allSignatures.findIndex(s => s.id === this._lastViewedSignatureId); + currentIndex = index !== -1 ? index + 1 : 0; // 1-based index (kullanıcıya göstermek için) + } + return { total: total, signed: signed, unsigned: unsigned, - currentIndex: signed, + currentIndex: currentIndex, // Şu an hangi imzada (1-5 arası) canGoPrev: total > 0, // Her zaman aktif (e?er imza varsa) canGoNext: total > 0 // Her zaman aktif (e?er imza varsa) }; @@ -1017,3 +1024,4 @@ window.pdfViewer = { +