{{define "content"}}{{with .Data}}{{$tab := .Tab}}{{$matches := .Matches}}
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 the CRM queue. Each one keeps where and when it was found.
{{if and (eq $tab "new") (or .Companies .Loose)}}{{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}}
{{end}} {{range .Companies}}{{$c := .}}{{.}}
{{end}} {{with index $matches (printf "company:%d" .ID)}}{{template "crm-matches" .}}{{end}} {{if .Contacts}}Nothing to review. Add a prospect by hand; finding them for you comes next.
{{else if eq $tab "accepted"}}Nothing accepted yet.
{{else}}Nothing set aside.
{{end}}Already in your CRM: {{range $i, $r := .}}{{if $i}}, {{end}}{{$r.Entity}} {{$r.Name}}{{with $r.Email}} ({{.}}){{end}}{{end}}.
{{end}} {{define "crm-state"}} {{if eq .CRM.Status "done"}}{{if eq .CRM.Outcome "existing"}}already in the CRM{{else}}in the CRM{{end}} {{else if eq .CRM.Status "failed"}}failed CRM queue {{else if eq .CRM.Status "cancelled"}}cancelled {{else if eq .CRM.Status "claimed"}}with Hermes {{else if .CRM.Status}}waiting for Hermes {{else}}accepted{{end}} {{end}}