fix: implement handleSort method for sortable table headers
- Update th_sortable macro to call handleSort(key) instead of inline logic - Add handleSort method to subscriptions.js, subscription-tiers.js, billing-history.js - Add sort_by and sort_order params to API calls in all three files - Reset to page 1 when sort changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -136,6 +136,8 @@ function adminBillingHistory() {
|
||||
params.append('per_page', this.pagination.per_page);
|
||||
if (this.filters.vendor_id) params.append('vendor_id', this.filters.vendor_id);
|
||||
if (this.filters.status) params.append('status', this.filters.status);
|
||||
if (this.sortBy) params.append('sort_by', this.sortBy);
|
||||
if (this.sortOrder) params.append('sort_order', this.sortOrder);
|
||||
|
||||
const data = await apiClient.get(`/admin/subscriptions/billing/history?${params}`);
|
||||
this.invoices = data.invoices || [];
|
||||
@@ -154,6 +156,17 @@ function adminBillingHistory() {
|
||||
}
|
||||
},
|
||||
|
||||
handleSort(key) {
|
||||
if (this.sortBy === key) {
|
||||
this.sortOrder = this.sortOrder === 'asc' ? 'desc' : 'asc';
|
||||
} else {
|
||||
this.sortBy = key;
|
||||
this.sortOrder = 'asc';
|
||||
}
|
||||
this.pagination.page = 1;
|
||||
this.loadInvoices();
|
||||
},
|
||||
|
||||
updateStatusCounts() {
|
||||
// Reset counts
|
||||
this.statusCounts = {
|
||||
|
||||
Reference in New Issue
Block a user