Files
TimeTracker/docker-compose.local-test.yml
Dries Peeters 20b7401891 feat: Add invoice expenses, enhanced PDF editor with Konva.js, and uploads persistence
Major Features:
- Invoice Expenses: Allow linking billable expenses to invoices with automatic total calculations
  - Add expenses to invoices via "Generate from Time/Costs" workflow
  - Display expenses in invoice view, edit forms, and PDF exports
  - Track expense states (approved, invoiced, reimbursed) with automatic unlinking on invoice deletion
  - Update PDF generator and CSV exports to include expense line items

- Enhanced PDF Invoice Editor: Complete redesign using Konva.js for visual drag-and-drop layout design
  - Add 40+ draggable elements (company info, invoice data, shapes, text, advanced elements)
  - Implement comprehensive properties panel for precise element customization (position, fonts, colors, opacity)
  - Add canvas toolbar with alignment tools, zoom controls, and layer management
  - Support keyboard shortcuts (copy/paste, duplicate, arrow key positioning)
  - Save designs as JSON for editing and generate clean HTML/CSS for rendering
  - Add real-time preview with live data

- Uploads Persistence: Implement Docker volume persistence for user-uploaded files
  - Add app_uploads volume to all Docker Compose configurations
  - Ensure company logos and avatars persist across container rebuilds and restarts
  - Create migration script for existing installations
  - Update directory structure with proper permissions (755 for dirs, 644 for files)

Database & Backend:
- Add invoice_pdf_design_json column to settings table via Alembic migration
- Extend Invoice model with expenses relationship
- Update admin routes for PDF layout designer endpoints
- Enhance invoice routes to handle expense linking/unlinking

Frontend & UI:
- Redesign PDF layout editor template with Konva.js canvas (2484 lines, major overhaul)
- Update invoice edit/view templates to display and manage expenses
- Add expense sections to invoice forms with unlink functionality
- Enhance UI components with keyboard shortcuts support
- Update multiple templates for consistency and accessibility

Testing & Documentation:
- Add comprehensive test suites for invoice expenses, PDF layouts, and uploads persistence
- Create detailed documentation for all new features (5 new docs)
- Include migration guides and troubleshooting sections

Infrastructure:
- Update docker-compose files (main, example, remote, remote-dev, local-test) with uploads volume
- Configure pytest for new test modules
- Add template filters for currency formatting and expense display

This update significantly enhances TimeTracker's invoice management capabilities,
improves the PDF customization experience, and ensures uploaded files persist
reliably across deployments.
2025-10-29 15:03:01 +01:00

57 lines
2.1 KiB
YAML

services:
app:
build: .
container_name: timetracker-app-local-test
environment:
- TZ=${TZ:-Europe/Brussels}
- CURRENCY=${CURRENCY:-EUR}
- ROUNDING_MINUTES=${ROUNDING_MINUTES:-1}
- SINGLE_ACTIVE_TIMER=${SINGLE_ACTIVE_TIMER:-true}
- ALLOW_SELF_REGISTER=${ALLOW_SELF_REGISTER:-true}
- IDLE_TIMEOUT_MINUTES=${IDLE_TIMEOUT_MINUTES:-30}
- ADMIN_USERNAMES=${ADMIN_USERNAMES:-admin}
# TROUBLESHOOTING: If forms fail with "CSRF token missing or invalid":
# 1. For local testing, you can disable CSRF: WTF_CSRF_ENABLED=false
# 2. Or ensure SECRET_KEY doesn't change: set a fixed value in .env
# 3. Enable CSRF for production-like testing: WTF_CSRF_ENABLED=true
# For details: docs/CSRF_CONFIGURATION.md
- SECRET_KEY=${SECRET_KEY:-local-test-secret-key}
# Use SQLite database for local testing
- DATABASE_URL=sqlite:////data/timetracker.db
- LOG_FILE=/app/logs/timetracker.log
# CSRF Protection (can be disabled for local testing)
- WTF_CSRF_ENABLED=${WTF_CSRF_ENABLED:-false}
- WTF_CSRF_TIME_LIMIT=${WTF_CSRF_TIME_LIMIT:-3600}
# Disable secure cookies for local testing
- SESSION_COOKIE_SECURE=false
- REMEMBER_COOKIE_SECURE=false
# Set Flask environment for development
- FLASK_ENV=development
- FLASK_DEBUG=true
ports:
- "8080:8080"
volumes:
# Mount data directory for SQLite database and uploads
- app_data_local_test:/data
# Mount uploads directory for logos and avatars
- app_uploads_local_test:/app/app/static/uploads
# Mount logs directory for easier debugging
- ./logs:/app/logs
restart: unless-stopped
# Run as root initially to set up permissions, then switch to timetracker user
user: "0:0"
# Use custom entrypoint for local testing
entrypoint: ["/app/docker/entrypoint-local-test.sh"]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/_health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
volumes:
app_data_local_test:
driver: local
app_uploads_local_test:
driver: local