registerWalkIn(token, b)} onDone={() => setPhase("done")} onInactive={() => setPhase("inactive")} />;
} else {
body = (
diff --git a/solvway-admin-portal/app/components/events/EventForm.clearErrors.test.tsx b/solvway-admin-portal/app/components/events/EventForm.clearErrors.test.tsx
new file mode 100644
index 0000000..039c2cf
--- /dev/null
+++ b/solvway-admin-portal/app/components/events/EventForm.clearErrors.test.tsx
@@ -0,0 +1,23 @@
+import { render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { describe, it, expect, vi } from "vitest";
+
+vi.mock("@/app/lib/services/adminEvents", () => ({ listSalespersonOptions: vi.fn().mockResolvedValue([]) }));
+
+import { EventForm } from "./EventForm";
+import { pickDate } from "@/test/pickDate";
+
+describe("EventForm error clearing", () => {
+ it("clears a field's error as soon as that field is filled", async () => {
+ render();
+ await userEvent.click(screen.getByRole("button", { name: /create/i }));
+ expect(await screen.findByText("Name is required.")).toBeInTheDocument();
+
+ await userEvent.type(screen.getByLabelText("Name"), "A");
+ expect(screen.queryByText("Name is required.")).not.toBeInTheDocument();
+ expect(screen.getByText("Location is required.")).toBeInTheDocument();
+
+ pickDate("Start date", "2026-12-10");
+ await waitFor(() => expect(screen.queryByText("Start date is required.")).not.toBeInTheDocument());
+ });
+});
diff --git a/solvway-admin-portal/app/components/events/EventForm.tsx b/solvway-admin-portal/app/components/events/EventForm.tsx
index 046bfbd..980b0fe 100644
--- a/solvway-admin-portal/app/components/events/EventForm.tsx
+++ b/solvway-admin-portal/app/components/events/EventForm.tsx
@@ -59,6 +59,9 @@ export function EventForm({ initial, onSubmit, submitLabel }: EventFormProps) {
const [pickersError, setPickersError] = useState(null);
const [fieldErrors, setFieldErrors] = useState>({});
+ // A field's error goes away as soon as the user edits that field; the next submit re-validates.
+ const clearError = (k: string) => setFieldErrors((e) => (k in e ? Object.fromEntries(Object.entries(e).filter(([f]) => f !== k)) : e));
+
const [formError, setFormError] = useState(null);
const [saving, setSaving] = useState(false);
@@ -197,6 +200,7 @@ export function EventForm({ initial, onSubmit, submitLabel }: EventFormProps) {
value={companyChoice}
onValueChange={(v) => {
setCompanyChoice(v);
+ clearError("company");
setSelectedIds(new Set()); // the team is company-specific
}}
disabled={saving}
@@ -224,7 +228,7 @@ export function EventForm({ initial, onSubmit, submitLabel }: EventFormProps) {
id="evt-name"
required
value={name}
- onChange={(e) => setName(e.target.value)}
+ onChange={(e) => { setName(e.target.value); clearError("name"); }}
disabled={saving}
aria-invalid={!!fieldErrors.name}
/>
@@ -241,7 +245,7 @@ export function EventForm({ initial, onSubmit, submitLabel }: EventFormProps) {
id="evt-location"
required
value={location}
- onChange={(e) => setLocation(e.target.value)}
+ onChange={(e) => { setLocation(e.target.value); clearError("location"); }}
disabled={saving}
aria-invalid={!!fieldErrors.location}
/>
@@ -257,7 +261,7 @@ export function EventForm({ initial, onSubmit, submitLabel }: EventFormProps) {
{ setStartDate(v); clearError("startDate"); }}
aria-label={t("EvtStartDate")}
required
disabled={saving}
@@ -275,7 +279,7 @@ export function EventForm({ initial, onSubmit, submitLabel }: EventFormProps) {
{ setEndDate(v); clearError("endDate"); }}
aria-label={t("EvtEndDate")}
required
disabled={saving}
@@ -312,7 +316,7 @@ export function EventForm({ initial, onSubmit, submitLabel }: EventFormProps) {
type="number"
min={1}
value={capacity}
- onChange={(e) => setCapacity(e.target.value)}
+ onChange={(e) => { setCapacity(e.target.value); clearError("capacity"); }}
disabled={saving || !canSetLimits}
aria-invalid={!!fieldErrors.capacity}
/>
@@ -329,7 +333,7 @@ export function EventForm({ initial, onSubmit, submitLabel }: EventFormProps) {
type="number"
min={1}
value={invitationCap}
- onChange={(e) => setInvitationCap(e.target.value)}
+ onChange={(e) => { setInvitationCap(e.target.value); clearError("invitationCap"); }}
disabled={saving || !canSetLimits}
aria-invalid={!!fieldErrors.invitationCap}
/>
diff --git a/solvway-admin-portal/app/components/events/GuestsCard.nothingToSend.test.tsx b/solvway-admin-portal/app/components/events/GuestsCard.nothingToSend.test.tsx
new file mode 100644
index 0000000..37b155f
--- /dev/null
+++ b/solvway-admin-portal/app/components/events/GuestsCard.nothingToSend.test.tsx
@@ -0,0 +1,28 @@
+import { describe, it, expect, vi } from "vitest";
+import { render, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+
+const mocks = vi.hoisted(() => ({
+ listGuests: vi.fn(),
+ addGuests: vi.fn(),
+ removeGuest: vi.fn(),
+ sendInvites: vi.fn(),
+ getAttendance: vi.fn(),
+ useAdminAuth: vi.fn(),
+}));
+vi.mock("@/app/lib/services/adminGuests", () => mocks);
+vi.mock("@/app/lib/AdminAuthContext", () => ({ useAdminAuth: mocks.useAdminAuth }));
+
+import { GuestsCard } from "./GuestsCard";
+
+describe("GuestsCard send to all unsent", () => {
+ it("says so when nothing was sent or skipped", async () => {
+ mocks.listGuests.mockResolvedValue([]);
+ mocks.getAttendance.mockResolvedValue({});
+ mocks.sendInvites.mockResolvedValue({ sent: 0, skippedNoEmail: 0 });
+ mocks.useAdminAuth.mockReturnValue({ loading: false, hasModule: () => true });
+ render();
+ await userEvent.click(await screen.findByRole("button", { name: "Send to all unsent" }));
+ expect(await screen.findByRole("status")).toHaveTextContent("No unsent invitations");
+ });
+});
diff --git a/solvway-admin-portal/app/components/events/GuestsCard.tsx b/solvway-admin-portal/app/components/events/GuestsCard.tsx
index 7edbab7..3a05c0d 100644
--- a/solvway-admin-portal/app/components/events/GuestsCard.tsx
+++ b/solvway-admin-portal/app/components/events/GuestsCard.tsx
@@ -131,7 +131,7 @@ export function GuestsCard({ eventUuid, team = [] }: { eventUuid: string; team?:
const send = (target: { guestIds: number[] } | { allUnsent: true }) =>
run(async () => {
const res = await sendInvites(eventUuid, target);
- setNotice(t("GuestSendResult", { sent: res.sent, skipped: res.skippedNoEmail }));
+ setNotice(res.sent + res.skippedNoEmail === 0 ? t("GuestNoUnsent") : t("GuestSendResult", { sent: res.sent, skipped: res.skippedNoEmail }));
await load();
}, t("GuestSendFailed"));
diff --git a/solvway-admin-portal/app/components/users/UserForm.clearErrors.test.tsx b/solvway-admin-portal/app/components/users/UserForm.clearErrors.test.tsx
new file mode 100644
index 0000000..d096db2
--- /dev/null
+++ b/solvway-admin-portal/app/components/users/UserForm.clearErrors.test.tsx
@@ -0,0 +1,22 @@
+import { render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { describe, it, expect, vi } from "vitest";
+
+vi.mock("@/app/lib/services/adminRoles", () => ({ listAdminRoles: vi.fn().mockResolvedValue([]) }));
+vi.mock("@/app/lib/AdminAuthContext", () => ({ useAdminAuth: vi.fn().mockReturnValue({ id: null }) }));
+
+import { UserForm } from "./UserForm";
+
+describe("UserForm error clearing", () => {
+ it("clears a field's error as soon as that field is filled", async () => {
+ render();
+ await userEvent.click(screen.getByRole("button", { name: /save|create|add/i }));
+ expect(await screen.findByText("Name is required.")).toBeInTheDocument();
+
+ await userEvent.type(screen.getByLabelText("Name"), "A");
+ await waitFor(() => expect(screen.queryByText("Name is required.")).not.toBeInTheDocument());
+ expect(screen.getByText("Email is required.")).toBeInTheDocument();
+ await userEvent.type(screen.getByLabelText("Email"), "a@x.my");
+ expect(screen.queryByText("Email is required.")).not.toBeInTheDocument();
+ });
+});
diff --git a/solvway-admin-portal/app/components/users/UserForm.tsx b/solvway-admin-portal/app/components/users/UserForm.tsx
index 08421b6..455885d 100644
--- a/solvway-admin-portal/app/components/users/UserForm.tsx
+++ b/solvway-admin-portal/app/components/users/UserForm.tsx
@@ -68,6 +68,9 @@ export function UserForm({ initial, onSubmit, submitLabel, withPassword }: UserF
const [loadingPickers, setLoadingPickers] = useState(true);
const [fieldErrors, setFieldErrors] = useState>({});
+ // A field's error goes away as soon as the user edits that field; the next submit re-validates.
+ const clearError = (k: string) => setFieldErrors((e) => (k in e ? Object.fromEntries(Object.entries(e).filter(([f]) => f !== k)) : e));
+
const [formError, setFormError] = useState(null);
const [saving, setSaving] = useState(false);
@@ -161,7 +164,7 @@ export function UserForm({ initial, onSubmit, submitLabel, withPassword }: UserF
id="user-name"
required
value={name}
- onChange={(e) => setName(e.target.value)}
+ onChange={(e) => { setName(e.target.value); clearError("name"); }}
disabled={saving}
aria-invalid={!!fieldErrors.name}
/>
@@ -188,7 +191,7 @@ export function UserForm({ initial, onSubmit, submitLabel, withPassword }: UserF
id="user-username"
required
value={username}
- onChange={(e) => setUsername(e.target.value)}
+ onChange={(e) => { setUsername(e.target.value); clearError("username"); }}
// The backend ignores username on update, so it is fixed once the user exists.
disabled={saving || initial?.id != null}
aria-invalid={!!fieldErrors.username}
@@ -207,7 +210,7 @@ export function UserForm({ initial, onSubmit, submitLabel, withPassword }: UserF
type="email"
required
value={email}
- onChange={(e) => setEmail(e.target.value)}
+ onChange={(e) => { setEmail(e.target.value); clearError("email"); }}
disabled={saving}
aria-invalid={!!fieldErrors.email}
/>
@@ -221,7 +224,7 @@ export function UserForm({ initial, onSubmit, submitLabel, withPassword }: UserF
{showCompany && (
-