|
|
|
@ -19,6 +19,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
|
|
|
|
|
>
|
|
|
|
|
<%= if @form.source.type == :create do %>
|
|
|
|
|
<.input field={@form[:title]} type="text" label="Title" />
|
|
|
|
|
<.input field={@form[:cover_image_url]} type="text" label="Cover image url" />
|
|
|
|
|
<.input
|
|
|
|
|
field={@form[:description]}
|
|
|
|
|
type="text"
|
|
|
|
@ -26,11 +27,15 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
|
|
|
|
|
/>
|
|
|
|
|
<.bids_inputs form={@form} myself={@myself} />
|
|
|
|
|
<.author_roles_inputs form={@form} myself={@myself} />
|
|
|
|
|
<.input field={@form[:format]} type="text" label="Format" /><.input
|
|
|
|
|
<.input field={@form[:format]} type="text" label="Format" />
|
|
|
|
|
<.input
|
|
|
|
|
field={@form[:language]}
|
|
|
|
|
type="text"
|
|
|
|
|
label="Language"
|
|
|
|
|
/><.input field={@form[:page_count]} type="number" label="Page count" /><.input
|
|
|
|
|
/>
|
|
|
|
|
<.input field={@form[:page_count]} type="number" label="Page count" />
|
|
|
|
|
<.input field={@form[:publisher_id]} type="text" label="Publisher" />
|
|
|
|
|
<.input
|
|
|
|
|
field={@form[:published]}
|
|
|
|
|
type="date"
|
|
|
|
|
label="Published"
|
|
|
|
@ -49,7 +54,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
|
|
|
|
|
|
|
|
|
|
def bids_inputs(assigns) do
|
|
|
|
|
~H"""
|
|
|
|
|
<h2>Book Ids</h2>
|
|
|
|
|
<h2>Book ids</h2>
|
|
|
|
|
|
|
|
|
|
<table class="w-full">
|
|
|
|
|
<thead class="border-b border-zinc-100">
|
|
|
|
@ -235,10 +240,6 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
|
|
|
|
|
AshPhoenix.Form.for_update(book, :update, as: "book", actor: socket.assigns.current_user)
|
|
|
|
|
else
|
|
|
|
|
AshPhoenix.Form.for_create(DecentralisedBookIndex.Metadata.Book, :create,
|
|
|
|
|
transform_params: fn _form, params, _context ->
|
|
|
|
|
Map.put(params, "author_roles", ["d880b385-5df6-4127-a49c-16f9070ea066"])
|
|
|
|
|
Map.put(params, "publishers", ["9ca6f110-8ef4-494b-9979-f5b016d0f45e"])
|
|
|
|
|
end,
|
|
|
|
|
as: "book",
|
|
|
|
|
actor: socket.assigns.current_user
|
|
|
|
|
)
|
|
|
|
|