[object Object]

← back to Commercialrealestate

record all license numbers on every listing (display): email + viewer card render one row per agent w/ each DRE# linked to its record; overlayBroker + report overlay carry agents[]; graceful fallback to single broker

3a9480d48e540e8b14ed79042c70e884ca2d83cd · 2026-08-03 10:55:27 -0700 · Steve Abrams

Files touched

Diff

commit 3a9480d48e540e8b14ed79042c70e884ca2d83cd
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Aug 3 10:55:27 2026 -0700

    record all license numbers on every listing (display): email + viewer card render one row per agent w/ each DRE# linked to its record; overlayBroker + report overlay carry agents[]; graceful fallback to single broker
---
 public/condos.html       |  8 ++++++--
 scripts/condos-report.js | 27 +++++++++++++++++++--------
 scripts/serve.js         |  1 +
 3 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/public/condos.html b/public/condos.html
index 8cefecc..5832d70 100644
--- a/public/condos.html
+++ b/public/condos.html
@@ -308,11 +308,15 @@ function brokerCell(c){
   if(!(c.broker_name||c.firm_name)){
     return c.source?`<div class="broker" style="color:var(--mut)">🧑‍💼 <a href="${esc(c.source)}" target="_blank" rel="noopener noreferrer">Listed by — view broker on Redfin ↗</a></div>`:'';
   }
-  const dre=c.broker_dre?` · <a href="${esc(c.dre_url||('https://www2.dre.ca.gov/PublicASP/pplinfo.asp?License_id='+c.broker_dre))}" target="_blank" rel="noopener noreferrer" title="CA DRE license record">DRE# ${esc(c.broker_dre)}</a>`:'';
   const aph=c.agent_phone?` · <a href="${telHref(c.agent_phone)}">📱 ${esc(c.agent_phone)}</a>`:'';
   const oph=(c.office_phone&&c.office_phone!==c.agent_phone)?` · ☎ ${esc(c.office_phone)}`:'';
   const exp=c.broker_dre_expiration?`<div class="broker" style="color:var(--mut);font-size:10px">DRE exp ${esc(c.broker_dre_expiration)}${c.responsible_broker?' · resp. broker '+esc(c.responsible_broker):''}</div>`:'';
-  return `<div class="broker">🧑‍💼 ${esc(c.broker_name||'')}${c.firm_name?(c.broker_name?' · ':'')+esc(c.firm_name):''}${dre}${aph}${oph}</div>${exp}`;
+  // Record ALL license numbers on the listing (Steve 2026-08-03): one line per agent (primary +
+  // co-listing agent), each DRE# linked to its full CA DRE record. Falls back to the single broker.
+  const agents=(Array.isArray(c.agents)&&c.agents.length)?c.agents:[{name:c.broker_name,firm:c.firm_name,dre:c.broker_dre,dre_record:(c.dre_url?{dre_url:c.dre_url}:null)}];
+  const dreLink=(a)=>{ if(!a.dre) return ''; const u=(a.dre_record&&a.dre_record.dre_url)||('https://www2.dre.ca.gov/PublicASP/pplinfo.asp?License_id='+a.dre); return ` · <a href="${esc(u)}" target="_blank" rel="noopener noreferrer" title="Full CA DRE license record">DRE# ${esc(a.dre)}</a>`; };
+  const lines=agents.map((a,i)=>`🧑‍💼 ${esc(a.name||'')}${a.firm?(a.name?' · ':'')+esc(a.firm):''}${dreLink(a)}${i===0?aph+oph:'<span style="color:var(--mut);font-size:10px"> (co-agent)</span>'}`).join('<br>');
+  return `<div class="broker">${lines}</div>${exp}`;
 }
 function noteBox(c){
   const v=(NOTES[c.id]&&NOTES[c.id].note)||'';
diff --git a/scripts/condos-report.js b/scripts/condos-report.js
index 0689ba1..e78c05f 100644
--- a/scripts/condos-report.js
+++ b/scripts/condos-report.js
@@ -17,6 +17,7 @@ try {
   for (const c of all) {
     const b = cb[c.id]; if (!b || !b.broker_name) continue;
     c.broker_name = b.broker_name;
+    if (Array.isArray(b.agents) && b.agents.length) c.agents = b.agents;   // ALL license numbers on the listing
     if (b.firm_name) c.firm_name = b.firm_name;
     if (b.broker_dre) { c.broker_dre = b.broker_dre; c.dre_url = (b.dre && b.dre.dre_url) || `https://www2.dre.ca.gov/PublicASP/pplinfo.asp?License_id=${b.broker_dre}`; }
     if (b.agent_phone) c.agent_phone = b.agent_phone;
@@ -55,14 +56,24 @@ const row = (c, i) => `<tr>
 // ("using dre#, always hook into the full list"). Falls back to a Redfin deep link when a
 // listing's broker couldn't be captured, so every listing still routes somewhere.
 const brokerLine = (c) => {
-  const dre = c.broker_dre
-    ? ` · DRE# <a href="${c.dre_url || `https://www2.dre.ca.gov/PublicASP/pplinfo.asp?License_id=${c.broker_dre}`}">${c.broker_dre}</a>`
-    : '';
-  const aph = c.agent_phone ? ` · 📱 <a href="tel:${String(c.agent_phone).replace(/[^0-9]/g,'')}">${c.agent_phone}</a>` : '';
-  const oph = (c.office_phone && c.office_phone !== c.agent_phone) ? ` · ☎ ${c.office_phone}` : '';
-  const exp = c.broker_dre_expiration ? ` · DRE exp ${c.broker_dre_expiration}` : '';
-  if (c.broker_name || c.firm_name) {
-    return `<div style="font-size:12px;color:#1a5; margin:3px 0"><b>🧑‍💼 Listed by:</b> ${esc(c.broker_name || '')}${c.firm_name ? (c.broker_name ? ' · ' : '') + esc(c.firm_name) : ''}${dre}${aph}${oph}${exp}</div>`;
+  const aph = c.agent_phone ? ` · 📱 <a href="tel:${String(c.agent_phone).replace(/[^0-9]/g,'')}">${esc(c.agent_phone)}</a>` : '';
+  const oph = (c.office_phone && c.office_phone !== c.agent_phone) ? ` · ☎ ${esc(c.office_phone)}` : '';
+  // Record ALL license numbers on the listing: one row per agent (primary + any co-listing agent),
+  // each DRE# hyperlinked to its full CA DRE record. Falls back to the single primary broker until
+  // the multi-agent re-scrape populates c.agents.
+  const agents = (Array.isArray(c.agents) && c.agents.length)
+    ? c.agents
+    : ((c.broker_name || c.broker_dre) ? [{ name: c.broker_name, firm: c.firm_name, dre: c.broker_dre, dre_record: c.dre }] : []);
+  if (agents.length) {
+    const rows = agents.map((a, i) => {
+      const dreUrl = (a.dre_record && a.dre_record.dre_url) || (a.dre ? `https://www2.dre.ca.gov/PublicASP/pplinfo.asp?License_id=${a.dre}` : '');
+      const dre = a.dre ? ` · DRE# <a href="${dreUrl}">${esc(a.dre)}</a>` : '';
+      const exp = (a.dre_record && a.dre_record.dre_expiration) ? ` · exp ${esc(a.dre_record.dre_expiration)}`
+        : (i === 0 && c.broker_dre_expiration ? ` · exp ${esc(c.broker_dre_expiration)}` : '');
+      const role = i === 0 ? '' : ' <span style="color:#888">(co-agent)</span>';
+      return `${esc(a.name || '')}${a.firm ? (a.name ? ' · ' : '') + esc(a.firm) : ''}${dre}${exp}${role}`;
+    }).join('<br>&nbsp;&nbsp;&nbsp;&nbsp;');
+    return `<div style="font-size:12px;color:#1a5;margin:3px 0"><b>🧑‍💼 Listed by:</b> ${rows}${aph}${oph}</div>`;
   }
   return `<div style="font-size:12px;color:#888;margin:3px 0"><b>🧑‍💼 Listed by:</b> <a href="${c.source}">view listing broker on Redfin ↗</a></div>`;
 };
diff --git a/scripts/serve.js b/scripts/serve.js
index a35526d..aa2293b 100644
--- a/scripts/serve.js
+++ b/scripts/serve.js
@@ -680,6 +680,7 @@ function overlayBroker(row) {
   if (!b) return row;
   const o = { ...row };
   if (b.broker_name) o.broker_name = b.broker_name;
+  if (Array.isArray(b.agents) && b.agents.length) o.agents = b.agents;   // ALL license numbers on the listing
   if (b.firm_name) o.firm_name = b.firm_name;
   if (b.broker_dre) o.broker_dre = b.broker_dre;
   if (b.agent_phone) o.agent_phone = b.agent_phone;

← fcd24a8 enrich-condo-brokers: record ALL license numbers per listing  ·  back to Commercialrealestate  ·  index broker-line: tighten DRE link guard /^d{7,8}/ -> /^d{8 c0235f6 →