Commit Graph

243 Commits

Author SHA1 Message Date
Christian
827463d59e Add dedicated SAG email tab with preview and filters 2026-03-03 14:33:53 +01:00
Christian
81cc3a4a9e fix: enhance email threading and extraction logic in sag email handling 2026-03-03 10:42:16 +01:00
Christian
b0a51f1919 release: v2.2.36 helpdesk sag routing 2026-03-02 23:58:56 +01:00
Christian
2d2c7aeb9b fix: template builder AI URL /ai-analyze → /ai/analyze v2.2.35 2026-03-02 15:46:30 +01:00
Christian
bf28e94d6e fix: JSON truncation num_predict 8000 + 5-stage parser + batch-analyze endpoint v2.2.34 2026-03-02 13:48:14 +01:00
Christian
72acca9e8b fix: duplikat link-vendor endpoint + extraction_id reference fix v2.2.33 2026-03-02 13:12:41 +01:00
Christian
4953c82b93 fix: link-vendor opretter minimal extraction hvis ingen findes v2.2.32 2026-03-02 13:12:01 +01:00
Christian
4b2b0ea0f3 fix: PDF iframe størrelse + AI skelner leverandør fra BMC-modtager v2.2.31 2026-03-02 12:59:17 +01:00
Christian
8d29302b01 fix: console logging + robust auto-reprocess med isRetry guard v2.2.30 2026-03-02 09:47:07 +01:00
Christian
8a0dbcd1cc feat: auto-reprocess faktura når panel åbnes uden AI-data v2.2.29 2026-03-02 09:41:06 +01:00
Christian
d561a063f6 fix: vendor pre-fill bruger server-normaliseret llm_data + operator precedence fix v2.2.28 2026-03-02 09:33:50 +01:00
Christian
14ccd5accf fix: llm_response_json already parsed object i split-view modal v2.2.27 2026-03-02 09:22:40 +01:00
Christian
bdf76a2a80 feat: quick opret leverandør split-view panel v2.2.26 2026-03-02 09:09:30 +01:00
Christian
2ed3118c83 fix: exclude OWN_CVR from AI vendor extraction v2.2.25 2026-03-02 09:01:43 +01:00
Christian
aabd9f0069 fix: remove vat_note from extraction_lines INSERT v2.2.24 2026-03-02 08:54:14 +01:00
Christian
5e94fc5e69 fix: wrong table name supplier_invoice_extractions -> extractions v2.2.23 2026-03-02 08:48:03 +01:00
Christian
744b405142 fix: vendor info + rerun button on supplier invoices v2.2.21
- Fix get_files_by_status query: LATERAL join to get latest extraction
  per file, returning vendor_name, vendor_match_confidence, total_amount
- Fix renderUnhandledFiles: use best_vendor_name, convert confidence
  0-1 to %, use total_amount field
- Add rerun button for all files (not just failed) via rerunSingleFile()
- rerunSingleFile() calls /reprocess/{file_id} and reloads unhandled tab
- Fix retry_extraction endpoint to actually run extraction immediately
2026-03-02 06:22:33 +01:00
Christian
ea4905ef8a fix: vendor DB lookup after regex/AI extraction v2.2.20
extract_vendor_suggestion now matches found CVR/domain/name against
vendors table for ALL code paths (not just fast path):
- CVR match → score 100
- Domain match → score 80
- Email-domain match → score 75
- Name substring → score 60

Frontend auto-links when match_score >= 80 (was only pdf_extraction source).
Shows score reason: CVR-match/domæne-match/navne-match in success toast.

Also: saves newly found CVR to extracted_vendor_cvr so fast path
works on subsequent calls for old emails too.
2026-03-02 00:35:44 +01:00
Christian
09de3c7373 feat: auto-link vendor from PDF extraction, improve vendor suggestion v2.2.19
- extract_vendor_suggestion: fast path if extracted_vendor_cvr already set
  - CVR lookup in vendors table → returns vendor_id if match found
  - source='pdf_extraction' with confidence=0.95
- Frontend quickCreateVendor:
  - If vendor_id returned → auto-link without modal (no manual input needed)
  - New source label '📄 PDF-faktura' for pdf_extraction source
- Added execute_query_single import to emails router
2026-03-02 00:26:23 +01:00
Christian
c6d310e96d feat: analyze PDF attachments for invoice extraction v2.2.18
- email_analysis_service: extract PDF text from attachments as PRIMARY source
  - _build_invoice_extraction_context: reads PDF bytes (in-memory or DB)
  - _extract_pdf_texts_from_attachments: pdfplumber on in-memory bytes
  - _get_attachment_texts_from_db: fallback to content_data/file_path
  - _build_extraction_prompt: comprehensive schema (vendor, CVR, lines, dates)
  - num_predict 300→3000, timeout 30→120s, format=json
