| 1 | {{define "title"}}{{.Title}}{{end}} |
| 2 | {{define "content"}} |
| 3 | <header rst-page-header> |
| 4 | <div rst-page-header-titles> |
| 5 | <h1>{{.Data.Title}}</h1> |
| 6 | <p rst-page-header-sub>{{if .Data.RescheduleToken}}Pick a new time.{{else}}{{duration .Data.DurationMin}} with {{.Data.HostName}}.{{end}}</p> |
| 7 | </div> |
| 8 | </header> |
| 9 | |
| 10 | {{with .Data.Description}}<p>{{.}}</p>{{end}} |
| 11 | |
| 12 | {{if .Data.Gone}} |
| 13 | {{template "callout" dict "Tone" "warning" "Body" "That time has just gone. The times still free are below." "Alert" true}} |
| 14 | {{end}} |
| 15 | {{with .Data.Error}} |
| 16 | {{template "callout" dict "Tone" "negative" "Body" . "Alert" true}} |
| 17 | {{end}} |
| 18 | |
| 19 | {{/* The zone, as a plain form. Scriptless it is a select and a button; |
| 20 | booking.js may preselect the browser's zone when none was chosen |
| 21 | (data-chosen says one was). */}} |
| 22 | <form method="get" action="{{.Data.Path}}" cal-book-zone-form> |
| 23 | {{if .Data.Day}}<input type="hidden" name="day" value="{{.Data.Day}}">{{end}} |
| 24 | <label rst-field-label for="zone">Times shown in</label> |
| 25 | <select rst-input="short" id="zone" name="zone" cal-book-zone{{if .Data.ZoneChosen}} data-chosen="1"{{end}}> |
| 26 | {{range .Data.Zones}}<option value="{{.}}"{{if eq . $.Data.Zone}} selected{{end}}>{{.}}</option>{{end}} |
| 27 | </select> |
| 28 | <button rst-btn="ghost compact" type="submit">Change</button> |
| 29 | </form> |
| 30 | |
| 31 | {{if .Data.Picked}} |
| 32 | {{/* Step two: the slot is fixed; now who is booking it. */}} |
| 33 | <section rst-box> |
| 34 | <header rst-box-head><h2>{{.Data.DayLabel}}, {{.Data.Picked.Label}}</h2></header> |
| 35 | <form rst-form method="post" action="{{.Data.Path}}" cal-book-details> |
| 36 | <input type="hidden" name="start" value="{{.Data.Picked.StartUTC}}"> |
| 37 | <input type="hidden" name="zone" value="{{.Data.Zone}}"> |
| 38 | {{template "field" dict "ID" "name" "Name" "name" "Label" "Your name" "Value" .Data.Name "Required" true "Autofocus" true |
| 39 | "Error" (if_eq .Data.ErrorField "name" .Data.Error)}} |
| 40 | {{template "field" dict "ID" "address" "Name" "address" "Label" "Your email" "Type" "email" "Value" .Data.Address "Required" true |
| 41 | "Help" "A link to confirm goes here, and nothing else does." |
| 42 | "Error" (if_eq .Data.ErrorField "address" .Data.Error)}} |
| 43 | {{template "field-textarea" dict "Name" "note" "Label" "Anything to say beforehand?" "Value" .Data.Note "Rows" 3 |
| 44 | "Error" (if_eq .Data.ErrorField "note" .Data.Error)}} |
| 45 | {{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"}} |
| 46 | </form> |
| 47 | </section> |
| 48 | {{else if .Data.Day}} |
| 49 | {{/* Step one: this day's slots, each a form of its own. */}} |
| 50 | <p><a href="{{.Data.Path}}?zone={{.Data.Zone}}">← Other days</a></p> |
| 51 | <h2>{{.Data.DayLabel}}</h2> |
| 52 | {{if .Data.Slots}} |
| 53 | <div cal-book-slots> |
| 54 | {{range .Data.Slots}} |
| 55 | <form method="post" action="{{$.Data.Path}}"> |
| 56 | <input type="hidden" name="start" value="{{.StartUTC}}"> |
| 57 | <input type="hidden" name="zone" value="{{$.Data.Zone}}"> |
| 58 | {{with $.Data.Rev}}<input type="hidden" name="rev" value="{{.}}">{{end}} |
| 59 | <button rst-btn type="submit" cal-book-slot>{{.Label}}</button> |
| 60 | </form> |
| 61 | {{end}} |
| 62 | </div> |
| 63 | {{else}} |
| 64 | {{template "empty-state" dict "Body" "Nothing free that day any more."}} |
| 65 | {{end}} |
| 66 | {{else}} |
| 67 | {{if .Data.Days}} |
| 68 | <ul cal-book-days> |
| 69 | {{range .Data.Days}} |
| 70 | <li><a href="{{$.Data.Path}}?day={{.Date}}&zone={{$.Data.Zone}}">{{.Label}}</a> <small>{{.Count}} free</small></li> |
| 71 | {{end}} |
| 72 | </ul> |
| 73 | {{else}} |
| 74 | {{template "empty-state" dict "Body" "Nothing free in the next while. Try again in a few days."}} |
| 75 | {{end}} |
| 76 | {{end}} |
| 77 | {{end}} |
| 78 | |