Commit Graph
162 Commits
Author SHA1 Message Date
alexpolo1 fa2a79f8aa sec: Replace eval with safe expression parser (expr-eval) for material formulas 2025-12-22 21:56:51 +00:00
alexpolo1 0435f121d1 feat: remove old MaterialPackages and SmartPackages components; add performance optimization indexes for various tables 2025-12-22 21:51:33 +00:00
alexpolo1 efc3475ac0 docs: Add repo-level Project Memory and README pointer for Copilot Chat grounding 2025-12-22 21:36:37 +00:00
alexpolo1 835dd9654f feat: Enhance Selenium tests for Carpenter Quote with improved loading checks and realism validation 2025-12-20 14:58:39 +00:00
alexpolo1 ac9f64376e Add initial simple analysis results JSON file with project flow details 2025-12-20 14:46:04 +00:00
alexpolo1 c35478ceaf chore: Enhanced .gitignore to block all log files 2025-12-20 14:02:10 +00:00
alexpolo1 3e6f3f58a9 feat: Implement root-only encrypted environment system
Add comprehensive encrypted environment variable system with AES-256 encryption.

Security Features:
- AES-256-CBC encryption with PBKDF2 (100k iterations)
- Root-only encryption key (/root/.tilbudgivern-secure/)
- Encrypted .env.enc files safe to commit to git
- Plaintext .env files only exist at runtime
- Auto-cleanup on shutdown

Components:
- setup-encrypted-env.sh: Encrypt .env → .env.enc
- decrypt-env.sh: Decrypt .env.enc → .env
- start-secure.sh: Decrypt + start application
- test-encryption.sh: Test encryption/decryption
- tilbudgivern-secure.service: Systemd service

Documentation:
- ENCRYPTED_ENV_README.md: Overview and quick start
- ENCRYPTED_ENV_QUICKSTART.md: Quick reference guide
- docs/ENCRYPTED_ENV_SECURITY.md: Complete security guide

Threat Model:
✅ User account compromise: Credentials safe
✅ Git repository leak: Only encrypted files exposed
✅ File system read: Encrypted files useless
❌ Root compromise: Defense in depth

This ensures attackers need root access to decrypt credentials.
2025-12-20 13:36:30 +00:00
alexpolo1andClaude Sonnet 4.5 4af8713934 security: Remove all hardcoded credential fallbacks from source code
BREAKING CHANGE: Application now requires proper environment configuration

Changes:
- Remove hardcoded password fallbacks from 6 backend files
- auth.js: Remove 'toemrer/tilbud2024' fallbacks
- db/connection.js: Remove 'tilbudpass123' fallback
- graphqlClient.js: Remove API token fallback
- ordrestyringSyncService.js: Remove password and token fallbacks
- databaseService.js: Remove 'ServicePass2024!' fallback
- logger.js: Remove 'tilbudpass123' fallback

- Update .env.example with secure template
- Add validation to fail fast if credentials not configured
- Add security notes to .env.example

Security improvements:
✅ No hardcoded credentials in source code
✅ Application fails immediately if not configured
✅ Clear error messages for missing env vars
✅ Secure .env.example template provided

Action required:
1. Copy backend/.env.example to backend/.env
2. Configure all required credentials
3. Restart the application

All exposed credentials have been removed from source code.
Credential rotation is strongly recommended.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
2025-12-20 13:18:13 +00:00
alexpolo1andClaude Sonnet 4.5 5d566d3d2d docs: Add SVG implementation documentation and roof types guide
- Add SVG_IMPLEMENTATION_STATUS.md with complete implementation details
- Add SVG_TESTING_GUIDE.md for quick testing instructions
- Add SVG_VALIDATION_COMPLETE.md with technical validation
- Add ROOF_TYPES_IMPLEMENTATION.md for roof type implementations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
2025-12-20 13:07:35 +00:00
alexpolo1 faa18f8590 Add license information for React and related libraries in LICENSE.txt 2025-11-28 08:44:33 +00:00
alexpolo1 b6cf7a23f9 Add LICENSE file for bundled React and related libraries 2025-11-26 14:57:57 +00:00
alexpolo1 f792e555aa ✅ Importeret STARK katalog - 24655 materialer (20457 unikke) - Total nu 75001 materialer (Bygma: 54544 + STARK: 20457) 2025-11-26 14:00:35 +00:00
alexpolo1 e5f92ec037 ✅ Fix materialoversigt til at tælle både Bygma (54544) og STARK (5) = 54549 total 2025-11-26 13:49:16 +00:00
alexpolo1 45181e634f Clean: Archive large log files and remove core dump
- Compressed backend/combined.log (87MB) → 4.7MB
- Compressed backend/error.log (86MB) → 4.6MB
- Compressed archive/logs/combined.log (204MB) → 3.0MB
- Removed core dump (1.1GB)
- Updated .gitignore to prevent future large files