- email_processor_service: _update_extracted_fields saves vendor_name, CVR, invoice_date
- migration 140: extracted_vendor_name, extracted_vendor_cvr, extracted_invoice_date columns

Sender (forwarder/external bookkeeper) is now ignored for vendor detection.
The actual invoice PDF determines vendor/amounts/lines.
2026-03-02 00:17:41 +01:00
Christian
3d24987365 fix: use execute_query_single for duplicate checksum check v2.2.17
Fixes 'list indices must be integers or slices, not str' error when
uploading a duplicate file. execute_query returns a list, so accessing
existing_file['file_id'] caused TypeError. Now uses execute_query_single
which returns a single dict row.
2026-03-02 00:05:24 +01:00
Christian
aa7b0894af fix: MAX_FILE_SIZE_MB → EMAIL_MAX_UPLOAD_SIZE_MB in supplier invoice upload v2.2.15 2026-03-01 20:15:40 +01:00
Christian
3978dae692 fix: BACKUP_STORAGE_PATH→/app/data/backups + container_name STACK_NAME + pdf extension v2.2.14 2026-03-01 20:06:02 +01:00
Christian
c5aa31b825 fix: container_name uses STACK_NAME + ALLOWED_EXTENSIONS CSV parsing v2.2.13 2026-03-01 20:01:11 +01:00
Christian
84c837f303 fix: store PDF bytes in DB (content_data) + re-save existing email attachments v2.2.11 2026-03-01 16:36:05 +01:00
Christian
eb0dad8a10 fix: read body_html + resolve relative file paths for PDF extraction 2026-03-01 16:03:07 +01:00
Christian
14e1c87a4c fix: dedicated footer parser + debug logging for PDF text extraction 2026-03-01 15:51:45 +01:00
Christian
04acdecb91 fix: extract address/company from invoice footer dash-format (KONI Accounting style) 2026-03-01 12:22:14 +01:00
Christian
a8970701ab fix: massively improved vendor info extraction (CVR/address/phone/domain) 2026-03-01 12:04:53 +01:00
Christian
07584b1b0c feat: quick-create customer/vendor from unknown email sender 2026-03-01 11:24:06 +01:00
Christian
8d7d32571a Release v2.2.4: AI prompt test feature + updateto.sh path fix 2026-03-01 02:56:38 +01:00
Christian
e772311a86 Release v2.2.2: sync safety hardening 2026-02-22 03:27:40 +01:00
Christian
bef5c20c83 feat: Implement AI-powered Case Analysis Service and QuickCreate Modal
- Added CaseAnalysisService for analyzing case text using Ollama LLM.
- Integrated AI analysis into the QuickCreate modal for automatic case creation.
- Created HTML structure for QuickCreate modal with dynamic fields for title, description, customer, priority, technician, and tags.
- Implemented customer search functionality with debounce for efficient querying.
- Added priority field to sag_sager table with migration for consistency in case management.
- Introduced caching mechanism in CaseAnalysisService to optimize repeated analyses.
- Enhanced error handling and user feedback in the QuickCreate modal.
2026-02-20 07:10:06 +01:00
Christian
e6b4d8fb47 feat: add alert notes functionality with inline and modal display
- Implemented alert notes JavaScript module for loading and displaying alerts for customers and contacts.
- Created HTML template for alert boxes to display alerts inline on detail pages.
- Developed modal for creating and editing alert notes with form validation and user restrictions.
- Added modal for displaying alerts with acknowledgment functionality.
- Enhanced user experience with toast notifications for successful operations.
2026-02-17 12:49:11 +01:00
Christian
3cddb71cec feat: Add Technician Dashboard V1, V2, and V3 with enhanced UI and functionality
- Introduced Technician Dashboard V1 (tech_v1_overview.html) with KPI cards and new cases overview.
- Implemented Technician Dashboard V2 (tech_v2_workboard.html) featuring a workboard layout for daily tasks and opportunities.
- Developed Technician Dashboard V3 (tech_v3_table_focus.html) with a power table for detailed case management.
- Created a dashboard selector page (technician_dashboard_selector.html) for easy navigation between dashboard versions.
- Added user dashboard preferences migration (130_user_dashboard_preferences.sql) to store default dashboard paths.
- Enhanced sag_sager table with assigned group ID (131_sag_assignment_group.sql) for better case management.
- Updated sag_subscriptions table to include cancellation rules and billing dates (132_subscription_cancellation.sql, 134_subscription_billing_dates.sql).
- Implemented subscription staging for CRM integration (136_simply_subscription_staging.sql).
- Added a script to move time tracking section in detail view (move_time_section.py).
- Created a test script for subscription processing (test_subscription_processing.py).
2026-02-17 08:29:05 +01:00
Christian
891180f3f0 Refactor opportunities and settings management
- Removed opportunity detail page route from views.py.
- Deleted opportunity_service.py as it is no longer needed.
- Updated router.py to seed new setting for case_type_module_defaults.
- Enhanced settings.html to include standard modules per case type with UI for selection.
- Implemented JavaScript functions to manage case type module defaults.
- Added RelationService for handling case relations with a tree structure.
- Created migration scripts (128 and 129) for new pipeline fields and descriptions.
- Added script to fix relation types in the database.
2026-02-15 11:12:58 +01:00
Christian
0831715d3a feat: add SMS service and frontend integration
- Implement SmsService class for sending SMS via CPSMS API.
- Add SMS sending functionality in the frontend with validation and user feedback.
- Create database migrations for SMS message storage and telephony features.
- Introduce telephony settings and user-specific configurations for click-to-call functionality.
- Enhance user experience with toast notifications for incoming calls and actions.
2026-02-14 02:26:29 +01:00
Christian
7eda0ce58b feat(dashboard): enhance dashboard stats and add upcoming reminders feature
- Updated dashboard stats to include new customer counts and trends, ticket counts, hardware counts, and revenue growth percentages.
- Added a new endpoint for fetching upcoming reminders for the dashboard calendar widget.
- Improved recent activity fetching to include recent tickets and cases.
- Enhanced frontend with modern styling for dashboard components, including stat cards and activity feed.
- Implemented loading states and error handling for stats, activity, and reminders in the frontend.
- Refactored HTML structure for better organization and responsiveness.

