feat(tickets): order detail shows each ticket's attendee and check-in; no resend once checked in
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
This commit is contained in:
1 parent
5c2cb605b9
commit
5831d7e15b
5 files changed
+35
-5
No files matched your search
@@ -42,6 +42,19 @@ describe("OrderPage resend ticket", () => {
|
||||
expect(await screen.findByText("Ticket sent.")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows each ticket's attendee and check-in, and offers no resend once checked in", async () => {
|
||||
mocks.getOrder.mockResolvedValue({ ...detail("PAID"), tickets: [
|
||||
{ id: 1, typeName: "General", status: "ACTIVE", cancelledAt: null, cancelledBy: null, attendeeName: "Tan Mei Ling", checkedInAt: null },
|
||||
{ id: 3, typeName: "General", status: "ACTIVE", cancelledAt: null, cancelledBy: null, attendeeName: null, checkedInAt: "2026-12-04T18:14:00" },
|
||||
] });
|
||||
render(<OrderPage />);
|
||||
const tan = (await screen.findByText("Tan Mei Ling")).closest("tr")!;
|
||||
expect(within(tan).getByRole("button", { name: "Resend ticket" })).toBeInTheDocument();
|
||||
const used = screen.getByText("Not named yet").closest("tr")!;
|
||||
expect(used).toHaveTextContent(/Checked in at/);
|
||||
expect(within(used).queryByRole("button", { name: "Resend ticket" })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("offers no resend before payment", async () => {
|
||||
mocks.getOrder.mockResolvedValue(detail("AWAITING"));
|
||||
render(<OrderPage />);
|
||||
|
||||
@@ -155,6 +155,7 @@ function OrderContent() {
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>{t("TktTicketType")}</TableHead>
|
||||
<TableHead>{t("TktAttendeeName")}</TableHead>
|
||||
<TableHead>{t("Status")}</TableHead>
|
||||
<TableHead />
|
||||
</TableRow>
|
||||
@@ -163,9 +164,13 @@ function OrderContent() {
|
||||
{d.tickets.map((x) => (
|
||||
<TableRow key={x.id}>
|
||||
<TableCell>{x.typeName ?? "-"}</TableCell>
|
||||
<TableCell>{x.status === "ACTIVE" ? t("TktTicketActive") : t("TktTicketCancelledBy", { by: x.cancelledBy ?? "-", at: when(x.cancelledAt) })}</TableCell>
|
||||
<TableCell>{x.attendeeName ?? t("TktNotNamed")}</TableCell>
|
||||
<TableCell>
|
||||
{x.status !== "ACTIVE" ? t("TktTicketCancelledBy", { by: x.cancelledBy ?? "-", at: when(x.cancelledAt) })
|
||||
: x.checkedInAt ? t("TktCheckedInAt", { when: when(x.checkedInAt) }) : t("TktTicketActive")}
|
||||
</TableCell>
|
||||
<TableCell className="text-right">
|
||||
{o.status === "PAID" && x.status === "ACTIVE" && (
|
||||
{o.status === "PAID" && x.status === "ACTIVE" && !x.checkedInAt && (
|
||||
<Button type="button" variant="ghost" size="sm" disabled={busy} onClick={() => run(() => resendTicket(uuid, orderId, x.id).then(() => {}), "TktTicketSent")}>
|
||||
{t("TktResendTicket")}
|
||||
</Button>
|
||||
|
||||
@@ -58,7 +58,8 @@ export interface OrderDetail {
|
||||
createdAt: string;
|
||||
};
|
||||
lines: { id: number; name: string; unitPriceSen: number; quantity: number }[];
|
||||
tickets: { id: number; typeName: string | null; status: "ACTIVE" | "CANCELLED"; cancelledAt: string | null; cancelledBy: string | null }[];
|
||||
tickets: { id: number; typeName: string | null; status: "ACTIVE" | "CANCELLED"; cancelledAt: string | null; cancelledBy: string | null;
|
||||
attendeeName?: string | null; checkedInAt?: string | null }[];
|
||||
}
|
||||
|
||||
const base = (uuid: string) => `/api/events/${encodeURIComponent(uuid)}`;
|
||||
|
||||
+3
-2
@@ -55,7 +55,8 @@ public class TicketOrderStaffService {
|
||||
/** ticketId is used by cancelTicket only. */
|
||||
public record ActionRequest(Long companyId, long eventUuid, long orderId, Long ticketId, String doneBy) {}
|
||||
|
||||
public record TicketView(Long id, String typeName, String status, LocalDateTime cancelledAt, String cancelledBy) {}
|
||||
public record TicketView(Long id, String typeName, String status, LocalDateTime cancelledAt, String cancelledBy, String attendeeName,
|
||||
LocalDateTime checkedInAt) {}
|
||||
|
||||
public record Detail(ShopOrder order, List<ShopOrderLine> lines, List<TicketView> tickets) {}
|
||||
|
||||
@@ -80,7 +81,7 @@ public class TicketOrderStaffService {
|
||||
Map<Long, String> typeNames = types.findByEventUuidOrderBySortAscIdAsc(r.eventUuid()).stream()
|
||||
.collect(Collectors.toMap(TicketType::getId, TicketType::getName));
|
||||
List<TicketView> views = tickets.findByOrderIdOrderByIdAsc(o.getId()).stream().map(t -> new TicketView(t.getId(),
|
||||
typeNames.get(t.getTicketTypeId()), t.getStatus(), t.getCancelledAt(), t.getCancelledBy())).toList();
|
||||
typeNames.get(t.getTicketTypeId()), t.getStatus(), t.getCancelledAt(), t.getCancelledBy(), t.getAttendeeName(), t.getCheckedInAt())).toList();
|
||||
return new Detail(o, lines.findByOrderIdOrderByIdAsc(o.getId()), views);
|
||||
}
|
||||
|
||||
|
||||
+10
@@ -142,6 +142,16 @@ class TicketOrderStaffServiceTest {
|
||||
assertThat(d.tickets()).extracting(TicketOrderStaffService.TicketView::typeName).containsOnly("General");
|
||||
}
|
||||
|
||||
@Test
|
||||
void detailShowsEachTicketsAttendeeAndCheckIn() {
|
||||
t1.setAttendeeName("Tan Mei Ling");
|
||||
java.time.LocalDateTime at = java.time.LocalDateTime.of(2026, 12, 4, 18, 14);
|
||||
t2.setCheckedInAt(at);
|
||||
TicketOrderStaffService.Detail d = service.get(new TicketOrderStaffService.OrderRef(COMPANY, EVENT, 300L));
|
||||
assertThat(d.tickets()).extracting(TicketOrderStaffService.TicketView::attendeeName).containsExactly("Tan Mei Ling", null, null);
|
||||
assertThat(d.tickets()).extracting(TicketOrderStaffService.TicketView::checkedInAt).containsExactly(null, at, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
void marksAnAwaitingOrderPaidWithItsReference() {
|
||||
service.markPaid(new TicketOrderStaffService.PayRequest(COMPANY, EVENT, 300L, " MBB 0412 883 ", "finance1"));
|
||||
|
||||
Reference in new issue
Block a user