cannery/lib/cannery_web/live/ammo_type_live/form_component.html.heex

165 lines
6.7 KiB
Plaintext
Raw Normal View History

2022-02-14 21:21:24 -05:00
<div>
2022-02-18 18:21:56 -05:00
<h2 class="mb-8 text-center title text-xl text-primary-600">
2022-02-14 21:21:24 -05:00
<%= @title %>
</h2>
<.form
:let={f}
2022-02-14 21:21:24 -05:00
for={@changeset}
id="ammo_type-form"
phx-target={@myself}
phx-change="validate"
phx-submit="save"
2022-02-19 18:06:50 -05:00
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
2022-02-14 21:21:24 -05:00
>
2023-02-04 10:28:13 -05:00
<div
:if={@changeset.action && not @changeset.valid?()}
class="invalid-feedback col-span-3 text-center"
>
<%= changeset_errors(@changeset) %>
</div>
2022-02-14 21:21:24 -05:00
<%= label(f, :name, gettext("Name"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= text_input(f, :name, class: "text-center col-span-2 input input-primary") %>
<%= error_tag(f, :name, "col-span-3 text-center") %>
<%= label(f, :desc, gettext("Description"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= textarea(f, :desc,
2023-03-18 22:13:32 -04:00
id: "ammo-type-form-desc",
2022-02-14 21:21:24 -05:00
class: "text-center col-span-2 input input-primary",
2023-03-18 22:13:32 -04:00
phx_hook: "MaintainAttrs",
phx_update: "ignore"
2022-02-14 21:21:24 -05:00
) %>
<%= error_tag(f, :desc, "col-span-3 text-center") %>
2023-03-18 01:03:55 -04:00
<.link
href="https://shootersreference.com/reloadingdata/bullet_abbreviations/"
2022-02-14 21:21:24 -05:00
class="col-span-3 text-center link title text-md text-primary-600"
>
<%= gettext("Example bullet type abbreviations") %>
2023-03-18 01:03:55 -04:00
</.link>
2022-02-20 20:40:24 -05:00
<%= label(f, :bullet_type, gettext("Bullet type"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= text_input(f, :bullet_type,
class: "text-center col-span-2 input input-primary",
placeholder: gettext("FMJ")
) %>
<%= error_tag(f, :bullet_type, "col-span-3 text-center") %>
2022-02-20 20:40:24 -05:00
<%= label(f, :bullet_core, gettext("Bullet core"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= text_input(f, :bullet_core,
class: "text-center col-span-2 input input-primary",
placeholder: gettext("Steel")
) %>
<%= error_tag(f, :bullet_core, "col-span-3 text-center") %>
<%= label(f, :cartridge, gettext("Cartridge"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= text_input(f, :cartridge,
class: "text-center col-span-2 input input-primary",
2023-03-18 22:13:32 -04:00
placeholder: gettext("5.56x46mm NATO")
2022-02-14 21:21:24 -05:00
) %>
<%= error_tag(f, :cartridge, "col-span-3 text-center") %>
<%= label(f, :caliber, gettext("Caliber"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= text_input(f, :caliber,
class: "text-center col-span-2 input input-primary",
2023-03-18 22:13:32 -04:00
placeholder: gettext(".223")
2022-02-14 21:21:24 -05:00
) %>
<%= error_tag(f, :caliber, "col-span-3 text-center") %>
2022-02-20 20:40:24 -05:00
<%= label(f, :case_material, gettext("Case material"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= text_input(f, :case_material,
class: "text-center col-span-2 input input-primary",
placeholder: gettext("Brass")
) %>
<%= error_tag(f, :case_material, "col-span-3 text-center") %>
2022-02-20 20:40:24 -05:00
<%= label(f, :jacket_type, gettext("Jacket type"), class: "title text-lg text-primary-600") %>
<%= text_input(f, :jacket_type,
class: "text-center col-span-2 input input-primary",
placeholder: gettext("Bimetal")
) %>
<%= error_tag(f, :case_material, "col-span-3 text-center") %>
<%= label(f, :muzzle_velocity, gettext("Muzzle velocity"),
class: "title text-lg text-primary-600"
) %>
<%= number_input(f, :muzzle_velocity,
step: "1",
class: "text-center col-span-2 input input-primary",
min: 1
) %>
<%= error_tag(f, :muzzle_velocity, "col-span-3 text-center") %>
2022-02-20 20:40:24 -05:00
<%= label(f, :powder_type, gettext("Powder type"), class: "title text-lg text-primary-600") %>
2022-02-18 19:00:49 -05:00
<%= text_input(f, :powder_type, class: "text-center col-span-2 input input-primary") %>
<%= error_tag(f, :powder_type, "col-span-3 text-center") %>
<%= label(f, :powder_grains_per_charge, gettext("Powder grains per charge"),
class: "title text-lg text-primary-600"
) %>
<%= number_input(f, :powder_grains_per_charge,
step: "1",
class: "text-center col-span-2 input input-primary",
min: 1
) %>
<%= error_tag(f, :powder_grains_per_charge, "col-span-3 text-center") %>
<%= label(f, :grains, gettext("Grains"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= number_input(f, :grains,
step: "1",
class: "text-center col-span-2 input input-primary",
min: 1
) %>
<%= error_tag(f, :grains, "col-span-3 text-center") %>
<%= label(f, :pressure, gettext("Pressure"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= text_input(f, :pressure,
class: "text-center col-span-2 input input-primary",
2023-03-18 22:13:32 -04:00
placeholder: gettext("+P")
2022-02-14 21:21:24 -05:00
) %>
<%= error_tag(f, :pressure, "col-span-3 text-center") %>
2022-02-20 20:40:24 -05:00
<%= label(f, :primer_type, gettext("Primer type"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= text_input(f, :primer_type,
class: "text-center col-span-2 input input-primary",
2023-03-18 22:13:32 -04:00
placeholder: gettext("Boxer")
2022-02-14 21:21:24 -05:00
) %>
<%= error_tag(f, :primer_type, "col-span-3 text-center") %>
2022-02-20 20:40:24 -05:00
<%= label(f, :firing_type, gettext("Firing type"), class: "title text-lg text-primary-600") %>
2022-02-16 00:10:18 -05:00
<%= text_input(f, :firing_type,
class: "text-center col-span-2 input input-primary",
2023-03-18 22:13:32 -04:00
placeholder: gettext("Centerfire")
2022-02-16 00:10:18 -05:00
) %>
<%= error_tag(f, :firing_type, "col-span-3 text-center") %>
2022-02-14 21:21:24 -05:00
<%= label(f, :tracer, gettext("Tracer"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= checkbox(f, :tracer, class: "text-center col-span-2 checkbox") %>
<%= error_tag(f, :tracer, "col-span-3 text-center") %>
<%= label(f, :incendiary, gettext("Incendiary"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= checkbox(f, :incendiary, class: "text-center col-span-2 checkbox") %>
<%= error_tag(f, :incendiary, "col-span-3 text-center") %>
<%= label(f, :blank, gettext("Blank"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= checkbox(f, :blank, class: "text-center col-span-2 checkbox") %>
<%= error_tag(f, :blank, "col-span-3 text-center") %>
<%= label(f, :corrosive, gettext("Corrosive"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= checkbox(f, :corrosive, class: "text-center col-span-2 checkbox") %>
<%= error_tag(f, :corrosive, "col-span-3 text-center") %>
2022-02-20 20:40:24 -05:00
<%= label(f, :manufacturer, gettext("Manufacturer"), class: "title text-lg text-primary-600") %>
2022-02-14 21:21:24 -05:00
<%= text_input(f, :manufacturer, class: "text-center col-span-2 input input-primary") %>
<%= error_tag(f, :manufacturer, "col-span-3 text-center") %>
<%= label(f, :upc, gettext("UPC"), class: "title text-lg text-primary-600") %>
<%= text_input(f, :upc, class: "text-center col-span-2 input input-primary") %>
<%= error_tag(f, :upc, "col-span-3 text-center") %>
2022-02-14 21:21:24 -05:00
<%= submit(dgettext("actions", "Save"),
phx_disable_with: dgettext("prompts", "Saving..."),
class: "mx-auto col-span-3 btn btn-primary"
) %>
</.form>
</div>