Archived logs in .archived_logs/ directory
Ready for GitHub push
2025-11-26 13:30:20 +00:00
alexpolo1 ddc005280d feat(tests): Implement comprehensive Stark import tests using Playwright, Selenium, and integration scripts
- Added Playwright tests for the Stark import system covering navigation, modal interactions, CSV uploads, and database verification.
- Developed Selenium tests to validate the complete workflow of Stark material imports, including API checks and project creation.
- Created a JavaScript test suite for Stark imports using Selenium WebDriver.
- Introduced integration tests to verify database connections, table existence, and API endpoint availability.
- Enhanced test scripts with detailed logging and error handling for better traceability.
- Ensured cleanup of temporary files and resources after tests execution.
2025-11-26 13:28:40 +00:00
alexpolo1 eb03213f16 oprydning 2025-11-26 12:36:27 +00:00
alexpolo1 cc5e098f0f feat: add diagnostic script for page analysis and login testing 2025-11-26 12:33:11 +00:00
alexpolo1 3fc1811a89 cleanup 2025-11-26 10:17:25 +00:00
alexpolo1 c5c5a70643 tests1 2025-11-24 23:08:04 +00:00
alexpolo1 9d1b1917a7 Add comprehensive database backup setup and scripts
- Created DATABASE_BACKUP_SETUP.md for detailed backup instructions
- Implemented backup-databases.sh for automated database backups
- Added logrotate configuration for managing backup logs
- Developed setup scripts for user-specific backup configurations
- Included error handling and logging in backup processes
- Established cron job setup for automated backups
- Provided examples and troubleshooting tips in documentation
2025-11-16 21:12:29 +00:00
alexpolo1 7489234f74 Implement OpenAI Costs API integration with backend and frontend updates
- Integrated OpenAI Costs API into the backend service with new methods for fetching costs and detailed breakdowns.
- Added new API endpoints for retrieving costs, budget status, and detailed cost breakdown.
- Updated frontend to display OpenAI costs and budget status, including new UI components and states.
- Enhanced styling for budget status and cost breakdown sections.
- Configured environment variables for OpenAI API access.
- Created comprehensive documentation for setup, API endpoints, and user flow.
- Added test script for validating API endpoints.
- Fixed production issues by ensuring new endpoints are loaded correctly.
2025-11-16 21:00:04 +00:00
alexpolo1 b0b6f05333 feat: Implement Nøgletal Dashboard with GraphQL API integration
- Created a new dashboard component for displaying real-time quote metrics.
- Integrated with Ordrestyring GraphQL API for fetching offers and metrics.
- Added backend endpoint for dashboard data retrieval.
- Implemented responsive design and error handling for user-friendly experience.
- Configured auto-refresh for live data updates every 5 minutes.

fix: Resolve issues with API key configuration and pagination limits

- Updated service to check for both API key variable names.
- Adjusted pagination limit from 500 to 200 to comply with API constraints.
- Modified status mapping logic to align with actual API responses.

docs: Add quick start guide and detailed implementation summary

