Commit Graph

456 Commits

Author SHA1 Message Date
Dries Peeters 628e85a402 Update list.html 2025-11-05 13:27:16 +01:00
Dries Peeters 0df8ef5ae1 Update test_invoices.py 2025-11-05 13:18:24 +01:00
Dries Peeters fbb2fee1fe Update test_invoices.py 2025-11-05 13:14:24 +01:00
Dries Peeters e28e58b5d2 Update list.html 2025-11-05 13:09:54 +01:00
Dries Peeters 2502ddf552 Update for smoke test 2025-11-05 13:05:01 +01:00
Dries Peeters 17e1843f9d Update tests. 2025-11-05 11:56:05 +01:00
Dries Peeters fe26969647 Update setup.py 2025-11-05 11:51:25 +01:00
Dries Peeters e6ffee4d85 Merge branch 'develop' of https://github.com/drytrix/TimeTracker into develop 2025-11-05 11:49:02 +01:00
Dries Peeters b0b374b9bd Fix: Clear description field on fresh project creation page load
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
2025-11-05 11:47:15 +01:00
Dries Peeters 9d669fbca5 Merge pull request #222 from DRYTRIX/Feat-ImprovedUI
Feat improved UI
2025-11-05 11:42:25 +01:00
Dries Peeters d5417501e8 feat: Enhance UI with timer page, projects grid view, invoice filters, and reports improvements
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
2025-11-05 11:41:16 +01:00
Dries Peeters 01459f6d3b feat: Implement comprehensive onboarding and enhanced error handling
- 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
2025-11-05 10:54:55 +01:00
Dries Peeters 5ad3dfa3cb feat: Implement comprehensive UI enhancements and per diem rates management
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
2025-11-05 09:19:57 +01:00
Dries Peeters dc010c8da1 feat: Add enhanced table features with sorting, pagination, and column visibility
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.
2025-11-05 08:17:38 +01:00
Dries Peeters b4b8bafb9a feat: Add comprehensive form validation system with real-time feedback
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.
2025-11-05 08:02:30 +01:00
Dries Peeters e1d6fbafa0 feat: standardize table templates and implement bulk actions with enhanced UX
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
2025-11-05 07:35:26 +01:00
Dries Peeters b937f4e2d9 feat: Add bulk selection and actions to expenses, payments, per diem, and mileage tables
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
2025-11-05 06:50:27 +01:00
Dries Peeters 4e25f305e9 Update tests 2025-11-03 13:51:03 +01:00
Dries Peeters 64e94aed50 Update admin.py 2025-11-03 13:42:13 +01:00
Dries Peeters 6427f52521 Merge pull request #216 from DRYTRIX/Feat-PDFTemplateInDifferentSizes
feat: Add support for multiple PDF template page sizes
2025-11-03 11:50:32 +01:00
Dries Peeters a94e928509 feat: Add support for multiple PDF template page sizes
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)
2025-11-03 11:48:41 +01:00
Dries Peeters 279a2fb667 fix: resolve Excel export 500 error caused by incorrect project.client access
- 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
2025-11-03 08:32:10 +01:00
Dries Peeters a90e587fc9 Update entrypoint_fixed.sh 2025-11-01 11:28:01 +01:00
Dries Peeters 47ebf9989c Update ci-comprehensive.yml 2025-11-01 11:12:46 +01:00
Dries Peeters e515e55586 Update 037_advanced_expenses.py 2025-11-01 10:51:09 +01:00
Dries Peeters 456c3c5f47 Hopefully fixes it. 2025-11-01 10:26:45 +01:00
Dries Peeters 8b3de55ac1 fix tests 2025-11-01 09:04:06 +01:00
Dries Peeters 3bfb0fe9b2 Update 037_advanced_expenses.py 2025-11-01 08:55:00 +01:00
Dries Peeters a110b94a08 fix tests 2025-11-01 08:44:02 +01:00
Dries Peeters 7a28f0665b Update tests. 2025-10-31 19:24:47 +01:00
Dries Peeters 9eb4fbe166 fix tests 2025-10-31 18:33:02 +01:00
Dries Peeters be65235e2a update tests. 2025-10-31 17:56:24 +01:00
Dries Peeters 31fa60164d Change tests 2025-10-31 17:26:32 +01:00
Dries Peeters 945ef48f8d Update testing 2025-10-31 14:13:16 +01:00
Dries Peeters 81c57493c4 Update test_currency_display.py 2025-10-31 13:51:53 +01:00
Dries Peeters cbebf0d7e5 Update tests 2025-10-31 13:44:07 +01:00
Dries Peeters 6432f61ee8 Update pytest.ini 2025-10-31 13:38:15 +01:00
Dries Peeters 157272356c feat: Add Resume Time Entry feature for quick timer restart
Add new Resume feature that allows users to quickly start a new active
timer with the same properties as a previously completed time entry. This
eliminates repetitive data entry when continuing work on tasks that span
multiple days, reducing time from ~30 seconds to ~3 seconds (90% savings).

