Files
TimeTracker/docs/CLIENT_FEATURES_IMPLEMENTATION.md
Dries Peeters 3218ab012a feat: expand client portal and approval workflows
Add new client portal pages (dashboard, approvals, notifications, documents, reports) and extend API/routes/services to support client approvals, invoices/quotes views, and related notifications.

Update email templates and docs; add/adjust tests for new models/routes.
2026-01-02 07:52:32 +01:00

7.2 KiB

Client Features Implementation Guide

Date: 2025-01-27
Status: In Progress


Implementation Summary

This document tracks the implementation of all client-facing features recommended in CLIENT_FEATURE_RECOMMENDATIONS.md.


Completed Features

1. Time Entry Approval UI in Client Portal

Status: Routes Added

Files Modified:

  • app/routes/client_portal.py - Added approval routes

Routes Added:

  • /client-portal/approvals - List pending approvals
  • /client-portal/approvals/<id> - View approval details
  • /client-portal/approvals/<id>/approve - Approve time entry
  • /client-portal/approvals/<id>/reject - Reject time entry

Next Steps:

  • Create templates: templates/client_portal/approvals.html
  • Create template: templates/client_portal/approval_detail.html
  • Add approval count badge to dashboard
  • Add approval notifications

2. Quote Approval Workflow

Status: Routes Added

Files Modified:

  • app/routes/client_portal.py - Added quote approval routes

Routes Added:

  • /client-portal/quotes/<id>/accept - Accept quote
  • /client-portal/quotes/<id>/reject - Reject quote

Next Steps:

  • Update quote detail template with accept/reject buttons
  • Add email notifications for quote acceptance/rejection
  • Create email templates: templates/email/quote_accepted.html, templates/email/quote_rejected.html

Status: Route Added

Files Modified:

  • app/routes/client_portal.py - Added payment route

Routes Added:

  • /client-portal/invoices/<id>/pay - Pay invoice via gateway

Next Steps:

  • Add "Pay Now" button to invoice detail view
  • Update invoice list to show payment status
  • Add payment status indicators

4. Project Comments (Partial)

Status: ⚠️ Route Added, Needs Model Update

Files Modified:

  • app/routes/client_portal.py - Added comment route

Routes Added:

  • /client-portal/projects/<id>/comments - View/add project comments

Issues:

  • Comment model requires user_id (non-nullable)
  • Need to either:
    • Create system user for client comments
    • Modify Comment model to support nullable user_id with client_contact_id
    • Create separate ClientComment model

Next Steps:

  • Decide on approach for client comments
  • Update Comment model or create ClientComment model
  • Create template: templates/client_portal/project_comments.html
  • Add comment count to project view

🚧 In Progress Features

5. Email Notification System

Status: 🚧 Planning

Required:

  • Client notification preferences model
  • Email templates for:
    • New invoice created
    • Invoice payment received
    • Project milestone reached
    • Budget threshold alerts
    • Time entry approval requests
    • Project status changes
    • New quotes available

Implementation:

  • Create ClientNotificationPreferences model
  • Add notification service methods
  • Create email templates
  • Add notification triggers

6. In-App Notification Center

Status: 🚧 Planning

Required:

  • Notification model for client portal
  • Notification center UI component
  • Real-time updates via WebSocket
  • Notification preferences

Implementation:

  • Create ClientNotification model
  • Add notification API endpoints
  • Create notification center component
  • Integrate with WebSocket system

7. Enhanced File Sharing

Status: 🚧 Planning

Current State:

  • ClientAttachment model exists
  • Basic file upload/download

Enhancements Needed:

  • Document library UI
  • Folder organization
  • Document categories
  • Search functionality
  • Version control
  • Document preview

8. Client Dashboard Widgets

Status: 🚧 Planning

Current State:

  • Dashboard widget system exists (dashboard-widgets.js)
  • Basic dashboard exists

Enhancements Needed:

  • Client-specific widgets
  • Customizable layout
  • Widget preferences storage
  • Quick actions widget

9. Client-Specific Reports

Status: 🚧 Planning

Required:

  • Report generation service
  • Report templates
  • Scheduled report emails
  • PDF/Excel export
  • Visual analytics

10. Project Activity Feed

Status: 🚧 Planning

Required:

  • Activity feed component
  • Real-time updates
  • Activity filtering
  • Activity types:
    • Time entries added
    • Tasks completed
    • Comments posted
    • Files uploaded
    • Status changes

📋 Implementation Checklist

Phase 1: Quick Wins (Week 1)

  • Time Entry Approval UI routes
  • Quote Approval routes
  • Invoice Payment route
  • Approval templates
  • Quote approval templates
  • Payment button in invoice view

Phase 2: Core Features (Week 2-3)

  • Email notification system
  • In-app notification center
  • Project comments (with model update)
  • Enhanced file sharing UI
  • Dashboard widgets

Phase 3: Advanced Features (Week 4-5)

  • Client-specific reports
  • Project activity feed
  • Real-time updates
  • Mobile optimizations

Phase 4: Polish (Week 6)

  • UI/UX improvements
  • Performance optimization
  • Documentation
  • Testing

🔧 Technical Notes

Comment Model Issue

The Comment model requires user_id to be non-nullable. For client comments, we have options:

Option 1: System User

  • Create a system user for client comments
  • Store contact_id in a separate field
  • Pros: No model changes
  • Cons: Requires system user management

Option 2: Modify Comment Model

  • Make user_id nullable
  • Add client_contact_id field
  • Add is_client_comment boolean
  • Pros: Clean separation
  • Cons: Requires migration

Option 3: Separate Model

  • Create ClientComment model
  • Similar structure to Comment
  • Pros: Complete separation
  • Cons: Code duplication

Recommendation: Option 2 (Modify Comment Model)


Notification System Architecture

ClientNotification Model
├── client_id
├── type (invoice, project, approval, etc.)
├── title
├── message
├── read_at
├── created_at
└── metadata (JSON)

ClientNotificationPreferences Model
├── client_id
├── email_enabled
├── email_types (JSON array)
├── in_app_enabled
└── preferences (JSON)

📝 Template Requirements

New Templates Needed:

  1. templates/client_portal/approvals.html - Approval list
  2. templates/client_portal/approval_detail.html - Approval details
  3. templates/client_portal/project_comments.html - Project comments
  4. templates/client_portal/notifications.html - Notification center
  5. templates/client_portal/documents.html - Document library
  6. templates/client_portal/reports.html - Reports page
  7. templates/client_portal/activity_feed.html - Activity feed

Email Templates Needed:

  1. templates/email/client_invoice_created.html
  2. templates/email/client_payment_received.html
  3. templates/email/client_milestone_reached.html
  4. templates/email/client_budget_alert.html
  5. templates/email/client_approval_request.html (exists)
  6. templates/email/quote_accepted.html
  7. templates/email/quote_rejected.html

🎯 Success Metrics

  • Client portal engagement (login frequency)
  • Feature usage rates
  • Invoice payment speed
  • Approval response time
  • Support ticket reduction

Last Updated: 2025-01-27
Next Review: After Phase 1 completion