feat(hardware): support for new hardware_assets table in contact hardware listing

- Modified the endpoint to list hardware by contact to support both new hardware_assets and legacy hardware tables.
- Merged results from both tables, prioritizing the new hardware_assets table for better data accuracy.

style(eset_import): improve device display options in ESET import template

- Added toggle functionality for switching between tablet view and table view for device listings.
- Enhanced the layout and visibility of device cards and tables for better user experience.
2026-02-12 07:03:18 +01:00
Christian
489f81a1e3 feat: Enhance hardware detail view with ESET data synchronization and specifications
- Added a button to sync ESET data in the hardware detail view.
- Introduced a new tab for ESET specifications, displaying relevant device information.
- Included ESET UUID and group details in the hardware information section.
- Implemented a JavaScript function to handle ESET data synchronization via API.
- Updated the ESET import template to improve device listing and inline contact selection.
- Enhanced the Nextcloud and locations routers to support customer ID resolution from contacts.
- Added utility functions for retrieving customer IDs linked to contacts.
- Removed debug information from the service contract wizard for cleaner output.
2026-02-11 23:51:21 +01:00
Christian
297a8ef2d6 feat: Implement ESET integration for hardware management
- Added ESET sync functionality to periodically fetch devices and incidents.
- Created new ESET service for API interactions, including authentication and data retrieval.
- Introduced new database tables for storing ESET incidents and hardware contacts.
- Updated hardware assets schema to include ESET-specific fields (UUID, specs, group).
- Developed frontend templates for ESET overview, import, and testing.
- Enhanced existing hardware creation form to auto-generate AnyDesk links.
- Added global logout functionality to clear user session data.
- Improved error handling and logging for ESET API interactions.
2026-02-11 13:23:32 +01:00
Christian
3d7fb1aa48 feat(migrations): add AnyDesk session management and customer wiki slug updates
- Created migration scripts for AnyDesk sessions and hardware assets.
- Implemented apply_migration_115.py to execute migration for AnyDesk sessions.
- Added set_customer_wiki_slugs.py script to update customer wiki slugs based on a predefined folder list.
- Developed run_migration.py to apply AnyDesk migration schema.
- Added tests for Service Contract Wizard to ensure functionality and dry-run mode.
2026-02-10 14:40:38 +01:00
Christian
693ac4cfd6 feat: Add case types to settings if not found
feat: Update frontend navigation and links for support and CRM sections

fix: Modify subscription listing and stats endpoints to support 'all' status

feat: Implement subscription status filter in the subscriptions list view

feat: Redirect ticket routes to the new sag path

feat: Integrate devportal routes into the main application

feat: Create a wizard for location creation with nested floors and rooms

