Autogen Yield liveviews

This commit is contained in:
2023-06-08 21:07:00 +03:00
parent 090053c312
commit 3a983516c9
13 changed files with 578 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<h1>Listing Yields</h1>
<%= if @live_action in [:new, :edit] do %>
<.modal return_to={Routes.yield_index_path(@socket, :index)}>
<.live_component
module={OsuuspuutarhaWeb.YieldLive.FormComponent}
id={@yield.id || :new}
title={@page_title}
action={@live_action}
yield={@yield}
return_to={Routes.yield_index_path(@socket, :index)}
/>
</.modal>
<% end %>
<table>
<thead>
<tr>
<th>Date</th>
<th>Plant</th>
<th>Amount</th>
<th>Unit</th>
<th></th>
</tr>
</thead>
<tbody id="yields">
<%= for yield <- @yields do %>
<tr id={"yield-#{yield.id}"}>
<td><%= yield.date %></td>
<td><%= yield.plant %></td>
<td><%= yield.amount %></td>
<td><%= yield.unit %></td>
<td>
<span><%= live_redirect "Show", to: Routes.yield_show_path(@socket, :show, yield) %></span>
<span><%= live_patch "Edit", to: Routes.yield_index_path(@socket, :edit, yield) %></span>
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: yield.id, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= live_patch "New Yield", to: Routes.yield_index_path(@socket, :new) %></span>