<%= if @live_action in [:new, :edit, :clone] do %> <%= live_modal @socket, Shift73kWeb.ShiftTemplateLive.FormComponent, id: @shift_template.id || :new, title: @page_title, action: @live_action, shift_template: @shift_template, current_user: @current_user %> <% end %> <%= if @delete_shift_template do %> <%= live_modal @socket, Shift73kWeb.ShiftTemplateLive.DeleteComponent, id: @delete_shift_template.id, title: "Delete Shift Template", delete_shift_template: @delete_shift_template, current_user: @current_user %> <% end %>

<%= icon_div @socket, "bi-clock-history", [class: "icon baseline"] %> My Shift Templates

<%= live_patch to: Routes.shift_template_index_path(@socket, :new), class: "btn btn-primary" do %> <%= icon_div @socket, "bi-plus-circle-dotted", [class: "icon baseline me-1"] %> New Shift Template <% end %>
<%= for template <- @shift_templates do %>
Subject:
<%= template.subject %> <%= if template.id == @current_user.fave_shift_template_id do %> <%= icon_div @socket, "bi-star-fill", [class: "icon baseline text-primary align-self-start ms-2", phx_click: "unset-user-fave-shift-template"] %> <% else %> <%= icon_div @socket, "bi-star", [class: "icon baseline text-primary align-self-start ms-2", phx_click: "set-user-fave-shift-template", phx_value_id: template.id] %> <% end %>
<%= icon_div @socket, "bi-hourglass", [class: "icon text-muted"] %> Hours: <%= template.time_start |> Timex.format!("{h12}:{m}{am}") %> — <%= template.time_end |> Timex.format!("{h12}:{m}{am}") %> Shift length: (<%= format_shift_length(template) %>) TZ: <%= template.time_zone %>
<%= icon_div @socket, "bi-geo", [class: "icon baseline text-muted"] %> Location: <%= if template.location do %> <%= template.location %> <% else %> none <% end %>
<%= icon_div @socket, "bi-justify-left", [class: "icon baseline text-muted"] %> Description: <%= if template.description do %> <%= text_to_html template.description %> <% else %> none <% end %>
<%= if Roles.can?(@current_user, template, :edit) do %> <%= live_patch to: Routes.shift_template_index_path(@socket, :edit, template), class: "btn btn-primary btn-sm text-nowrap" do %> <%= icon_div @socket, "bi-pencil", [class: "icon baseline", style: "margin-right:0.125rem;"] %> Edit <% end %> <% end %> <%= if Roles.can?(@current_user, template, :clone) do %> <%= live_patch to: Routes.shift_template_index_path(@socket, :clone, template), class: "btn btn-outline-primary btn-sm text-nowrap" do %> <%= icon_div @socket, "bi-clipboard-plus", [class: "icon baseline", style: "margin-right:0.125rem;"] %> Clone <% end %> <% end %> <%#= button "" %> <%= if Roles.can?(@current_user, template, :delete) do %> <% end %>
<% end %>