Styling fixes on harvest page

This commit is contained in:
2023-06-13 14:22:47 +03:00
parent 3a983516c9
commit e67b2cd453
5 changed files with 23 additions and 8 deletions

View File

@@ -9,9 +9,14 @@
phx-change="validate"
phx-submit="save">
<%= label f, :date %>
<%= date_input f, :date %>
<%= error_tag f, :date %>
<div class="date-picker" >
<%= date_select f, :date, default: DateTime.now!("Etc/UTC"), builder: fn b -> %>
<%= b.(:day, []) %> / <%= b.(:month, options: [{"01", "1"}, "02", "03", "04", "05", {"06", "6"}, "07", "08", "09", "10", "11", "12"]) %> / <%= b.(:year, options: ["2023"]) %>
<% end %>
<%= error_tag f, :date %>
</div>
<%= label f, :plant %>
<%= select f, :plant, Ecto.Enum.values(Osuuspuutarha.Harvest.Yield, :plant), prompt: "Choose a value" %>

View File

@@ -16,19 +16,19 @@ defmodule OsuuspuutarhaWeb.YieldLive.Index do
defp apply_action(socket, :edit, %{"id" => id}) do
socket
|> assign(:page_title, "Edit Yield")
|> assign(:page_title, "Edit yield")
|> assign(:yield, Harvest.get_yield!(id))
end
defp apply_action(socket, :new, _params) do
socket
|> assign(:page_title, "New Yield")
|> assign(:yield, %Yield{})
|> assign(:page_title, "New yield")
|> assign(:yield, %Yield{unit: :kg, date: DateTime.utc_now()})
end
defp apply_action(socket, :index, _params) do
socket
|> assign(:page_title, "Listing Yields")
|> assign(:page_title, "Good day, Albert!")
|> assign(:yield, nil)
end

View File

@@ -1,4 +1,4 @@
<h1>Listing Yields</h1>
<h1>Hello Albert!</h1>
<%= if @live_action in [:new, :edit] do %>
<.modal return_to={Routes.yield_index_path(@socket, :index)}>
@@ -27,7 +27,7 @@
<tbody id="yields">
<%= for yield <- @yields do %>
<tr id={"yield-#{yield.id}"}>
<td><%= yield.date %></td>
<td><%= yield.date.day %>.<%= yield.date.month %>.<%= yield.date.year %></td>
<td><%= yield.plant %></td>
<td><%= yield.amount %></td>
<td><%= yield.unit %></td>