fix(loyalty): card detail — enrolled store name + copy buttons
Some checks failed
Some checks failed
- Fix "Enrolled at: Unknown" by resolving enrolled_at_store_name from the store service and adding it to CardDetailResponse schema. - Add clipboard-copy buttons next to card number, customer name, email, and phone fields using the shared Utils.copyToClipboard() utility with toast feedback. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -514,6 +514,17 @@ def get_card_detail(
|
||||
program = card.program
|
||||
customer = card.customer
|
||||
|
||||
# Resolve enrolled store name
|
||||
enrolled_store_name = None
|
||||
if card.enrolled_at_store_id:
|
||||
from app.modules.tenancy.services.store_service import store_service
|
||||
|
||||
enrolled_store = store_service.get_store_by_id_optional(
|
||||
db, card.enrolled_at_store_id
|
||||
)
|
||||
if enrolled_store:
|
||||
enrolled_store_name = enrolled_store.name
|
||||
|
||||
return CardDetailResponse(
|
||||
id=card.id,
|
||||
card_number=card.card_number,
|
||||
@@ -521,6 +532,7 @@ def get_card_detail(
|
||||
merchant_id=card.merchant_id,
|
||||
program_id=card.program_id,
|
||||
enrolled_at_store_id=card.enrolled_at_store_id,
|
||||
enrolled_at_store_name=enrolled_store_name,
|
||||
customer_name=customer.full_name if customer else None,
|
||||
customer_email=customer.email if customer else None,
|
||||
merchant_name=card.merchant.name if card.merchant else None,
|
||||
|
||||
Reference in New Issue
Block a user