Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
Start work on responsive colors for QR code scans
Graham Blair35c5d5dc8562
diff --git a/frontend/src/components/common/AttendeeCheckInTable/AttendeesCheckInTable.module.scss b/frontend/src/components/common/AttendeeCheckInTable/AttendeesCheckInTable.module.scssdeleted file mode 100644index 53d96cdbe..000000000--- a/frontend/src/components/common/AttendeeCheckInTable/AttendeesCheckInTable.module.scss+++ /dev/null@@ -1,68 +0,0 @@-@import '../../../styles/mixins';--.header {- position: sticky;- top: 0;- z-index: 2;- display: flex;- flex-direction: column;-- .checkInCount {- font-size: 0.7em;- color: #999;- }-- .search {- flex: 1;-- .searchBar {- display: flex;- gap: 20px;- align-items: center;-- .searchInput {- flex: 1;- margin-bottom: 0 !important;- }-- .scanButton {- @include respond-below(sm) {- display: none;- }- }-- .scanIcon {- display: none;- @include respond-below(sm) {- display: flex;- }- }- }- }-- .stats {- flex: 1;- }-}--.loading, .noResults {- display: flex;- justify-content: center;- align-items: center;- margin-top: 50px;-}--.attendees {- .attendee {- display: flex;- align-items: center;-- .details {- flex: 1;- }-- .actions {- flex-grow: initial;- }- }-}diff --git a/frontend/src/components/common/AttendeeCheckInTable/QrScanner.module.scss b/frontend/src/components/common/AttendeeCheckInTable/QrScanner.module.scssindex c22c2e81b..189811d67 100644--- a/frontend/src/components/common/AttendeeCheckInTable/QrScanner.module.scss+++ b/frontend/src/components/common/AttendeeCheckInTable/QrScanner.module.scss@@ -63,6 +63,7 @@animation: colorfulBorder 10s infinite;border-radius: 10px;outline: solid 50vmax #472e7840;+ transition: outline-color .2s ease-out;min-width: 200px;min-height: 200px;@@ -72,6 +73,16 @@}}+ .scannerOverlay.success {+ outline: solid 50vmax rgb(72 193 72 / 50%);++ }++ .scannerOverlay.failure {+ outline: solid 50vmax rgb(193 72 72 / 50%);++ }+video {width: 100vw !important;height: 100vh !important;diff --git a/frontend/src/components/common/AttendeeCheckInTable/QrScanner.tsx b/frontend/src/components/common/AttendeeCheckInTable/QrScanner.tsxindex c90465173..a5251035e 100644--- a/frontend/src/components/common/AttendeeCheckInTable/QrScanner.tsx+++ b/frontend/src/components/common/AttendeeCheckInTable/QrScanner.tsx@@ -8,7 +8,7 @@ import {showError} from "../../../utilites/notifications.tsx";import {t, Trans} from "@lingui/macro";interface QRScannerComponentProps {- onCheckIn: (attendeePublicId: string, onRequestComplete: () => void, onFailure: () => void) => void;+ onCheckIn: (attendeePublicId: string, onRequestComplete: (didSucceed: bool) => void, onFailure: () => void) => void;onClose: () => void;}@@ -26,6 +26,8 @@ export const QRScannerComponent = (props: QRScannerComponentProps) => {const [currentAttendeeId, setCurrentAttendeeId] = useState<string | null>(null);const [debouncedAttendeeId] = useDebouncedValue(currentAttendeeId, 500);+ const [isScanFailed, setIsScanFailed] = useState(false);+ const [isScanSucceeded, setIsScanSucceeded] = useState(false);useEffect(() => {latestProcessedAttendeeIdsRef.current = processedAttendeeIds;@@ -56,15 +58,33 @@ export const QRScannerComponent = (props: QRScannerComponentProps) => {if (alreadyScanned) {showError(t`You already scanned this ticket`);+ setIsScanFailed(true);+ setInterval(function() {+ setIsScanFailed(false);+ }, 1000);return;}if (!isCheckingIn && !alreadyScanned) {setIsCheckingIn(true);- props.onCheckIn(debouncedAttendeeId, () => {+ props.onCheckIn(debouncedAttendeeId, (didSucceed) => {setIsCheckingIn(false);setProcessedAttendeeIds(prevIds => [...prevIds, debouncedAttendeeId]);setCurrentAttendeeId(null);++ console.log(`Did it succeed? ${didSucceed}`)+ console.log(this);+ if (didSucceed) {+ setIsScanSucceeded(true);+ setInterval(function() {+ setIsScanSucceeded(false);+ }, 1000);+ } else {+ setIsScanFailed(true);+ setInterval(function() {+ setIsScanFailed(false);+ }, 1000);+ }}, () => {setIsCheckingIn(false);setCurrentAttendeeId(null);@@ -178,7 +198,7 @@ export const QRScannerComponent = (props: QRScannerComponentProps) => {</Menu.Dropdown></Menu></Button>- <div className={classes.scannerOverlay}/>+ <div className={`${classes.scannerOverlay} ${isScanSucceeded ? classes.success : ""} ${isScanFailed ? classes.failure : ""}`}/></div>);};diff --git a/frontend/src/components/common/AttendeeCheckInTable/index.tsx b/frontend/src/components/common/AttendeeCheckInTable/index.tsxdeleted file mode 100644index 37f5a004e..000000000--- a/frontend/src/components/common/AttendeeCheckInTable/index.tsx+++ /dev/null@@ -1,204 +0,0 @@-import {ActionIcon, Button, Loader, Modal, Switch} from "@mantine/core";-import classes from './AttendeesCheckInTable.module.scss';-import {useParams} from "react-router-dom";-import {Card} from "../Card";-import {PageTitle} from "../PageTitle";-import {SearchBar} from "../SearchBar";-import {useState} from "react";-import {useDebouncedValue} from "@mantine/hooks";-import {useGetAttendees} from "../../../queries/useGetAttendees.ts";-import {useGetEvent} from "../../../queries/useGetEvent.ts";-import {useCheckInAttendee} from "../../../mutations/useCheckInAttendee.ts";-import {Attendee, QueryFilters} from "../../../types.ts";-import {showError, showSuccess} from "../../../utilites/notifications.tsx";-import {AxiosError} from "axios";-import {IconQrcode} from "@tabler/icons-react";-import {QRScannerComponent} from "./QrScanner.tsx";-import {t, Trans} from "@lingui/macro";-import {useGetEventCheckInStats} from "../../../queries/useGetEventCheckInStats.ts";--export const AttendeesCheckInTable = () => {- const {eventId} = useParams();- const [searchQuery, setSearchQuery] = useState('');- const [searchQueryDebounced] = useDebouncedValue(searchQuery, 200);- const [qrScannerOpen, setQrScannerOpen] = useState(false);- const {data: {tickets} = {}} = useGetEvent(eventId);- const queryFilters: QueryFilters = {- pageNumber: 1,- query: searchQueryDebounced,- perPage: 100,- filterFields: {- status: ['ACTIVE'],- },- };- const attendeesQuery = useGetAttendees(eventId, queryFilters);- const attendees = attendeesQuery?.data?.data;- const mutation = useCheckInAttendee();- const {data: eventStats} = useGetEventCheckInStats(eventId);-- const handleCheckInToggle = (checked: boolean, attendee: Attendee) => {- mutation.mutate({- eventId: eventId,- attendeePublicId: attendee.public_id,- action: checked ? 'check_in' : 'check_out',- pagination: queryFilters,- }, {- onSuccess: ({data: attendee}, variables) => {- showSuccess(<Trans>Successfully- checked <b>{attendee.first_name} {attendee.last_name}</b> {variables.action === 'check_in' ? 'in' : 'out'}- </Trans>);- },- onError: (error, variables) => {- if (error instanceof AxiosError) {- showError(error?.response?.data.message ||- <Trans>Unable to {variables.action ? t`check in` : t`check out`} attendee</Trans>);- }- }- })- }-- const handleQrCheckIn = (attendeePublicId: string, onRequestComplete?: () => void) => {- mutation.mutate({- eventId: eventId,- attendeePublicId: attendeePublicId,- action: 'check_in',- pagination: queryFilters,- }, {- onSuccess: ({data: attendee}, variables) => {- if (onRequestComplete) {- onRequestComplete()- }- showSuccess(<Trans>Successfully- checked <b>{attendee.first_name} {attendee.last_name}</b> {variables.action === 'check_in' ? 'in' : 'out'}- </Trans>);- },- onError: (error, variables) => {- if (onRequestComplete) {- onRequestComplete()- }- if (error instanceof AxiosError) {- showError(error?.response?.data.message ||- <Trans>Unable to {variables.action ? t`check in` : t`check out`} attendee</Trans>);- }- }- })- }-- const Attendees = () => {- const Container = () => {- if (attendeesQuery.isFetching || !attendees || !tickets) {- return (- <div className={classes.loading}>- <Loader size={40}/>- </div>- )- }-- if (attendees.length === 0) {- return (- <div className={classes.noResults}>- No attendees to show.- </div>- );- }-- return (- <div className={classes.attendees}>- {attendees.map(attendee => {- return (- <Card className={classes.attendee} key={attendee.public_id}>- <div className={classes.details}>- <div>- {attendee.first_name} {attendee.last_name}- </div>- <div>- <b>{attendee.public_id}</b>- </div>- <div style={{color: 'gray'}}>- {tickets.find(ticket => ticket.id === attendee.ticket_id)?.title}- </div>- </div>- <div className={classes.actions}>- <Switch- color={'green'}- onLabel={t`Checked In`}- offLabel={t`Not Checked In`}- size="xl"- disabled={mutation.isPending}- checked={attendee.checked_in_at !== null}- value={attendee.public_id}- onChange={(event) => handleCheckInToggle(event.target.checked, attendee)}- />- </div>- </Card>- )- })}- </div>- )- }-- return (- <div style={{position: 'relative'}}>- <Container/>- </div>- );- }-- return (- <>- <Card className={classes.header}>- <div className={classes.search}>- <PageTitle>- {t`Check In`}{' '}- {eventStats && (- <span className={classes.checkInCount}>- <Trans>- {eventStats && `${eventStats.total_checked_in_attendees}/${eventStats.total_attendees}`} checked in- </Trans>- </span>- )}- </PageTitle>-- <div className={classes.searchBar}>- <SearchBar- className={classes.searchInput}- mb={20}- value={searchQuery}- onChange={(event) => setSearchQuery(event.target.value)}- onClear={() => setSearchQuery('')}- placeholder={t`Seach by name, order #, attendee # or email...`}- />- <Button variant={'light'} size={'md'} className={classes.scanButton}- onClick={() => setQrScannerOpen(true)} leftSection={<IconQrcode/>}>- {t`Scan QR Code`}- </Button>- <ActionIcon aria-label={t`Scan QR Code`} variant={'light'} size={'xl'}- className={classes.scanIcon}- onClick={() => setQrScannerOpen(true)}>- <IconQrcode size={32}/>- </ActionIcon>- </div>- </div>- </Card>- <Attendees/>- {qrScannerOpen && (- <Modal.Root- opened- onClose={() => setQrScannerOpen(false)}- fullScreen- radius={0}- transitionProps={{transition: 'fade', duration: 200}}- padding={'none'}- >- <Modal.Overlay/>- <Modal.Content>- <QRScannerComponent- onCheckIn={handleQrCheckIn}- onClose={() => setQrScannerOpen(false)}- />- </Modal.Content>- </Modal.Root>- )}- </>- );-};diff --git a/frontend/src/components/layouts/CheckIn/index.tsx b/frontend/src/components/layouts/CheckIn/index.tsxindex 9b5e65e9b..c932b8fa4 100644--- a/frontend/src/components/layouts/CheckIn/index.tsx+++ b/frontend/src/components/layouts/CheckIn/index.tsx@@ -100,14 +100,14 @@ const CheckIn = () => {)}- const handleQrCheckIn = (attendeePublicId: string, onRequestComplete: () => void, onFailure: () => void) => {+ const handleQrCheckIn = (attendeePublicId: string, onRequestComplete: (didSucceed: void) => void, onFailure: () => void) => {checkInMutation.mutate({checkInListShortId: checkInListShortId,attendeePublicId: attendeePublicId,}, {onSuccess: ({errors}) => {if (onRequestComplete) {- onRequestComplete()+ onRequestComplete(!(errors && errors[attendeePublicId]))}// Show error if there is an error for this specific attendee// It's a bulk endpoint, so even if there's an error it returns a 200