Import Shifts

If you have an iCal/ics formatted calendar hosted elsewhere, provide its URL here to import its events.

<%= form_for :ics_import, "#", [phx_change: "validate", phx_submit: "save"], fn iimf -> %> <% show_url_error = @url_validated && !@url_valid || false %> <% valid_class = @url_validated && "is-valid" || "" %> <%= label iimf, :ics_url, "iCal/ics URL", class: "form-label" %>
<%= url_input iimf, :ics_url, class: show_url_error && "form-control is-invalid" || "form-control #{valid_class}", phx_debounce: 500, aria_describedby: "ics-import-url-error" %> <%= if show_url_error do %>
Must be a valid URL
<% end %>
<%= label iimf, :time_zone, class: "form-label" %>
<%= text_input iimf, :time_zone, value: Shift73k.get_app_time_zone(), class: @tz_valid && "form-control" || "form-control is-invalid", phx_debounce: 250, aria_describedby: "ics-import-tz-error", list: "tz_list" %> <%= for tz_name <- Tzdata.zone_list() do %> <% end %>
Type to search & select from list of known <%= link "IANA tz database", to: "https://en.wikipedia.org/wiki/List_of_tz_database_time_zones", target: "_blank" %> time zones
<%= if !@tz_valid do %>
Invalid time zone
<% end %>
<%= submit "Submit", class: "btn btn-primary", disabled: !@tz_valid || !@url_valid %>
<% end %>