mejoras en el modelo de clarificacion de productos

This commit is contained in:
Lucas Tettamanti
2026-01-17 06:31:49 -03:00
parent 63b9ecef61
commit 204403560e
24 changed files with 1940 additions and 873 deletions

View File

@@ -9,6 +9,7 @@ class UsersCrud extends HTMLElement {
this.selected = null;
this.loading = false;
this.searchQuery = "";
this.wooFilter = false;
this.shadowRoot.innerHTML = `
<style>
@@ -49,7 +50,9 @@ class UsersCrud extends HTMLElement {
.loading { text-align:center; padding:40px; color:#8aa0b5; }
.stats { display:flex; gap:16px; margin-bottom:16px; }
.stat { background:#0f1520; border:1px solid #253245; border-radius:8px; padding:12px; flex:1; text-align:center; }
.stat { background:#0f1520; border:1px solid #253245; border-radius:8px; padding:12px; flex:1; text-align:center; cursor:pointer; transition:all .15s; }
.stat:hover { border-color:#1f6feb; }
.stat.active { border-color:#1f6feb; background:#111b2a; }
.stat-value { font-size:24px; font-weight:700; color:#1f6feb; }
.stat-label { font-size:11px; color:#8aa0b5; text-transform:uppercase; margin-top:4px; }
</style>
@@ -58,11 +61,11 @@ class UsersCrud extends HTMLElement {
<div class="panel">
<div class="panel-title">Usuarios</div>
<div class="stats">
<div class="stat">
<div class="stat" id="statTotal">
<div class="stat-value" id="totalCount">—</div>
<div class="stat-label">Total</div>
</div>
<div class="stat">
<div class="stat" id="statWoo">
<div class="stat-value" id="wooCount">—</div>
<div class="stat-label">Con Woo ID</div>
</div>
@@ -92,9 +95,29 @@ class UsersCrud extends HTMLElement {
this._searchTimer = setTimeout(() => this.load(), 300);
};
// Stats click handlers
this.shadowRoot.getElementById("statTotal").onclick = () => {
this.wooFilter = false;
this.renderList();
this.updateStatStyles();
};
this.shadowRoot.getElementById("statWoo").onclick = () => {
this.wooFilter = !this.wooFilter;
this.renderList();
this.updateStatStyles();
};
this.load();
}
updateStatStyles() {
const statTotal = this.shadowRoot.getElementById("statTotal");
const statWoo = this.shadowRoot.getElementById("statWoo");
statTotal.classList.toggle("active", !this.wooFilter);
statWoo.classList.toggle("active", this.wooFilter);
}
async load() {
this.loading = true;
this.renderList();
@@ -129,13 +152,18 @@ class UsersCrud extends HTMLElement {
return;
}
if (!this.items.length) {
// Filter by woo ID if filter is active
const filteredItems = this.wooFilter
? this.items.filter(u => u.external_customer_id)
: this.items;
if (!filteredItems.length) {
list.innerHTML = `<div class="loading">No se encontraron usuarios</div>`;
return;
}
list.innerHTML = "";
for (const item of this.items) {
for (const item of filteredItems) {
const el = document.createElement("div");
el.className = "item" + (this.selected?.chat_id === item.chat_id ? " active" : "");