fix(prospecting): add missing pagination computed properties to JS components
Some checks failed
Some checks failed
The pagination() macro expects startIndex, endIndex, pageNumbers, totalPages, nextPage(), and previousPage() to be defined in the Alpine.js component. Added these to scan-jobs.js, prospects.js, and leads.js. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -57,11 +57,47 @@ function scanJobs() {
|
||||
}
|
||||
},
|
||||
|
||||
get startIndex() {
|
||||
if (this.pagination.total === 0) return 0;
|
||||
return (this.pagination.page - 1) * this.pagination.per_page + 1;
|
||||
},
|
||||
|
||||
get endIndex() {
|
||||
const end = this.pagination.page * this.pagination.per_page;
|
||||
return end > this.pagination.total ? this.pagination.total : end;
|
||||
},
|
||||
|
||||
get totalPages() {
|
||||
return this.pagination.pages;
|
||||
},
|
||||
|
||||
get pageNumbers() {
|
||||
const pages = [];
|
||||
const total = this.totalPages;
|
||||
const current = this.pagination.page;
|
||||
if (total <= 7) { for (let i = 1; i <= total; i++) pages.push(i); return pages; }
|
||||
pages.push(1);
|
||||
if (current > 3) pages.push('...');
|
||||
for (let i = Math.max(2, current - 1); i <= Math.min(total - 1, current + 1); i++) pages.push(i);
|
||||
if (current < total - 2) pages.push('...');
|
||||
pages.push(total);
|
||||
return pages;
|
||||
},
|
||||
|
||||
goToPage(page) {
|
||||
if (page === '...' || page < 1 || page > this.totalPages) return;
|
||||
this.pagination.page = page;
|
||||
this.loadJobs();
|
||||
},
|
||||
|
||||
nextPage() {
|
||||
if (this.pagination.page < this.totalPages) { this.pagination.page++; this.loadJobs(); }
|
||||
},
|
||||
|
||||
previousPage() {
|
||||
if (this.pagination.page > 1) { this.pagination.page--; this.loadJobs(); }
|
||||
},
|
||||
|
||||
jobStatusClass(status) {
|
||||
const classes = {
|
||||
pending: 'text-yellow-700 bg-yellow-100 dark:text-yellow-100 dark:bg-yellow-700',
|
||||
|
||||
Reference in New Issue
Block a user