- Created quick start guide for easy access to the dashboard.
- Documented technical implementation details, including API key management and error handling.
- Provided troubleshooting tips for common issues encountered by users.
2025-11-16 20:03:44 +00:00
alexpolo1 9795d2edde Add tests and HTML for Excel-style materials table
- Created `test_alignment.html` to test Excel-style table alignment.
- Implemented `test_excel_table_prod.py` for verifying Excel-style table in production.
- Developed `test_material_search.py` to check styling of material search table.
- Added `test_materials_screenshot.py` for taking screenshots of materials page and verifying table styling.
- Created `test_materials_with_login.py` to test materials table styling with user login.
- Implemented `test_prod_materials.py` to validate production materials page styling and CSS loading.
2025-11-16 19:08:12 +00:00
alexpolo1 b06152385c style: Enhance styling for materials tables and task dialog components 2025-11-16 08:05:56 +00:00
alexpolo1 8fd3ecd001 feat: Implement backend PUT endpoint for updating customer projects and add auto-save functionality for materials in FinalReview component
- Added PUT /api/customer-projects/:projectId endpoint to handle updates for selected_package_id and selected_package_name.
- Implemented auto-save feature in FinalReview.js to persist material changes automatically.
- Enhanced error handling in InlineSmartPackage.js for package selection saving.
- Updated documentation for materials saving error analysis and implementation details.
- Removed unused code sections in PlanningDashboard.js and added comments for future features.
2025-11-16 07:35:42 +00:00
alexpolo1 bb1f48829a Tilføjet SQL seed fil med 142 tømreropgaver
Database seed fil indeholder alle opgaver fordelt på:
- Tag: 38 opgaver
- Væg: 17 opgaver
- Udvendigt: 21 opgaver
- Loft: 10 opgaver
- Facade: 10 opgaver
- Gulv: 8 opgaver
- Trapper: 7 opgaver
- Renovering: 6 opgaver
- Opmåling: 5 opgaver
- Tilbygning: 5 opgaver
- Finish: 5 opgaver
- Indbygget: 4 opgaver
- Special: 4 opgaver
- Køkken: 2 opgaver

Kan bruges til at seede database på nye installationer.
2025-11-15 22:03:06 +00:00
alexpolo1 35f2748bae Udvidet opgave database til 72 tømreropgaver
Tilføjet opgaver i følgende kategorier:
- Tag: 38 opgaver (nedrivning, konstruktion, dækning, isolering, finish, vinduer)
- Facade: 10 opgaver (beklædning, finish, vinduer/døre)
- Gulv: 8 opgaver (konstruktion, underlag, dækning, isolering)
- Udvendigt: 16 opgaver (terrasse, carport, skur, havehus, hegn, læskur)

Opgaver dækker nu alt fra nedtagning til færdiggørelse af projekter.
2025-11-15 22:00:12 +00:00
alexpolo1 03fa42e9c5 Tilføjet opgave søgning i database
Backend:
- Implementeret /api/tasks/search endpoint
- Implementeret /api/tasks/categories endpoint
- Søger i labor_tasks tabellen (18 standard opgaver)
- Søger i opgavenavn, kategori og underkategori

