oficina / calendar Public

Clone
git clone https://amadan.net/oficina/calendar

Plain git — no account needed to clone.

Download

Download this file

1{{define "title"}}{{.Title}}{{end}}
2{{define "content"}}
3<header rst-page-header>
4 <div rst-page-header-titles>
5 <h1>{{.Data.Heading}}</h1>
6 </div>
7</header>
8
9{{with .Data.Error}}
10{{template "callout" dict "Tone" "negative" "Body" . "Alert" true}}
11{{end}}
12
13<form rst-form method="post" action="{{.Data.Action}}" cal-book-form>
14 {{template "field" dict
15 "ID" "title" "Name" "title" "Label" "What is it?"
16 "Value" .Data.Title "Required" true "Autofocus" true
17 "Placeholder" "Quick chat"
18 "Error" (if_eq .Data.ErrorField "title" .Data.Error)}}
19
20 {{template "field-textarea" dict
21 "Name" "description" "Label" "A line or two for the person booking"
22 "Value" .Data.Description "Rows" 2
23 "Error" (if_eq .Data.ErrorField "description" .Data.Error)}}
24
25 {{/* The sentence. ONE parser reads it, on the server; booking.js
26 only asks that parser while you type. Scriptless, the pane
27 below is filled in when the form comes back. */}}
28 <div rst-field>
29 <label rst-field-label for="availability">When are you free?</label>
30 <textarea rst-textarea id="availability" name="availability" rows="2" cal-book-text
31 placeholder="mondays 12–3, tuesdays 12–2, 5–7">{{.Data.Availability}}</textarea>
32 <small rst-field-hint>Days and times, in your own zone. Commas between clauses; a clause with no day keeps the day before it.</small>
33 {{with (if_eq .Data.ErrorField "availability" .Data.Error)}}<small rst-field-error>{{.}}</small>{{end}}
34 </div>
35 <div id="cal-book-pane" cal-book-pane aria-live="polite">
36 {{template "bookingpane" .Data.Pane}}
37 </div>
38
39 {{template "field-select" dict
40 "ID" "duration_min" "Name" "duration_min" "Label" "How long is a slot?"
41 "Options" (list
42 (dict "Value" "15" "Label" "15 minutes" "Selected" (eq .Data.DurationMin "15"))
43 (dict "Value" "20" "Label" "20 minutes" "Selected" (eq .Data.DurationMin "20"))
44 (dict "Value" "30" "Label" "30 minutes" "Selected" (eq .Data.DurationMin "30"))
45 (dict "Value" "45" "Label" "45 minutes" "Selected" (eq .Data.DurationMin "45"))
46 (dict "Value" "60" "Label" "An hour" "Selected" (eq .Data.DurationMin "60"))
47 (dict "Value" "90" "Label" "An hour and a half" "Selected" (eq .Data.DurationMin "90"))
48 (dict "Value" "120" "Label" "Two hours" "Selected" (eq .Data.DurationMin "120")))
49 "Error" (if_eq .Data.ErrorField "duration_min" .Data.Error)}}
50
51 {{template "field" dict
52 "ID" "buffer_min" "Name" "buffer_min" "Label" "Minutes between slots"
53 "Value" .Data.BufferMin "Type" "number" "Min" "0" "Max" "120" "Short" true
54 "Error" (if_eq .Data.ErrorField "buffer_min" .Data.Error)}}
55
56 {{template "field" dict
57 "ID" "notice_min" "Name" "notice_min" "Label" "Minimum notice, in minutes"
58 "Value" .Data.NoticeMin "Type" "number" "Min" "0" "Max" "10080" "Short" true
59 "Help" "Nothing is ever offered less than ten minutes ahead."
60 "Error" (if_eq .Data.ErrorField "notice_min" .Data.Error)}}
61
62 {{template "field" dict
63 "ID" "horizon_days" "Name" "horizon_days" "Label" "How far ahead, in days"
64 "Value" .Data.HorizonDays "Type" "number" "Min" "1" "Max" "90" "Short" true
65 "Error" (if_eq .Data.ErrorField "horizon_days" .Data.Error)}}
66
67 {{template "form-foot" dict "Submit" .Data.Submit "CancelHref" "/settings/booking" "CancelLabel" "Cancel"}}
68</form>
69{{end}}
70