feat: add vendor order detail page with invoice integration

- Add new route /vendor/{code}/orders/{order_id} for order details
- Create order-detail.html template with:
  - Order summary with status and totals
  - Order items with per-item shipment status and ship buttons
  - Customer and shipping address display
  - Invoice section (create invoice or view existing)
  - Quick actions (confirm, ship all, mark delivered, cancel)
  - Status update modal with tracking info fields
  - Ship all modal for bulk shipment with tracking
- Create order-detail.js with full functionality:
  - Load order details, shipment status, and linked invoice
  - Individual item shipping with partial shipment support
  - Ship all remaining items with tracking info
  - Create invoice from order
  - Download invoice PDF
  - Status management with automatic shipment handling
- Update orders list to navigate to detail page instead of modal
- Add partially_shipped status (orange) to orders list

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-01 18:34:13 +01:00
parent 5a3f2bce57
commit 8fd8168ff4
5 changed files with 862 additions and 14 deletions

View File

@@ -243,6 +243,40 @@ async def vendor_orders_page(
)
@router.get(
"/{vendor_code}/orders/{order_id}",
response_class=HTMLResponse,
include_in_schema=False,
)
async def vendor_order_detail_page(
request: Request,
vendor_code: str = Path(..., description="Vendor code"),
order_id: int = Path(..., description="Order ID"),
current_user: User = Depends(get_current_vendor_from_cookie_or_header),
):
"""
Render order detail page.
Shows comprehensive order information including:
- Order header and status
- Customer and shipping details
- Order items with shipment status
- Invoice creation/viewing
- Partial shipment controls
JavaScript loads order details via API.
"""
return templates.TemplateResponse(
"vendor/order-detail.html",
{
"request": request,
"user": current_user,
"vendor_code": vendor_code,
"order_id": order_id,
},
)
# ============================================================================
# CUSTOMER MANAGEMENT
# ============================================================================