{{/* abono/owner-members: GET /admin/members, every holding with its status and where it came from, "sync with Stripe now", the paying subscriptions no plan recognises (each with a form that puts it onto a plan), and the form that gives a free membership (a comp). A comp still granting has a link to its own confirm page, which ends it. A subscription held only by abono's 30-day backstop is flagged with the day access stops. Data: Title string, the page title's message key On bool, Stripe (or the sandbox) is configured Members []abonoMember, {Subject, Label, Holding, EndURL}: Label is what to call the member Unrecognised []abonoUnrecognised, {SubscriptionID, PriceID, Subject, Label, ...}; empty while Stripe is off Now time.Time, the moment holdings are described at Offers []abono.Offer, the plans a comp can give PlanOptions []abonoOption, the same as field-select options AdoptOptions []abonoOption, the plans, none selected, for adopting Form abonoCompForm, {Member, Plan, Ends, Note, Errors}: the comp form as posted, Errors a message key by field SyncAction string, where "sync now" posts CompAction string, where the comp form posts AdoptAction string, where an adopt form posts (with from=members) StripeURL string, the Stripe page Done *abonoNotice, {Kind, N, Plan}: what the last action did Error string, a message key, or "" L the request's localizer */}} {{define "content"}}{{$L := localizer $}} {{template "page-header" dict "L" $L "Title" (T $L .Title) "Sub" (T $L "abono.owner.members_intro")}} {{with .Done}}{{if eq .Kind "sync"}}{{if eq .N 1}}{{template "notice" (T $L "abono.owner.sync_done_one")}}{{else}}{{template "notice" (Tf $L "abono.owner.sync_done" "n" .N)}}{{end}}{{else if eq .Kind "comp"}}{{template "notice" (Tf $L "abono.owner.free_given" "plan" .Plan)}}{{else if eq .Kind "end"}}{{template "notice" (T $L "abono.owner.end_done")}}{{else if eq .Kind "adopt"}}{{template "notice" (Tf $L "abono.owner.adopted" "plan" .Plan)}}{{end}}{{end}} {{with .Error}}{{template "callout" dict "L" $L "Tone" "negative" "Focus" true "Body" (T $L .)}}{{end}} {{if .On}}

{{T $L "abono.owner.sync_help"}}

{{else}}

{{T $L "abono.owner.nothing_for_sale"}} {{T $L "abono.owner.stripe_title"}}

{{end}} {{if .Members}}
{{range .Members}} {{end}}
{{T $L "abono.owner.col_member"}}{{T $L "abono.owner.col_plan"}}{{T $L "abono.owner.col_status"}}{{T $L "abono.owner.col_source"}}
{{.Label}} {{.Plan}} {{template "abono-status" dict "L" $L "Holding" .Holding "Now" $.Now}}{{if .Holding.Backstop}}{{$s := .Holding.Describe $.Now}} {{$s.Sentence (T $L "abono.owner.backstop") ""}}{{end}} {{if eq .Source "comp"}}{{T $L "abono.owner.source_free"}}{{with .EndURL}} {{T $L "abono.button.end_free"}}{{end}}{{else}}{{T $L "abono.owner.source_paid"}}{{end}}
{{else}}{{template "empty-state" dict "L" $L "Body" (T $L "abono.owner.members_empty")}} {{end}} {{if .On}}

{{T $L "abono.owner.unrecognised_title"}}

{{if .Unrecognised}}

{{T $L "abono.owner.unrecognised_body"}}

{{T $L "abono.owner.unrecognised_warn"}}

{{range .Unrecognised}}

{{.SubscriptionID}} {{.PriceID}} {{.Label}}

{{template "field-select" dict "L" $L "ID" (printf "abono-adopt-%s" .SubscriptionID) "Name" "plan" "Label" (T $L "abono.owner.adopt_plan") "Options" $.AdoptOptions "Required" true}}
{{end}} {{else}}

{{T $L "abono.owner.unrecognised_none"}}

{{end}}
{{end}} {{if .Offers}}{{$memberErr := ""}}{{$planErr := ""}}{{with .Form.Errors}}{{with index . "member"}}{{$memberErr = T $L .}}{{end}}{{with index . "plan"}}{{$planErr = T $L .}}{{end}}{{end}}

{{T $L "abono.owner.free_title"}}

{{T $L "abono.owner.free_help"}}

{{template "field-text" dict "L" $L "Name" "member" "Label" (T $L "abono.owner.free_member") "Type" "email" "Value" .Form.Member "Required" true "Autocomplete" "off" "Error" $memberErr}} {{template "field-select" dict "L" $L "ID" "plan" "Name" "plan" "Label" (T $L "abono.owner.free_plan") "Options" .PlanOptions "Required" true "Error" $planErr}} {{template "field-date" dict "L" $L "Name" "ends" "Label" (T $L "abono.owner.free_ends") "Value" .Form.Ends "Hint" (T $L "abono.owner.free_ends_hint") "Plain" true}} {{template "field-text" dict "L" $L "Name" "note" "Label" (T $L "abono.owner.free_note") "Value" .Form.Note "Hint" (T $L "abono.owner.free_note_hint")}} {{template "form-foot" dict "L" $L "Submit" (T $L "abono.button.give_free")}}
{{end}} {{end}}