Files
supermarket/internal/web/templates/prospects.html
T
davidandClaude Opus 5.5 b6758417a3 Prospects: Listmonk mailing lists, and their opt-outs
Settings → Email → Mailing lists connects Listmonk (the Core's, by
default) with an API user and its token; Test reads the lists. A person
in Review can be added to a list, with their company, title and signal:
a double opt-in list asks them to confirm unless they already agreed; a
single opt-in list takes them only once they have; a suppressed address
is refused. Their card shows the lists they're on (a new list_members
table). Every hour, or on Sync now, everyone blocklisted in Listmonk or
unsubscribed from one of its lists goes on the suppression list, with
the reason; an address already there keeps its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 13:15:37 -07:00

224 lines
17 KiB
HTML

{{define "content"}}{{with .Data}}{{$tab := .Tab}}{{$matches := .Matches}}{{$d := .}}
<div class="heading">
<h1>Review prospects</h1>
<div class="buttons">
<a class="button" href="/prospects/new{{if .Signal}}?signal={{.Signal}}{{end}}">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>
{{if .Signals}}
<form method="get" action="/prospects" class="filters">
<input type="hidden" name="status" value="{{$tab}}">
<label class="small">Signal
<select name="signal" data-autosubmit>
<option value="0">All signals</option>
{{range .Signals}}<option value="{{.ID}}" {{if eq .ID $d.Signal}}selected{{end}}>{{.Name}}</option>{{end}}
</select>
</label>
<noscript><button type="submit" class="secondary small">Show</button></noscript>
</form>
{{end}}
<nav class="tabs">
{{range .Statuses}}<a href="/prospects?status={{.}}{{if $d.Signal}}&amp;signal={{$d.Signal}}{{end}}" {{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)}}
{{if and .Hunter .Unverified}}
<form method="post" action="/prospects/verify" class="inline-note" data-busy="Verifying…">
<input type="hidden" name="filter" value="{{.Signal}}">
<span class="small">{{.Unverified}} {{if eq .Unverified 1}}address hasn't{{else}}addresses haven't{{end}} been verified{{if gt .Unverified .MaxVerify}} ({{.MaxVerify}} are checked at a time){{end}}.</span>
<button type="submit" class="secondary small">Verify with Hunter.io</button>
</form>
{{end}}
<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}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><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}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><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}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><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}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><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 "Filter" $d.Signal}}
{{else}}
<form method="post" action="/prospects/company/{{.ID}}/reconsider"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="secondary small">Reconsider</button></form>
{{end}}
<form method="post" action="/prospects/company/{{.ID}}/delete" data-confirm="Delete {{.Name}}{{if .Contacts}} and its people{{end}}? Their steps in the funnel go too, and a CRM action not yet done is taken back. Anything already in EspoCRM stays there."><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="link small">Delete</button></form>
</div>
{{end}}
</div>
{{with .Why}}<p class="why">{{.}}</p>{{end}}
<p class="meta">{{template "provenance" .}}</p>
{{if and $d.Hunter .Domain (ne .Status "rejected")}}
<form method="post" action="/prospects/company/{{.ID}}/people" class="inline-note" data-busy="Searching Hunter.io…">
<input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}">
<button type="submit" class="secondary small">Find people at {{.Domain}}</button>
{{template "enrich-run" (index $d.Runs (printf "company:%d" .ID))}}
</form>
{{else}}{{template "enrich-run" (index $d.Runs (printf "company:%d" .ID))}}{{end}}
{{template "signal-tag" dict "Kind" "company" "ID" .ID "SignalID" .SignalID "D" $d}}
{{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 "D" $d}}{{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 "D" $d}}{{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}}{{$d := .D}}
<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 if eq $p.EmailStatus "unknown"}} <span class="muted">couldn't be verified</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>
{{if and $d.Hunter (ne $p.Status "rejected")}}
{{if and (not $p.Email) $p.CompanyID}}
<form method="post" action="/prospects/contact/{{$p.ID}}/find-email" class="inline-note" data-busy="Searching Hunter.io…"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="link small">Find their email</button></form>
{{else if and $p.Email (not $p.EmailStatus)}}
<form method="post" action="/prospects/contact/{{$p.ID}}/verify" class="inline-note" data-busy="Verifying…"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="link small">Verify the address</button></form>
{{end}}
{{end}}
{{template "enrich-run" (index $d.Runs (printf "contact:%d" $p.ID))}}
{{with index $d.Messages $p.ID}}<div class="small">{{range .}}<a href="/outreach?tab={{if .RepliedAt.IsZero}}{{if eq .Status "bounced"}}failed{{else}}{{.Status}}{{end}}{{else}}replied{{end}}#m-{{.ID}}">{{if eq .Channel "email"}}Email{{else}}LinkedIn message{{end}} {{if not .RepliedAt.IsZero}}replied to {{ago .RepliedAt}}{{else if eq .Status "sent"}}sent {{ago .SentAt}}{{else if eq .Status "draft"}}drafted{{else if eq .Status "failed"}}didn't go{{else}}{{.Status}}{{end}}</a> {{end}}</div>{{end}}
{{if ne $p.Status "rejected"}}
<div class="row wrap">
{{if and $p.Email (ne $p.EmailStatus "invalid")}}<form method="post" action="/outreach/draft" data-busy="Writing…"><input type="hidden" name="contact" value="{{$p.ID}}"><input type="hidden" name="channel" value="email"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="link small">Write an email</button></form>{{end}}
{{if $p.LinkedIn}}<form method="post" action="/outreach/draft" data-busy="Writing…"><input type="hidden" name="contact" value="{{$p.ID}}"><input type="hidden" name="channel" value="linkedin"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="link small">Write a LinkedIn message</button></form>{{end}}
</div>
{{end}}
{{if not $p.CompanyID}}{{template "signal-tag" dict "Kind" "contact" "ID" $p.ID "SignalID" $p.SignalID "D" $d}}{{end}}
{{with index .Matches (printf "contact:%d" $p.ID)}}{{template "crm-matches" .}}{{end}}
{{template "outcomes" dict "Kind" "contact" "ID" $p.ID "Tab" $tab "D" $d}}
{{template "mailing" dict "P" $p "Tab" $tab "D" $d}}
</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}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="small">Accept</button></form>
<form method="post" action="/prospects/contact/{{$p.ID}}/reject"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><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}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><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 "Filter" $d.Signal}}
{{else}}
<form method="post" action="/prospects/contact/{{$p.ID}}/reconsider"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="secondary small">Reconsider</button></form>
{{end}}
<form method="post" action="/prospects/contact/{{$p.ID}}/delete" data-confirm="Delete {{$p.Name}}? Their steps in the funnel go too, and a CRM action not yet done is taken back. Anything already in EspoCRM stays there."><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="link small">Delete</button></form>
</div>
{{end}}
</div>
</li>
{{end}}
{{define "prospect-status"}}{{if eq . "new"}}new{{else if eq . "accepted"}}accepted{{else}}set aside{{end}}{{end}}
{{define "enrich-run"}}{{if .ID}}<span class="small {{if .Error}}error-text{{else}}muted{{end}}">Hunter.io {{ago .At}}: {{if .Error}}{{.Error}}{{else}}{{.Result}}{{end}}{{if .Credits}} ({{.Credits}} {{if eq .Credits 1.0}}credit{{else}}credits{{end}}){{end}}</span>{{end}}{{end}}
{{define "provenance"}}{{if eq .Source "manual"}}Added by hand{{else}}Found by {{sourceLabel .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}}"><input type="hidden" name="filter" value="{{.Filter}}"><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}}
{{define "signal-tag"}}{{$d := .D}}{{$cur := .SignalID}}
{{if $d.Signals}}
<form method="post" action="/prospects/{{.Kind}}/{{.ID}}/signal" class="signal-tag">
<input type="hidden" name="tab" value="{{$d.Tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}">
<label class="small">Signal
<select name="signal" data-autosubmit>
<option value="0">none</option>
{{range $d.Signals}}<option value="{{.ID}}" {{if eq .ID $cur}}selected{{end}}>{{.Name}}</option>{{end}}
</select>
</label>
<noscript><button type="submit" class="secondary small">Save</button></noscript>
</form>
{{end}}
{{end}}
{{define "outcomes"}}{{$d := .D}}{{$subject := printf "%s:%d" .Kind .ID}}
{{with index $d.Events $subject}}
<ol class="steps-done">
{{range .}}<li><span class="badge {{if eq .Stage "paid"}}published{{else}}draft{{end}}">{{stage .Stage}}</span> {{channel .Channel}} · {{ago .At}}{{if .ValueCents}} · {{money .ValueCents}}{{end}}{{with .Note}} · {{truncate 100 .}}{{end}}
{{if eq .Source "manual"}}<form method="post" action="/funnel/{{.ID}}/delete" class="inline" data-confirm="Remove this step?"><input type="hidden" name="back" value="{{$d.Back}}"><input type="hidden" name="tab" value="{{$d.Tab}}"><button type="submit" class="link small">remove</button></form>{{end}}</li>{{end}}
</ol>
{{end}}
<details class="outcome">
<summary class="small">Record an outcome</summary>
<form method="post" action="/prospects/{{.Kind}}/{{.ID}}/outcome" class="row wrap">
<input type="hidden" name="tab" value="{{.Tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}">
<label class="small">Step <select name="stage">{{range $d.Stages}}<option value="{{.ID}}">{{.Label}}</option>{{end}}</select></label>
<label class="small">Channel <select name="channel">{{range $d.Channels}}<option value="{{.ID}}">{{.Label}}</option>{{end}}</select></label>
<label class="small">Date <input type="date" name="date" value="{{$d.Today}}"></label>
<label class="small">Amount <input name="amount" inputmode="decimal" placeholder="for Paid, e.g. 70" size="8"></label>
<label class="small grow">Note <input name="note" placeholder="optional"></label>
<button type="submit" class="secondary small">Record</button>
</form>
</details>
{{end}}
{{define "mailing"}}{{$d := .D}}{{$p := .P}}
{{with index $d.OnLists $p.ID}}<p class="small muted">On {{range $i, $m := .}}{{if $i}}, {{end}}<strong>{{$m.List}}</strong>{{if not $m.Confirmed}} (asked to confirm){{end}} since {{ago $m.At}}{{end}}.</p>{{end}}
{{if and $d.MailingLists $p.Email}}
<details class="outcome">
<summary class="small">Add to a mailing list</summary>
<form method="post" action="/prospects/contact/{{$p.ID}}/list" class="row wrap">
<input type="hidden" name="tab" value="{{.Tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}">
<label class="small">List <select name="list">{{range $d.MailingLists}}<option value="{{.ID}}">{{.Name}}{{if .Double}} (double opt-in){{else}} (single opt-in){{end}}</option>{{end}}</select></label>
<label class="check small"><input type="checkbox" name="agreed"> They agreed to receive it</label>
<button type="submit" class="secondary small">Add</button>
</form>
<p class="small muted">Without their agreement, only a double opt-in list takes them: Listmonk asks them to confirm, and they get nothing until they do. A single opt-in list sends its mail straight away, so it needs their agreement.</p>
</details>
{{end}}
{{end}}