diff --git a/app.js b/app.js
index fd65232..1101630 100644
--- a/app.js
+++ b/app.js
@@ -1399,27 +1399,40 @@ async function crmLoadRecords() {
/* ─── CRM — Render table ────────────────────────────────────────── */
function crmRender() {
- const search = (
- document.getElementById("crm-search")?.value ?? ""
+ const searchName = (
+ document.getElementById("crm-search-name")?.value ?? ""
+ ).toLowerCase();
+ const searchCompany = (
+ document.getElementById("crm-search-company")?.value ?? ""
+ ).toLowerCase();
+ const searchEmail = (
+ document.getElementById("crm-search-email")?.value ?? ""
+ ).toLowerCase();
+ const searchStage = (
+ document.getElementById("crm-search-stage")?.value ?? ""
+ ).toLowerCase();
+ const searchStrategy = (
+ document.getElementById("crm-search-strategy")?.value ?? ""
+ ).toLowerCase();
+ const searchCategory = (
+ document.getElementById("crm-search-category")?.value ?? ""
).toLowerCase();
const filtered = crmRecords.filter((r) => {
- if (!search) return true;
- const haystack = [
- r.Name,
- r.Company,
- r.email,
- r.Stage,
- r.strategy,
- r.category,
- r.affiliate,
- r.History,
- r.Number,
- ]
- .filter((v) => v != null)
- .join(" ")
- .toLowerCase();
- return haystack.includes(search);
+ const name = (r.Name ?? "").toLowerCase();
+ const company = (r.Company ?? "").toLowerCase();
+ const email = (r.email ?? "").toLowerCase();
+ const stage = (r.Stage ?? "").toLowerCase();
+ const strategy = (r.strategy ?? "").toLowerCase();
+ const category = (r.category ?? "").toLowerCase();
+ return (
+ (!searchName || name.includes(searchName)) &&
+ (!searchCompany || company.includes(searchCompany)) &&
+ (!searchEmail || email.includes(searchEmail)) &&
+ (!searchStage || stage.includes(searchStage)) &&
+ (!searchStrategy || strategy.includes(searchStrategy)) &&
+ (!searchCategory || category.includes(searchCategory))
+ );
});
const total = crmRecords.length;
@@ -1435,7 +1448,7 @@ function crmRender() {
const tbody = document.getElementById("crm-table-body");
if (filtered.length === 0) {
- tbody.innerHTML = `
+ tbody.innerHTML = `
@@ -826,7 +881,6 @@
| Strategy |
Category |
Date Next Contact |
- Actions |
@@ -1032,6 +1086,165 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|