feat(loyalty): add dedicated program edit page with full CRUD and tests
Some checks failed
Some checks failed
Add /admin/loyalty/merchants/{id}/program route for program configuration
with a dedicated Alpine.js edit page supporting create/edit/delete flows.
Restructure programs dashboard with create modal (merchant search +
duplicate detection) and delete confirmation. Rename "Loyalty Settings"
to "Admin Policy" for clearer separation of concerns.
Add integration tests for all admin page routes (12 tests) and program
list search/filter/pagination endpoints (9 tests).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -99,6 +99,31 @@ async def admin_loyalty_merchant_detail(
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/merchants/{merchant_id}/program",
|
||||
response_class=HTMLResponse,
|
||||
include_in_schema=False,
|
||||
)
|
||||
async def admin_loyalty_program_edit(
|
||||
request: Request,
|
||||
merchant_id: int = Path(..., description="Merchant ID"),
|
||||
current_user: User = Depends(require_menu_access("loyalty-programs", FrontendType.ADMIN)),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""
|
||||
Render program configuration edit page for a merchant.
|
||||
Allows admin to create or edit the merchant's loyalty program settings.
|
||||
"""
|
||||
return templates.TemplateResponse(
|
||||
"loyalty/admin/program-edit.html",
|
||||
{
|
||||
"request": request,
|
||||
"user": current_user,
|
||||
"merchant_id": merchant_id,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/merchants/{merchant_id}/settings",
|
||||
response_class=HTMLResponse,
|
||||
|
||||
Reference in New Issue
Block a user