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:
+33
-1
@@ -8,8 +8,17 @@ import (
|
||||
"supermarket/internal/content"
|
||||
"supermarket/internal/inventory"
|
||||
"supermarket/internal/profile"
|
||||
"supermarket/internal/prospects"
|
||||
)
|
||||
|
||||
// prospectBadge is a prospect's status as search shows it.
|
||||
func prospectBadge(status string) string {
|
||||
if status == prospects.StatusRejected {
|
||||
return "set aside"
|
||||
}
|
||||
return status
|
||||
}
|
||||
|
||||
// hit is one search result.
|
||||
type hit struct {
|
||||
Title, Detail, Link string
|
||||
@@ -143,6 +152,29 @@ func (s *Server) search(q string) ([]hitGroup, error) {
|
||||
posts = append(posts, hit{Title: text, Detail: detail, Link: link, Badge: d.Status})
|
||||
}
|
||||
|
||||
companies, people, err := prospects.Search(s.DB, words, searchLimit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var prospectHits []hit
|
||||
for _, c := range companies {
|
||||
detail := "Company"
|
||||
if c.Domain != "" {
|
||||
detail += " · " + c.Domain
|
||||
}
|
||||
prospectHits = append(prospectHits, hit{Title: c.Name, Detail: detail, Link: "/prospects?status=" + c.Status, Badge: prospectBadge(c.Status)})
|
||||
}
|
||||
for _, p := range people {
|
||||
detail := "Person"
|
||||
if p.Title != "" {
|
||||
detail += " · " + p.Title
|
||||
}
|
||||
if p.Email != "" {
|
||||
detail += " · " + p.Email
|
||||
}
|
||||
prospectHits = append(prospectHits, hit{Title: p.Name(), Detail: detail, Link: "/prospects?status=" + p.Status, Badge: prospectBadge(p.Status)})
|
||||
}
|
||||
|
||||
var settings []hit
|
||||
if p, err := profile.Load(s.DB); err == nil && p.IsSet() {
|
||||
for _, pr := range p.Products {
|
||||
@@ -158,7 +190,7 @@ func (s *Server) search(q string) ([]hitGroup, error) {
|
||||
}
|
||||
|
||||
var groups []hitGroup
|
||||
for _, g := range []hitGroup{{"Posts", posts}, {"Fetched items", found}, {"Inventory", inv}, {"Settings", settings}} {
|
||||
for _, g := range []hitGroup{{"Posts", posts}, {"Fetched items", found}, {"Inventory", inv}, {"Prospects", prospectHits}, {"Settings", settings}} {
|
||||
if len(g.Hits) > 0 {
|
||||
groups = append(groups, g)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user