Backend Changes:
- Add new route GET /timer/resume/<timer_id> in app/routes/timer.py
- Copies project, task, notes, tags, and billable status to new timer
- Validates permissions (users can only resume their own entries)
- Prevents concurrent timers (blocks if active timer exists)
- Validates project status (must be active, not archived)
- Handles deleted tasks gracefully (creates timer without task)
- Logs events for analytics and activity tracking
- Emits WebSocket events for real-time UI updates

Frontend Changes:
- Add green Resume button (play icon) to dashboard recent entries
- Add Resume button to search results time entry table
- Add Resume button to task view time entries table
- Position Resume as first action before Edit/Duplicate/Delete

Testing:
- Add comprehensive test suite in tests/test_time_entry_resume.py
- 14 tests covering unit, integration, and smoke test scenarios
- Tests property copying, permissions, validations, and edge cases
- 100% code coverage of new functionality

Documentation:
- Add docs/RESUME_FEATURE.md - Complete feature documentation
- Add docs/features/RESUME_TIME_ENTRY_IMPLEMENTATION.md - Technical guide
- Add docs/features/RESUME_TIME_ENTRY_README.md - User quick start guide

Properties Copied: project_id, task_id, notes, tags, billable
Properties NOT Copied: start_time (uses current), end_time (NULL for active)

No database migrations required - works with existing schema.

Resolves user feature request for resuming time entries across work sessions.
2025-10-31 13:33:11 +01:00
Dries Peeters 890df2f4bc Fix: Preserve task selection when duplicating time entries
Fix: Preserve task selection when duplicating time entriesWhen duplicating a time entry with an assigned task, the task was notbeing pre-selected in the duplicate form. This was caused by thetemplate application code interfering with the duplication logic.The template code would run after duplication data was set, overwritingthe `data-selected-task-id` attribute and clearing the task selectioneven when no template was being applied.Changes:- Added isDuplicating flag check in manual_entry.html to prevent  template application code from running during duplication- Template functionality continues to work normally for non-duplicate  manual entries- Added comprehensive test to verify task pre-selection is preserved- Updated documentation with fix notes and changelog entryImpact:- Users can now duplicate time entries with tasks and the task will be  correctly pre-selected, saving time and improving UX- No breaking changes - all existing tests pass (54/54)- Clean separation between duplication and template featuresTests:- test_duplicate_with_task_not_overridden_by_template_code (new)- All 22 duplication tests passing- All 32 template tests passing
2025-10-31 13:22:24 +01:00
Dries Peeters aa7e78c0f9 feat(pdf-editor): Add grid snapping and expenses table support
Add snap-to-grid functionality with visual grid overlay:
- 10px grid with toggle checkbox in action bar
- Visual grid lines (light gray, bolder every 50px)
- Elements snap to grid during drag operations
- Position updates in properties panel after dragging

Add Expenses Table element for invoice customization:
- New table element in sidebar with amber/yellow theme
- Displays expense title, date, category, and amount
- Loops through invoice.expenses using Jinja2 templating
- Backend support for Query-to-list conversion in preview and PDF generation

Clean up debug logging:
- Remove console.log statements from JavaScript
- Remove print debug statements from Python endpoints
- Clean up pdf_layout_preview and related functions

Backend changes:
- Convert invoice.expenses from SQLAlchemy Query to list in admin.py
- Add expenses data support in pdf_generator.py
- Update generateCode() to handle both items-table and expenses-table

