feat: add vendor invoice management UI and comprehensive tests

UI Components:
- Add vendor invoices page route in vendor_pages.py
- Create invoices.html template with stats cards, invoice table,
  settings tab, and create invoice modal
- Add invoices.js Alpine.js component for CRUD operations,
  PDF download, and settings management
- Add Invoices link to vendor sidebar in Sales section

Unit Tests (35 tests):
- VAT calculation (EU rates, regimes, labels)
- Invoice settings CRUD and number generation
- Invoice retrieval, listing, and pagination
- Status management and validation
- Statistics calculation

Integration Tests (34 tests):
- Settings API endpoints (GET/POST/PUT)
- Stats API endpoint
- Invoice list with filtering and pagination
- Invoice detail retrieval
- Invoice creation from orders
- Status update transitions
- PDF generation endpoints
- Authentication/authorization checks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-24 18:59:39 +01:00
parent 319fba5d39
commit e456ae3c73
6 changed files with 2527 additions and 0 deletions

View File

@@ -353,6 +353,33 @@ async def vendor_letzshop_page(
)
# ============================================================================
# INVOICES
# ============================================================================
@router.get(
"/{vendor_code}/invoices", response_class=HTMLResponse, include_in_schema=False
)
async def vendor_invoices_page(
request: Request,
vendor_code: str = Path(..., description="Vendor code"),
current_user: User = Depends(get_current_vendor_from_cookie_or_header),
):
"""
Render invoices management page.
JavaScript loads invoices via API.
"""
return templates.TemplateResponse(
"vendor/invoices.html",
{
"request": request,
"user": current_user,
"vendor_code": vendor_code,
},
)
# ============================================================================
# TEAM MANAGEMENT
# ============================================================================