shift73k/lib/shift73k_web/live/shift_template_live/index.html.leex

55 lines
1.8 KiB
Text

<%= if @live_action in [:new, :edit] 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 %>
<div class="d-flex justify-content-between d-flex align-items-center">
<h2>
<%= icon_div @socket, "bi-clock-history", [class: "icon baseline"] %>
My Shift Templates
</h2>
<%= live_patch "New Shift Template", to: Routes.shift_template_index_path(@socket, :new), class: "btn btn-primary" %>
</div>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Label</th>
<th>Subject</th>
<th>Description</th>
<th>Location</th>
<th>Timezone</th>
<th>Start time</th>
<th>Length</th>
<th></th>
</tr>
</thead>
<tbody id="shift_templates">
<%= for shift_template <- @shift_templates do %>
<tr id="shift_template-<%= shift_template.id %>">
<td><%= shift_template.label %></td>
<td><%= shift_template.subject %></td>
<td><%= shift_template.description %></td>
<td><%= shift_template.location %></td>
<td><%= shift_template.timezone %></td>
<td><%= shift_template.start_time |> Calendar.strftime("%I:%M %p") %></td>
<td><%= shift_template.length_hours %>h <%= shift_template.length_minutes || 0 %>m</td>
<td>
<span><%= live_redirect "Show", to: Routes.shift_template_show_path(@socket, :show, shift_template) %></span>
<span><%= live_patch "Edit", to: Routes.shift_template_index_path(@socket, :edit, shift_template) %></span>
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: shift_template.id, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>