diff --git a/assets/css/app.css b/assets/css/app.css
index 3b2ad9e..7ee3c20 100644
--- a/assets/css/app.css
+++ b/assets/css/app.css
@@ -7,6 +7,7 @@
@import './live/registration.css';
@import './pages/privacy.css';
@import './live/table.css';
+@import './live/yield.css';
/* Alerts and form errors used by phx.new */
.alert {
diff --git a/assets/css/live/yield.css b/assets/css/live/yield.css
new file mode 100644
index 0000000..6a12396
--- /dev/null
+++ b/assets/css/live/yield.css
@@ -0,0 +1,9 @@
+.date-picker {
+ display: flex;
+ align-items: baseline;
+ gap: 0.7em;
+}
+
+.date-picker select {
+ max-width: 8rem;
+}
diff --git a/lib/osuuspuutarha_web/live/yield_live/form_component.html.heex b/lib/osuuspuutarha_web/live/yield_live/form_component.html.heex
index d8770a2..498e015 100644
--- a/lib/osuuspuutarha_web/live/yield_live/form_component.html.heex
+++ b/lib/osuuspuutarha_web/live/yield_live/form_component.html.heex
@@ -9,9 +9,14 @@
phx-change="validate"
phx-submit="save">
+
<%= label f, :date %>
- <%= date_input f, :date %>
- <%= error_tag f, :date %>
+
+ <%= 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 %>
+
<%= label f, :plant %>
<%= select f, :plant, Ecto.Enum.values(Osuuspuutarha.Harvest.Yield, :plant), prompt: "Choose a value" %>
diff --git a/lib/osuuspuutarha_web/live/yield_live/index.ex b/lib/osuuspuutarha_web/live/yield_live/index.ex
index 3931a10..251331d 100644
--- a/lib/osuuspuutarha_web/live/yield_live/index.ex
+++ b/lib/osuuspuutarha_web/live/yield_live/index.ex
@@ -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
diff --git a/lib/osuuspuutarha_web/live/yield_live/index.html.heex b/lib/osuuspuutarha_web/live/yield_live/index.html.heex
index 3dc1fa3..67d0a91 100644
--- a/lib/osuuspuutarha_web/live/yield_live/index.html.heex
+++ b/lib/osuuspuutarha_web/live/yield_live/index.html.heex
@@ -1,4 +1,4 @@
-Listing Yields
+Hello Albert!
<%= if @live_action in [:new, :edit] do %>
<.modal return_to={Routes.yield_index_path(@socket, :index)}>
@@ -27,7 +27,7 @@
<%= for yield <- @yields do %>
- | <%= yield.date %> |
+ <%= yield.date.day %>.<%= yield.date.month %>.<%= yield.date.year %> |
<%= yield.plant %> |
<%= yield.amount %> |
<%= yield.unit %> |