Enable infinite signature navigation and improve button logic

Updated the `disabled` attribute logic in `EnvelopeViewer.razor`
to ensure navigation buttons are always active when signatures
exist. Modified `pdf-viewer.js` to enable infinite looping for
signature navigation, allowing users to cycle between the first
and last signatures seamlessly. Adjusted `canGoPrev` and
`canGoNext` properties to depend on the total number of
signatures, ensuring navigation is always enabled when
signatures are present.
This commit is contained in:
2026-06-08 00:00:03 +02:00
parent 7a7fc2f903
commit 5bed9c932f
2 changed files with 13 additions and 9 deletions

View File

@@ -119,7 +119,7 @@
<div class="pdf-toolbar__section pdf-toolbar__signature-nav">
<button class="pdf-toolbar__btn pdf-toolbar__btn--signature-nav"
@onclick="GoToPreviousSignature"
disabled="@(_signedSignatures == 0)"
disabled="@(_totalSignatures == 0)"
title="Vorherige Unterschrift">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/>
@@ -144,7 +144,7 @@
<button class="pdf-toolbar__btn pdf-toolbar__btn--signature-nav"
@onclick="GoToNextSignature"
disabled="@(_unsignedSignatures == 0)"
disabled="@(_totalSignatures == 0)"
title="Nächste Unterschrift">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" 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"/>

View File

@@ -509,9 +509,9 @@ window.pdfViewer = {
total: total,
signed: signed,
unsigned: unsigned,
currentIndex: signed, // Sonraki imzan?n index'i
canGoPrev: signed > 0, // En az 1 imza uygulanm?? m??
canGoNext: unsigned > 0 // Hala imzalanmam?? var m??
currentIndex: signed,
canGoPrev: total > 0, // Her zaman aktif (e?er imza varsa)
canGoNext: total > 0 // Her zaman aktif (e?er imza varsa)
};
},
@@ -533,9 +533,11 @@ window.pdfViewer = {
}
// Bir sonraki imzay? al (imzalanm?? olup olmad???na bakmadan)
const nextIndex = currentIndex + 1;
let nextIndex = currentIndex + 1;
// Sonsuz döngü: Son imzadaysa ilk imzaya dön
if (nextIndex >= this._allSignatures.length) {
return false; // Son imzaday?z
nextIndex = 0; // ?lk imzaya dön
}
const nextSignature = this._allSignatures[nextIndex];
@@ -608,9 +610,11 @@ window.pdfViewer = {
}
// Bir önceki imzay? al
const prevIndex = currentIndex - 1;
let prevIndex = currentIndex - 1;
// Sonsuz döngü: ?lk imzadaysa son imzaya git
if (prevIndex < 0) {
return false; // ?lk imzaday?z
prevIndex = this._allSignatures.length - 1; // Son imzaya git
}
const prevSignature = this._allSignatures[prevIndex];