- Added hub_customer_id to TModuleApprovalStats for better tracking. - Introduced TModuleWizardEditRequest for editing time entries, allowing updates to description, hours, and billing method. - Implemented approval and rejection logic for Hub Worklogs, including handling negative IDs. - Created a new endpoint for updating entry details, supporting both Hub Worklogs and Module Times. - Updated frontend to include an edit modal for time entries, with specific fields for Hub Worklogs and Module Times. - Enhanced customer statistics retrieval to include pending counts from Hub Worklogs. - Added migrations for ticket enhancements, including new fields and constraints for worklogs and prepaid cards.
30 lines
962 B
Python
30 lines
962 B
Python
from fastapi import APIRouter, Request
|
|
from fastapi.templating import Jinja2Templates
|
|
from fastapi.responses import HTMLResponse
|
|
from app.core.database import execute_query_single
|
|
|
|
router = APIRouter()
|
|
templates = Jinja2Templates(directory="app")
|
|
|
|
@router.get("/", response_class=HTMLResponse)
|
|
async def dashboard(request: Request):
|
|
"""
|
|
Render the dashboard page
|
|
"""
|
|
# Fetch count of unknown billing worklogs
|
|
unknown_query = """
|
|
SELECT COUNT(*) as count
|
|
FROM tticket_worklog
|
|
WHERE billing_method = 'unknown'
|
|
AND status NOT IN ('billed', 'rejected')
|
|
"""
|
|
start_date = "2024-01-01" # Filter ancient history if needed, but for now take all
|
|
|
|
result = execute_query_single(unknown_query)
|
|
unknown_count = result['count'] if result else 0
|
|
|
|
return templates.TemplateResponse("dashboard/frontend/index.html", {
|
|
"request": request,
|
|
"unknown_worklog_count": unknown_count
|
|
})
|