Skip to content

CardManagement.vue

Image of the component

Card management tab — OnCash only. Shows all cards (active by default, toggle to include inactive). Supports creating member/guest cards, printing selected cards, and deactivating.

📄 View source on GitHub

Used by

Used Stores

Functions

toggleRow

Toggles the selection state of a single card row.

Parameters:

  • documentId: - Strapi documentId of the card to toggle.

toggleAll

Selects all visible rows, or deselects all if every row is already selected.

fmtDate

Formats an ISO date string to DD.MM.YYYY. Returns '-' for falsy input.

Parameters:

  • iso:

formatCardNumber

Returns the display card number matching the physical card format (e.g. B0042, G0003).

Parameters:

  • c: - Card object from the store.

holderLabel

Returns the human-readable holder name for a card (member alias or guest label).

Parameters:

  • c: - Card object from the store.

deactivateCard

Asks for confirmation then calls PUT /cards/:documentId/deactivate. Refreshes the card list and removes the card from the current selection on success.

Parameters:

  • card: - Enriched table row object (must have documentId and holder).

createGuestCards

Bulk-creates guestCardCount guest cards via POST /cards/guest/bulk. Closes the dialog and refreshes the card list on success.

openCreateMemberDialog

Resets the member selection and opens the create member card dialog.

createMemberCard

Creates a member card for the selected member via POST /cards/member. If the member already has an active card the backend deactivates it first (shown as a warning in the dialog).

printSelected

Downloads a PDF of all selected cards via GET /cards/print. Passes memberIds and guestNumbers as query params so the backend returns only the selected cards. Triggers a browser download and clears the selection on success.

Reactivity

isOnline (computed)

Mirrors connectivityStore.isOnline; disables all write actions when offline.

allSelected (computed)

true when every visible table row is selected — drives the select-all checkbox state.

someSelected (computed)

true when some (but not all) rows are selected — puts the select-all checkbox into indeterminate state.

existingCard (computed)

Active card already held by the selected member, if any.

tableRows (computed)

Filtered, searched, and display-mapped card rows for the data table. Applies the type filter (all/member/guest), the inactive toggle, and the search query, then enriches each row with pre-formatted card_number, holder, created, and inactivated fields.

(anonymous) (watch)

Clears the selection whenever the filter, inactive toggle, or search changes so stale IDs don't carry over.

Released under the MIT License.