44 lines
1.3 KiB
Plaintext
44 lines
1.3 KiB
Plaintext
<h1>Hello Albert!</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 %>
|
|
|
|
<span><%= live_patch "New Yield", to: Routes.yield_index_path(@socket, :new) %></span>
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Date</th>
|
|
<th>Plant</th>
|
|
<th>Amount</th>
|
|
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="yields">
|
|
<%= for yield <- @yields do %>
|
|
<tr id={"yield-#{yield.id}"}>
|
|
<td><%= yield.date.day %>.<%= yield.date.month %></td>
|
|
<td><%= Osuuspuutarha.Harvest.Parser.parse_plant(yield.plant) %></td>
|
|
<td><%= yield.amount %> <%= 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>
|