- Add module-level logging import and logger initialization
- Remove redundant logging import from export_invoice_pdf function
- Ensure all logging uses proper logger instance instead of print statements
- Improves production logging consistency and respects LOG_LEVEL configuration
Fixes debug logging issues in invoice routes for production readiness.
Fixed 'str' object has no attribute 'strftime' error in analytics endpoints by improving date object handling across multiple functions.
- Enhanced weekly_trends() to properly handle string, datetime, and date object types
- Added robust type checking and error handling for date parsing
- Improved hours_by_day() and payments_over_time() with hasattr() checks before strftime() calls
- Added fallback handling to skip invalid date objects gracefully
This prevents analytics dashboard failures when databases return dates in different formats (strings vs date objects).
ented features that were missingUI components, integrations, or proper error handling:1. Time Entry Templates UI Integration - Added template selector to timer page (timer_page.html) - Updated timer route to load user templates - Added JavaScript function to apply templates with one-click - Created missing view.html template for template details - Templates now appear on timer page sorted by most recently used2. Activity Feed Widget Real-time Updates - Added WebSocket integration to Activity model for real-time events - Activity.log() now emits 'activity_created' SocketIO events - Updated activity feed widget to listen for WebSocket events - Feed automatically refreshes when new activities match current filter - Added proper error handling for WebSocket connection failures3. Invoice Routes Logging Improvements - Replaced all print() statements with proper logging in invoices.py - Added structured logging with appropriate log levels (info, debug, warning, error) - Improved error handling with full traceback logging using exc_info=True - All PDF export debug statements now use logger.debug/info/errorFiles changed:- app/routes/timer.py: Added template loading for timer page- app/templates/timer/timer_page.html: Added template selector UI and applyTemplate function- app/models/activity.py: Added WebSocket event emission on activity creation- app/templates/components/activity_feed_widget.html: Added WebSocket listener for real-time updates- app/routes/invoices.py: Replaced print statements with proper logging- app/templates/time_entry_templates/view.html: Created missing view template
When selecting a project in the Dashboard Start Timer modal, all tasks were displayed including those marked as 'done' or 'cancelled'. This made it difficult to find active tasks in projects with many completed tasks.
Changes:
- Updated /api/projects/<project_id>/tasks endpoint to exclude tasks with status 'done' or 'cancelled'
- Only returns active tasks (todo, in_progress, review)
- Added test to verify the filtering behavior
This improves usability by showing only actionable tasks when starting a timer, especially beneficial for larger projects with many tasks.
This commit implements several UX improvements based on user feedback
to make the application more production-ready:
Navigation improvements:
- Add Email Configuration link to Admin side menu for easier access
- Move Time Entry Templates from Work menu to Admin section
- Fix menu dropdown state so Time Entry Templates opens Admin menu
Clickable listings for better navigation:
- Make project names clickable in project list view
- Make client names clickable in project list view
- Make task names clickable in task list view
- Make project names clickable in task list view
- Make client names clickable in client list view
- Add mailto: links for client email addresses in list and detail views
- Make project names clickable in client detail view
Kanban board improvements:
- Support more columns on wider screens (up to 6 columns on 2xl screens)
- Change from fixed 4 columns to responsive: lg:4, xl:5, 2xl:6
Dark mode fixes:
- Fix black calendar/time icons in dark mode by adding proper CSS rules
- Add dark mode color classes to calendar icons
- Ensure icons are visible and properly colored in dark theme
These changes improve discoverability, reduce clicks, and enhance the
overall user experience, especially for power users with wide screens.
parse prepaid hour/reset fields on client edit/create; guard invalid values with new route tests
suppress benign ResizeObserver warnings globally and load handler on standalone pages
raise invoice actions dropdown as a floating menu so it isn’t clipped or scroll-locking
- share a centralized timezone list across admin and user settings
- allow admins to pick from the same list when setting the system default
- let users clear their personal override to fall back to the global default
- add regression tests covering the new helper and reset path
The PDF layout editor was displaying the canvas at actual page dimensions (595x842px for A4) without scaling to fit the container, causing the canvas to appear compressed and making it difficult to position elements accurately. When generating PDFs, fields would appear compressed in a small space instead of utilizing the full page width.
Changes:
- Add auto-fit scaling function that calculates optimal scale to fit canvas within container while maintaining aspect ratio
- Center canvas in container using flexbox CSS
- Update zoom controls to work with base fit scale (zoom applies on top of auto-fit)
- Ensure saved designs are properly refitted when loaded
- Add window resize handler to refit canvas on container size changes
The coordinate system remains in actual page dimensions (72 DPI), ensuring that elements positioned in the editor match their positions in generated PDFs. The visual representation is now properly scaled to fit the container, making the editor more user-friendly while maintaining accurate PDF generation.
Fixes issue where canvas appeared smaller than actual page size, causing compression when generating invoices.
When no filters are active (status, priority, project, assigned_to, search, or overdue), the tasks page now displays all tasks instead of limiting to 20 per page. When filters are active, pagination remains at 20 items per page for better performance.
This fixes the issue where users expected to see all tasks when filters were set to 'All' but only saw the first 20 tasks.
The description field was persisting values from previously created
projects due to localStorage autosave restoration. The autosave feature
was restoring cached descriptions even on fresh page loads.
Solution:
- Only restore from localStorage when form data exists (validation
error scenarios)
- Clear localStorage on fresh page loads to prevent value persistence
- Preserves autosave functionality during validation errors
Fixes#221
This commit implements comprehensive UI enhancements across multiple pages
with improved user experience, visual feedback, and functionality.
Timer Page (/timer):
- Add dedicated timer page with visual SVG progress ring
- Implement real-time timer display with animated progress indicator
- Add quick project/task selection dropdown with dynamic task loading
- Display recent projects quick access (last 5 projects used in 30 days)
- Add timer duration estimation based on average session duration
- Show today's stats sidebar with total hours and active timer status
Projects List (/projects):
- Add grid/list view toggle with localStorage persistence
- Create project cards with budget and hours progress indicators
- Add quick actions on hover (View, Edit, Favorite) for grid view
- Display project status badges (Active/Inactive/Archived) on cards
- Show client information and billable status on cards
- Implement responsive grid layout (1/2/3 columns based on screen size)
Invoice List (/invoices):
- Add visual status filter buttons with icons (Draft, Sent, Paid, Overdue)
- Add payment status filter dropdown (Unpaid, Partially Paid, Fully Paid, Overpaid)
- Display payment status icons with color-coded badges
- Implement due date highlighting with red border for overdue invoices
- Add quick invoice actions dropdown (View, Edit, Download PDF, Send Email, Delete)
- Enhance invoice status badges with icons for better visual recognition
Reports (/reports):
- Add date range presets (Today, This Week, This Month, This Year)
- Implement comparison view API endpoint for month/year comparisons
- Add export format selection dropdown (CSV, Excel, PDF)
- Create scheduled reports management modal UI
- Display comparison results with current vs previous period metrics
- Add custom date range picker with apply button
Bug Fixes:
- Fix datetime import shadowing issue in reports route causing UnboundLocalError
- Fix invoice template date.today() Jinja template error
- Fix timer route db.case() SQLAlchemy syntax for recent projects ordering
- Fix projects template missing </script> tag causing JavaScript errors
- Fix mileage page date parsing error when start_date/end_date are empty
- Fix budget alerts user_project_ids undefined error for admin users
- Fix skip tour button z-index issue - confirmation dialog now appears above mask
Technical Improvements:
- Add proper error handling for date parsing in mileage route
- Improve z-index management for onboarding tooltip and confirmation dialogs
- Add proper variable initialization in budget alerts route
- Enhance template syntax for overdue date calculation
- Add timedelta import to timer route for date calculations
All features include:
- Responsive design for mobile and desktop
- Dark mode support throughout
- Smooth transitions and animations
- Accessibility considerations
- No linting errors
- Interactive tour system with 13-16 comprehensive steps covering all
major features
- Tooltip system for complex features (auto-attaches to elements with
data-tooltip attribute)
- Contextual help buttons on complex features (Kanban, Reports,
Analytics, Invoices, Time Entry)
- Feature discovery system with visual badges for power features
- Enhanced tour content with keyboard shortcuts, tips, and actionable
guidance
- Smart element finding with auto-expansion of hidden dropdowns
- Proper tooltip positioning with viewport-aware placement
### Error Handling Features (Section 15)
- User-friendly error messages for all HTTP status codes (400, 401, 403,
404, 409, 422, 429, 500, 502, 503, 504)
- Retry buttons for failed operations with exponential backoff
- Offline mode indicators with visual queue count display
- Offline operation queue with automatic processing when connection
restored
- Graceful degradation with feature detection and fallbacks
- Recovery options in error pages (Dashboard, Back, Refresh, Login)
- Enhanced error templates with retry buttons and recovery actions
### Technical Improvements
- Added /api/health endpoint for connection monitoring
- Improved fetch interceptor for automatic error handling
- Network status monitoring with periodic health checks
- localStorage-based queue persistence for offline operations
- Enhanced error handler with recovery option mapping
- Fixed Activity model attribute error (activity_type -> entity_type)
### UI/UX Enhancements
- Improved highlight visibility with better mask gradients
- Optimized onboarding performance (reduced from triple to double
requestAnimationFrame)
- Fixed tooltip positioning to use viewport coordinates correctly
- Enhanced mask system with proper cutout revealing focused elements
- Better button event handling with event delegation
- Styled keyboard shortcuts (kbd) and emphasized text (strong) in
tooltips
### Files Changed
- app/static/onboarding.js - Enhanced onboarding system
- app/static/onboarding-enhanced.js - Tooltips, contextual help, feature
discovery
- app/static/error-handling-enhanced.js - Enhanced error handling
- app/utils/error_handlers.py - User-friendly error messages
- app/routes/api.py - Added /api/health endpoint, fixed Activity error
- app/templates/base.html - Added script includes
- app/templates/errors/*.html - Enhanced error templates with recovery
- tests/test_onboarding.py - Onboarding tests
- tests/test_error_handling.py - Error handling tests
### Testing
- Comprehensive unit tests for onboarding features
- Comprehensive unit tests for error handling
- Smoke tests for file existence and integration
Major UI/UX improvements:
- Add context menus (right-click) on list items with Edit, Duplicate, Delete actions
- Implement bulk selection with visual feedback and enhanced bulk actions bar
- Make keyboard shortcuts help modal more discoverable with floating indicator
- Add keyboard shortcuts: Ctrl+A (select all), Delete key (delete selected)
- Expand bulk actions with more shortcuts and context menu support
Visual hierarchy and design system:
- Implement consistent spacing scale (xs to 3xl) with CSS variables
- Establish clear typographic hierarchy (h1-h6, body, label, caption classes)
- Add subtle shadows (subtle, sm, md, lg, xl) with dark mode support
- Implement status color system: green (active), yellow (pending), red (overdue)
- Improve dark mode contrast and apply semantic colors for actions
- Standardize colors for clarity across light and dark themes
Micro-interactions and animations:
- Add button press animations with scale effect
- Implement smooth transitions between states
- Add success checkmarks after form submissions
- Add loading spinners in buttons during async operations
- Enhance basic interactions with visual feedback
Dashboard enhancements:
- Add sparklines for quick stats visualization (7-day time tracking)
- Implement activity timeline with icons and time formatting
- Add real-time updates with live indicator (30-second intervals)
- Enhance dashboard widgets with improved styling and hover effects
- Add API endpoints for dashboard stats, sparklines, and activity timeline
Per diem rates management:
- Add edit functionality for per diem rates
- Add delete functionality with usage validation
- Fix navigation: per_diem.list_rates now correctly opens admin section
- Add context menu support for per diem rates list
- Improve form styling and button interactions
Bug fixes:
- Fix TimeEntry.duration error in dashboard_sparklines (use duration_seconds)
- Fix template syntax errors in rate_form.html (extract ternary expressions)
- Fix sparkline data calculation to use seconds instead of duration objects
Technical changes:
- Create ui-enhancements.css for new design system styles
- Create ui-enhancements.js for context menus and bulk selection
- Create dashboard-enhancements.js for sparklines and real-time updates
- Update base.html to include new CSS/JS files
- Add API endpoints: /api/dashboard/stats, /api/dashboard/sparklines, /api/activity/timeline
- Update keyboard shortcuts help modal with bulk actions section
- Enhance existing templates with new styling classes and interactions
Implement comprehensive table enhancements across all data tables in the
application:
- Add sortable columns with visual indicators (up/down arrows)
- Implement client-side pagination with configurable page size (10/25/50/100)
- Add column visibility toggles with dropdown menu
- Enable sticky headers that stick to top on scroll
- Save user preferences (page size, visible columns) in localStorage
- Support numeric, date, and text sorting with proper formatting
Features:
- Visual sort indicators show active column and direction
- Pagination controls with page size selector and navigation buttons
- Column visibility button integrated into existing toolbars
- Sticky headers with shadow effect when active
- Responsive design with mobile-friendly pagination
- Dark mode support throughout
Technical implementation:
- Created data-tables-enhanced.js module with DataTableEnhanced class
- Created data-tables-enhanced.css for all styling
- Auto-initializes tables with data-table-enhanced attribute or table-zebra class
- Properly integrates with existing Finance category table toolbars
- Handles checkbox columns and special table structures
Updated templates:
- tasks/list.html, projects/list.html, clients/list.html
- invoices/list.html, expenses/list.html, payments/list.html
- mileage/list.html, per_diem/list.html, main/search.html
All tables now provide consistent, enhanced user experience with improved
data navigation and viewing options.
Implement a reusable form validation system that provides immediate,
contextual feedback to users with inline error messages and visual indicators.
Features:
- Real-time validation on input, blur, and submit events
- Inline error and success messages displayed near form fields
- Visual indicators for required vs optional fields (asterisks)
- Subtle validation styling with softer colors and smaller icons
- Phone number validation for tel/phone fields (7-15 digits, optional country code)
- Email, URL, number, date, and pattern validation support
- Debounced validation to reduce performance impact
- Form-level error messages on submit
- Automatic focus management for invalid fields
Technical improvements:
- Prevent duplicate initialization with form and field flags
- Smart message container insertion that respects existing form structure
- Better detection of existing required indicators to prevent duplicates
- Hidden messages take zero space (height: 0) to prevent layout shifts
- Graceful error handling with try-catch blocks
Styling:
- Subtle visual feedback with green-300/red-300 borders (softer than before)
- Smaller validation icons (0.875rem) and reduced padding (2rem)
- Reduced opacity for messages (0.75-0.85) for less intrusive appearance
- Lighter focus shadows (0.08 opacity) for subtle feedback
- Dark mode support with appropriate color adjustments
Applied to all forms:
- Projects (create/edit)
- Clients (create/edit)
- Tasks (create/edit)
- Invoices (create/edit)
- Payments (create/edit)
- Expenses, Mileage, Per Diem forms
- Time Entry (manual entry)
- Weekly Goals
Fixes:
- Prevent duplicate message containers and layout breaks
- Better insertion logic that respects existing help text
- Improved container detection to avoid duplicates
- Fixed required indicator duplication issues
- Enhanced form submission handler management
The validation system automatically initializes on forms with
data-validate-form attribute or novalidate attribute, providing
consistent validation UX across the application.
Standardize all table templates across the application and implement comprehensive bulk operations with improved loading states and empty state handling.
Frontend Improvements:
- Standardize table templates: Apply consistent styling, filters, and bulk actions across all list pages
- Add bulk action UI: Implement bulk selectors, action dropdowns, and confirmation dialogs
- Implement loading states: Add skeleton loaders, progress indicators for exports and bulk operations
- Enhance empty states: Create context-aware empty states with clear CTAs
- Improve filter UX: Make filter sections collapsible with localStorage persistence
Backend Implementation:
- Add bulk delete routes: Implement bulk deletion endpoints for invoices, expenses, payments, per diem, and mileage
- Add bulk status update routes: Implement bulk status update endpoints for all applicable resources
- Ensure proper permission checks and comprehensive error handling
UI Components:
- Enhance empty_state macro with context-awareness
- Add skeleton_table, skeleton_card, and progress_indicator components
- Extend enhanced-ui.css with progress-indeterminate animation and fade-in-up transitions
Files Changed: 15 files modified with 1,274 additions
Standardize table templates across all list pages by adding bulk selection
and bulk actions functionality, following the same pattern as the tasks table.
Changes:
- Add bulk actions dropdown button (admin only) with "Change Status" and "Delete" options
- Add checkbox column in table headers with select-all functionality
- Add individual checkboxes for each row
- Implement JavaScript functions for bulk operations:
* toggleAll[Entity]() - Select/deselect all checkboxes
* updateBulkDeleteButton() - Update button state based on selection count
* Menu management (openMenu, closeAllMenus)
* Bulk delete confirmation dialog
* Bulk status change dialog
- Add hidden forms for bulk delete and bulk status change operations
- Add confirmation dialogs for bulk operations with proper styling
- Maintain consistent UI/UX across all entity list pages
Note: Backend routes for bulk operations need to be implemented (forms
currently use placeholder action="#"). The frontend is ready for backend
integration.
Affected files:
- app/templates/expenses/list.html
- app/templates/payments/list.html
- app/templates/per_diem/list.html
- app/templates/mileage/list.html
Add the ability to create and manage PDF invoice templates for different
page sizes (A4, Letter, Legal, A3, A5, Tabloid) with independent templates
for each size.
Features:
- Database migration to create invoice_pdf_templates table with page_size
column and default templates for all supported sizes
- New InvoicePDFTemplate model with helper methods for template management
- Page size selector dropdown in canvas editor with dynamic canvas resizing
- Size selection in invoice export view
- Each page size maintains its own template (HTML, CSS, design JSON)
- Preview functionality converted to full-screen modal popup
PDF Generation:
- Updated InvoicePDFGenerator to accept page_size parameter
- Dynamic @page rule updates in CSS based on selected size
- Removed conflicting @page rules from HTML inline styles when separate
CSS exists
- Template content preserved exactly as saved (no whitespace stripping)
- Fallback logic: size-specific template → legacy Settings template → default
UI/UX Improvements:
- Styled page size selector to match app theme with dark mode support
- Fixed canvas editor header styling and readability
- Canvas correctly resizes when switching between page sizes
- Unsaved changes confirmation uses app's standard modal
- All editor controls properly styled for dark/light mode
- Preview opens in modal instead of small side window
Bug Fixes:
- Fixed migration KeyError by correcting down_revision reference
- Fixed DatatypeMismatch error by using boolean TRUE instead of integer
- Fixed template content mismatch (logo positions) by preserving HTML
- Fixed page size not being applied by ensuring @page rules are updated
- Fixed f-string syntax error in _generate_css by using .format() instead
- Fixed debug_print scope issue in _render_from_custom_template
Debugging:
- Added comprehensive debug logging to PDF generation flow
- Debug output visible in Docker console for troubleshooting
- Logs template retrieval, @page size updates, and final CSS content
Files Changed:
- migrations/versions/041_add_invoice_pdf_templates_table.py (new)
- app/models/invoice_pdf_template.py (new)
- app/models/__init__.py (register new model)
- app/routes/admin.py (template management by size)
- app/routes/invoices.py (page size parameter, debug logging)
- app/utils/pdf_generator.py (page size support, debug logging)
- templates/admin/pdf_layout.html (size selector, canvas resizing, modal)
- app/templates/invoices/view.html (size selector for export)
- Fixed AttributeError when accessing project.client.name in Excel export
- Project.client is a string property returning the client name, not an object
- Changed all incorrect .name accesses to use the string property directly
- Added unit tests for Excel export functionality to prevent regression
Fixes bug where exporting time entries to Excel resulted in 500 server error
with message: 'str' object has no attribute 'name'
Files changed:
- app/utils/excel_export.py: Fixed time entries export client column
- app/routes/reports.py: Fixed project report export client field
- app/templates/projects/view.html: Fixed project view template
- tests/test_excel_export.py: Added comprehensive Excel export tests