Commit Graph
86 Commits
Author SHA1 Message Date
alexpolo1 2d7218d67e feat: Implement TaskDialog component for managing tasks in smart packages
- 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.
2025-10-22 19:29:21 +00:00
alexpolo1 2c121882bc feat: Enhance CalendarGrid with status filters and improved event handling 2025-10-21 15:21:02 +00:00
alexpolo1 d4fb536198 feat: Filter calendar to show only employees with events
- CalendarGrid now only displays employees who have calendar entries
- Filters by current week - if employee has no events in displayed week, they are hidden
- Reduces clutter and matches user preference to see only active employees
- Dynamic filtering updates when navigating between weeks
- Employee count in footer shows only visible employees with data
2025-10-21 08:47:23 +00:00
alexpolo1 598c0b073c feat: Show customer names in calendar instead of task descriptions
- Calendar now displays customer name as event title (highest priority)
- Fetches customer_number from cases table
- Looks up customer_name from debtors table
- Title priority: 1) customer name, 2) event text/header, 3) case description, 4) type.title
- Added customer_number and customer_name fields to calendar response
- Example: Shows 'Lars Koch Magnussen' and 'Rasmus Gamrath' instead of 'Opgave 2603'
2025-10-21 08:00:04 +00:00
alexpolo1 2df6ee1e7c feat: Calendar shows task titles and integrates directly with Ordrestyring API
- Calendar endpoint now calls Ordrestyring /calendar API directly instead of local database
- Title priority: 1) event text/header, 2) case description from DB, 3) type.title
- Fetches case descriptions from both cases and ordrestyring_cases tables
- Uses local user cache for performance (avoid N+1 queries)
- Maps calendar_type (hours/personal/planned) from API
- Shows proper event colors from type.color field
- Frontend rebuilt with updated calendar display
2025-10-21 07:51:32 +00:00
alexpolo1 f9648991c0 feat: Update CalendarGrid status color mapping and improve database query for calendar events 2025-10-21 07:23:41 +00:00
alexpolo1 f89506ca28 feat: Add new CalendarGrid component matching screenshot design 1-to-1
✨ New Features:
- CalendarGrid component with employee rows and day columns
- Full status color mapping (Åben, Lukket, Afsluttet, Murer/Tømrer statuser)
- Settings panel with filter options (Planlagt tid, Arbejdstid, etc.)
- Responsive grid layout matching exact screenshot design
- Time range display (07:00-15:30 format)
- Status indicators with proper colors:
  * Åben (green #22c55e)
  * Lukket (orange #f97316)
  * Afsluttet (red #dc2626)
  * Murer igangværende (blue #3b82f6)
  * Murer kommende (cyan #06b6d4)
  * Tømrer igangværende (dark green #059669)
  * Tømrer kommende (light green #10b981)
  * Bogført (gray #6b7280)
  * Ferie/Syg/Fri statuses

📋 Components Added:
- frontend/src/components/CalendarGrid.js
- frontend/src/components/CalendarGrid.css

🔧 Integration:
- Updated PlanningDashboard to use CalendarGrid instead of CalendarView
- Removed unused transformCalendarData function
- Clean import structure
2025-10-21 06:41:22 +00:00
alexpolo1 4a018d7862 fix: Complete codebase audit - 100% API test coverage with all errors fixed
✅ 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
2025-10-21 06:33:28 +00:00
alexpolo1 9cdc4c27b0 test: Add installation manual API tests to build script
- Added test for installation manual search endpoint
- Tests both found and not-found scenarios
- Validates JSON response structure
- Shows step count and tools count in test output
- Updated feature list to include installation manual feature
2025-10-20 10:43:14 +00:00
alexpolo1 adfbef5e3a ui: Improve installation manual button visibility and clean up Smart Packages page
- Changed manual button from icon-only to 'Montagevejledning' text
- Made button larger and more prominent with better styling
- Removed long calculation info box from Smart Packages page
- Cleaned up UI to give more space for actual package selection
- Updated button styling with better padding and hover effects
2025-10-20 10:40:27 +00:00
alexpolo1 2a640821a5 test: Add installation manual API test script 2025-10-20 10:35:59 +00:00
alexpolo1 f2198e9a47 docs: Add installation manual feature documentation 2025-10-20 10:35:26 +00:00
alexpolo1 8727535808 feat: Add installation manual viewer in MaterialsManager
- 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
2025-10-20 10:34:44 +00:00
alexpolo1 d7f9dfd2da fix: Remove all emojis from scraper to fix ASCII encoding error 2025-10-20 10:21:41 +00:00
alexpolo1 f8512149b5 feat: Add automated Bygma installation manual scraper with AI analysis
Features:
- Automated login and PDF download from Bygma
- GPT-4o AI analysis of installation manuals
- Extracts: steps, time estimates, tools, safety, materials, skill level
- Direct database storage (installation_manuals table)
- Auto-cleanup: deletes PDFs after analysis to save space
- Node.js integration for quote generation

New files:
- scrape_and_analyze_bygma.py - Main automated scraper
- scrape_bygma_with_login.py - Simple download script
- analyze_manual_pdfs.py - Standalone PDF analyzer
- get_installation_tasks.js - Node.js quote integration
- demo_tilbud_opgave.js - Working demo
- BYGMA_AUTOMATION_README.md - Complete documentation

Database:
- installation_manuals table with JSON fields
- Sample data: 1 manual analyzed (Cembrit Bølgeplader)

Integration:
- getInstallationTask(productName, quantity) function
- Returns formatted task descriptions for quotes
- Time calculations: 2.5 hours/m² example

Cleanup:
- Removed old test scripts and debug files
- Removed downloaded PDFs (saved to database)
- Organized documentation files
2025-10-20 10:19:54 +00:00
alexpolo1 0a2c02b51b feat: Implement task categorization service with fuzzy matching and caching
- 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.
2025-10-20 09:05:59 +00:00
alexpolo1 550b374e03 feat: Update last sync status and add intelligent help demo documentation 2025-10-15 21:55:18 +00:00
alexpolo1 27182828f2 feat: Simplify experience section for similar projects with a cleaner layout and concise information display 2025-10-15 13:18:07 +00:00
alexpolo1 72ebbc39d8 feat: Implement intelligent task estimation feature with backend service, API endpoint, and frontend integration
- 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.
2025-10-15 13:07:13 +00:00
alexpolo1 5e9ab79d4f feat: Enhance project creation and flow with SmartPakke navigation
- Updated ProjectCreation component to include a button for direct navigation to SmartPakke.
- Improved ProjectFlow component to handle SmartPakke navigation and project selection logic.
- Added CSS styles for new buttons and layout adjustments in ProjectFlow.
- Introduced a calculation info box in SmartPackagesEnhanced to display detailed pricing and time estimates based on real project data.
- Implemented functionality to load similar projects based on keywords from selected packages.
- Added API endpoint to fetch similar projects based on project descriptions and names.
2025-10-15 12:22:36 +00:00
alexpolo1 6c9c5dd9db feat: Enhance calendar functionality with improved data retrieval and filtering options 2025-10-15 11:30:10 +00:00
alexpolo1 ea5394b0b6 feat: calender impprovements , carptender database 2025-10-15 09:57:16 +00:00
alexpolo1 1d79f4710d feat: Implement comprehensive analytics population and data synchronization
- 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.
2025-10-14 13:06:02 +00:00
alexpolo1 63c38c8cd3 feat: Implement quote creation in ordrestyring system with simulated response and logging 2025-10-14 06:10:47 +00:00
alexpolo1 d83571b669 Refactor code structure for improved readability and maintainability 2025-10-10 22:10:47 +00:00
alexpolo1 c571105a31 🚀 Major System Enhancement: Complete Smart Package System & Production Ready
✨ New Features:
- Complete Smart Package System with 6 B7 package types
- Enhanced geometry validation with ridgeHeight support
- Automatic material quantity calculations (2.13 plates/m², 2.17m batten/m²)
- Intelligent labor hour calculations (580 DKK/hour)
- Total price calculations with VAT (realistic 800 DKK/m² for B7 roofs)

🔧 Backend Improvements:
- Enhanced PackageService with real Bygma material integration
- Improved CustomerProjects API with package management
- ProjectMaterialService with advanced calculations
- Ridge height validation (0.5-8.0m range)

🎨 Frontend Enhancements:
- Enhanced geometry input component with validation
- Improved SmartPackage components with better UX
- Real-time package selection and pricing display

📦 Deployment & Operations:
- Complete database migration scripts
- Nginx configurations for production deployment
- Build and test automation scripts
- Implementation progress documentation

🧪 System Verification:
- Full end-to-end workflow testing completed
- All calculations validated with realistic pricing
- 165m² B7 project: 132,770 DKK total (competitive market rate)
- Ready for production carpenter use!
2025-10-10 19:39:55 +00:00
alex dd4dffb517 Add InlineSmartPackage component with styling and functionality
- Implemented InlineSmartPackage component for managing smart packages.
- Added CSS styles for layout, sections, and interactive elements.
- Integrated automatic material and labor calculations based on geometry data.
- Included profit margin settings and total price calculations.
- Enabled selection of predefined packages and dynamic updates of materials and tasks.
- Added functionality to add, update, and remove materials.
- Implemented task selection with detailed calculations for labor costs.
2025-09-26 15:29:47 +02:00
alex e82f2c7a8f feat: Enhance GeometryInput to auto-select roof type based on selected packages
style: Add form help text styling in ProjectFlow.css

fix: Update SmartPackagesEnhanced to use strict equality checks for isCustom

refactor: Modify unified-server.js to use material_name instead of sku and implement new project_packages table for package management

chore: Create new MCP server configuration files for deployment

chore: Add SQL script to introduce wall_height column in roof_geometry table

build: Implement build and test script for local development

docs: Provide instructions for updating proxy server configuration

chore: Add quick deploy script for streamlined deployment process

test: Create comprehensive test, build, and deploy script for Tilbudgivern
2025-09-26 14:36:19 +02:00
alex 04c2623998 feat: Allow creation of editable copies for standard packages and update edit button behavior 2025-09-26 01:01:05 +02:00
alex 06ec0f01c4 feat: Enhance quote generation with Smart Pakker integration and improved package handling 2025-09-26 00:34:36 +02:00
alex 9f74ec8949 Add initial test suite configuration with Jest and Supertest
- Created package.json for the test suite "tilbudgivern-tests"
- Added scripts for running tests, watching tests, and generating coverage reports
- Included Jest and Supertest as development dependencies
- Configured Jest with a test environment, test match pattern, and coverage collection settings
- Specified coverage output directory
2025-09-26 00:14:38 +02:00
alex 0a4f13b8ea Refactor and cleanup nginx configurations; remove obsolete files and update paths in unified-server.js and related scripts. Add debugging and production testing tools for improved diagnostics and deployment processes. 2025-09-24 21:19:26 +02:00
alex ae12fc0a44 feat: Implement Material Packages feature
- Added MaterialPackageService for handling CRUD operations on material packages.
- Introduced new API endpoints for creating, retrieving, updating, and deleting material packages.
- Developed frontend components for managing material packages, including forms for creating and listing packages.
- Implemented styling for the Material Packages interface.
- Created SQL setup script for material packages and related tables, including category mapping for Bygma standards.
2025-09-24 15:41:40 +02:00
alex e45aad27db feat: Update file paths in scripts and add LocalOrdrestyringAnalyzer class for database analysis 2025-09-24 15:27:29 +02:00
alex ae3ad4918b feat: Implement SmartPackages component and enhance database schema for custom packages and advanced features
- Added SmartPackages component for selecting roof types and packages based on area and search criteria.
- Integrated API calls to fetch packages based on selected roof type and area.
- Implemented package selection logic and summary display for selected packages.
- Enhanced database schema with new tables for custom packages, advanced geometry calculations, and time calculations.
- Added foreign key relationships and indexes for improved performance.
- Created default packages for various roof types and implemented a view for easy package selection.
- Developed a function to calculate total project costs including selected packages and labor costs.
- Added triggers to keep project total updated on package and time calculation changes.
2025-09-24 14:37:15 +02:00
alex 55ed5fd686 Refactor code structure for improved readability and maintainability 2025-09-21 23:54:23 +02:00
alex 23d20fb92b feat: Remove outdated PDF quote file and add enhanced SQL view for quotes
- Deleted the outdated PDF file `updated_real_project_quote.pdf`.
- Created a new SQL view `v_enhanced_quotes` to enhance quote data extraction with improved project and customer name handling, price extraction, labor cost calculation, material cost estimation, and project type icon mapping.
- Updated the existing SQL view `enhanced_quotes_view` to align with the new enhancements.
- Added comprehensive integration tests for the new system, including tests for project review status, reject functionality, and overall quote accessibility.
2025-09-21 23:14:13 +02:00
alex b2d835d09e feat: Add script to calculate work time based on git commits 2025-09-21 01:17:58 +02:00
alex 7438d33fe9 feat: Implement on-demand PDF download for quotes and improve error handling 2025-09-21 01:15:19 +02:00
alex 967eea4121 feat: Implement on-demand PDF generation and remove pre-generation logic 2025-09-21 01:08:28 +02:00
alex d089693bd9 feat: Update PDF generation to use HTML template and improve data handling 2025-09-21 01:03:11 +02:00
alex 9743ceaaa2 Refactor code structure for improved readability and maintainability 2025-09-21 00:59:31 +02:00
alex bb51c50dff feat: Add GET endpoint for generating HTML quotes and improve error handling 2025-09-21 00:35:56 +02:00
alex 823713cf4a feat: Update project material handling to support multiple materials in a single request
- Enhanced the materials endpoint to accept both single and multiple materials.
- Added validation for each material's required fields.
- Updated response to return all added materials and their count.
- Adjusted frontend API base URL to point to the new server port (4031).
- Improved logging for debugging purposes in CalculationView and MaterialsManager components.
- Refactored labor and materials handling in ProjectFlow and other components to ensure state consistency.
- Implemented incremental addition of materials without deleting existing ones.
- Added calculation endpoint to compute project costs including labor and materials.
- Enhanced error handling and logging throughout the application.
2025-09-21 00:21:11 +02:00
alex 0d35e03f52 feat: Enhance task description handling and improve textarea styling in LaborInput 2025-09-20 22:53:44 +02:00
alex 2ac65c3c79 feat: Add confirmation for task removal and implement clear all tasks button in LaborInput 2025-09-20 22:44:56 +02:00
alex 4d2d1f4c18 feat: Implement custom task management in LaborInput and enhance work breakdown retrieval in unified-server 2025-09-20 22:40:20 +02:00
alex 2769a66ee6 feat: Remove unused tag experience suggestions JSON and update database connection details in analyzer 2025-09-20 22:27:50 +02:00
alex ebc88bf76a feat: Enhance backend API tests and improve Ordrestyring configuration handling 2025-09-20 21:51:03 +02:00
alex 10473e8a32 feat: Add complete data import and incremental update scripts for Ordrestyring
- Implemented setup_ordrestyring_import.sh for initial database setup and data import from API.
- Created sync_ordrestyring_data.sh for incremental updates to the local database.
- Developed test_ordrestyring_import.js to validate API data import functionality.
- Added test_enhanced_quote_demo.js to demonstrate the enhanced quote system using hybrid data sources.
- Introduced test_ordrestyring_system.sh for comprehensive testing of the database system and API functionality.
- Enhanced logging and error handling across scripts for better traceability.
- Included analysis script creation for post-import data analysis.
2025-09-19 15:06:03 +02:00