Files
osuuspuutarha/lib/osuuspuutarha_web/live/calendar_live/index.html.heex
2023-06-07 18:21:33 +03:00

42 lines
1.2 KiB
Plaintext

<h1>Listing Calendars</h1>
<%= if @live_action in [:new, :edit] do %>
<.modal return_to={Routes.calendar_index_path(@socket, :index)}>
<.live_component
module={OsuuspuutarhaWeb.CalendarLive.FormComponent}
id={@calendar.id || :new}
title={@page_title}
action={@live_action}
calendar={@calendar}
return_to={Routes.calendar_index_path(@socket, :index)}
/>
</.modal>
<% end %>
<table>
<thead>
<tr>
<th>Pickup date</th>
<th>Is picked up</th>
<th></th>
</tr>
</thead>
<tbody id="calendars">
<%= for calendar <- @calendars do %>
<tr id={"calendar-#{calendar.id}"}>
<td><%= calendar.pickup_date %></td>
<td><%= calendar.is_picked_up %></td>
<td>
<span><%= live_redirect "Show", to: Routes.calendar_show_path(@socket, :show, calendar) %></span>
<span><%= live_patch "Edit", to: Routes.calendar_index_path(@socket, :edit, calendar) %></span>
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: calendar.id, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= live_patch "New Calendar", to: Routes.calendar_index_path(@socket, :new) %></span>