Phase 2 part 2: prospects, the review screen and the suppression list

Schema 6 adds prospect_companies, prospect_contacts (merged by domain and
email, each with its source, detail and date) and suppressions. Prospects
-> Review lists New, Accepted and Set aside: accepting a company queues an
EspoCRM Account, a person a Lead at their company, with provenance and
why they fit in the description; the page warns about records already in
the CRM as of the last sync, and shows each accepted prospect's CRM
progress. Prospects can be added by hand. The suppression list (emails
and domains) is checked on add and again before queueing, and suppressing
sets matching new prospects aside. Search finds prospects too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 16:51:05 -07:00
co-authored by Claude Opus 5.5
parent 1dc5476d43
commit 7633697567
14 changed files with 1667 additions and 5 deletions
+2
View File
@@ -40,6 +40,8 @@
{{end}}
{{if eq .ID "prospects"}}
<div class="subnav">
<a href="/prospects" {{if eq $nav "prospects/review"}}aria-current="page"{{end}}>Review{{with $.NewProspects}} <span class="count-badge" title="{{.}} waiting for review">{{.}}</span>{{end}}</a>
<a href="/prospects/suppressed" {{if eq $nav "prospects/suppressed"}}aria-current="page"{{end}}>Suppression list</a>
<a href="/crm" {{if eq $nav "prospects/crm"}}aria-current="page"{{end}}>CRM queue</a>
</div>
{{end}}
+35
View File
@@ -0,0 +1,35 @@
{{define "content"}}{{with .Data}}
<h1>{{if .For}}Add a person at {{.For}}{{else}}Add a prospect{{end}}</h1>
<p class="lede">{{if .For}}They go into review with {{.For}}.{{else}}A company, a person at it, or both. They go into review first; nothing reaches your CRM until you accept it.{{end}}</p>
<form method="post" action="/prospects/new" class="card">
{{if .For}}<input type="hidden" name="company_id" value="{{.CompanyID}}">
{{else}}
<h2>Company</h2>
<div class="cols">
<label>Name <input name="company_name" value="{{.Company.Name}}" autocomplete="off"></label>
<label>Website <input name="website" value="{{.Company.Website}}" placeholder="example.com" autocomplete="off"></label>
<label>Industry <input name="industry" value="{{.Company.Industry}}"></label>
<label>Size <input name="size" value="{{.Company.Size}}" placeholder="e.g. 50–200 people"></label>
<label>Location <input name="location" value="{{.Company.Location}}"></label>
<label>LinkedIn page <input name="company_linkedin" value="{{.Company.LinkedIn}}" placeholder="https://www.linkedin.com/company/…"></label>
</div>
<label>Why they fit <textarea name="why" rows="2" placeholder="What makes them a good prospect">{{.Company.Why}}</textarea></label>
<h2>Person <span class="muted small">(optional)</span></h2>
{{end}}
<div class="cols">
<label>First name <input name="first_name" value="{{.Contact.FirstName}}" autocomplete="off"></label>
<label>Last name <input name="last_name" value="{{.Contact.LastName}}" autocomplete="off"></label>
<label>Job title <input name="title" value="{{.Contact.Title}}"></label>
<label>Email <input name="email" type="email" value="{{.Contact.Email}}" autocomplete="off"></label>
<label>Phone <input name="phone" value="{{.Contact.Phone}}"></label>
<label>LinkedIn profile <input name="linkedin" value="{{.Contact.LinkedIn}}" placeholder="https://www.linkedin.com/in/…"></label>
</div>
<label>Where you found them <input name="source_detail" value="{{.Contact.SourceDetail}}" placeholder="A link, an event, a referral…">
<span class="help">Kept with the prospect and written into the CRM record, so you can always say where a contact came from.</span></label>
<div class="actions">
<button type="submit">Add for review</button>
<a href="/prospects">Cancel</a>
</div>
</form>
{{end}}{{end}}
+121
View File
@@ -0,0 +1,121 @@
{{define "content"}}{{with .Data}}{{$tab := .Tab}}{{$matches := .Matches}}
<div class="heading">
<h1>Review prospects</h1>
<div class="buttons">
<a class="button" href="/prospects/new">Add a prospect</a>
</div>
</div>
<p class="lede">Companies and people who may fit your targets. Nothing goes to your CRM until you accept it: accepting a company adds an Account, accepting a person adds a Lead, through <a href="/crm">the CRM queue</a>. Each one keeps where and when it was found.</p>
<nav class="tabs">
{{range .Statuses}}<a href="/prospects?status={{.}}" {{if eq $tab .}}aria-current="page"{{end}}>{{if eq . "new"}}New{{else if eq . "accepted"}}Accepted{{else}}Set aside{{end}}{{with index $.Data.Counts .}} <span class="muted">{{.}}</span>{{end}}</a>{{end}}
</nav>
{{if and (eq $tab "new") (or .Companies .Loose)}}
<p class="help">{{if .Synced.IsZero}}Your CRM hasn't been synced yet, so Supermarket can't warn you about records you already have.{{else}}Checked against your CRM as of {{ago .Synced}}.{{end}}</p>
{{end}}
{{range .Companies}}{{$c := .}}
<section class="card prospect">
<div class="prospect-head">
<div>
<h2>{{.Name}}{{if ne .Status $tab}} <span class="badge">{{template "prospect-status" .Status}}</span>{{end}}</h2>
<p class="meta">
{{with .Website}}<a href="{{.}}" target="_blank" rel="noopener noreferrer">{{$c.Domain}}</a>{{end}}
{{with .Industry}} · {{.}}{{end}}{{with .Size}} · {{.}}{{end}}{{with .Location}} · {{.}}{{end}}
{{with .LinkedIn}} · <a href="{{.}}" target="_blank" rel="noopener noreferrer">LinkedIn</a>{{end}}
</p>
</div>
{{if eq .Status $tab}}
<div class="row-actions">
{{if eq $tab "new"}}
{{if .Contacts}}<form method="post" action="/prospects/company/{{.ID}}/accept-all"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="small">Accept with {{len .Contacts}} {{if eq (len .Contacts) 1}}person{{else}}people{{end}}</button></form>{{end}}
<form method="post" action="/prospects/company/{{.ID}}/accept"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="small {{if .Contacts}}secondary{{end}}">Accept {{if .Contacts}}company only{{else}}company{{end}}</button></form>
<form method="post" action="/prospects/company/{{.ID}}/reject"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Set aside</button></form>
{{if .Domain}}<form method="post" action="/prospects/company/{{.ID}}/suppress" data-confirm="Never add anyone at {{.Domain}}? This puts the domain on your suppression list."><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Suppress {{.Domain}}</button></form>{{end}}
{{else if eq $tab "accepted"}}
{{template "crm-state" dict "CRM" .CRM "Kind" "company" "ID" .ID "Tab" $tab}}
{{else}}
<form method="post" action="/prospects/company/{{.ID}}/reconsider"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Reconsider</button></form>
{{end}}
</div>
{{end}}
</div>
{{with .Why}}<p class="why">{{.}}</p>{{end}}
<p class="meta">{{template "provenance" .}}</p>
{{with index $matches (printf "company:%d" .ID)}}{{template "crm-matches" .}}{{end}}
{{if .Contacts}}
<ul class="items people">
{{range .Contacts}}{{template "contact" dict "P" . "Tab" $tab "Matches" $matches}}{{end}}
</ul>
{{end}}
{{if eq $tab "new"}}<p class="small"><a href="/prospects/new?company={{.ID}}">Add a person at {{.Name}}</a></p>{{end}}
</section>
{{end}}
{{if .Loose}}
<section class="card prospect">
<h2>People without a company</h2>
<ul class="items people">
{{range .Loose}}{{template "contact" dict "P" . "Tab" $tab "Matches" $matches}}{{end}}
</ul>
</section>
{{end}}
{{if not (or .Companies .Loose)}}
<section class="card empty">
{{if eq $tab "new"}}<p>Nothing to review. <a href="/prospects/new">Add a prospect</a> by hand; finding them for you comes next.</p>
{{else if eq $tab "accepted"}}<p>Nothing accepted yet.</p>
{{else}}<p>Nothing set aside.</p>{{end}}
</section>
{{end}}
{{end}}{{end}}
{{define "contact"}}{{$p := .P}}{{$tab := .Tab}}
<li class="item">
<div class="prospect-head">
<div>
<strong>{{$p.Name}}</strong>{{with $p.Title}} · {{.}}{{end}}{{if ne $p.Status $tab}} <span class="badge">{{template "prospect-status" $p.Status}}</span>{{end}}
<div class="meta">
{{with $p.Email}}<a href="mailto:{{.}}">{{.}}</a>{{if eq $p.EmailStatus "valid"}} <span class="badge published">verified</span>{{else if eq $p.EmailStatus "risky"}} <span class="badge">risky</span>{{else if eq $p.EmailStatus "invalid"}} <span class="badge failed">bounces</span>{{else}} <span class="muted">not verified</span>{{end}}{{end}}
{{with $p.Phone}} · {{.}}{{end}}
{{with $p.LinkedIn}} · <a href="{{.}}" target="_blank" rel="noopener noreferrer">LinkedIn</a>{{end}}
</div>
<div class="meta">{{template "provenance" $p}}</div>
{{with index .Matches (printf "contact:%d" $p.ID)}}{{template "crm-matches" .}}{{end}}
</div>
{{if eq $p.Status $tab}}
<div class="row-actions">
{{if eq $tab "new"}}
<form method="post" action="/prospects/contact/{{$p.ID}}/accept"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="small">Accept</button></form>
<form method="post" action="/prospects/contact/{{$p.ID}}/reject"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Set aside</button></form>
{{if $p.Email}}<form method="post" action="/prospects/contact/{{$p.ID}}/suppress" data-confirm="Never add {{$p.Email}}? This puts the address on your suppression list."><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Suppress</button></form>{{end}}
{{else if eq $tab "accepted"}}
{{template "crm-state" dict "CRM" $p.CRM "Kind" "contact" "ID" $p.ID "Tab" $tab}}
{{else}}
<form method="post" action="/prospects/contact/{{$p.ID}}/reconsider"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Reconsider</button></form>
{{end}}
</div>
{{end}}
</div>
</li>
{{end}}
{{define "prospect-status"}}{{if eq . "new"}}new{{else if eq . "accepted"}}accepted{{else}}set aside{{end}}{{end}}
{{define "provenance"}}{{if eq .Source "manual"}}Added by hand{{else}}Found by {{.Source}}{{end}} {{ago .FoundAt}}{{with .SourceDetail}} · {{if or (hasPrefix . "https://") (hasPrefix . "http://")}}<a href="{{.}}" target="_blank" rel="noopener noreferrer">source</a>{{else}}{{.}}{{end}}{{end}}{{end}}
{{define "crm-matches"}}
<p class="warnings">Already in your CRM: {{range $i, $r := .}}{{if $i}}, {{end}}{{$r.Entity}} <strong>{{$r.Name}}</strong>{{with $r.Email}} ({{.}}){{end}}{{end}}.</p>
{{end}}
{{define "crm-state"}}
{{if eq .CRM.Status "done"}}<span class="badge published">{{if eq .CRM.Outcome "existing"}}already in the CRM{{else}}in the CRM{{end}}</span>
{{else if eq .CRM.Status "failed"}}<span class="badge failed">failed</span> <a class="small" href="/crm">CRM queue</a>
{{else if eq .CRM.Status "cancelled"}}<span class="badge">cancelled</span>
<form method="post" action="/prospects/{{.Kind}}/{{.ID}}/accept"><input type="hidden" name="tab" value="{{.Tab}}"><button type="submit" class="secondary small">Queue again</button></form>
{{else if eq .CRM.Status "claimed"}}<span class="badge scheduled">with Hermes</span>
{{else if .CRM.Status}}<span class="badge draft">waiting for Hermes</span>
{{else}}<span class="badge">accepted</span>{{end}}
{{end}}
+35
View File
@@ -0,0 +1,35 @@
{{define "content"}}{{with .Data}}
<h1>Suppression list</h1>
<p class="lede">People and companies Supermarket must never add to your CRM: someone who asked not to be contacted, existing customers, partners, competitors. It's checked before a prospect is added, and again before anything is queued. A domain covers everyone with an email there.</p>
<form method="post" action="/prospects/suppressed" class="card">
<div class="cols">
<label>Email or domain <input name="value" value="{{.Value}}" placeholder="name@example.com or example.com" required autocomplete="off"></label>
<label>Reason <span class="muted small">(optional)</span> <input name="reason" placeholder="e.g. asked not to be contacted"></label>
</div>
<button type="submit">Add to the list</button>
</form>
{{if .List}}
<table class="list">
<thead><tr><th>Email or domain</th><th>Reason</th><th>Added</th><th></th></tr></thead>
<tbody>
{{range .List}}
<tr>
<td><strong>{{.Value}}</strong> <span class="muted small">{{.Kind}}</span></td>
<td>{{.Reason}}</td>
<td>{{ago .CreatedAt}}</td>
<td class="row-actions">
<form method="post" action="/prospects/suppressed" data-confirm="Take {{.Value}} off the suppression list?">
<input type="hidden" name="kind" value="{{.Kind}}"><input type="hidden" name="value" value="{{.Value}}">
<button type="submit" name="remove" value="1" class="secondary small">Remove</button>
</form>
</td>
</tr>
{{end}}
</tbody>
</table>
{{else}}
<section class="card empty"><p>The list is empty.</p></section>
{{end}}
{{end}}{{end}}