diff --git a/.gitignore b/.gitignore index b6e05d3..f4572ae 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ gallium-*.tar npm-debug.log /assets/node_modules/ .env.dev +.env diff --git a/lib/gallium/ticketing.ex b/lib/gallium/ticketing.ex index 074d817..c47e750 100644 --- a/lib/gallium/ticketing.ex +++ b/lib/gallium/ticketing.ex @@ -306,6 +306,17 @@ defmodule Gallium.Ticketing do Repo.get_by(Attendee, user_id: user_id) end + def get_purchase_by_user_id(user_id) do + attendee = + Attendee + |> Repo.get_by(user_id: user_id) + |> Repo.preload([:accompany, :payment]) + + ticket = Repo.get_by(Ticket, user_id: user_id) + + %{attendee: attendee, ticket: ticket} + end + def create_booking(form_data, has_accompany?, user_id) do data = form_data diff --git a/lib/gallium/ticketing/checkout_form.ex b/lib/gallium/ticketing/checkout_form.ex index acac0a9..2e0668e 100644 --- a/lib/gallium/ticketing/checkout_form.ex +++ b/lib/gallium/ticketing/checkout_form.ex @@ -45,6 +45,10 @@ defmodule Gallium.Ticketing.CheckoutForm do ) |> validate_cesium_member(:student_number, :is_cesium_member) |> validate_format(:nif, ~r/^\d{9}$/, message: "O NIF tem de ter exatamente 9 números") + |> validate_length(:table_preference, + max: 30, + message: "A preferência da mesa tem de ter no máximo 30 caracteres" + ) |> cast_embed(:accompany, with: &accompany_changeset/2) end diff --git a/lib/gallium_web/components/forecast.ex b/lib/gallium_web/components/forecast.ex index 4aeed90..faca51a 100644 --- a/lib/gallium_web/components/forecast.ex +++ b/lib/gallium_web/components/forecast.ex @@ -25,8 +25,8 @@ defmodule GalliumWeb.Components.Forecast do /> <.card icon="hero-musical-note" - title="Karaoke & Animação" - description="Diverte-te com karaoke, cantores quebra-gelo e muitas outras surpresas ao longo da noite." + title="Animação" + description="Diverte-te com cartões quebra-gelo e muitas outras surpresas ao longo da noite." /> <.card icon="hero-camera" diff --git a/lib/gallium_web/components/info_component.ex b/lib/gallium_web/components/info_component.ex index 4930d8a..8479e4f 100644 --- a/lib/gallium_web/components/info_component.ex +++ b/lib/gallium_web/components/info_component.ex @@ -24,15 +24,7 @@ defmodule GalliumWeb.Components.InfoSection do
Viagem de Ida
Paragem da UM • Quinta
-18H30 • 19H
- - -Sessão Fotográfica
-19H30 • 20H
+18H • 19:00H
Regresso
3H
+2H
diff --git a/lib/gallium_web/components/program_section.ex b/lib/gallium_web/components/program_section.ex index eb8164f..227862a 100644 --- a/lib/gallium_web/components/program_section.ex +++ b/lib/gallium_web/components/program_section.ex @@ -9,13 +9,13 @@ defmodule GalliumWeb.Components.ProgramSection do attr :schedule_items, :list, default: [ %{ - time: "18H30", + time: "18H", title: "PARTIDA DA UNIVERSIDADE", description: "Encontro na paragem da UM para embarque no autocarro" }, %{ - time: "19H30", - title: "CHEGADA À QUINTA DA ALDEIA", + time: "19H", + title: "CHEGADA À QUINTA VINHA DO CABO", description: "Recepção com entradas e bebidas de boas-vindas" }, %{ @@ -26,15 +26,15 @@ defmodule GalliumWeb.Components.ProgramSection do %{ time: "20H30", title: "JANTAR", - description: "Sopa, prato principal e sobremesa servidos à mesa" + description: "Sopa, prato principal e sobremesa" }, %{ time: "22H00", - title: "ANIMAÇÃO & KARAOKE", - description: "Música, karaoke, cartões quebra-gelo e muitas surpresas" + title: "ANIMAÇÃO", + description: "Música, cartões quebra-gelo e muitas surpresas" }, %{ - time: "3H", + time: "2H", title: "REGRESSO À UNIVERSIDADE", description: "Autocarro de volta ao ponto de partida" } @@ -67,7 +67,7 @@ defmodule GalliumWeb.Components.ProgramSection do- Não percas atividades incríveis como karaoke, cartões quebra-gelo e muitas outras surpresas! + Não percas atividades incríveis como cartões quebra-gelo e muitas outras surpresas!
diff --git a/lib/gallium_web/components/ticket_section.ex b/lib/gallium_web/components/ticket_section.ex index 5d16970..63630e8 100644 --- a/lib/gallium_web/components/ticket_section.ex +++ b/lib/gallium_web/components/ticket_section.ex @@ -35,7 +35,7 @@ defmodule GalliumWeb.Components.TicketSection do "Jantar completo", "Sessão fotográfica", "Transporte opcional", - "Animação e karaoke" + "Animação" ]} /> @@ -47,7 +47,7 @@ defmodule GalliumWeb.Components.TicketSection do "Jantar completo", "Sessão fotográfica", "Transporte opcional", - "Animação e karaoke" + "Animação" ]} /> diff --git a/lib/gallium_web/controllers/midas_controller.ex b/lib/gallium_web/controllers/midas_controller.ex index 314dfc3..9002698 100644 --- a/lib/gallium_web/controllers/midas_controller.ex +++ b/lib/gallium_web/controllers/midas_controller.ex @@ -4,7 +4,7 @@ defmodule GalliumWeb.MidasController do alias Gallium.Ticketing def handle_webhook(conn, %{"api_key" => api_key, "order_id" => order_id}) do - if api_key == Application.fetch_env!(:gallium, :midas)[:midas_api_key] do + if api_key == Application.fetch_env!(:gallium, :midas)[:api_key] do process_payment_if_pending(conn, order_id) else send_resp(conn, 403, "invalid api key") @@ -12,7 +12,7 @@ defmodule GalliumWeb.MidasController do end def payment_received(conn, %{"orderId" => order_id, "key" => api_key}) do - if api_key == Application.fetch_env!(:gallium, :midas)[:midas_api_key] do + if api_key == Application.fetch_env!(:gallium, :midas)[:api_key] do process_payment_if_pending(conn, order_id) else send_resp(conn, 403, "invalid api key") diff --git a/lib/gallium_web/live/landing/index.html.heex b/lib/gallium_web/live/landing/index.html.heex index db29d10..566f1b5 100644 --- a/lib/gallium_web/live/landing/index.html.heex +++ b/lib/gallium_web/live/landing/index.html.heex @@ -1,6 +1,6 @@{if @payment_status == :paid, - do: "O teu pagamento foi recebido. Até já na Quinta da Aldeia!", + 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."}
@@ -63,7 +63,7 @@ 5 de Junho, 2026+ Limite máximo de 10 pessoas por mesa. +
+ <.input field={@form_data[:allergies]} type="text" diff --git a/lib/gallium_web/live/tickets/index.html.heex b/lib/gallium_web/live/tickets/index.html.heex index 1b3b4d1..a102ca3 100644 --- a/lib/gallium_web/live/tickets/index.html.heex +++ b/lib/gallium_web/live/tickets/index.html.heex @@ -21,7 +21,7 @@ "Jantar completo", "Sessão fotográfica", "Transporte opcional", - "Animação e karaoke" + "Animação" ]} /> @@ -34,7 +34,7 @@ "Jantar completo", "Sessão fotográfica", "Transporte opcional", - "Animação e karaoke" + "Animação" ]} />- Garante já o teu lugar no Jantar de Gala na Quinta da Aldeia. + Garante já o teu lugar no Jantar de Gala na Quinta Vinha do Cabo.
<.primary_button text="Comprar Bilhete" diff --git a/lib/gallium_web/live/user_live/registration.ex b/lib/gallium_web/live/user_live/registration.ex index fa8653e..6aea554 100644 --- a/lib/gallium_web/live/user_live/registration.ex +++ b/lib/gallium_web/live/user_live/registration.ex @@ -74,7 +74,7 @@ defmodule GalliumWeb.UserLive.Registration do socket |> put_flash( :info, - "Foi enviado um email para #{user.email}, acede a ele para confirmar a tua conta." + "Foi enviado um email para #{user.email}, acede para confirmar a tua conta." ) |> push_navigate(to: ~p"/users/log-in")} diff --git a/lib/gallium_web/user_auth.ex b/lib/gallium_web/user_auth.ex index c6c0073..601fefc 100644 --- a/lib/gallium_web/user_auth.ex +++ b/lib/gallium_web/user_auth.ex @@ -221,7 +221,10 @@ defmodule GalliumWeb.UserAuth do else socket = socket - |> Phoenix.LiveView.put_flash(:error, "Precisa de estar logado para acessar esta página.") + |> Phoenix.LiveView.put_flash( + :error, + "Precisas de ter a sessão iniciada para aceder a esta página." + ) |> Phoenix.LiveView.redirect(to: ~p"/users/log-in") {:halt, socket} @@ -247,7 +250,7 @@ defmodule GalliumWeb.UserAuth do else socket = socket - |> Phoenix.LiveView.put_flash(:error, "Precisa de ser admin para acessar esta página .") + |> Phoenix.LiveView.put_flash(:error, "Precisa de ser admin para aceder a esta página.") |> Phoenix.LiveView.redirect(to: ~p"/") {:halt, socket} @@ -281,7 +284,7 @@ defmodule GalliumWeb.UserAuth do conn else conn - |> put_flash(:error, "Precisa de estar logado para acessar esta página.") + |> put_flash(:error, "Precisa de ter sessão iniciada para aceder a esta página.") |> maybe_store_return_to() |> redirect(to: ~p"/users/log-in") |> halt() @@ -313,7 +316,7 @@ defmodule GalliumWeb.UserAuth do conn else conn - |> put_flash(:error, "Precisa de ser admin para acessar esta página.") + |> put_flash(:error, "Precisa de ser admin para aceder a esta página.") |> redirect(to: ~p"/") |> halt() end diff --git a/test/gallium_web/live/user_live/confirmation_test.exs b/test/gallium_web/live/user_live/confirmation_test.exs index ee5e782..77d8a07 100644 --- a/test/gallium_web/live/user_live/confirmation_test.exs +++ b/test/gallium_web/live/user_live/confirmation_test.exs @@ -19,7 +19,7 @@ defmodule GalliumWeb.UserLive.ConfirmationTest do {:ok, _lv, html} = live(conn, ~p"/users/log-in/#{token}") - assert html =~ "Confirmar e ficar logado" + assert html =~ "Confirmar e manter sessão iniciada" end test "renders login page for confirmed user", %{conn: conn, confirmed_user: user} do @@ -30,8 +30,8 @@ defmodule GalliumWeb.UserLive.ConfirmationTest do {:ok, _lv, html} = live(conn, ~p"/users/log-in/#{token}") - refute html =~ "Confirmar e ficar logado" - assert html =~ "Mantém-me logado neste dispositivo" + refute html =~ "Confirmar e manter sessão iniciada" + assert html =~ "Manter sessão iniciada neste dispositivo" end test "renders login page for already logged in user", %{conn: conn, confirmed_user: user} do diff --git a/test/gallium_web/live/user_live/registration_test.exs b/test/gallium_web/live/user_live/registration_test.exs index be8603a..22ae09e 100644 --- a/test/gallium_web/live/user_live/registration_test.exs +++ b/test/gallium_web/live/user_live/registration_test.exs @@ -48,7 +48,7 @@ defmodule GalliumWeb.UserLive.RegistrationTest do |> follow_redirect(conn, ~p"/users/log-in") assert html =~ - ~r/Foi enviado um email para .*, acede a ele para confirmar a tua conta/ + ~r/Foi enviado um email para .*, acede para confirmar a tua conta/ end test "renders errors for duplicated email", %{conn: conn} do diff --git a/test/gallium_web/live/user_live/settings_test.exs b/test/gallium_web/live/user_live/settings_test.exs index 639c824..60f2da8 100644 --- a/test/gallium_web/live/user_live/settings_test.exs +++ b/test/gallium_web/live/user_live/settings_test.exs @@ -21,7 +21,7 @@ defmodule GalliumWeb.UserLive.SettingsTest do assert {:redirect, %{to: path, flash: flash}} = redirect assert path == ~p"/users/log-in" - assert %{"error" => "Precisa de estar logado para acessar esta página."} = flash + assert %{"error" => "Precisa de ter sessão iniciada para aceder a esta página."} = flash end end @@ -194,7 +194,7 @@ defmodule GalliumWeb.UserLive.SettingsTest do assert {:redirect, %{to: path, flash: flash}} = redirect assert path == ~p"/users/log-in" assert %{"error" => message} = flash - assert message == "Precisa de estar logado para acessar esta página." + assert message == "Precisa de ter sessão iniciada para aceder a esta página." end end end diff --git a/test/gallium_web/user_auth_test.exs b/test/gallium_web/user_auth_test.exs index 33df35b..a1969ba 100644 --- a/test/gallium_web/user_auth_test.exs +++ b/test/gallium_web/user_auth_test.exs @@ -294,7 +294,7 @@ defmodule GalliumWeb.UserAuthTest do assert redirected_to(conn) == ~p"/users/log-in" assert Phoenix.Flash.get(conn.assigns.flash, :error) == - "Precisa de estar logado para acessar esta página." + "Precisa de ter sessão iniciada para aceder a esta página." end test "stores the path to redirect to on GET", %{conn: conn} do