- 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.
- 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
- 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.
- 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.
- 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.
- 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.
- 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
- 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
- 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
- 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.
- 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.
- 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.
- 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.
Task 9 completed:
- Added smart category matching for 'Tag' category
- 'Tag' category now shows ALL tag-related packages automatically
- Includes: Tag, Tagrenovering, Tagudskiftning, Tagmaterialer, Tagrende
- Prevents duplicate tag subcategories in dropdown menu
Backend changes:
- smartPackageManagementService.js: Smart category filtering
- When category='Tag', uses LIKE matching for all tag-related items
- Supports both 'Tag' and 'tag' case variations
- Specific subcategories (Tagrenovering, etc.) still work as before
Frontend changes:
- SmartPackages.js: Added 'Tag (alle tag-relaterede)' option
- Filters out tag subcategories from dropdown to avoid duplication
- Clean dropdown with main 'Tag' category + other categories
Technical improvements:
- Case-insensitive category matching
- LIKE pattern matching for flexibility
- Maintains backward compatibility with existing categories
Customer feedback: Task 9 - Fix kategori dropdown to show all tag-related items
- Added customer_address field to static quote template
- Updated AI quote template to include [KUNDE_ADRESSE] placeholder
- Added instruction to AI to replace address placeholder with actual customer address
- Both static and AI-generated quotes now show complete customer information
Technical changes:
- buildCompleteStaticQuote: Added conditional customer_address display
- buildStaticQuoteTemplate: Added [KUNDE_ADRESSE] placeholder
- buildOptimizedPrompt: Added instruction #3 to replace address placeholder
Customer feedback: Task 17 - Fix tilbudstekst address not working
- Replaced complex 'ARBEJDE DER UDFØRES' section with simple format
- Now only shows: work hours and total area (m²)
- Added customer's preferred text: 'Med mange års erfaring...'
- Removed detailed breakdowns (tag type, antal tømrere, timepris)
- Simplified price section to only show: price excl. VAT, VAT, total
- Updated AI instructions to generate simpler, focused quotes
- Removed company values, guarantees, and service descriptions from template
Customer feedback: Tasks 18, 19, 20 from customer email
- Replaced 'Komplekst tag' with proper tag types: Sadeltag/Skråttag, Valmtag, Københavnertag, Fladtag, Pulttag, Tag med kviste, Mansardtag
- Removed parentheses from tag type names for cleaner UI
- Removed 'Komplekse detaljer' checkbox (karnapper, kviste)
- Removed manual 'Gem Geometri' button - geometry now auto-saves after calculation
- Updated backend complexity calculations to support new tag types
- Updated getRoofTypeDisplayName to include all new tag types
Customer feedback addressed:
- Tag type cleanup and proper Danish names
- Removed komplekst tag option
- Removed manual save button
FEATURES IMPLEMENTED:
✅ Full GraphQL integration with Ordrestyring API
✅ Automatic offer creation from Tilbudsgiveren quotes
✅ Customer management (find existing or create new)
✅ Task/Opgave management with full quote description
✅ Material lines (tilbudslinjer) with pricing
✅ Internal notes in bemærkninger field
✅ Department assignment (Tømrer = ID 2)
✅ Status management (Tilbudsgiver Oprettet Tilbud)
KEY COMPONENTS:
1. OrdrestyringQuoteService (backend/src/services/ordrestyringQuoteService.js)
- generateDetailedQuoteDescription(): Creates formatted quote text
- findOrCreateCustomer(): Handles customer, contact, delivery address
- createOfferLines(): Updates default task & adds material lines
- sendQuoteToOrdrestyring(): Main orchestration method
- getOfferWithTasks(): Query offers with task details
2. Smart Task Management:
- Finds and updates existing default 'Opgave 1' task
- Renames to 'Tilbudsgivertekst' for clarity
- Adds full 2000+ character quote description
- Creates material lines under the task
- Fallback: Creates new task if none exists
3. GraphQL Mutations & Queries:
- createOffer: Creates offer with customer, status, department
- updateOfferTask: Updates existing task with description
- createOfferTask: Fallback for new task creation
- createOfferLine: Adds material lines with pricing
- Proper error handling and logging throughout
4. Database Integration:
- Migration: add_ordrestyring_columns.sql
- Tracks ordrestyring_offer_id, ordrestyring_offer_number
- Status synchronization with ordrestyring_status
- Timestamp tracking with ordrestyring_sent_at
5. Route Updates (backend/routes/ordrestyring.js):
- POST /api/ordrestyring/send-quote-graphql
- Optional customerId parameter (uses existing or creates new)
- Validation for projectId and calculationId
- Returns complete offer details
TECHNICAL HIGHLIGHTS:
• GraphQL Client: graphql-request v7.3.1
• API Endpoint: https://graphql.ordrestyring.dk/graphql
• Authentication: Bearer token in headers
• Error Handling: Graceful fallbacks, detailed logging
• Field Discovery: Used introspection to find correct types
- UpdateOfferTaskInput (not OfferTaskInput)
- Task fields: header & text (not name & description)
- productNumber required for offer lines
TESTING:
• Test scripts: test_roesevangen_ordrestyring.py
• Verification: test_check_offer.js
• Live testing with Project 22 (Røsevangen 44)
• Confirmed: Single task with full description
• Confirmed: 10 material lines with correct pricing
• Confirmed: Department, status, and internal notes working
RESULT:
Complete end-to-end integration from Tilbudsgiveren → Ordrestyring
- Creates professional offers with all data
- Single 'Tilbudsgivertekst' task (not duplicate Opgave 1)
- Full quote description visible in task
- Material lines with quantities and prices
- Ready for production use
Co-authored-by: AI Assistant <copilot@github.com>
- Updated AI prompt in projectQuoteGenerationService.js to include a hierarchical task description format for professional quotes.
- Added critical rules for AI to follow, emphasizing action words and specific material descriptions.
- Created comprehensive documentation for the updated quote system, including examples and guidelines for AI prompts.
- Developed a new layout template for quotes to improve readability and professionalism.
- Established a detailed guide on professional quote structure based on Mikael Holck's standards.
- Added `scrape_fixed_v2.py` for scraping installation manuals from Bygma using Playwright.
- Created `test-custom-task.js` to test custom task creation in the smart packages API.
- Developed `test-customer-search.html` for testing customer search functionality with auto-fill capabilities.
- Implemented `test-manuals.html` for testing the retrieval and display of installation manuals.
- Added SQL script `test_project_21_materials.sql` to insert test materials for project 21 and check for manual availability.
feat: Create Python script to scrape 10 installation manuals from Bygma, focusing on construction materials
feat: Develop script to scrape installation manual from Bygma by VareNr, including AI analysis and database storage
feat: Add script to scrape Swedoor Snap-In Karmsat installation manual using product name from URL
chore: Create start script for PM2 to manage services with correct node path
test: Add comprehensive test script for quote generation and PDF endpoints
test: Implement CSV parser tests to verify product presence and data integrity
test: Create readline test script to efficiently read and search for product in CSV
- Oprettet create-packages-simple.js til at generere SmartPackages med detaljerede materialelister og installationstider.
- Oprettet create-packages-v3.js som en minimal version til oprettelse af basis erfaringspakker.
- Tilføjet test-markup-sliders.js for at teste markup sliders for materialer og final review.
- Implementeret test-package-calculation.js til at teste geometri-beregninger for SmartPackages.
- Oprettet test-stern-til-kip-formula.js for at validere brugen af stern_til_kip variabel i formler.
- Tilføjet test-stern-to-ridge-height.js for at sikre korrekt gemning af højde stern til kip i databasen.
- Removed `package_type` from the Smart Package creation process in the backend.
- Updated SQL queries and data handling in `smartPackageManagementService.js` to reflect the removal of `package_type`.
- Simplified the Smart Package form component by removing unnecessary navigation hooks and parameters.
- Adjusted the Smart Packages main component to handle editing and creating packages without direct navigation.
- Enhanced the Smart Packages menu to use callback functions for section changes instead of routing.
- Implemented a new script to create Smart Packages from Ordrestyring cases, including detailed logging and error handling.
- Added a test script to explore cases from Ordrestyring, providing insights into available cases and their details.
- Updated last_sync_status.json with new sync data.
- Updated `/api/planning/calendar` to use GraphQL for fetching hours data.
- Removed deprecated calendar sync service files.
- Adjusted employee fetching logic to utilize GraphQL for active employees.
- Cleaned up and refactored related code for better maintainability.
- Added comprehensive tests for migration and cleanup, ensuring all endpoints function correctly.
- Documented migration status and test results in KALENDER_CLEANUP_COMPLETE.md.
feat(graphql): Create a GraphQL client for improved API interaction and error handling
chore(deprecated): Disable deprecated REST endpoints and notify users of changes
feat(mapping): Develop a script to map Bygma products to categories based on varegrp codes
chore(lock): Update lock file for ordrestyring comprehensive sync
test(graphql): Add tests for new GraphQL endpoints and identify unused code
test(migration): Complete migration tests for GraphQL endpoints and cleanup
test(calendar): Implement tests for calendar and hours GraphQL integration
test(offer): Create tests for GraphQL offer creation endpoint
test(work-breakdown): Add tests for work breakdown and case details endpoints
- Added TaskDialog component with functionality to create and edit tasks.
- Integrated form validation and error handling for task inputs.
- Implemented step management within tasks, including adding and deleting steps.
- Styled TaskDialog with CSS for improved user experience.
feat: Create SmartPackagesRoutes for navigation and routing
- Established routing for smart packages, including create and edit functionalities.
- Added loading state management for better user feedback during data fetching.
- Integrated SmartPackagesMenu for navigation within the smart packages section.
feat: Add utility functions for formatting data
- Implemented formatting utilities for currency, time, date, and percentages.
- Ensured consistent formatting across the application for better readability.
chore: Update database schema for smart packages
- Extended material_packages table with new fields for estimated hours, hourly rate, and difficulty level.
- Created smart_package_tasks and smart_package_steps tables for task management.
- Added foreign key relationships and indexes for improved database performance.
test: Add API tests for smart packages functionality
- Created test suite for validating smart packages API endpoints.
- Included tests for CRUD operations on smart packages and retrieval of categories and types.
✅ Fixes implemented:
- Fixed all 6 failing API endpoints (Bygma imports, prices, stats, orders, status-summary, analytics/materials)
- Disabled non-functional sync services (CalendarSync, Materials sync from Ordrestyring API)
- Removed duplicate PUT/DELETE /api/pricing/materials/:id endpoints
- Updated scrape_and_analyze_bygma.py to use service user from .env file
- Fixed analytics/materials query to use project_materials table with denormalized schema
📊 Test results:
- Created comprehensive-api-test.js testing 46 critical endpoints
- Success rate: 100% (46/46 passing)
- All Bygma endpoints working with direct SQL queries
- Orders endpoints protected with API key guards
- No more CalendarSync/Materials sync errors in logs
🗃️ Database schema discoveries:
- project_materials uses material_name (TEXT) not material_id (FK)
- material_prices has is_active not is_current
- bygma_import_log uses import_batch_id not batch_id
- All queries updated to match actual schema
- Added API endpoint /api/customer/installation-manual/search
- Added installation manual button to each material in the list
- Created modal to display installation steps, tools, safety requirements
- Added CSS styling for modal with gradient header and step-by-step view
- Integrated with existing Bygma scraper data in database
- Shows time estimates, weather conditions, and key points
- Mobile-responsive design with smooth animations
- Added TaskCategorizationService to categorize tasks based on keywords in descriptions.
- Implemented fuzzy matching using Levenshtein distance for better keyword matching.
- Introduced caching for categories and keywords to optimize database queries.
- Added methods for categorizing individual tasks and batch processing for project tasks.
- Created SQL migration scripts for task_categories and category_keywords tables.
- Included default categories and keywords for initial setup.
- Enhanced project_tasks table with new columns for categorization data.
- Added statistics export functionality for category performance analysis.
- Added ProjectExperienceService to calculate similar projects and scale hours based on area.
- Created API endpoint for fetching similar project experiences.
- Developed frontend components for automatic data fetching and displaying intelligent task estimates.
- Updated build and test scripts to include new features and ensure functionality.
- Added tests for the Experience API to validate responses and data integrity.
- Added SimpleAnalyticsPopulator class for populating project, employee, customer analytics, and daily metrics.
- Integrated MySQL database connections for tilbudgivern and ordrestyring_local databases.
- Developed sync_ordrestyring_data_old.sh script for comprehensive data synchronization from Ordrestyring API.
- Created test scripts for analytics API and services to validate functionality and data integrity.
- Introduced FixedHistoricalQuoteCalculator and HistoricalQuoteCalculator for generating quotes based on historical data.
- Implemented vary-profit-margins.js to introduce variability in profit margins based on project size and customer type.