diff --git a/app/modules/loyalty/routes/api/store.py b/app/modules/loyalty/routes/api/store.py index f11c8fd9..aadced4c 100644 --- a/app/modules/loyalty/routes/api/store.py +++ b/app/modules/loyalty/routes/api/store.py @@ -652,11 +652,22 @@ def list_store_transactions( db, merchant_id, skip=skip, limit=limit ) + from app.modules.loyalty.services.category_service import category_service + tx_responses = [] for t in transactions: tx = TransactionResponse.model_validate(t) if t.card and t.card.customer: tx.customer_name = t.card.customer.full_name + if t.category_ids and isinstance(t.category_ids, list): + names = [] + for cid in t.category_ids: + name = category_service.validate_category_for_store( + db, cid, t.store_id or 0 + ) + if name: + names.append(name) + tx.category_names = names if names else None tx_responses.append(tx) return TransactionListResponse(transactions=tx_responses, total=total) diff --git a/app/modules/loyalty/static/store/js/loyalty-terminal.js b/app/modules/loyalty/static/store/js/loyalty-terminal.js index 64adf977..688e0f7e 100644 --- a/app/modules/loyalty/static/store/js/loyalty-terminal.js +++ b/app/modules/loyalty/static/store/js/loyalty-terminal.js @@ -369,9 +369,11 @@ function storeLoyaltyTerminal() { getTransactionLabel(tx) { const type = tx.transaction_type; if (type) { - return I18n.t('loyalty.transactions.' + type, {defaultValue: type.replace(/_/g, ' ')}); + // Use server-rendered labels (no async flicker) + if (window._txLabels && window._txLabels[type]) return window._txLabels[type]; + return type.replace(/_/g, ' '); } - return I18n.t('loyalty.common.unknown'); + return 'Unknown'; }, getTransactionColor(tx) { diff --git a/app/modules/loyalty/templates/loyalty/store/terminal.html b/app/modules/loyalty/templates/loyalty/store/terminal.html index 4f3f1e2a..87502e80 100644 --- a/app/modules/loyalty/templates/loyalty/store/terminal.html +++ b/app/modules/loyalty/templates/loyalty/store/terminal.html @@ -129,7 +129,7 @@

-

+