giraffe icon indicating copy to clipboard operation
giraffe copied to clipboard

Checkout api enhancement

Open yaxit24 opened this issue 4 months ago • 5 comments

Fixes #38.

Summary by Sourcery

Enhance the Eventyay search check-in component and its Pinia store to support both check-in and check-out workflows, including single and bulk check-out, with improved UI feedback via popups and badge preview

New Features:

  • Add check-out mode toggle and support for exiting attendees via the check-in/redeem API
  • Implement an event-wide “Checkout All Attendees” action with confirmation dialog

Enhancements:

  • Show attendee info popup with countdown timer, note input, and badge generation preview using StandardButton and BadgePrintPreview components
  • Unify check-in and check-out flows in processEventyayCheckIn store with new isCheckoutMode, toggleMode, and eventCheckout actions
  • Resume QR camera scanning after each operation

yaxit24 avatar Jul 31 '25 18:07 yaxit24

Reviewer's Guide

This PR enhances the Eventyay check-in component and its store to support a dedicated checkout mode, including new store state and actions, dual API endpoints for entry/exit, a ‘checkout all’ feature, UI updates with a mode toggle and dynamic buttons, and a confirmation popup with countdown and badge preview.

Sequence diagram for check-in and checkout API interaction

sequenceDiagram
    actor User
    participant UI as EventyaySearchCheckIn.vue
    participant Store as processEventyayCheckInStore
    participant API as Eventyay API
    User->>UI: Scan QR code / Click check-in/out
    UI->>Store: checkIn(order)
    alt Checkout mode
        Store->>API: POST /checkin/redeem/ (type: exit)
    else Check-in mode
        Store->>API: POST /orderpositions/{id}/checkin/
    end
    API-->>Store: Response (status)
    Store->>UI: showSuccessMsg/showErrorMsg
    UI->>User: Show popup with result

Sequence diagram for event-wide checkout

sequenceDiagram
    actor User
    participant UI as EventyaySearchCheckIn.vue
    participant Store as processEventyayCheckInStore
    participant API as Eventyay API
    User->>UI: Click 'Checkout All Attendees'
    UI->>Store: eventCheckout()
    Store->>API: POST /events/{eventSlug}/checkout/
    API-->>Store: Response (status, checkout_count)
    Store->>UI: showSuccessMsg/showErrorMsg
    UI->>User: Show popup with result

Class diagram for updated processEventyayCheckInStore

classDiagram
    class processEventyayCheckInStore {
      +message: ref
      +showSuccess: ref
      +showError: ref
      +badgeUrl: ref
      +isGeneratingBadge: ref
      +isCheckoutMode: ref
      +$reset()
      +toggleMode()
      +showErrorMsg(msg, attendeeName)
      +showSuccessMsg(msg, attendeeName)
      +checkIn()
      +printBadge()
      +eventCheckout()
    }

Class diagram for updated EventyaySearchCheckIn.vue component structure

classDiagram
    class EventyaySearchCheckIn {
      -searchQuery: ref
      -orders: ref
      -loading: ref
      -showPrintPreview: ref
      -countdown: ref
      -timerInstance: ref
      -timeoutInstance: ref
      -notes: ref
      +checkIn(order)
      +handleToggleMode()
      +handleEventCheckout()
      +startCountdown()
      +stopTimer()
      +handleNotesInput()
      +handleCancel()
      +handlePrintBadge()
      +handlePrintClose()
      +handlePrint()
      +showPopup()
      +generateBadge(order)
    }

File-Level Changes

Change Details Files
Add checkout mode state and actions to processEventyayCheckIn store
  • Define isCheckoutMode ref and expose it in the store
  • Implement toggleMode action to switch modes
  • Add eventCheckout action for bulk event checkout
src/stores/processEventyayCheckIn.js
Implement dual check-in/check-out API logic in component and store
  • Branch component checkIn method to call redeem endpoint when in checkout mode
  • Set request type (entry/exit) based on isCheckoutMode in store
  • Handle various response.status cases (ok, redeemed, cancelled, etc.) with success/error messaging
src/components/Eventyay/EventyaySearchCheckIn.vue
src/stores/processEventyayCheckIn.js
Introduce 'Checkout All Attendees' feature and button in UI
  • Add StandardButton for bulk checkout and bind handleEventCheckout
  • Implement eventCheckout store method to call event-level checkout API
src/components/Eventyay/EventyaySearchCheckIn.vue
src/stores/processEventyayCheckIn.js
Add confirmation popup with countdown and badge preview
  • Add reactive vars (showPrintPreview, countdown, timer/timeout instances)
  • Create modal template displaying attendee info, countdown, and action buttons
  • Implement startCountdown, stopTimer, showPopup and handlePrintClose logic
src/components/Eventyay/EventyaySearchCheckIn.vue
Revamp component layout with mode toggle and dynamic button styles
  • Restructure template into left/right panels for event info and search
  • Import and integrate StandardButton and BadgePrintPreview components
  • Apply dynamic classes on check-in/out buttons based on mode and status
src/components/Eventyay/EventyaySearchCheckIn.vue
Fix minor bugs and improve QR camera handling
  • Correct typo in fetchAllOrders (accumulatedOrders variable)
  • Add delay in QRCamera to resume scanning after popup display
src/components/Eventyay/EventyaySearchCheckIn.vue
src/components/Common/QRCamera.vue

Assessment against linked issues

Issue Objective Addressed Explanation
#38 Create an API to enable checkout for the whole event (i.e., an endpoint to check out all attendees for an event).
#38 Integrate the event checkout API into the checkin-app, including a toggle in the checkin staff page to activate checkin or checkout mode.

Possibly linked issues

  • #38: The PR directly addresses issue #38 by modifying check-in/out logic for search, integrating badge printing with URL, and using BadgePrintPreview.vue.
  • #38: The PR adds checkout mode and related features to the Eventyay check-in app, fulfilling part of the issue's request.
  • #38: The PR implements the checkout API, adds a check-in/checkout toggle, and an event-wide checkout feature, directly addressing the issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Jul 31 '25 18:07 sourcery-ai[bot]

Deploy Preview for eventyay-checkin ready!

Name Link
Latest commit b6de8aab1ff90cde3dd70589a59ee9b9e1bba956
Latest deploy log https://app.netlify.com/projects/eventyay-checkin/deploys/6894ad18c35d0200085910cf
Deploy Preview https://deploy-preview-39--eventyay-checkin.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Jul 31 '25 18:07 netlify[bot]

https://github.com/user-attachments/assets/ad8c6736-a832-4d7d-8283-7b133c9fdcad

yaxit24 avatar Aug 04 '25 19:08 yaxit24

https://github.com/user-attachments/assets/61e77033-e128-4fd3-a844-c62621f81567

yaxit24 avatar Aug 05 '25 20:08 yaxit24

https://github.com/user-attachments/assets/9419c0da-7e50-402f-bc6f-e2d13031ab0e

Added Pop-up feature and have made it Responsive.

yaxit24 avatar Aug 05 '25 20:08 yaxit24