package web import ( "strconv" "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" ) // MapServer serves the map tiles, styles and the MapLibre library the // region maps load. const MapServer = "https://maps.zb-server.de" // coord formats a coordinate for an attribute or input, empty for none. func coord(f *float64) string { if f == nil { return "" } return strconv.FormatFloat(*f, 'f', -1, 64) } // HasLocation reports whether r has a place on the map. func (r RegionOption) HasLocation() bool { return r.Lat != nil && r.Lon != nil } // HasLocation reports whether r has a place on the map. func (r Region) HasLocation() bool { return r.Lat != nil && r.Lon != nil } // regionMap is a map of the regions marked with data-lat and data-lon // inside the element items selects. In "select" mode a click on a marker // toggles the region's checkbox; in "edit" mode a click on the map fills // the active [data-location-form]. The script shows it once the map loads. templ regionMap(mode, items string) { } // locationFields are the coordinate inputs of a region; empty ones remove // the location. templ locationFields(lat, lon *float64) {
for _, f := range []struct { label, name, value, min, max string }{ {i18n.T(ctx, "regions.latitude"), "latitude", coord(lat), "-90", "90"}, {i18n.T(ctx, "regions.longitude"), "longitude", coord(lon), "-180", "180"}, } { }
}