Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0a30fda9a4 | |||
| b2ef39df76 | |||
| 8c3e7b3ee8 |
@ -10,7 +10,7 @@ defmodule BeetRoundServerWeb.BiddingLive.Form do
|
|||||||
~H"""
|
~H"""
|
||||||
<Layouts.app flash={@flash} current_scope={@current_scope}>
|
<Layouts.app flash={@flash} current_scope={@current_scope}>
|
||||||
<.header>
|
<.header>
|
||||||
{@page_title}
|
{@page_title} ({@current_scope.user.email})
|
||||||
<:subtitle>Bitte gib hier den Betrag ein, den Du monatlich bezahlen willst.</:subtitle>
|
<:subtitle>Bitte gib hier den Betrag ein, den Du monatlich bezahlen willst.</:subtitle>
|
||||||
</.header>
|
</.header>
|
||||||
<%= if @bidding.bidding_round == 0 do %>
|
<%= if @bidding.bidding_round == 0 do %>
|
||||||
@ -20,24 +20,30 @@ defmodule BeetRoundServerWeb.BiddingLive.Form do
|
|||||||
</footer>
|
</footer>
|
||||||
<% else %>
|
<% else %>
|
||||||
<.form for={@form} id="bidding-form" phx-change="validate" phx-submit="save">
|
<.form for={@form} id="bidding-form" phx-change="validate" phx-submit="save">
|
||||||
<.input field={@form[:amount]} type="number" label="Betrag" />
|
<p>
|
||||||
|
Wenn du für einen halben Anteil bietest, orientiere dich bitte an einen Richtwert von 56 €.
|
||||||
|
</p>
|
||||||
|
<br />
|
||||||
|
<p><b>Bietrunde: {@bidding.bidding_round}</b></p>
|
||||||
|
<%= if @bidding.bidding_round == 1 do %>
|
||||||
|
<.input field={@form[:amount]} type="number" label="Betrag/Monat" />
|
||||||
<.input
|
<.input
|
||||||
field={@form[:depot_wish_one]}
|
field={@form[:depot_wish_one]}
|
||||||
type="select"
|
type="select"
|
||||||
label="Depot Wunsch 1"
|
label="Depot Wunsch 1"
|
||||||
options={[
|
options={[
|
||||||
{"", ""},
|
{"", ""},
|
||||||
{"KlimaWerkStadt (1)", "KlimaWerkStadt"},
|
{"Puramila (1)", "Puramila"},
|
||||||
{"Puramila (2)", "Puramila"},
|
{"Eine Welt Aktion (2)", "Eine Welt Aktion"},
|
||||||
{"Eine Welt Aktion (3)", "Eine Welt Aktion"},
|
{"KlimaWerkStadt (3)", "KlimaWerkStadt"},
|
||||||
{"Hof Buntentor (4)", "Hof Buntentor"},
|
{"Buntentorsteinweg 231, Abholschrank (4)", "Buntentorsteinweg 231, Abholschrank"},
|
||||||
{"Mädchen-Kulturhaus (5)", "Mädchen-Kulturhaus"},
|
{"Klimazone (5)", "Klimazone"},
|
||||||
{"neues Depot im Viertel (6)", "neues Depot im Viertel"},
|
{"Hof von bude e.V., Abholschrank(6)", "Hof von bude e.V., Abholschrank"},
|
||||||
{"Creative Hub (7)", "Creative Hub"},
|
{"Lagerhaus, Abholschrank (7)", "Lagerhaus, Abholschrank"},
|
||||||
{"Klimazone (8)", "Klimazone"},
|
{"KARL, Abholschrank (8)", "KARL, Abholschrank"},
|
||||||
{"Garage Walle (9)", "Garage Walle"},
|
|
||||||
{"Hof Riede (A)", "Hof Riede"},
|
{"Hof Riede (A)", "Hof Riede"},
|
||||||
{"Thedinghausen (B)", "Thedinghausen"}
|
{"Thedinghausen (B)", "Thedinghausen"},
|
||||||
|
{"Achim (Planung ab April) (C)", "Achim"}
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<.input
|
<.input
|
||||||
@ -46,20 +52,26 @@ defmodule BeetRoundServerWeb.BiddingLive.Form do
|
|||||||
label="Depot Wunsch 2"
|
label="Depot Wunsch 2"
|
||||||
options={[
|
options={[
|
||||||
{"", ""},
|
{"", ""},
|
||||||
{"KlimaWerkStadt (1)", "KlimaWerkStadt"},
|
{"Puramila (1)", "Puramila"},
|
||||||
{"Puramila (2)", "Puramila"},
|
{"Eine Welt Aktion (2)", "Eine Welt Aktion"},
|
||||||
{"Eine Welt Aktion (3)", "Eine Welt Aktion"},
|
{"KlimaWerkStadt (3)", "KlimaWerkStadt"},
|
||||||
{"Hof Buntentor (4)", "Hof Buntentor"},
|
{"Buntentorsteinweg 231, Abholschrank (4)", "Buntentorsteinweg 231, Abholschrank"},
|
||||||
{"Mädchen-Kulturhaus (5)", "Mädchen-Kulturhaus"},
|
{"Klimazone (5)", "Klimazone"},
|
||||||
{"neues Depot im Viertel (6)", "neues Depot im Viertel"},
|
{"Hof von bude e.V., Abholschrank(6)", "Hof von bude e.V., Abholschrank"},
|
||||||
{"Creative Hub (7)", "Creative Hub"},
|
{"Lagerhaus, Abholschrank (7)", "Lagerhaus, Abholschrank"},
|
||||||
{"Klimazone (8)", "Klimazone"},
|
{"KARL, Abholschrank (8)", "KARL, Abholschrank"},
|
||||||
{"Garage Walle (9)", "Garage Walle"},
|
|
||||||
{"Hof Riede (A)", "Hof Riede"},
|
{"Hof Riede (A)", "Hof Riede"},
|
||||||
{"Thedinghausen (B)", "Thedinghausen"}
|
{"Thedinghausen (B)", "Thedinghausen"},
|
||||||
|
{"Achim (Planung ab April) (C)", "Achim"}
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<.input field={@form[:bidding_round]} type="number" readonly hidden />
|
<.input field={@form[:bidding_round]} type="hidden" readonly />
|
||||||
|
<% else %>
|
||||||
|
<.input field={@form[:amount]} type="number" label="Betrag/Monat" />
|
||||||
|
<.input field={@form[:depot_wish_one]} type="hidden" readonly />
|
||||||
|
<.input field={@form[:depot_wish_two]} type="hidden" readonly />
|
||||||
|
<.input field={@form[:bidding_round]} type="hidden" readonly />
|
||||||
|
<% end %>
|
||||||
<footer>
|
<footer>
|
||||||
<.button phx-disable-with="Bearbeitung..." variant="primary">Gebot abgeben</.button>
|
<.button phx-disable-with="Bearbeitung..." variant="primary">Gebot abgeben</.button>
|
||||||
<.button navigate={return_path(@current_scope, @return_to, @bidding)}>Abbrechen</.button>
|
<.button navigate={return_path(@current_scope, @return_to, @bidding)}>Abbrechen</.button>
|
||||||
@ -96,6 +108,10 @@ defmodule BeetRoundServerWeb.BiddingLive.Form do
|
|||||||
defp apply_action(socket, :new, _params) do
|
defp apply_action(socket, :new, _params) do
|
||||||
current_round = BiddingRoundFacade.get_current_round()
|
current_round = BiddingRoundFacade.get_current_round()
|
||||||
|
|
||||||
|
current_bidding = Biddings.get_most_recent_bidding(socket.assigns.current_scope)
|
||||||
|
|
||||||
|
case current_bidding do
|
||||||
|
nil ->
|
||||||
bidding = %Bidding{
|
bidding = %Bidding{
|
||||||
user_id: socket.assigns.current_scope.user.id,
|
user_id: socket.assigns.current_scope.user.id,
|
||||||
bidding_round: current_round
|
bidding_round: current_round
|
||||||
@ -105,6 +121,20 @@ defmodule BeetRoundServerWeb.BiddingLive.Form do
|
|||||||
|> assign(:page_title, "Neues Gebot")
|
|> assign(:page_title, "Neues Gebot")
|
||||||
|> assign(:bidding, bidding)
|
|> assign(:bidding, bidding)
|
||||||
|> assign(:form, to_form(Biddings.change_bidding(socket.assigns.current_scope, bidding)))
|
|> assign(:form, to_form(Biddings.change_bidding(socket.assigns.current_scope, bidding)))
|
||||||
|
|
||||||
|
%Bidding{} ->
|
||||||
|
bidding = %Bidding{
|
||||||
|
user_id: socket.assigns.current_scope.user.id,
|
||||||
|
bidding_round: current_round,
|
||||||
|
depot_wish_one: current_bidding.depot_wish_one,
|
||||||
|
depot_wish_two: current_bidding.depot_wish_two
|
||||||
|
}
|
||||||
|
|
||||||
|
socket
|
||||||
|
|> assign(:page_title, "Neues Gebot")
|
||||||
|
|> assign(:bidding, bidding)
|
||||||
|
|> assign(:form, to_form(Biddings.change_bidding(socket.assigns.current_scope, bidding)))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
|||||||
Reference in New Issue
Block a user