From 715ac96de8b7c399cbfc6b3d2d46b5b700bc7df4 Mon Sep 17 00:00:00 2001 From: wasrusgen Date: Fri, 15 May 2026 22:40:03 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=20=D0=BA?= =?UTF-8?q?=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD=D0=BE=D0=BC=20=D1=8D=D0=BA=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B5=20(=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=20?= =?UTF-8?q?=D0=BF=D0=BE=20=D0=A4=D0=98=D0=9E=20/=20=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D1=84=D0=BE=D0=BD=D1=83=20/=20=D0=B4=D0=BE=D0=B3=D0=BE?= =?UTF-8?q?=D0=B2=D0=BE=D1=80=D1=83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - clients.js: renderList — поле поиска над списком, renderFiltered() фильтрует без API-запроса - фильтрация: имя (подстрока), телефон (только цифры), номер договора - счётчик обновляется: «Найдено N из M» при поиске, полная статистика без запроса - podbor.css: .client-search-wrap, .client-search, .client-search-meta - index.html: cache bump → v=20260514n Co-Authored-By: Claude Sonnet 4.5 --- miniapp/assets/clients.js | 51 ++++++++++++++++++++++++++++++++------- miniapp/assets/podbor.css | 24 ++++++++++++++++++ miniapp/index.html | 26 ++++++++++---------- 3 files changed, 79 insertions(+), 22 deletions(-) diff --git a/miniapp/assets/clients.js b/miniapp/assets/clients.js index 1c9d92d..3464e88 100644 --- a/miniapp/assets/clients.js +++ b/miniapp/assets/clients.js @@ -408,6 +408,15 @@ const Clients = (function () { }); root.appendChild(addBtn); + // Поиск (рендерится сразу, до загрузки) + const searchWrap = el(` +
+ +
+ `); + root.appendChild(searchWrap); + const searchInput = searchWrap.querySelector(".client-search"); + const loading = el(`
`); root.appendChild(loading); @@ -434,18 +443,42 @@ const Clients = (function () { return; } - const meta = el(` -
- ${data.count} ${pluralize(data.count, "клиент", "клиента", "клиентов")} · ${countLeads(data.clients)} ${pluralize(countLeads(data.clients), "подбор", "подбора", "подборов")} -
- `); - root.appendChild(meta); + const metaEl = el(`
`); + root.appendChild(metaEl); const list = el(`
`); - for (const c of data.clients) { - list.appendChild(renderClientCard(c)); - } root.appendChild(list); + + function renderFiltered(q) { + q = (q || "").trim().toLowerCase(); + const qDigits = q.replace(/\D/g, ""); + const filtered = q + ? data.clients.filter(c => { + const nameMatch = (c.client_name || "").toLowerCase().includes(q); + const phoneMatch = qDigits && (c.client_phone || "").replace(/\D/g, "").includes(qDigits); + const contractMatch = (c.contract_no || "").toLowerCase().includes(q); + return nameMatch || phoneMatch || contractMatch; + }) + : data.clients; + + const n = filtered.length; + const total = data.clients.length; + metaEl.textContent = q + ? `Найдено: ${n} из ${total}` + : `${total} ${pluralize(total, "клиент", "клиента", "клиентов")} · ${countLeads(data.clients)} ${pluralize(countLeads(data.clients), "подбор", "подбора", "подборов")}`; + + list.innerHTML = ""; + if (!filtered.length) { + list.innerHTML = `
Ничего не найдено
`; + return; + } + for (const c of filtered) { + list.appendChild(renderClientCard(c)); + } + } + + searchInput.addEventListener("input", () => renderFiltered(searchInput.value)); + renderFiltered(""); } function renderClientCard(c) { diff --git a/miniapp/assets/podbor.css b/miniapp/assets/podbor.css index 037db28..f7db2c2 100644 --- a/miniapp/assets/podbor.css +++ b/miniapp/assets/podbor.css @@ -3358,6 +3358,30 @@ border-top: 1px dashed var(--line); } +/* ===== Поиск по списку клиентов ===== */ +.client-search-wrap { + padding: 0 0 10px; +} +.client-search { + width: 100%; + padding: 10px 14px; + background: var(--paper, #FBF7F0); + border: 1.5px solid rgba(107,74,43,0.18); + border-radius: 10px; + font-family: inherit; + font-size: 14px; + color: var(--ink, #1F1A14); + box-sizing: border-box; + -webkit-appearance: none; +} +.client-search:focus { + outline: none; + border-color: var(--walnut, #6B4A2B); + background: white; +} +.client-search::placeholder { color: var(--muted, #998877); } +.client-search-meta { transition: color 0.15s; } + /* ===== Поля адреса (addr-grid) ===== */ .addr-grid { display: grid; diff --git a/miniapp/index.html b/miniapp/index.html index 5f5cec9..0699599 100644 --- a/miniapp/index.html +++ b/miniapp/index.html @@ -12,14 +12,14 @@ - - + +
- +
- - - - - - - - - - + + + + + + + + + +