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.
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
3. Invoice Payment Links
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
ClientNotificationPreferencesmodel - 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
ClientNotificationmodel - Add notification API endpoints
- Create notification center component
- Integrate with WebSocket system
7. Enhanced File Sharing
Status: 🚧 Planning
Current State:
ClientAttachmentmodel 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_idnullable - Add
client_contact_idfield - Add
is_client_commentboolean - Pros: Clean separation
- Cons: Requires migration
Option 3: Separate Model
- Create
ClientCommentmodel - 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:
templates/client_portal/approvals.html- Approval listtemplates/client_portal/approval_detail.html- Approval detailstemplates/client_portal/project_comments.html- Project commentstemplates/client_portal/notifications.html- Notification centertemplates/client_portal/documents.html- Document librarytemplates/client_portal/reports.html- Reports pagetemplates/client_portal/activity_feed.html- Activity feed
Email Templates Needed:
templates/email/client_invoice_created.htmltemplates/email/client_payment_received.htmltemplates/email/client_milestone_reached.htmltemplates/email/client_budget_alert.htmltemplates/email/client_approval_request.html(exists)templates/email/quote_accepted.htmltemplates/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