{{define "title"}}{{.Title}}{{end}} {{define "content"}}

{{.Data.Title}}

{{if .Data.RescheduleToken}}Pick a new time.{{else}}{{duration .Data.DurationMin}} with {{.Data.HostName}}.{{end}}

{{with .Data.Description}}

{{.}}

{{end}} {{if .Data.Gone}} {{template "callout" dict "Tone" "warning" "Body" "That time has just gone. The times still free are below." "Alert" true}} {{end}} {{with .Data.Error}} {{template "callout" dict "Tone" "negative" "Body" . "Alert" true}} {{end}} {{/* The zone, as a plain form. Scriptless it is a select and a button; booking.js may preselect the browser's zone when none was chosen (data-chosen says one was). */}}
{{if .Data.Day}}{{end}}
{{if .Data.Picked}} {{/* Step two: the slot is fixed; now who is booking it. */}}

{{.Data.DayLabel}}, {{.Data.Picked.Label}}

{{template "field" dict "ID" "name" "Name" "name" "Label" "Your name" "Value" .Data.Name "Required" true "Autofocus" true "Error" (if_eq .Data.ErrorField "name" .Data.Error)}} {{template "field" dict "ID" "address" "Name" "address" "Label" "Your email" "Type" "email" "Value" .Data.Address "Required" true "Help" "A link to confirm goes here, and nothing else does." "Error" (if_eq .Data.ErrorField "address" .Data.Error)}} {{template "field-textarea" dict "Name" "note" "Label" "Anything to say beforehand?" "Value" .Data.Note "Rows" 3 "Error" (if_eq .Data.ErrorField "note" .Data.Error)}} {{template "form-foot" dict "Submit" "Hold this time" "CancelHref" (printf "%s?day=%s&zone=%s" .Data.Path .Data.Day .Data.Zone) "CancelLabel" "Pick another time"}}
{{else if .Data.Day}} {{/* Step one: this day's slots, each a form of its own. */}}

← Other days

{{.Data.DayLabel}}

{{if .Data.Slots}}
{{range .Data.Slots}}
{{with $.Data.Rev}}{{end}}
{{end}}
{{else}} {{template "empty-state" dict "Body" "Nothing free that day any more."}} {{end}} {{else}} {{if .Data.Days}} {{else}} {{template "empty-state" dict "Body" "Nothing free in the next while. Try again in a few days."}} {{end}} {{end}} {{end}}