Disabling depot wish comboboxes after the first round & updated the depot choices.
This commit is contained in:
@ -20,46 +20,58 @@ 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>
|
||||||
<.input
|
Wenn du für einen halben Anteil bietest, orientiere dich bitte an einen Richtwert von 56 €.
|
||||||
field={@form[:depot_wish_one]}
|
</p>
|
||||||
type="select"
|
<br />
|
||||||
label="Depot Wunsch 1"
|
<p><b>Bietrunde: {@bidding.bidding_round}</b></p>
|
||||||
options={[
|
<%= if @bidding.bidding_round == 1 do %>
|
||||||
{"", ""},
|
<.input field={@form[:amount]} type="number" label="Betrag/Monat" />
|
||||||
{"KlimaWerkStadt (1)", "KlimaWerkStadt"},
|
<.input
|
||||||
{"Puramila (2)", "Puramila"},
|
field={@form[:depot_wish_one]}
|
||||||
{"Eine Welt Aktion (3)", "Eine Welt Aktion"},
|
type="select"
|
||||||
{"Hof Buntentor (4)", "Hof Buntentor"},
|
label="Depot Wunsch 1"
|
||||||
{"Mädchen-Kulturhaus (5)", "Mädchen-Kulturhaus"},
|
options={[
|
||||||
{"neues Depot im Viertel (6)", "neues Depot im Viertel"},
|
{"", ""},
|
||||||
{"Creative Hub (7)", "Creative Hub"},
|
{"Puramila (1)", "Puramila"},
|
||||||
{"Klimazone (8)", "Klimazone"},
|
{"Eine Welt Aktion (2)", "Eine Welt Aktion"},
|
||||||
{"Garage Walle (9)", "Garage Walle"},
|
{"KlimaWerkStadt (3)", "KlimaWerkStadt"},
|
||||||
{"Hof Riede (A)", "Hof Riede"},
|
{"Buntentorsteinweg 231, Abholschrank (4)", "Buntentorsteinweg 231, Abholschrank"},
|
||||||
{"Thedinghausen (B)", "Thedinghausen"}
|
{"Klimazone (5)", "Klimazone"},
|
||||||
]}
|
{"Hof von bude e.V., Abholschrank(6)", "Hof von bude e.V., Abholschrank"},
|
||||||
/>
|
{"Lagerhaus, Abholschrank (7)", "Lagerhaus, Abholschrank"},
|
||||||
<.input
|
{"KARL, Abholschrank (8)", "KARL, Abholschrank"},
|
||||||
field={@form[:depot_wish_two]}
|
{"Hof Riede (A)", "Hof Riede"},
|
||||||
type="select"
|
{"Thedinghausen (B)", "Thedinghausen"},
|
||||||
label="Depot Wunsch 2"
|
{"Achim (Planung ab April) (C)", "Achim"}
|
||||||
options={[
|
]}
|
||||||
{"", ""},
|
/>
|
||||||
{"KlimaWerkStadt (1)", "KlimaWerkStadt"},
|
<.input
|
||||||
{"Puramila (2)", "Puramila"},
|
field={@form[:depot_wish_two]}
|
||||||
{"Eine Welt Aktion (3)", "Eine Welt Aktion"},
|
type="select"
|
||||||
{"Hof Buntentor (4)", "Hof Buntentor"},
|
label="Depot Wunsch 2"
|
||||||
{"Mädchen-Kulturhaus (5)", "Mädchen-Kulturhaus"},
|
options={[
|
||||||
{"neues Depot im Viertel (6)", "neues Depot im Viertel"},
|
{"", ""},
|
||||||
{"Creative Hub (7)", "Creative Hub"},
|
{"Puramila (1)", "Puramila"},
|
||||||
{"Klimazone (8)", "Klimazone"},
|
{"Eine Welt Aktion (2)", "Eine Welt Aktion"},
|
||||||
{"Garage Walle (9)", "Garage Walle"},
|
{"KlimaWerkStadt (3)", "KlimaWerkStadt"},
|
||||||
{"Hof Riede (A)", "Hof Riede"},
|
{"Buntentorsteinweg 231, Abholschrank (4)", "Buntentorsteinweg 231, Abholschrank"},
|
||||||
{"Thedinghausen (B)", "Thedinghausen"}
|
{"Klimazone (5)", "Klimazone"},
|
||||||
]}
|
{"Hof von bude e.V., Abholschrank(6)", "Hof von bude e.V., Abholschrank"},
|
||||||
/>
|
{"Lagerhaus, Abholschrank (7)", "Lagerhaus, Abholschrank"},
|
||||||
<.input field={@form[:bidding_round]} type="number" readonly hidden />
|
{"KARL, Abholschrank (8)", "KARL, Abholschrank"},
|
||||||
|
{"Hof Riede (A)", "Hof Riede"},
|
||||||
|
{"Thedinghausen (B)", "Thedinghausen"},
|
||||||
|
{"Achim (Planung ab April) (C)", "Achim"}
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<.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,15 +108,33 @@ 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()
|
||||||
|
|
||||||
bidding = %Bidding{
|
current_bidding = Biddings.get_most_recent_bidding(socket.assigns.current_scope)
|
||||||
user_id: socket.assigns.current_scope.user.id,
|
|
||||||
bidding_round: current_round
|
|
||||||
}
|
|
||||||
|
|
||||||
socket
|
case current_bidding do
|
||||||
|> assign(:page_title, "Neues Gebot")
|
nil ->
|
||||||
|> assign(:bidding, bidding)
|
bidding = %Bidding{
|
||||||
|> assign(:form, to_form(Biddings.change_bidding(socket.assigns.current_scope, bidding)))
|
user_id: socket.assigns.current_scope.user.id,
|
||||||
|
bidding_round: current_round
|
||||||
|
}
|
||||||
|
|
||||||
|
socket
|
||||||
|
|> assign(:page_title, "Neues Gebot")
|
||||||
|
|> assign(:bidding, 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