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.
This commit is contained in:
@@ -131,6 +131,10 @@
|
||||
<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__signature-counter-text">
|
||||
@if (_currentSignatureIndex > 0) {
|
||||
<span style="color: #4F46E5; font-weight: 600;">#@_currentSignatureIndex</span>
|
||||
<span style="opacity: 0.4; margin: 0 0.35rem;">|</span>
|
||||
}
|
||||
<strong style="color: @(_unsignedSignatures > 0 ? "#4F46E5" : "#10b981");">@_signedSignatures</strong>
|
||||
<span style="opacity: 0.6;"> / </span>
|
||||
<span>@_totalSignatures</span>
|
||||
@@ -380,6 +384,7 @@ IReadOnlyList<SignatureDto> _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
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user