- add primer_type to ammo type
- fix ammo type typespec - remove unused ammo type card - mix format
This commit is contained in:
		| @@ -43,7 +43,9 @@ | ||||
|               </td> | ||||
|  | ||||
|               <td class="p-2"> | ||||
|                 $ <%= ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2) %> | ||||
|                 <%= if ammo_group.price_paid do %> | ||||
|                   $ <%= ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2) %> | ||||
|                 <% end %> | ||||
|               </td> | ||||
|  | ||||
|               <td class="p-2"> | ||||
|   | ||||
| @@ -1,46 +0,0 @@ | ||||
| defmodule CanneryWeb.AmmoTypeLive.AmmoTypeCard do | ||||
|   @moduledoc """ | ||||
|   Display card for an ammo type | ||||
|   """ | ||||
|  | ||||
|   use CanneryWeb, :component | ||||
|   alias Cannery.Repo | ||||
|   alias CanneryWeb.Endpoint | ||||
|  | ||||
|   def ammo_group_card(assigns) do | ||||
|     assigns = assigns |> assign(:ammo_group, assigns.ammo_group |> Repo.preload(:ammo_type)) | ||||
|  | ||||
|     ~H""" | ||||
|     <div | ||||
|       id={"ammo_group-#{@ammo_group.id}"} | ||||
|       class="px-8 py-4 flex flex-col justify-center items-center | ||||
|             border border-gray-400 rounded-lg shadow-lg hover:shadow-md" | ||||
|     > | ||||
|       <%= live_redirect to: Routes.ammo_group_show_path(Endpoint, :show, @ammo_group), | ||||
|                     class: "mb-2 link" do %> | ||||
|         <h1 class="title text-xl title-primary-500"> | ||||
|           <%= @ammo_group.ammo_type.name %> | ||||
|         </h1> | ||||
|       <% end %> | ||||
|  | ||||
|       <div class="flex flex-col justify-center items-center"> | ||||
|         <span class="rounded-lg title text-lg"> | ||||
|           Count: <%= @ammo_group.count %> | ||||
|         </span> | ||||
|  | ||||
|         <%= if @ammo_group.notes do %> | ||||
|           <span class="rounded-lg title text-lg"> | ||||
|             Notes: <%= @ammo_group.notes %> | ||||
|           </span> | ||||
|         <% end %> | ||||
|  | ||||
|         <%= if @ammo_group.price_paid do %> | ||||
|           <span class="rounded-lg title text-lg"> | ||||
|             Price paid: $ <%= @ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2) %> | ||||
|           </span> | ||||
|         <% end %> | ||||
|       </div> | ||||
|     </div> | ||||
|     """ | ||||
|   end | ||||
| end | ||||
| @@ -117,6 +117,13 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do | ||||
|         ) %> | ||||
|         <%= error_tag(f, :pressure, "col-span-3 text-center") %> | ||||
|  | ||||
|         <%= label(f, :primer_type, class: "mr-4 title text-lg text-primary-500") %> | ||||
|         <%= text_input(f, :primer_type, | ||||
|           class: "text-center col-span-2 input input-primary", | ||||
|           placeholder: "Boxer" | ||||
|         ) %> | ||||
|         <%= error_tag(f, :primer_type, "col-span-3 text-center") %> | ||||
|  | ||||
|         <%= label(f, :rimfire, class: "mr-4 title text-lg text-primary-500") %> | ||||
|         <%= checkbox(f, :rimfire, class: "text-center col-span-2 checkbox") %> | ||||
|         <%= error_tag(f, :rimfire, "col-span-3 text-center") %> | ||||
|   | ||||
| @@ -31,6 +31,7 @@ | ||||
|                   :case_material, | ||||
|                   :grains, | ||||
|                   :pressure, | ||||
|                   :primer_type, | ||||
|                   :rimfire, | ||||
|                   :tracer, | ||||
|                   :incendiary, | ||||
| @@ -58,7 +59,8 @@ | ||||
|                     :caliber, | ||||
|                     :case_material, | ||||
|                     :grains, | ||||
|                     :pressure | ||||
|                     :pressure, | ||||
|                     :primer_type | ||||
|                   ] do %> | ||||
|                 <td class="p-2"> | ||||
|                   <%= ammo_type |> Map.get(field) %> | ||||
|   | ||||
| @@ -36,11 +36,12 @@ | ||||
|           :caliber, | ||||
|           :case_material, | ||||
|           :grains, | ||||
|           :pressure | ||||
|           :pressure, | ||||
|           :primer_type | ||||
|         ] do %> | ||||
|       <%= if @ammo_type |> Map.get(field) do %> | ||||
|         <h3 class="mb-2 sm:mr-4 title text-lg"> | ||||
|           <%= field |> humanize() %>: | ||||
|           <%= field |> humanize() %> : | ||||
|         </h3> | ||||
|  | ||||
|         <span class="mb-4 sm:mb-2 text-primary-600"> | ||||
| @@ -57,7 +58,7 @@ | ||||
|           :corrosive | ||||
|         ] do %> | ||||
|       <h3 class="mb-2 sm:mr-4 title text-lg"> | ||||
|         <%= field |> humanize() %>: | ||||
|         <%= field |> humanize() %> : | ||||
|       </h3> | ||||
|  | ||||
|       <span class="mb-4 sm:mb-2 text-primary-600"> | ||||
| @@ -68,7 +69,7 @@ | ||||
|     <%= for field <- [:manufacturer, :sku] do %> | ||||
|       <%= if @ammo_type |> Map.get(field) do %> | ||||
|         <h3 class="mb-2 sm:mr-4 title text-lg"> | ||||
|           <%= field |> humanize() %>: | ||||
|           <%= field |> humanize() %> : | ||||
|         </h3> | ||||
|  | ||||
|         <span class="mb-4 sm:mb-2 text-primary-600"> | ||||
|   | ||||
| @@ -24,8 +24,8 @@ defmodule CanneryWeb.ModalComponent do | ||||
|         flex flex-col justify-start items-center | ||||
|         bg-white border-2 rounded-lg"> | ||||
|         <%= live_patch to: @return_to, | ||||
|                    class: "absolute top-8 right-10 text-gray-500 hover:text-gray-800 | ||||
|                                                                   transition-all duration-500 ease-in-out" do %> | ||||
|                    class: | ||||
|                      "absolute top-8 right-10 text-gray-500 hover:text-gray-800 transition-all duration-500 ease-in-out" do %> | ||||
|           <i class="fa-fw fa-lg fas fa-times"></i> | ||||
|         <% end %> | ||||
|         <div class="p-8 flex flex-col space-y-4 justify-start items-center"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user