diff --git a/lib/osuuspuutarha_web/controllers/page_controller.ex b/lib/osuuspuutarha_web/controllers/page_controller.ex
index 8a7f556..de7906a 100644
--- a/lib/osuuspuutarha_web/controllers/page_controller.ex
+++ b/lib/osuuspuutarha_web/controllers/page_controller.ex
@@ -4,8 +4,4 @@ defmodule OsuuspuutarhaWeb.PageController do
def index(conn, _params) do
render(conn, "index.html")
end
-
- def welcome(conn, _params) do
- render(conn, "welcome.html")
- end
end
diff --git a/lib/osuuspuutarha_web/live/order_live/registration.ex b/lib/osuuspuutarha_web/live/order_live/registration.ex
new file mode 100644
index 0000000..fb9b47c
--- /dev/null
+++ b/lib/osuuspuutarha_web/live/order_live/registration.ex
@@ -0,0 +1,27 @@
+defmodule OsuuspuutarhaWeb.OrderLive.Registration do
+ use OsuuspuutarhaWeb, :live_view
+
+ alias Osuuspuutarha.Orders.Order
+
+ @impl true
+ def mount(_params, _session, socket) do
+ {:ok, socket}
+ end
+
+ @impl true
+ def handle_params(_, _, socket) do
+ {:noreply, apply_action(socket, socket.assigns.live_action)}
+ end
+
+ defp apply_action(socket, :index) do
+ socket
+ |> assign(:page_title, "Tilaukset")
+ |> assign(:order, nil)
+ end
+
+ defp apply_action(socket, :new) do
+ socket
+ |> assign(:page_title, "Satolaatikko tilaus")
+ |> assign(:order, %Order{})
+ end
+end
diff --git a/lib/osuuspuutarha_web/live/order_live/registration.html.heex b/lib/osuuspuutarha_web/live/order_live/registration.html.heex
new file mode 100644
index 0000000..7e4bc13
--- /dev/null
+++ b/lib/osuuspuutarha_web/live/order_live/registration.html.heex
@@ -0,0 +1,26 @@
+
Tervetuloa osuuspuutarhan jäseneksi
+
+<%= if @live_action == :new do %>
+ <.modal return_to={Routes.order_registration_path(@socket, :index)}>
+ <.live_component
+ module={OsuuspuutarhaWeb.OrderLive.FormComponent}
+ id={:new}
+ title={@page_title}
+ submit_text="Lähetä tilaus"
+ action={@live_action}
+ order={@order}
+ return_to={Routes.order_registration_path(@socket, :index)}
+ />
+
+<% end %>
+
+Tarjouksemme ovat seuraavat
+
+
+
+Voit lähteä mukaan alla olevasta linkistä
+<%= link "Tilaa satolaatikko", to: Routes.order_registration_path(@socket, :new) %>
\ No newline at end of file
diff --git a/lib/osuuspuutarha_web/router.ex b/lib/osuuspuutarha_web/router.ex
index 4eebcee..6272459 100644
--- a/lib/osuuspuutarha_web/router.ex
+++ b/lib/osuuspuutarha_web/router.ex
@@ -18,7 +18,6 @@ defmodule OsuuspuutarhaWeb.Router do
pipe_through :browser
get "/", PageController, :index
- get "/tervetuloa", PageController, :welcome
live "/tilaukset", OrderLive.Index, :index
live "/tilaukset/uusi", OrderLive.Index, :new
@@ -26,6 +25,9 @@ defmodule OsuuspuutarhaWeb.Router do
live "/tilaukset/:id", OrderLive.Show, :show
live "/tilaukset/:id/nayta/muokkaa", OrderLive.Show, :edit
+
+ live "/ilmoittautuminen", OrderLive.Registration, :index
+ live "/ilmoittautuminen/uusi", OrderLive.Registration, :new
end
# Other scopes may use custom stacks.
diff --git a/lib/osuuspuutarha_web/templates/page/welcome.html.heex b/lib/osuuspuutarha_web/templates/page/welcome.html.heex
deleted file mode 100644
index 50f493b..0000000
--- a/lib/osuuspuutarha_web/templates/page/welcome.html.heex
+++ /dev/null
@@ -1,12 +0,0 @@
-Tervetuloa osuuspuutarhan jäseneksi
-
-Tarjouksemme ovat seuraavat
-
-
-
-Voit lähteä mukaan alla olevasta linkistä
-<%= link "Liity jäseneksi", to: Routes.order_index_path(@conn, :new) %>
\ No newline at end of file