Improves UX with precise element positioning and adds support for
displaying project expenses alongside invoice items in custom PDF layouts.
2025-10-31 13:09:04 +01:00
Dries Peeters 04760170c2 fix: pass datetime module to test email template
Fixes warning 'datetime is undefined' that appeared when sending test emails.
The test_email.html template was trying to use datetime.utcnow() to display
the timestamp, but the datetime module wasn't included in the template context.

This change ensures the HTML email template renders correctly with the
formatted timestamp.
2025-10-31 10:51:33 +01:00
Dries Peeters 8e85e41f21 fix: Replace hardcoded Euro symbols with dynamic currency in finance pages
xes bug where Reports, Payments, and Expenses dashboards displayed
hardcoded Euro symbols (€) instead of respecting the CURRENCY setting
from the environment file.

Changes:
- Added currency_symbol and currency_icon Jinja2 filters supporting 25+ currencies
- Updated Reports page to use dynamic currency symbols
- Updated Payments list page to use dynamic currency symbols
- Updated Expenses list page to use dynamic currency symbols and icons
- Updated Expenses dashboard to use dynamic currency symbols and icons
- Created comprehensive test suite with 14 tests (unit, integration, smoke)
- Added bug fix documentation

The currency variable is already injected via context processor, so pages
now correctly display USD ($), EUR (€), GBP (£), or any configured currency
symbol based on the CURRENCY environment variable.

Affected pages:
- /reports
- /payments
- /expenses
- /expenses/dashboard

Test with: pytest tests/test_currency_display.py -v

Files changed:
- app/utils/template_filters.py (added filters)
- app/templates/reports/index.html
- app/templates/payments/list.html
- app/templates/expenses/list.html
- app/templates/expenses/dashboard.html
- tests/test_currency_display.py (new)
- docs/BUGFIX_CURRENCY_DISPLAY.md (new)
2025-10-31 10:49:12 +01:00
Dries Peeters a64d69134e Merge pull request #196 from DRYTRIX/Feat-Multi-Language-Support-Completion
feat: implement comprehensive multi-language support with RTL
2025-10-31 10:39:44 +01:00
Dries Peeters d9c6192884 feat: implement comprehensive multi-language support with RTL
Add complete internationalization (i18n) infrastructure supporting 9 languages
including full Right-to-Left (RTL) support for Arabic and Hebrew.

Languages supported:
- English, German, French, Spanish, Dutch, Italian, Finnish (LTR)
- Arabic, Hebrew (RTL with complete layout support)

Core features:
* Flask-Babel configuration with locale selector
* Translation files for all 9 languages (480+ strings each)
* Language selector UI component in header with globe icon
* User language preference storage in database
* RTL CSS support with automatic layout reversal
* Session and user-based language persistence

Model field translation system:
* Created comprehensive i18n helper utilities (app/utils/i18n_helpers.py)
* 17 new Jinja2 template filters for automatic translation
* Support for task statuses, priorities, project statuses, invoice statuses,
  payment methods, expense categories, and all model enum fields
* Status badge CSS classes for consistent styling

Technical implementation:
* Language switching via API endpoint (POST /api/language)
* Direct language switching route (GET /set-language/<lang>)
* RTL detection and automatic dir="rtl" attribute
* Context processors for language information in all templates
* Template filters registered globally

Testing and quality:
* 50+ unit tests covering all i18n functionality
* Tests for locale selection, language switching, RTL detection
* Comprehensive test coverage for all translation features

Files added:
- translations/es/LC_MESSAGES/messages.po (Spanish)
- translations/ar/LC_MESSAGES/messages.po (Arabic)
- translations/he/LC_MESSAGES/messages.po (Hebrew)
- app/utils/i18n_helpers.py (translation helper functions)
- app/static/css/rtl-support.css (RTL layout support)
- tests/test_i18n.py (comprehensive test suite)
- scripts/audit_i18n.py (translation audit tool)

