Keep validation dialog in sync after removing an item

Recompute filtered, sorted, and paginated validation state after a request is removed from the pending list.\nAdjust next-item selection so the dialog advances only when a valid next item exists, avoiding wraparound to stale entries.
This commit is contained in:
mahdahar 2026-04-21 12:36:40 +07:00
parent 4a14dbddce
commit b142a1076d

View File

@ -273,9 +273,17 @@ document.addEventListener('alpine:init', () => {
item => item.SP_ACCESSNUMBER !== accessnumber
);
this.computeUnvalidatedFiltered();
this.computeUnvalidatedSorted();
this.computeUnvalidatedTotalPages();
if (this.currentPage > this.unvalidatedTotalPages) {
this.currentPage = this.unvalidatedTotalPages;
}
this.computeUnvalidatedPaginated();
const filteredLength = this.unvalidatedFiltered.length;
if (filteredLength > 0) {
const nextIndex = Math.min(this.currentIndex, filteredLength - 1);
if (filteredLength > 0 && this.currentIndex < filteredLength) {
const nextIndex = this.currentIndex;
this.closeValDialog();
setTimeout(() => this.openValDialogByIndex(nextIndex), 50);
} else {