diff --git a/lib/cannery_web/live/ammo_type_live/form_component.ex b/lib/cannery_web/live/ammo_type_live/form_component.ex index 66201b93..9b85f367 100644 --- a/lib/cannery_web/live/ammo_type_live/form_component.ex +++ b/lib/cannery_web/live/ammo_type_live/form_component.ex @@ -35,7 +35,7 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do def render(assigns) do ~H"""
-

+

<%= @title %>

<.form @@ -45,26 +45,52 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do phx-target={@myself} phx-change="validate" phx-submit="save" + class="grid grid-cols-3 justify-center items-center space-y-4" > - <%= label(f, :name, class: "title text-lg text-primary-500") %> - <%= text_input(f, :name, class: "input input-primary") %> - <%= error_tag(f, :name) %> - <%= label(f, :desc, class: "title text-lg text-primary-500") %> - <%= text_input(f, :desc, class: "input input-primary") %> - <%= error_tag(f, :desc) %> - <%= label(f, :case_material, class: "title text-lg text-primary-500") %> - <%= text_input(f, :case_material, class: "input input-primary") %> - <%= error_tag(f, :case_material) %> - <%= label(f, :bullet_type, class: "title text-lg text-primary-500") %> - <%= text_input(f, :bullet_type, class: "input input-primary") %> - <%= error_tag(f, :bullet_type) %> - <%= label(f, :weight, class: "title text-lg text-primary-500") %> - <%= number_input(f, :weight, step: "any") %> - <%= error_tag(f, :weight) %> - <%= label(f, :manufacturer, class: "title text-lg text-primary-500") %> - <%= text_input(f, :manufacturer, class: "input input-primary") %> - <%= error_tag(f, :manufacturer) %> - <%= submit("Save", phx_disable_with: "Saving...") %> + <%= label(f, :name, class: "mr-4 title text-lg text-primary-500") %> + <%= text_input(f, :name, class: "text-center col-span-2 input input-primary") %> +
+ <%= error_tag(f, :name) %> +
+ + <%= label(f, :desc, class: "mr-4 title text-lg text-primary-500") %> + <%= textarea(f, :desc, + class: "text-center col-span-2 input input-primary", + phx_hook: "MaintainAttrs") %> +
+ <%= error_tag(f, :desc) %> +
+ + <%= label(f, :case_material, class: "mr-4 title text-lg text-primary-500") %> + <%= text_input(f, :case_material, class: "text-center col-span-2 input input-primary") %> +
+ <%= error_tag(f, :case_material) %> +
+ + <%= label(f, :bullet_type, class: "mr-4 title text-lg text-primary-500") %> + <%= text_input(f, :bullet_type, class: "text-center col-span-2 input input-primary") %> +
+ <%= error_tag(f, :bullet_type) %> +
+ + <%= label(f, :grain, class: "mr-4 title text-lg text-primary-500") %> + <%= number_input(f, :grain, + step: "any", + class: "text-center col-span-2 input input-primary", + min: 0) %> +
+ <%= error_tag(f, :grain) %> +
+ + <%= label(f, :manufacturer, class: "mr-4 title text-lg text-primary-500") %> + <%= text_input(f, :manufacturer, class: "text-center col-span-2 input input-primary") %> +
+ <%= error_tag(f, :manufacturer) %> +
+ + <%= submit("Save", + phx_disable_with: "Saving...", + class: "mx-auto col-span-3 btn btn-primary") %>
""" diff --git a/lib/cannery_web/live/ammo_type_live/index.html.heex b/lib/cannery_web/live/ammo_type_live/index.html.heex new file mode 100644 index 00000000..f70ca9e3 --- /dev/null +++ b/lib/cannery_web/live/ammo_type_live/index.html.heex @@ -0,0 +1,51 @@ +
+

+ Listing Ammo Types +

+ + <%= live_patch "New Ammo type", + to: Routes.ammo_type_index_path(@socket, :new), + class: "btn btn-primary" %> + +
+ + + + + + + + + + + + + + <%= for ammo_type <- @ammo_types do %> + + + + + + + + + + <% end %> + +
NameCase materialBullet typeGrainManufacturer
<%= ammo_type.name %><%= ammo_type.case_material %><%= ammo_type.bullet_type %><%= ammo_type.grain %><%= ammo_type.manufacturer %> + <%= live_redirect "Show", to: Routes.ammo_type_show_path(@socket, :show, ammo_type) %> + <%= live_patch "Edit", to: Routes.ammo_type_index_path(@socket, :edit, ammo_type) %> + <%= link "Delete", to: "#", phx_click: "delete", phx_value_id: ammo_type.id, data: [confirm: "Are you sure?"] %> +
+
+
+ +<%= if @live_action in [:new, :edit] do %> + <%= live_modal CanneryWeb.AmmoTypeLive.FormComponent, + id: @ammo_type.id || :new, + title: @page_title, + action: @live_action, + ammo_type: @ammo_type, + return_to: Routes.ammo_type_index_path(@socket, :index) %> +<% end %> diff --git a/lib/cannery_web/live/ammo_type_live/index.html.leex b/lib/cannery_web/live/ammo_type_live/index.html.leex deleted file mode 100644 index 9abe40ed..00000000 --- a/lib/cannery_web/live/ammo_type_live/index.html.leex +++ /dev/null @@ -1,45 +0,0 @@ -

Listing Ammo types

- -<%= if @live_action in [:new, :edit] do %> - <%= live_modal CanneryWeb.AmmoTypeLive.FormComponent, - id: @ammo_type.id || :new, - title: @page_title, - action: @live_action, - ammo_type: @ammo_type, - return_to: Routes.ammo_type_index_path(@socket, :index) %> -<% end %> - - - - - - - - - - - - - - - - <%= for ammo_type <- @ammo_types do %> - - - - - - - - - - - <% end %> - -
NameDescCase materialBullet typeWeightManufacturer
<%= ammo_type.name %><%= ammo_type.desc %><%= ammo_type.case_material %><%= ammo_type.bullet_type %><%= ammo_type.weight %><%= ammo_type.manufacturer %> - <%= live_redirect "Show", to: Routes.ammo_type_show_path(@socket, :show, ammo_type) %> - <%= live_patch "Edit", to: Routes.ammo_type_index_path(@socket, :edit, ammo_type) %> - <%= link "Delete", to: "#", phx_click: "delete", phx_value_id: ammo_type.id, data: [confirm: "Are you sure?"] %> -
- -<%= live_patch "New Ammo type", to: Routes.ammo_type_index_path(@socket, :new) %>