Files modified:
- app/config.py: Added 3 languages + RTL configuration
- app/routes/user.py: Language switching endpoints
- app/templates/base.html: Language selector + RTL support
- app/utils/context_processors.py: Language context injection
- app/__init__.py: Registered i18n template filters
- scripts/extract_translations.py: Updated language list
- translations/*/messages.po: Added 70+ model field translations

The infrastructure is production-ready. Model enum fields now automatically
translate in templates using the new filters. Flash messages and some template
strings remain in English until wrapped with translation markers (tracked
separately for incremental implementation).
2025-10-31 10:39:12 +01:00
Dries Peeters 17ff25a332 Merge pull request #195 from DRYTRIX/Feat-Import/Export-System
feat: Add comprehensive Import/Export system and standardize UI headers
2025-10-31 10:08:44 +01:00
Dries Peeters 12d3b9fb1b feat: Add comprehensive Import/Export system and standardize UI headers
## New Features

### Import/Export System
- Add DataImport and DataExport models for tracking operations
- Implement CSV import for bulk time entry data
- Add support for importing from Toggl and Harvest (placeholder)
- Implement GDPR-compliant full data export (JSON format)
- Add filtered export functionality with date/project filters
- Create backup/restore functionality for database migrations
- Build migration wizard UI for seamless data transitions
- Add comprehensive test coverage (unit and integration tests)
- Create user documentation (IMPORT_EXPORT_GUIDE.md)

### Database Changes
- Add migration 040: Create data_imports and data_exports tables
- Track import/export operations with status, logs, and file paths
- Support automatic file expiration for temporary downloads

## UI/UX Improvements

### Navigation Menu Restructure
- Rename "Work" to "Time Tracking" for clarity
- Rename "Finance" to "Finance & Expenses"
- Add "Tools & Data" submenu with Import/Export and Saved Filters
- Reorganize Time Tracking submenu: prioritize Log Time, add icons to all items
- Expand Finance submenu: add Mileage, Per Diem, and Budget Alerts
- Add icons to all Admin submenu items for better visual scanning
- Fix Weekly Goals not keeping Time Tracking menu open

### Standardized Page Headers
Apply consistent page_header macro across 26+ pages:
- **Time Tracking**: Tasks, Projects, Clients, Kanban, Weekly Goals, Templates, Manual Entry
- **Finance**: Invoices, Payments, Expenses, Mileage, Per Diem, Budget Alerts, Reports
- **Admin**: Dashboard, Users, Roles, Permissions, Settings, API Tokens, Backups, System Info, OIDC
- **Tools**: Import/Export, Saved Filters, Calendar
- **Analytics**: Dashboard

Each page now includes:
- Descriptive icon (Font Awesome)
- Clear title and subtitle
- Breadcrumb navigation
- Consistent action button placement
- Responsive design with dark mode support

## Bug Fixes

### Routing Errors
- Fix endpoint name: `per_diem.list_per_diems` → `per_diem.list_per_diem`
- Fix endpoint name: `reports.index` → `reports.reports`
- Fix endpoint name: `timer.timer` → `timer.manual_entry`
- Add missing route registration for import_export blueprint

### User Experience
- Remove duplicate "Test Configuration" button from OIDC debug page
- Clean up user dropdown menu (remove redundant Import/Export link)
- Improve menu item naming ("Profile" → "My Profile", "Settings" → "My Settings")

## Technical Details

### New Files
- `app/models/import_export.py` - Import/Export models
- `app/utils/data_import.py` - Import business logic
- `app/utils/data_export.py` - Export business logic
- `app/routes/import_export.py` - API endpoints
- `app/templates/import_export/index.html` - User interface
- `tests/test_import_export.py` - Integration tests
- `tests/models/test_import_export_models.py` - Model tests
- `docs/IMPORT_EXPORT_GUIDE.md` - User documentation
- `docs/import_export/README.md` - Quick reference
- `migrations/versions/040_add_import_export_tables.py` - Database migration

### Modified Files
- `app/__init__.py` - Register import_export blueprint
- `app/models/__init__.py` - Export new models
- `app/templates/base.html` - Restructure navigation menu
- 26+ template files - Standardize headers with page_header macro

## Breaking Changes
None. All changes are backward compatible.

## Testing
- All existing tests pass
- New test coverage for import/export functionality
- Manual testing of navigation menu changes
- Verified consistent UI across all updated pages
2025-10-31 09:56:49 +01:00
Dries Peeters 8b16914165 Merge pull request #194 from DRYTRIX/Feat-Budget Alerts-Forecasting
feat: Add Budget Alerts & Forecasting system with modern UI
2025-10-31 08:54:56 +01:00
Dries Peeters 755faa22c3 feat: Add Budget Alerts & Forecasting system with modern UI
Implement comprehensive budget monitoring and forecasting feature with:

Database & Models:
- Add BudgetAlert model for tracking project budget alerts
- Create migration 039_add_budget_alerts_table with proper indexes
- Support alert types: 80_percent, 100_percent, over_budget
- Add acknowledgment tracking with user and timestamp

Budget Forecasting Utilities:
- Implement burn rate calculation (daily/weekly/monthly)
- Add completion date estimation based on burn rate
- Create resource allocation analysis per team member
- Build cost trend analysis with configurable granularity
- Add automatic budget alert detection with deduplication

Routes & API:
- Create budget_alerts blueprint with dashboard and detail views
- Add API endpoints for burn rate, completion estimates, and trends
- Implement resource allocation and cost trend API endpoints
- Add alert acknowledgment and manual budget check endpoints
- Fix log_event() calls to use keyword arguments

UI Templates:
- Design modern budget dashboard with Tailwind CSS
- Create detailed project budget analysis page with charts
- Add gradient stat cards with color-coded status indicators
- Implement responsive layouts with full dark mode support
- Add smooth animations and toast notifications
- Integrate Chart.js for cost trend visualization

Project Integration:
- Add Budget Alerts link to Finance navigation menu
- Enhance project view page with budget overview card
- Show budget progress bars with status indicators
- Add Budget Analysis button to project header and dashboard
- Display real-time budget status with color-coded badges

Visual Enhancements:
- Use gradient backgrounds for stat cards (blue/green/yellow/red)
- Add status badges with icons (healthy/warning/critical/over)
- Implement smooth progress bars with embedded percentages
- Support responsive grid layouts for all screen sizes
- Ensure proper type conversion (Decimal to float) in templates

Scheduled Tasks:
- Register budget alert checking job (runs every 6 hours)
- Integrate with existing APScheduler tasks
- Add logging for alert creation and monitoring

This feature provides project managers with real-time budget insights,
predictive analytics, and proactive alerts to prevent budget overruns.
2025-10-31 08:52:12 +01:00
Dries Peeters f6e81c4b0d Merge pull request #193 from DRYTRIX/Feat-Advanced-Expense-Management
feat: implement advanced expense management with templates and naviga…
2025-10-31 07:11:25 +01:00
Dries Peeters b353184a4f feat: implement advanced expense management with templates and navigation
Implement complete Advanced Expense Management feature set with UI templates,
database schema fixes, and reorganized navigation structure.

Features:
- Expense Categories: Full CRUD with budget tracking and visualization
- Mileage Tracking: Vehicle mileage entries with approval workflow
- Per Diem Management: Daily allowance claims with location-based rates
- Receipt OCR: Infrastructure for receipt scanning (utilities ready)

Database:
- Migration 037: Create expense_categories, mileage, per_diem_rates, per_diems tables
- Migration 038: Fix schema column name mismatches (trip_purpose→purpose, etc.)
- Add missing columns (description, odometer, rates, reimbursement tracking)
- Fix circular foreign key dependencies

Templates (11 new files):
- expense_categories/: list, form, view
- mileage/: list, form, view
- per_diem/: list, form, view, rates_list, rate_form

Navigation:
- Move Mileage and Per Diem to Expenses sub-pages (header buttons)
- Move Expense Categories to Admin menu only
- Remove expense management items from Finance menu

Fixes:
- Fix NoneType comparison error in expense categories utilization
- Handle None values safely in budget progress bars
- Resolve database column name mismatches

UI/UX:
- Responsive design with Tailwind CSS and dark mode support
- Real-time calculations for mileage amounts
- Color-coded budget utilization progress bars
- Status badges for approval workflow states
- Advanced filtering on all list views

Default data:
- 7 expense categories (Travel, Meals, Accommodation, etc.)
- 4 per diem rates (US, GB, DE, FR)
2025-10-31 06:21:35 +01:00