diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index 10ed13e..32e1898 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -1,6 +1,7 @@ import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import "./index.css"; +import "./utils/i18n"; import App from "./App.tsx"; createRoot(document.getElementById("root")!).render( diff --git a/frontend/src/pages/MainForm.tsx b/frontend/src/pages/MainForm.tsx index 2e1b396..2b62ba1 100644 --- a/frontend/src/pages/MainForm.tsx +++ b/frontend/src/pages/MainForm.tsx @@ -7,6 +7,8 @@ import { CircularProgress, Autocomplete, Chip, + Box, + Paper, } from "@mui/material"; import { useTranslation } from "react-i18next"; import { useState, useEffect } from "react"; @@ -115,168 +117,247 @@ export const MainForm = () => { }; return ( - <> - -
{ - e.preventDefault(); - handleSubmit(); - }} + + - } - onChange={(_event, value) => handleUserSelection(value)} - onKeyDown={(event) => { - if (event.key === "Enter") { - event.defaultMuiPrevented = true; - } + { + e.preventDefault(); + handleSubmit(); }} - /> - - - - - - setInvoice(e.target.checked)} - /> - } - label={t("invoice")} - /> - {invoice && ( - <> + className="flex flex-col gap-4" + > + {/* User Selection */} + ( + + )} + onChange={(_event, value) => handleUserSelection(value)} + onKeyDown={(event) => { + if (event.key === "Enter") { + event.defaultMuiPrevented = true; + } + }} + /> + + {/* Next ID Chip */} + + + {/* Name Fields - Two Columns */} + - - - - - - - )} - {/* Payment methods - only one must be selected */} - } label={t("cash")} /> - } label={t("paypal")} /> - } label={t("transfer")} /> - {isLoading && } - + - {msg && ( - - {msg.headline}: {msg.text} - - )} - - + {/* Email */} + + + {/* Phone Number */} + + + {/* Tickets and Invoice Checkbox */} + + + setInvoice(e.target.checked)} + /> + } + label={t("invoice")} + className="justify-end" + /> + + + {/* Invoice Fields */} + {invoice && ( + + + + {/* Invoice Name Fields - Two Columns */} + + + + + + + + + + + + + + )} + + {/* Payment Methods */} + + } label={t("cash")} /> + } label={t("paypal")} /> + } label={t("transfer")} /> + + + {/* Submit Button */} + + + {/* Alert Message */} + {msg && ( + + {msg.headline}: {msg.text} + + )} + + +
); }; diff --git a/frontend/src/utils/i18n/index.ts b/frontend/src/utils/i18n/index.ts index cddd740..dcfa293 100644 --- a/frontend/src/utils/i18n/index.ts +++ b/frontend/src/utils/i18n/index.ts @@ -22,7 +22,7 @@ i18n .init({ resources, fallbackLng: "en", // use en if detected lng is not available - lng: Cookies.get("language") || "en", // language to use, more information here: https://www.i18next.com/overview/configuration-options#languages-namespaces-resources + lng: Cookies.get("language") || navigator.language.split("-")[0] || "en", // Check cookie first, then browser language // you can use the i18n.changeLanguage function to change the language manually: https://www.i18next.com/overview/api#changelanguage // if you're using a language detector, do not define the lng option diff --git a/frontend/src/utils/i18n/locales/de/de.json b/frontend/src/utils/i18n/locales/de/de.json index f19ced5..fc36ebb 100644 --- a/frontend/src/utils/i18n/locales/de/de.json +++ b/frontend/src/utils/i18n/locales/de/de.json @@ -11,5 +11,12 @@ "submit": "Kaufen", "failed-to-load-users": "Das Laden der Benutzer ist fehlgeschlagen.", "user": "Benutzer", - "next-id": "Nächste Eintragsnummer: " + "next-id": "Nächste Eintragsnummer: ", + "form-submitted-successfully": "Formular erfolgreich übermittelt!", + "orm-submission-failed": "Formularübermittlung fehlgeschlagen.", + "success": "Erfolg", + "error": "Fehler", + "cash": "Bar", + "paypal": "PayPal", + "transfer": "Überweisung" } \ No newline at end of file diff --git a/frontend/src/utils/i18n/locales/en/en.json b/frontend/src/utils/i18n/locales/en/en.json index 087d002..d006942 100644 --- a/frontend/src/utils/i18n/locales/en/en.json +++ b/frontend/src/utils/i18n/locales/en/en.json @@ -11,5 +11,12 @@ "submit": "Buy", "failed-to-load-users": "Failed to load users.", "user": "User", - "next-id": "Next Entry Number: " + "next-id": "Next Entry Number: ", + "form-submitted-successfully": "Form submitted successfully!", + "orm-submission-failed": "Form submission failed.", + "success": "Success", + "error": "Error", + "cash": "Cash", + "paypal": "PayPal", + "transfer": "Bank Transfer" } \ No newline at end of file