Frontend:
- Tilføjet task search UI med toggle button
- Søg i 18 standard tømreropgaver (tag, facade, udvendigt)
- Viser opgave detaljer (navn, enhed, kategori)
- Prompt for timer og timeløn ved tilføjelse
- Opdateret 'Tilføj opgave' til 'Tilføj opgave manuelt'
2025-11-15 21:58:23 +00:00
alexpolo1 5faf4f0a21 Implementeret material search API endpoint
- Tilføjet /api/materials/search endpoint som søger i bygma_products
- Søger i tekst, vareNr og varegrp kolonner
- Returnerer max 50 resultater sorteret alfabetisk
- Frontend kan nu søge materialer i database via manuel tilføjelse
2025-11-15 21:51:13 +00:00
alexpolo1 d609299a6a Fix: Manuel mode skal ikke vise B7 beskrivelse eller auto-loade materialer
- Tilføjet condition så B7 pakke-beskrivelse kun vises hvis selectedPackage.id !== 'manual'
- Disabled fallback materials useEffect for manuel mode
- Materialer kommer nu kun fra smart pakke valg eller manuel tilføjelse
2025-11-15 21:45:05 +00:00
alexpolo1 4b594e8ebf Fjernet 'Automatisk beregnet' tekst - materialer kommer fra smart pakken 2025-11-15 21:36:37 +00:00
alexpolo1 9bc4466279 Manuel tilbud-mode: Tilføj materialer fra DB og opret opgaver selv
- Tilføjet 'Spring over - Tilføj manuelt' knap i Smart Pakke vælger
- Material søgning i database med autocomplete
- Manuel material tilføjelse (eksisterende funktionalitet)
- Hurtig opgave oprettelse med prompts
- Fuld fleksibilitet: vælg mellem Smart Pakke eller manuel mode
- Kan søge i 1000+ materialer fra database
- Kan tilføje custom opgaver med timer/m² eller fast tid
2025-11-15 21:33:04 +00:00
alexpolo1 f47d8e98b6 Smart Pakke Vælger: Fjernet auto-valg, tilføjet AI-forslag og flere pakker
- Fjernet automatisk valg af B7 pakken
- Tilføjet intelligent AI-baseret pakke forslag baseret på projekt titel
- Tilføjet Tagpap Renovering pakke
- Tilføjet Facade Træbeklædning pakke
- Smart forslag UI med lilla gradient boks
- Bruger kan nu selv vælge mellem 3 pakker
2025-11-15 21:26:17 +00:00
alexpolo1 74affaca24 feat: Enhance auto-save functionality by tracking user interaction in EnhancedGeometry component 2025-11-14 22:08:02 +00:00
alexpolo1 a69e3850aa Add license information for React and related libraries in LICENSE.txt 2025-11-14 21:49:45 +00:00
alexpolo1 8773d96e94 feat: Add AI-Powered Visual Testing Suite using Selenium and OpenAI Vision API
- Implemented VisualAITester class for automated UI/UX testing
- Configured environment variables for API keys and paths
- Developed methods for browser setup, login, screenshot capture, and image encoding
- Integrated OpenAI Vision API for visual quality analysis with detailed feedback
- Created tests for various application pages including homepage, project flow, geometry form, and more
- Generated comprehensive HTML report summarizing test results and AI analysis
- Added functionality to copy AI prompts for automated issue resolution
2025-11-14 20:27:19 +00:00
alexpolo1 910b8eb94c Add complete Selenium test suite for Tilbudgivern application
- Implemented authentication tests including valid login and logout
- Developed navigation tests for various sections: Projekt Flow, Planlægning, Materialer, Smart Pakker, Nøgletal, and AI Budget
- Created end-to-end tests for project flow including project creation and geometry input
- Added countdown tests to verify countdown functionality and text format
- Included detailed logging of test results and execution summary
- Configured WebDriver setup with headless option for CI/CD compatibility
- Integrated screenshot functionality for error tracking
2025-11-14 14:16:00 +00:00
alexpolo1 bdb9e524db Implement manual and automated tests for auto-save countdown feature
- Added a comprehensive manual testing guide for the countdown functionality in `test_countdown_manual.md`.
- Developed a detailed Selenium test suite in `test_countdown_selenium.py` to verify countdown behavior, including server accessibility, login, countdown progression, and UI elements.
- Created a minimal Selenium test version in `test_countdown_selenium_minimal.py` for quick checks without complex setup.
- Introduced a verification script in `test_countdown_verification.py` to analyze code correctness, including server checks, build file existence, and countdown logic.
2025-11-14 11:28:58 +00:00
alexpolo1 31a4e4f61f feat: Improve installation manual fetching by enforcing URL requirement and enhancing user feedback in MaterialDialog 2025-11-07 12:41:16 +00:00
alexpolo1 12263aef2e feat: Enhance material pricing integration by adding JOINs in API and updating SmartPackageForm to auto-add tasks from installation manuals 2025-11-07 12:01:07 +00:00
alexpolo1 0c186eb06f feat: Implement price calculation and drag-and-drop functionality in SmartPackageForm 2025-11-07 09:58:08 +00:00
alexpolo1 b82f9e758b feat: Add Backup & Import functionality for SmartPackages
- Implemented BackupImport component for exporting and importing SmartPackages.
- Added API calls for exporting JSON backups and importing packages.
- Included file validation for JSON format during import.
- Enhanced user interface with MUI components for better user experience.

feat: Create Components Library for reusable components

- Developed ComponentsLibrary component to manage reusable components for SmartPackages.
- Integrated CRUD operations for components with API endpoints.
- Added filtering functionality by component category.
- Included dummy data for initial testing and development.

feat: Implement Statistics View for SmartPackages

- Created StatisticsView component to display package statistics.
- Added API call to fetch statistics and display key metrics.
- Included visual representation of categories and most used materials.

