<.primary_button
diff --git a/lib/gallium_web/live/ticketing_purchase/steps/confirmation.html.heex b/lib/gallium_web/live/ticketing_purchase/steps/confirmation.html.heex
index bb95f03..3245514 100644
--- a/lib/gallium_web/live/ticketing_purchase/steps/confirmation.html.heex
+++ b/lib/gallium_web/live/ticketing_purchase/steps/confirmation.html.heex
@@ -1,31 +1,57 @@
"bg-olive text-olive-600"
+ :blocked -> "bg-red-100 text-red-600"
+ _ -> "bg-amber-100 text-amber-600"
+ end
]}>
<.icon
- name={if @payment_status == :paid, do: "hero-check-circle", else: "hero-clock"}
+ name={
+ case @payment_status do
+ :paid -> "hero-check-circle"
+ :blocked -> "hero-no-symbol"
+ _ -> "hero-clock"
+ end
+ }
class={
- if @payment_status == :paid, do: "size-10 text-white", else: "size-10 text-amber-600ç"
+ case @payment_status do
+ :paid -> "size-10 text-white"
+ :blocked -> "size-10 text-red-600"
+ _ -> "size-10 text-amber-600"
+ end
}
/>
"text-olive"
+ :blocked -> "text-red-600"
+ _ -> "text-amber-600"
+ end
]}>
- {if @payment_status == :paid, do: "Bilhete Confirmado!", else: "Pagamento Pendente"}
+ <%= case @payment_status do %>
+ <% :paid -> %>
+ Bilhete Confirmado!
+ <% :blocked -> %>
+ Pagamento Bloqueado
+ <% _ -> %>
+ Pagamento Pendente
+ <% end %>
- {if @payment_status == :paid,
- do: "O teu pagamento foi recebido. Até já na Quinta Vinha do Cabo!",
- else:
- "A tua reserva foi registada. Efetua o pagamento via MBWay para confirmares o teu bilhete."}
+ <%= case @payment_status do %>
+ <% :paid -> %>
+ O teu pagamento foi recebido. Até já na Quinta Vinha do Cabo!
+ <% :blocked -> %>
+ O limite de 100 lugares pagos já foi atingido, incluindo acompanhantes. Contacta a organização para regularizar a situação.
+ <% _ -> %>
+ A tua reserva foi registada. Efetua o pagamento via MBWay para confirmares o teu bilhete.
+ <% end %>
diff --git a/priv/repo/migrations/20260511120000_change_attendees_wants_transport_default.exs b/priv/repo/migrations/20260511120000_change_attendees_wants_transport_default.exs
new file mode 100644
index 0000000..095a80b
--- /dev/null
+++ b/priv/repo/migrations/20260511120000_change_attendees_wants_transport_default.exs
@@ -0,0 +1,9 @@
+defmodule Gallium.Repo.Migrations.ChangeAttendeesWantsTransportDefault do
+ use Ecto.Migration
+
+ def change do
+ alter table(:attendees) do
+ modify :wants_transport, :boolean, null: false, default: true
+ end
+ end
+end
diff --git a/test/gallium/ticketing_test.exs b/test/gallium/ticketing_test.exs
index d65822e..42bde43 100644
--- a/test/gallium/ticketing_test.exs
+++ b/test/gallium/ticketing_test.exs
@@ -144,6 +144,43 @@ defmodule Gallium.TicketingTest do
end
end
+ describe "ticket capacity" do
+ import Gallium.TicketingFixtures
+
+ test "paid_people_count/0 counts paid attendees and their accompanies" do
+ paid_attendee = attendee_fixture()
+ paid_attendee_with_accompany = attendee_fixture()
+ pending_attendee = attendee_fixture()
+
+ accompany_fixture(%{attendee_id: paid_attendee_with_accompany.id})
+ accompany_fixture(%{attendee_id: pending_attendee.id})
+
+ payment_fixture(%{attendee_id: paid_attendee.id, status: :paid})
+ payment_fixture(%{attendee_id: paid_attendee_with_accompany.id, status: :paid})
+ payment_fixture(%{attendee_id: pending_attendee.id, status: :pending})
+
+ assert Ticketing.paid_people_count() == 3
+ assert Ticketing.available_ticket_slots() == 97
+ assert Ticketing.ticket_capacity_available?(97)
+ refute Ticketing.ticket_capacity_available?(98)
+ end
+
+ test "mark_payment_paid/1 accepts a confirmed payment even when it exceeds capacity" do
+ for index <- 1..99 do
+ attendee = attendee_fixture()
+ payment_fixture(%{attendee_id: attendee.id, status: :paid, order_id: "paid-#{index}"})
+ end
+
+ attendee = attendee_fixture()
+ accompany_fixture(%{attendee_id: attendee.id})
+ payment_fixture(%{attendee_id: attendee.id, status: :pending, order_id: "pending-over-cap"})
+
+ assert {:ok, payment} = Ticketing.mark_payment_paid("pending-over-cap")
+ assert payment.status == :paid
+ assert Ticketing.paid_people_count() == 101
+ end
+ end
+
describe "attendees" do
alias Gallium.Ticketing.Attendee
import Gallium.TicketingFixtures