- Added a new section in the settings frontend for managing time multiplier presets, including UI for adding, displaying, and saving presets. - Introduced a new function to normalize and load time multiplier presets from settings. - Updated the worklog submission process to include a selected multiplier preset and its corresponding rate multiplier. - Enhanced the worklog model to support additional fields: extra_billed_hours, extended_support_flag, rate_multiplier, manual_hourly_rate, manual_rounded_hours, and rounding_override_reason. - Implemented backend validation to ensure that time entries linked to prepaid cards cannot be edited if the card is in a locked status. - Added database migration to introduce new columns and constraints for the worklog and time entry tables.
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
from fastapi import APIRouter, Request, HTTPException
|
|
from fastapi.responses import HTMLResponse
|
|
from fastapi.templating import Jinja2Templates
|
|
import logging
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
router = APIRouter()
|
|
templates = Jinja2Templates(directory=["app/prepaid/frontend", "app/shared/frontend", "app"])
|
|
|
|
|
|
@router.get("/prepaid-cards", response_class=HTMLResponse)
|
|
async def prepaid_cards_page(request: Request):
|
|
"""
|
|
Prepaid cards overview page
|
|
"""
|
|
logger.info("🔍 Rendering prepaid cards page")
|
|
return templates.TemplateResponse("index.html", {
|
|
"request": request,
|
|
"page_title": "Prepaid Cards"
|
|
})
|
|
|
|
|
|
@router.get("/prepaid-cards/{card_id}", response_class=HTMLResponse)
|
|
async def prepaid_card_detail(request: Request, card_id: str):
|
|
"""
|
|
Prepaid card detail page
|
|
"""
|
|
try:
|
|
card_id_int = int(card_id)
|
|
except (TypeError, ValueError):
|
|
raise HTTPException(status_code=404, detail="Prepaid card not found")
|
|
|
|
logger.info(f"🔍 Rendering prepaid card detail: {card_id_int}")
|
|
return templates.TemplateResponse("detail.html", {
|
|
"request": request,
|
|
"page_title": "Card Details",
|
|
"card_id": card_id_int
|
|
})
|