add blank ammo types page

This commit is contained in:
shibao 2022-02-01 00:12:09 -05:00
parent 1b33632c29
commit cccc5aafc7

View File

@ -3,42 +3,52 @@
Listing Ammo Types Listing Ammo Types
</h1> </h1>
<%= live_patch "New Ammo type", <%= if @ammo_types |> Enum.empty?() do %>
to: Routes.ammo_type_index_path(@socket, :new), <h2 class="title text-xl text-primary-500">
class: "btn btn-primary" %> No Ammo Types 😔
</h2>
<div class="w-full overflow-x-auto border border-gray-600 rounded-lg shadow-lg bg-black"> <%= live_patch "Add your first type!",
<table class="min-w-full table-auto text-center bg-white"> to: Routes.ammo_type_index_path(@socket, :new),
<thead class="border-b border-primary-600"> class: "btn btn-primary" %>
<tr> <% else %>
<th class="p-2">Name</th> <%= live_patch "New Ammo type",
<th class="p-2">Case material</th> to: Routes.ammo_type_index_path(@socket, :new),
<th class="p-2">Bullet type</th> class: "btn btn-primary" %>
<th class="p-2">Grain</th>
<th class="p-2">Manufacturer</th>
<th class="p-2"></th> <div class="w-full overflow-x-auto border border-gray-600 rounded-lg shadow-lg bg-black">
</tr> <table class="min-w-full table-auto text-center bg-white">
</thead> <thead class="border-b border-primary-600">
<tbody> <tr>
<%= for ammo_type <- @ammo_types do %> <th class="p-2">Name</th>
<tr id={"ammo_type-#{ammo_type.id}"}> <th class="p-2">Case material</th>
<td class="p-2"><%= ammo_type.name %></td> <th class="p-2">Bullet type</th>
<td class="p-2"><%= ammo_type.case_material %></td> <th class="p-2">Grain</th>
<td class="p-2"><%= ammo_type.bullet_type %></td> <th class="p-2">Manufacturer</th>
<td class="p-2"><%= ammo_type.grain %></td>
<td class="p-2"><%= ammo_type.manufacturer %></td>
<td class="p-2 w-full h-full space-y-2 flex flex-col justify-center items-center"> <th class="p-2"></th>
<span><%= live_redirect "Show", to: Routes.ammo_type_show_path(@socket, :show, ammo_type) %></span>
<span><%= live_patch "Edit", to: Routes.ammo_type_index_path(@socket, :edit, ammo_type) %></span>
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: ammo_type.id, data: [confirm: "Are you sure?"] %></span>
</td>
</tr> </tr>
<% end %> </thead>
</tbody> <tbody>
</table> <%= for ammo_type <- @ammo_types do %>
</div> <tr id={"ammo_type-#{ammo_type.id}"}>
<td class="p-2"><%= ammo_type.name %></td>
<td class="p-2"><%= ammo_type.case_material %></td>
<td class="p-2"><%= ammo_type.bullet_type %></td>
<td class="p-2"><%= ammo_type.grain %></td>
<td class="p-2"><%= ammo_type.manufacturer %></td>
<td class="p-2 w-full h-full space-y-2 flex flex-col justify-center items-center">
<span><%= live_redirect "Show", to: Routes.ammo_type_show_path(@socket, :show, ammo_type) %></span>
<span><%= live_patch "Edit", to: Routes.ammo_type_index_path(@socket, :edit, ammo_type) %></span>
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: ammo_type.id, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% end %>
</div> </div>
<%= if @live_action in [:new, :edit] do %> <%= if @live_action in [:new, :edit] do %>