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

{{.Data.Heading}}

{{with .Data.Error}} {{template "callout" dict "Tone" "negative" "Body" . "Alert" true}} {{end}}
{{if and .Data.Series .Data.Occurrence}} {{/* Asked BEFORE the fields, not after: which occurrences this applies to changes what every field below means. "Just this one" is first and checked, because an edit that silently changed a year of standups is the most expensive default in the app. */}} {{template "choice-field" dict "Legend" "This repeats. What should this change?" "Name" "scope" "Type" "radio" "Options" (list (dict "Value" "this" "Title" "Just this one" "Desc" "The rest of the series keeps its current time and details." "Checked" true) (dict "Value" "following" "Title" "This one and everything after it" "Desc" "Earlier occurrences are left alone. The series is split in two from here.") (dict "Value" "all" "Title" "Every occurrence" "Desc" "Past ones included."))}} {{end}} {{template "field" dict "ID" "title" "Name" "title" "Label" "What is it?" "Value" .Data.EventTitle "Required" true "Autofocus" true "Error" (if_eq .Data.ErrorField "title" .Data.Error)}} {{if .Data.Booked}} {{/* A BOOKED meeting's scheduling belongs to the person who booked it (booking spec B18). The controls are shown disabled, and the stored values ride along as hidden inputs — a disabled control submits nothing, and a title-only save has to submit exactly what is stored to pass the comparison (B25). tz is the EVENT's own, not the host's profile zone. */}} {{if .Data.AllDay}}{{end}}
This is a booked meeting{{with .Data.BookedBy}} with {{.}}{{end}}. Its time is changed by the person who booked it, or by cancelling and letting them rebook. {{with (if_eq .Data.ErrorField "start" .Data.Error)}}{{.}}{{end}}
{{else}} {{/* Three kinds, one radio group, and the descriptions say what the difference actually is — because "meeting / commitment / note" without them is three words nobody can choose between. They differ in reminder defaults, in whether they count toward the day's booked hours, and in how they draw. */}} {{template "choice-field" dict "Legend" "What kind of thing?" "Name" "kind" "Type" "radio" "Options" (list (dict "Value" "meeting" "Title" "A meeting" "Desc" "Other people are in it. Being late matters." "Checked" (eq .Data.Kind "meeting")) (dict "Value" "commitment" "Title" "A commitment" "Desc" "Time you have promised yourself. It fills the day, but only you are inconvenienced when it moves." "Checked" (eq .Data.Kind "commitment")) (dict "Value" "note" "Title" "A note" "Desc" "True of the day without occupying any of it — a birthday, a deadline, a bin collection." "Checked" (eq .Data.Kind "note")))}} {{template "field-check" dict "Name" "all_day" "Value" "1" "Label" "All day" "Checked" .Data.AllDay}} {{/* An all-day event's times are DATES, and a datetime-local input refuses a bare date: it renders blank, and the form then cannot be saved without retyping both. So an all-day event gets date inputs. Ticking All day without script cannot swap the input, which is why readEventForm takes either shape. datetime.js enhances both into a picker with natural-language parsing. Without it they are ordinary inputs, which is a working floor. */}} {{if .Data.AllDay}} {{template "field-date" dict "Name" "start" "Label" "Starts" "Value" .Data.StartLocal "Required" true "Error" (if_eq .Data.ErrorField "start" .Data.Error)}} {{template "field-date" dict "Name" "end" "Label" "Ends" "Value" .Data.EndLocal "Required" true "Hint" "The end is exclusive: an all-day event on the 2nd ends on the 3rd." "Error" (if_eq .Data.ErrorField "end" .Data.Error)}} {{else}} {{template "field-datetime" dict "Name" "start" "Label" "Starts" "Value" .Data.StartLocal "Required" true "Error" (if_eq .Data.ErrorField "start" .Data.Error)}} {{template "field-datetime" dict "Name" "end" "Label" "Ends" "Value" .Data.EndLocal "Required" true "Hint" "The end is exclusive: an all-day event on the 2nd ends on the 3rd." "Error" (if_eq .Data.ErrorField "end" .Data.Error)}} {{end}} {{template "field-select" dict "ID" "repeat" "Name" "repeat" "Label" "Repeats" "Options" (repeatOptions .Data.StartLocal .Data.TZ .Data.AllDay .Data.Repeat)}} {{template "field-date" dict "Name" "repeat_end" "Label" "Repeat until" "Value" .Data.RepeatEnd "Hint" "Leave empty for a series with no end."}} {{end}} {{template "field" dict "ID" "location" "Name" "location" "Label" "Where" "Value" .Data.Location}} {{template "field-textarea" dict "Name" "notes" "Label" "Notes" "Value" .Data.Notes "Rows" 4}} {{template "field-select" dict "ID" "calendar_id" "Name" "calendar_id" "Label" "Calendar" "Options" (calendarOptions .Data.Calendars .Data.CalendarID)}} {{template "field-select" dict "ID" "status" "Name" "status" "Label" "Status" "Error" (if_eq .Data.ErrorField "status" .Data.Error) "Options" (list (dict "Value" "confirmed" "Label" "Confirmed" "Selected" (eq .Data.Status "confirmed")) (dict "Value" "tentative" "Label" "Tentative" "Selected" (eq .Data.Status "tentative")) (dict "Value" "cancelled" "Label" "Cancelled" "Selected" (eq .Data.Status "cancelled")))}} {{template "form-foot" dict "Submit" .Data.Submit "CancelHref" (eventCancelHref .Data.EventID) "CancelLabel" "Cancel"}}
{{end}}