bones73k/lib/real_estate_web/live/property_live/index.html.leex
Joao Gilberto Balsini Moura 4526435972 Run mix phx.gen.live properties
2020-09-14 13:22:25 -03:00

39 lines
1.2 KiB
Text

<h1>Listing Properties</h1>
<%= if @live_action in [:new, :edit] do %>
<%= live_modal @socket, RealEstateWeb.PropertyLive.FormComponent,
id: @property.id || :new,
title: @page_title,
action: @live_action,
property: @property,
return_to: Routes.property_index_path(@socket, :index) %>
<% end %>
<table>
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th>Description</th>
<th></th>
</tr>
</thead>
<tbody id="properties">
<%= for property <- @properties do %>
<tr id="property-<%= property.id %>">
<td><%= property.name %></td>
<td><%= property.price %></td>
<td><%= property.description %></td>
<td>
<span><%= live_redirect "Show", to: Routes.property_show_path(@socket, :show, property) %></span>
<span><%= live_patch "Edit", to: Routes.property_index_path(@socket, :edit, property) %></span>
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: property.id, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= live_patch "New Property", to: Routes.property_index_path(@socket, :new) %></span>