Update vcard_api.html
This commit is contained in:
@@ -1581,6 +1581,7 @@ function vcardApiApp() {
|
|||||||
sortByVenc: false,
|
sortByVenc: false,
|
||||||
loadingVenc: false,
|
loadingVenc: false,
|
||||||
filterPlan: '',
|
filterPlan: '',
|
||||||
|
knownPlans: [], // planes acumulados de todas las páginas cargadas
|
||||||
membresiaMap: {}, // { userId: { fecha_fin, activo, plan } }
|
membresiaMap: {}, // { userId: { fecha_fin, activo, plan } }
|
||||||
|
|
||||||
// Desactivar usuario + VCards
|
// Desactivar usuario + VCards
|
||||||
@@ -1748,6 +1749,8 @@ function vcardApiApp() {
|
|||||||
this.items = [];
|
this.items = [];
|
||||||
this.total = 0;
|
this.total = 0;
|
||||||
this.errorMsg = '';
|
this.errorMsg = '';
|
||||||
|
this.filterPlan = '';
|
||||||
|
this.knownPlans = [];
|
||||||
if (this.hasConfig) this.loadTab();
|
if (this.hasConfig) this.loadTab();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1787,11 +1790,11 @@ function vcardApiApp() {
|
|||||||
if (d.data && Array.isArray(d.data)) {
|
if (d.data && Array.isArray(d.data)) {
|
||||||
this.items = d.data;
|
this.items = d.data;
|
||||||
this.total = d.total || d.data.length;
|
this.total = d.total || d.data.length;
|
||||||
if (this.tab === 'usuarios') this._collectRoles(d.data);
|
if (this.tab === 'usuarios') { this._collectRoles(d.data); this._collectPlanes(d.data); }
|
||||||
} else if (Array.isArray(d)) {
|
} else if (Array.isArray(d)) {
|
||||||
this.items = d;
|
this.items = d;
|
||||||
this.total = d.length;
|
this.total = d.length;
|
||||||
if (this.tab === 'usuarios') this._collectRoles(d);
|
if (this.tab === 'usuarios') { this._collectRoles(d); this._collectPlanes(d); }
|
||||||
} else {
|
} else {
|
||||||
this.items = [];
|
this.items = [];
|
||||||
this.total = 0;
|
this.total = 0;
|
||||||
@@ -1816,6 +1819,16 @@ function vcardApiApp() {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_collectPlanes(users) {
|
||||||
|
users.forEach(u => {
|
||||||
|
const nombre = (u.plan && u.plan.nombre) ? u.plan.nombre : '';
|
||||||
|
if (nombre && !this.knownPlans.includes(nombre)) {
|
||||||
|
this.knownPlans.push(nombre);
|
||||||
|
this.knownPlans.sort();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
// ─── Ordenar por vencimiento ─────────────────────────────────────────
|
// ─── Ordenar por vencimiento ─────────────────────────────────────────
|
||||||
|
|
||||||
diasHastaVencer(u) {
|
diasHastaVencer(u) {
|
||||||
@@ -1906,8 +1919,7 @@ function vcardApiApp() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
planesDisponibles() {
|
planesDisponibles() {
|
||||||
const nombres = [...new Set(this.items.map(u => (u.plan && u.plan.nombre) || ''))].filter(Boolean).sort();
|
return this.knownPlans;
|
||||||
return nombres;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
usuariosFiltrados() {
|
usuariosFiltrados() {
|
||||||
|
|||||||
Reference in New Issue
Block a user