New registration page
This commit is contained in:
27
lib/osuuspuutarha_web/live/order_live/registration.ex
Normal file
27
lib/osuuspuutarha_web/live/order_live/registration.ex
Normal file
@@ -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
|
||||
26
lib/osuuspuutarha_web/live/order_live/registration.html.heex
Normal file
26
lib/osuuspuutarha_web/live/order_live/registration.html.heex
Normal file
@@ -0,0 +1,26 @@
|
||||
<h2>Tervetuloa osuuspuutarhan jäseneksi</h2>
|
||||
|
||||
<%= 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)}
|
||||
/>
|
||||
</.modal>
|
||||
<% end %>
|
||||
|
||||
<p>Tarjouksemme ovat seuraavat</p>
|
||||
|
||||
<ul>
|
||||
<li>Asd</li>
|
||||
<li>Qwe</li>
|
||||
<li>Zxc</li>
|
||||
</ul>
|
||||
|
||||
<h3>Voit lähteä mukaan alla olevasta linkistä</h3>
|
||||
<%= link "Tilaa satolaatikko", to: Routes.order_registration_path(@socket, :new) %>
|
||||
Reference in New Issue
Block a user