chore: Create migration for smart_package_components table

- Added SQL migration script to create smart_package_components table.
- Inserted sample data for testing and development purposes.
- Included verification query to check data integrity after insertion.
2025-11-07 09:45:19 +00:00
alexpolo1 537d55c106 feat: Consolidate tag categories into a single "Tag" category and update related scripts and documentation 2025-11-07 09:13:12 +00:00
alexpolo1 faaf9500f5 feat: Add API test HTML page and update server check documentation
- Created a new HTML page for testing the Tømmer Opgaver API with buttons for various endpoints.
- Added a LICENSE file for React and related libraries in the frontend build.
- Documented a complete server check report, detailing fixes, test results, and server status.
- Added sample test data for quotes, including project details, geometry, labor, materials, and calculations.
2025-11-07 08:44:35 +00:00
alexpolo1 99a31cb3cb fix: Downgrade dependencies for Node.js compatibility and add engines field 2025-11-07 08:08:24 +00:00
alexpolo1 26d3452d59 Add comprehensive tests for API verification, frontend integration, and PDF generation
- Implemented a new test suite for production API verification using curl, ensuring all critical endpoints respond correctly and return valid JSON.
- Added frontend integration tests to check for critical errors in the UI and verify key UI elements are present and functional.
- Created test data for quotes and project calculations to facilitate testing.
- Developed a script to check offers in the Ordrestyring system, including detailed task descriptions.
- Added tests for generating PDFs from quote data, ensuring the output is valid and contains expected information.
- Implemented a test script for the Røsevangen project, integrating with the Ordrestyring API and verifying database entries.
2025-11-07 08:02:07 +00:00
alexpolo1 0ebca585d7 feat: Implement auto-save functionality for geometry and smart packages, enhance roof type options, and update frontend status report 2025-11-05 09:42:43 +00:00
alexpolo1 210ad7a2a4 fix: Improve calendar view error handling and empty state messages
Task 22: Fix Kalendervisning/planlægning

Changes:
- Added comprehensive empty state messages for calendar view
- Better data validation before rendering calendar grid
- Helpful messages when no calendar data is available
- Separate message when no employees are found
- Empty week message when no tasks are scheduled
- User-friendly tips for troubleshooting calendar issues
- Improved UX with clear explanations of what might be wrong
- All messages in Danish matching application language

Messages include:
- 'Ingen kalenderdata tilgængelig' with sync tips
- 'Ingen medarbejdere fundet' with Ordrestyring reference
- 'Ingen planlagte opgaver denne uge' with navigation help
2025-11-05 08:55:46 +00:00
alexpolo1 3a67e106a2 feat: Add corner house (vinkelhus) calculation support
Task 21: Vinkelhus calculation support

Changes:
- Added 'Vinkelhus' checkbox to enable L-shaped building mode
- Added fields for second wing dimensions (wing2Width, wing2Length)
- Visual UI section for second wing with green highlighting
- Real-time total area calculation showing both wings combined
- Backend calculates area for both wings separately and combines:
  * Flat roof: wing1_area + wing2_area
  * Pitched roof: calculates each wing surface area independently
- Database migration adds is_corner_house, wing2_width, wing2_length columns
- Form labels update dynamically (Vinge 1/Vinge 2) when corner house mode active
- Proper data persistence and loading for corner house configurations
2025-11-05 08:50:36 +00:00
alexpolo1 c8b28e250c feat: Implement bidirectional auto-calculation for roof geometry
Task 2: Geometri - Auto-beregning højde kip/stern

Changes:
- Added 'Tagbeklædning' (roof covering area) field to geometry form
- Implemented bidirectional calculation:
  * When user enters stern-kip height → auto-calculates tagbeklædning
  * When user enters tagbeklædning → auto-calculates stern-kip height
- Added helper functions for mathematical calculations:
  * calculateRoofCoveringFromHeight() - uses Pythagorean theorem
  * calculateRidgeHeightFromCovering() - inverse calculation
- Backend saves roof_covering_area to database
- Database migration adds roof_covering_area column
- Real-time updates as user types in either field
- Uses accurate geometry formulas for pitched roofs
2025-11-05 08:44:38 +00:00