Skip to content

Commit 2855efe

Browse files
authored
Chore: Attendee table cleanup (#899)
1 parent 87918a2 commit 2855efe

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

backend/app/Repository/Eloquent/AttendeeRepository.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use HiEvents\DomainObjects\Generated\AttendeeDomainObjectAbstract;
88
use HiEvents\DomainObjects\Status\AttendeeStatus;
99
use HiEvents\DomainObjects\Status\OrderStatus;
10-
use HiEvents\Http\DTO\FilterFieldDTO;
1110
use HiEvents\Http\DTO\QueryParamsDTO;
1211
use HiEvents\Models\Attendee;
1312
use HiEvents\Repository\Eloquent\Value\Relationship;

frontend/src/components/common/AttendeeTable/index.tsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
import {Anchor, Avatar, Badge, Button, Table as MantineTable, Tooltip, ActionIcon, Popover, Group} from '@mantine/core';
2-
import {Attendee, MessageType} from "../../../types.ts";
3-
import {IconMailForward, IconPlus, IconSend, IconTrash, IconUserCog, IconQrcode, IconNote, IconCopy} from "@tabler/icons-react";
1+
import {ActionIcon, Anchor, Avatar, Badge, Button, Group, Popover, Table as MantineTable, Tooltip} from '@mantine/core';
2+
import {Attendee, IdParam, MessageType} from "../../../types.ts";
3+
import {
4+
IconCopy,
5+
IconMailForward,
6+
IconNote,
7+
IconPlus,
8+
IconQrcode,
9+
IconQrcodeOff,
10+
IconSend,
11+
IconTrash,
12+
IconUserCog
13+
} from "@tabler/icons-react";
414
import {getInitials, getProductFromEvent} from "../../../utilites/helpers.ts";
515
import {Table, TableHead} from "../Table";
6-
import {useDisclosure, useClipboard} from "@mantine/hooks";
16+
import {useClipboard, useDisclosure} from "@mantine/hooks";
717
import {SendMessageModal} from "../../modals/SendMessageModal";
818
import {useState} from "react";
919
import {NoResultsSplash} from "../NoResultsSplash";
@@ -22,7 +32,6 @@ import {ActionMenu} from '../ActionMenu';
2232
import {AttendeeStatusBadge} from "../AttendeeStatusBadge";
2333
import {CheckInStatusModal} from "../CheckInStatusModal";
2434
import {prettyDate} from "../../../utilites/dates.ts";
25-
import {IdParam} from "../../../types.ts";
2635

2736
interface AttendeeTableProps {
2837
attendees: Attendee[];
@@ -116,7 +125,7 @@ export const AttendeeTable = ({attendees, openCreateModal}: AttendeeTableProps)
116125
return getCheckInCount(attendee) > 0;
117126
};
118127

119-
const handleCopyEmail = (email: string, attendeeId: number | undefined) => {
128+
const handleCopyEmail = (email: string) => {
120129
clipboard.copy(email);
121130
showSuccess(t`Email address copied to clipboard`);
122131
setEmailPopoverId(null);
@@ -202,7 +211,7 @@ export const AttendeeTable = ({attendees, openCreateModal}: AttendeeTableProps)
202211
variant="light"
203212
color="gray"
204213
leftSection={<IconCopy size={16}/>}
205-
onClick={() => handleCopyEmail(attendee.email, attendee.id)}
214+
onClick={() => handleCopyEmail(attendee.email)}
206215
>
207216
{t`Copy Email`}
208217
</Button>
@@ -253,7 +262,8 @@ export const AttendeeTable = ({attendees, openCreateModal}: AttendeeTableProps)
253262
onClick={() => handleModalClick(attendee, checkInModal)}
254263
aria-label={t`View check-in status`}
255264
>
256-
<IconQrcode size={18}/>
265+
{!hasChecked && <IconQrcodeOff size={18}/>}
266+
{hasChecked && <IconQrcode size={18}/>}
257267
{hasChecked && (
258268
<Badge
259269
size="xs"

frontend/src/components/routes/event/attendees.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {IconDownload, IconPlus} from "@tabler/icons-react";
1010
import {ToolBar} from "../../common/ToolBar";
1111
import {TableSkeleton} from "../../common/TableSkeleton";
1212
import {useFilterQueryParamSync} from "../../../hooks/useFilterQueryParamSync.ts";
13-
import {IdParam, QueryFilters, QueryFilterOperator} from "../../../types.ts";
13+
import {IdParam, QueryFilters, QueryFilterOperator, ProductType} from "../../../types.ts";
1414
import {useDisclosure} from "@mantine/hooks";
1515
import {CreateAttendeeModal} from "../../modals/CreateAttendeeModal";
1616
import {downloadBinary} from "../../../utilites/download.ts";
@@ -38,7 +38,9 @@ const Attendees = () => {
3838
const [downloadPending, setDownloadPending] = useState(false);
3939
const {data: event} = useGetEvent(eventId);
4040

41-
const productOptions = getProductsFromEvent(event)?.flatMap(product => {
41+
const productOptions = getProductsFromEvent(event)
42+
?.filter(product => product.product_type === ProductType.Ticket)
43+
?.flatMap(product => {
4244
const options = [];
4345

4446
options.push({

frontend/src/utilites/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Event} from "../types.ts";
1+
import {Event, Product} from "../types.ts";
22
import {MantineColor} from "@mantine/core";
33
import {getConfig} from "./config.ts";
44

@@ -28,7 +28,7 @@ export const getInitials = (fullName: string) => {
2828
}, '');
2929
};
3030

31-
export const getProductsFromEvent = (event?: Event) => {
31+
export const getProductsFromEvent = (event?: Event): Product[] | undefined => {
3232
return event?.product_categories?.flatMap(category => category.products).filter(product => product !== undefined);
3333
}
3434

0 commit comments

Comments
 (0)