diff --git a/EnvelopeGenerator.ReceiverUI/wwwroot/js/pdf-viewer.js b/EnvelopeGenerator.ReceiverUI/wwwroot/js/pdf-viewer.js index cc5267d5..33beb6f1 100644 --- a/EnvelopeGenerator.ReceiverUI/wwwroot/js/pdf-viewer.js +++ b/EnvelopeGenerator.ReceiverUI/wwwroot/js/pdf-viewer.js @@ -462,23 +462,30 @@ window.pdfViewer = { * @returns {object} { total, signed, unsigned, currentIndex, canGoPrev, canGoNext } */ getSignatureNavState() { - const total = this.signatureButtons.length + this.appliedSignatures.length; - const signed = this.appliedSignatures.length; - const unsigned = this.signatureButtons.length; - - // Find index of first unsigned signature button (if any) - let currentIndex = -1; - if (unsigned > 0) { - currentIndex = signed; // 0-based index of next signature to sign + // Global imza listesi yoksa bo? state dön + if (!this._allSignatures || this._allSignatures.length === 0) { + return { + total: 0, + signed: 0, + unsigned: 0, + currentIndex: -1, + canGoPrev: false, + canGoNext: false + }; } + // TÜM sayfalardaki imzalar? say (database'den gelen global liste) + const total = this._allSignatures.length; // Global: Toplam imza say?s? + const signed = this.appliedSignatures.length; // ?mzalananlar + const unsigned = total - signed; // Hesaplanan: ?mzalanmayanlar + return { total: total, signed: signed, unsigned: unsigned, - currentIndex: currentIndex, - canGoPrev: signed > 0, // Can go to previous applied signature - canGoNext: unsigned > 0 // Can go to next unsigned signature + currentIndex: signed, // Sonraki imzan?n index'i + canGoPrev: signed > 0, // En az 1 imza uygulanm?? m?? + canGoNext: unsigned > 0 // Hala imzalanmam?? var m?? }; },