feat: Add product suppliers table to track multiple suppliers per product

feat: Implement product audit log to track changes in products

feat: Extend location types to include kantine and moedelokale

feat: Add last_2fa_at column to users table for 2FA grace period tracking
2026-02-09 15:30:07 +01:00
Christian
6320809f17 feat: Add subscriptions and products management
- Implemented frontend views for products and subscriptions using FastAPI and Jinja2 templates.
- Created API endpoints for managing subscriptions, including creation, listing, and status updates.
- Added HTML templates for displaying active subscriptions and their statistics.
- Established database migrations for sag_subscriptions, sag_subscription_items, and products, including necessary indexes and triggers for automatic subscription number generation.
- Introduced product price history tracking to monitor changes in product pricing.
2026-02-08 12:42:19 +01:00
Christian
e4b9091a1b feat: Implement fixed-price agreements frontend views and related templates
- Added views for listing fixed-price agreements, displaying agreement details, and a reporting dashboard.
- Created HTML templates for listing, detailing, and reporting on fixed-price agreements.
- Introduced API endpoint to fetch active customers for agreement creation.
- Added migration scripts for creating necessary database tables and views for fixed-price agreements, billing periods, and reporting.
- Implemented triggers for auto-generating agreement numbers and updating timestamps.
- Enhanced ticket management with archived ticket views and filtering capabilities.
2026-02-08 01:45:00 +01:00
Christian
b43e9f797d feat: Add reminder system for sag cases with user preferences and notification channels
- Implemented user notification preferences table for managing default notification settings.
- Created sag_reminders table to define reminder rules with various trigger types and recipient configurations.
- Developed sag_reminder_queue for processing reminder events triggered by status changes or scheduled times.
- Added sag_reminder_logs to track reminder notifications and user interactions.
- Introduced frontend notification system using Bootstrap 5 Toast for displaying reminders.
- Created email template for sending reminders with case details and action links.
- Implemented rate limiting for user notifications to prevent spamming.
- Added triggers and functions for automatic updates and reminder processing.
2026-02-06 10:47:14 +01:00
Christian
b06ff693df feat: Enhance contact management and user/group functionalities
- Added ContactCompanyLink model for linking contacts to companies with primary role handling.
- Implemented endpoint to link contacts to companies, including conflict resolution for existing links.
- Updated auth service to support additional password hashing schemes.
- Improved sag creation and update processes with new fields and validation for status.
- Enhanced UI for user and group management, including modals for group assignment and permissions.
- Introduced new product catalog and improved sales item structure for better billing and aggregation.
- Added recursive aggregation logic for financial calculations in cases.
- Implemented strict status lifecycle for billing items to prevent double-billing.
2026-02-03 15:37:16 +01:00
Christian
56d6d45aa2 feat(sag): Add Varekøb & Salg module with database migration and frontend template
- Created a new SQL migration for the sag_salgsvarer table to manage sales and purchase items.
- Implemented a new HTML template for the Varekøb & Salg module, including summary cards and tables for sales and purchases.
- Added JavaScript functions for loading and rendering order data dynamically.
- Introduced a new backend search module for customers, contacts, hardware, and locations with autocomplete functionality.
- Developed an email templates API for managing system and customer-specific email templates.
- Created multiple migrations for Nextcloud instances, cache, audit logs, email templates, sag comments, hardware locations, and billing methods.
- Enhanced the sag module with solutions, order lines, work types, and 2FA support for user authentication.
2026-02-02 20:23:56 +01:00
Christian
d5dd958bf9 Refactor Sager module templates and functionality
- Updated index.html to extend base template and improve structure.
- Added new styles and search/filter functionality in the Sager list view.
- Created a backup of the old index.html as index_old.html.
- Updated navigation links in base.html for consistency.
- Included new dashboard API router in main.py.
- Added test scripts for customer and sag queries to validate database interactions.
2026-02-01 11:58:44 +01:00
Christian
464c27808c Refactor case management views and templates for improved structure and styling
- Updated the case list endpoint to handle filtering and error logging more effectively.
- Changed the template directory structure for better organization.
- Enhanced the case detail view with improved error handling and customer information retrieval.
- Redesigned the index.html template to include a more modern layout and responsive design using Bootstrap.
- Implemented dark mode toggle functionality and improved search/filter capabilities in the frontend.
- Removed unused code and optimized existing JavaScript for better performance.
2026-02-01 00:38:10 +01:00
Christian
fe2110891f feat: redesign case detail page with 3-row layout and SAG compatibility modal 2026-02-01 00:29:57 +01:00