feat(loyalty): align program view, edit, and analytics pages across all frontends
Some checks failed
Some checks failed
Standardize naming (Program for view/edit, Analytics for stats), create shared read-only program-view partial, fix admin edit field population bug (14 missing fields), add store Program menu item, and rename merchant Overview→Program, Settings→Analytics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,8 +5,9 @@ Loyalty Store Page Routes (HTML rendering).
|
||||
Store pages for:
|
||||
- Loyalty terminal (primary daily interface for staff)
|
||||
- Loyalty members management
|
||||
- Program settings
|
||||
- Stats dashboard
|
||||
- Program view (read-only)
|
||||
- Program edit (settings)
|
||||
- Analytics dashboard
|
||||
|
||||
Routes follow the standard store convention: /loyalty/...
|
||||
so they match the menu URLs in definition.py.
|
||||
@@ -183,49 +184,49 @@ async def store_loyalty_card_detail(
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# STATS DASHBOARD
|
||||
# PROGRAM VIEW (Read-only)
|
||||
# ============================================================================
|
||||
|
||||
|
||||
@router.get(
|
||||
"/loyalty/stats",
|
||||
"/loyalty/program",
|
||||
response_class=HTMLResponse,
|
||||
include_in_schema=False,
|
||||
)
|
||||
async def store_loyalty_stats(
|
||||
async def store_loyalty_program(
|
||||
request: Request,
|
||||
store_code: str = Depends(get_resolved_store_code),
|
||||
current_user: User = Depends(get_current_store_from_cookie_or_header),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""
|
||||
Render loyalty statistics dashboard.
|
||||
Shows store's loyalty program metrics and trends.
|
||||
Render loyalty program view page (read-only).
|
||||
Shows program configuration. Edit button shown to merchant owners only.
|
||||
"""
|
||||
return templates.TemplateResponse(
|
||||
"loyalty/store/stats.html",
|
||||
"loyalty/store/program.html",
|
||||
get_store_context(request, db, current_user, store_code),
|
||||
)
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# SETTINGS (Merchant Owner)
|
||||
# PROGRAM EDIT (Merchant Owner)
|
||||
# ============================================================================
|
||||
|
||||
|
||||
@router.get(
|
||||
"/loyalty/settings",
|
||||
"/loyalty/program/edit",
|
||||
response_class=HTMLResponse,
|
||||
include_in_schema=False,
|
||||
)
|
||||
async def store_loyalty_settings(
|
||||
async def store_loyalty_program_edit(
|
||||
request: Request,
|
||||
store_code: str = Depends(get_resolved_store_code),
|
||||
current_user: User = Depends(get_current_store_from_cookie_or_header),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""
|
||||
Render loyalty program settings page.
|
||||
Render loyalty program edit page.
|
||||
Allows merchant owners to create or edit their loyalty program.
|
||||
"""
|
||||
return templates.TemplateResponse(
|
||||
@@ -234,6 +235,32 @@ async def store_loyalty_settings(
|
||||
)
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# ANALYTICS DASHBOARD
|
||||
# ============================================================================
|
||||
|
||||
|
||||
@router.get(
|
||||
"/loyalty/analytics",
|
||||
response_class=HTMLResponse,
|
||||
include_in_schema=False,
|
||||
)
|
||||
async def store_loyalty_analytics(
|
||||
request: Request,
|
||||
store_code: str = Depends(get_resolved_store_code),
|
||||
current_user: User = Depends(get_current_store_from_cookie_or_header),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""
|
||||
Render loyalty analytics dashboard.
|
||||
Shows store's loyalty program metrics and trends.
|
||||
"""
|
||||
return templates.TemplateResponse(
|
||||
"loyalty/store/analytics.html",
|
||||
get_store_context(request, db, current_user, store_code),
|
||||
)
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# ENROLLMENT
|
||||
# ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user