<%= if @delete_days_shifts do %> <.live_component module={Shift73kWeb.ModalComponent} id="modal" component={Shift73kWeb.ShiftAssignLive.DeleteComponent} opts={[ id: "delete-days-shifts-#{@current_user.id}", title: "Delete Shifts From Selected Days", delete_days_shifts: @delete_days_shifts, current_user: @current_user ]} /> <% end %>

Schedule Shifts

<%= form_for :template_select, "#", [phx_change: "change-selected-template"], fn sts -> %> <%= label sts, :template, "Select shift template to assign to dates", class: "form-label" %> <%= select sts, :template, @shift_templates, value: @shift_template && @shift_template.id || (@shift_template_options |> hd() |> elem(1)), class: "form-select" %> <% end %> <% details_button_class = "ms-2 btn btn-primary text-nowrap" details_button_class = if @show_template_btn_active, do: "#{details_button_class} active", else: details_button_class %>
<% template_details_div_class = "col-12 col-lg-9 col-xl-8 col-xxl-7 collapse" template_details_div_class = if @show_template_details, do: "#{template_details_div_class} show", else: template_details_div_class %>
<%= form_for @shift_template_changeset, "#", [phx_change: "validate-shift-template"], fn stf -> %>
<%= label stf, :subject, "Subject/Title", class: "form-label" %>
<%= text_input stf, :subject, value: input_value(stf, :subject), class: input_class(stf, :subject, "form-control"), phx_debounce: 250, disabled: @shift_template.id != @custom_shift.id, aria_describedby: error_ids(stf, :subject) %> <%= error_tag stf, :subject %>
<%= label stf, :time_start, "Start", class: "form-label" %> <%= time_input stf, :time_start, precision: :minute, value: input_value(stf, :time_start), class: input_class(stf, :time_start, "form-control"), disabled: @shift_template.id != @custom_shift.id, aria_describedby: error_ids(stf, :time_start), required: true %>
<%= label stf, :time_end, "End", class: "form-label" %> <%= time_input stf, :time_end, precision: :minute, value: input_value(stf, :time_end), class: input_class(stf, :time_end, "form-control"), disabled: @shift_template.id != @custom_shift.id, aria_describedby: error_ids(stf, :time_end), required: true %>
Shift length: <%= @shift_length %>
<%= error_tag stf, :time_start %>
<%= error_tag stf, :time_end %>
<%= label stf, :location, class: "form-label" %>
<%= text_input stf, :location, value: input_value(stf, :location), class: input_class(stf, :location, "form-control"), phx_debounce: 250, disabled: @shift_template.id != @custom_shift.id, aria_describedby: error_ids(stf, :location) %> <%= error_tag stf, :location %>
<%= label stf, :time_zone, class: "form-label" %>
<%= text_input stf, :time_zone, value: input_value(stf, :time_zone), class: input_class(stf, :time_zone, "form-control"), disabled: @shift_template.id != @custom_shift.id, phx_debounce: 250, list: "tz_list", placeholder: "Default: #{get_app_time_zone()}" %> <%= for tz_name <- Tzdata.zone_list() do %> <% end %> end <%= if @shift_template.id == @custom_shift.id do %>
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
<% end %> <%= error_tag stf, :time_zone %>
<%= label stf, :description, class: "form-label" %>
<%= textarea stf, :description, value: input_value(stf, :description), class: input_class(stf, :description, "form-control"), disabled: @shift_template.id != @custom_shift.id, phx_debounce: 250, aria_describedby: error_ids(stf, :description) %> <%= error_tag stf, :description %>
<% end %>
<%# month navigation %>

<%= Calendar.strftime(@cursor_date, "%B %Y") %>

<%# calendar month table display %> <%= for {day_name, _i} <- Enum.with_index(@day_names) do %> <% end %> <%= for week <- @week_rows do %> <%= for day <- week do %> <% end %> <% end %>
<%= day_name %>
<%= Calendar.strftime(day, "%d") %><%= if day.month != @cursor_date.month, do: "-#{Calendar.strftime(day, "%b")}" %> <% day_shifts = Enum.filter(@known_shifts, fn s -> s.date == day end) %> <% shifts_to_show = shifts_to_show(day_shifts) %> <%= for shift <- shifts_to_show do %> <%= format_shift_time(shift.time_start) %> <%= shift.subject %> <% end %> <%= if length(day_shifts) > 2 do %> <%= length(day_shifts) - 1 %> more… <% end %>