Skip to content

BarRedemption.vue ​

Image of the component

Bar redemption β€” Beerman only, mobile-first white page. Colour-codes header and drink card by member/drink type matching physical cards.

πŸ“„ View source on GitHub

Used by ​

Used Stores ​

Functions ​

startScan ​

Starts the Html5Qrcode camera scanner and attaches it to the #bar-qr-reader element.

stopScan ​

Stops and clears the active camera scanner. Safe to call when no scanner is running.

handleScan ​

Validates the scanned card UID and either populates scannedCard or sets scanError. Rejects unknown UIDs, inactive cards, and member cards whose owner is not yet registered for the run.

Parameters:

  • cardUid: - The card_uid decoded from the QR code.

submitManualUid ​

Dev-only: submits the manually typed card UID as if it had been scanned.

redeem ​

Posts a drink redemption for the current card, drink type, and quantity. Shows a snackbar with the result. If the guest's last entitlement was just used, shows the recollect prompt instead of resetting immediately.

acknowledgeRecollect ​

Dismisses the guest card recollect prompt and resets back to scan-ready state.

acknowledgeScanError ​

Dismisses the scan error overlay, allowing the Beerman to scan again.

reset ​

Resets the component to its initial scan-ready state without navigating away.

Reactivity ​

cardLabel (computed) ​

Display name for the scanned card β€” member alias or 'Honored Guest' for guest cards.

cardNumber (computed) ​

Formatted card number matching the physical card (e.g. B0042, S0007, G0003).

headerColor (computed) ​

Header band colour β€” matches the physical card colour scheme (Beer/Non-Beer/Guest).

isNonBeer (computed) ​

true when the scanned card belongs to a Non-Beer member β€” drives Softie-only UI.

isGuest (computed) ​

true when the scanned card is a guest card.

displayValues (computed) ​

Remaining, redeemed, and total entitlement for the current card and selected drink type. Applies the beer↔softie conversion ratio from redemptionStore.limits so that switching between Beer and Softie tabs shows the correct shared-unit balance. Returns null when no card is scanned.

drinkCardColor (computed) ​

Background colour of the drink stats card β€” cyan for Softie/Non-Beer, orange for Beer.

remainingBoxColor (computed) ​

Colour of the "Remaining" counter box β€” red when exhausted (<= 0), green otherwise.

entitlement (computed) ​

Result of redemptionStore.checkEntitlement for the current card, drink type, and quantity. Drives the Collect button disabled state and the entitlement warning message.

Released under the MIT License.