CRM · Customer receipts tab & ticket/stamp generation

Inside an existing customer record: register purchase receipts (date, code, amount, store, campaign) and generate the raffle tickets or loyalty stamps they earn, with a preview of what will be created before confirming.

AreaCRM
Routescrm.users.edit
Centre modulesloyalty-cards · tickets
Staff levelsroot · admin · manager · crmmanager · crmoperator · weboperator
Modelscampaign · commerce · receipt · ticket
UI labelusers.receipts
Coverage3 use cases · 1 happy · 4 failure

How it works

Only present when the centre has the tickets or loyalty-cards module and the customer already exists. activeCampaigns restricts which campaigns a receipt can be attributed to. The preview tables (ticketsPreviewColumns, stampsPreviewColumns) show the computed entitlement — including accumulated and pending balance — before generateTickets commits. Receipt validation errors are bubbled up to the parent form through onReceiptErrors, so the receipts tab shows an error badge. Submission wraps receipt.validate() in an explicit promise that rejects with the model errors.

Use cases

Why someone opens this (3)

  • Desk staff entering a paper receipt a customer brings in so they get their raffle entries.
  • Awarding loyalty-card stamps for a qualifying purchase.
  • Correcting or cancelling a wrongly entered receipt.

Path map

flowchart LR
    F(["Customer receipts tab and ticket/stamp generati…"]):::feat
    F --> H1["Receipt registered and tickets generated"]:::ok
    F -.-> X1["Receipt fields missing"]:::bad
    F -.-> X2["Ticket generation fails"]:::bad
    F -.-> X3["Invalid record on cancel"]:::bad
    F -.-> X4["No active campaign"]:::bad
    classDef feat fill:#157068,stroke:#157068,color:#ffffff,font-weight:bold
    classDef ok fill:#e3f1ea,stroke:#0d6b42,color:#0d4a2e
    classDef bad fill:#f7e6e2,stroke:#9a2d1c,color:#6e1f13

Happy paths

Receipt registered and tickets generated

  1. Operator opens the receipts tab on a customer and adds a receipt with date, code, amount and store.
  2. A campaign is selected from the active list; the accumulated/pending balance updates.
  3. submitReceipt validates and saves the receipt.
  4. Operator opens the generate-tickets modal, reviews the preview and confirms.
  5. ticket.generate-success-message is shown and the tickets appear under the loyalty tab.

Failure paths

QA checklist

Tick these off while regression-testing this feature. The boxes are plain Markdown, so progress is visible in git diffs.

  • ✅ Receipt registered and tickets generated
  • ⛔ Receipt fields missing
  • ⛔ Ticket generation fails
  • ⛔ Invalid record on cancel
  • ⛔ No active campaign

Implementation


Generated from doc/feature-inventory.json · id crm-customer-receipts-tab · commit 276788ca6