Commit Graph
31 Commits
Author SHA1 Message Date
alex fc40f65fec Add project data, quotes, and real project details for Kunda a/s
- Created test_project_data.json with project details including customer information, project description, and counts for geometry, labor, materials, and quotes.
- Added test_quote_data.json containing company information, project details, geometry, labor, materials, and calculation summary.
- Introduced test_real_project.json with comprehensive project data including labor, materials, and detailed calculations.
- Generated updated_real_project_quote.pdf reflecting the latest project quote details.
2025-09-17 15:13:52 +02:00
alex 04c84494ba Remove large core dump file and update .gitignore
- Remove 196MB core file that blocked git push
- Add core dump patterns to .gitignore
- Prevent future core files from being tracked
2025-09-17 10:31:16 +02:00
alex d44cfaabdc Refactor code structure for improved readability and maintainability 2025-09-17 10:29:17 +02:00
alex 23a0818cbe feat: Implement Materials List with CRUD functionality and styling
- Added MaterialsList component for managing materials with search, filter, and sort capabilities.
- Integrated new material form for adding materials with validation.
- Implemented editing and deleting functionalities for materials.
- Created a responsive design using CSS for the materials list and forms.
- Added health check script to verify server and API status.
- Developed a comprehensive functional test suite for API endpoints and application functionality.
2025-09-17 08:44:11 +02:00
alex 0e62cd6f0b Add frontend deployment scripts
- Created deploy-frontend.sh for detailed build and deployment process with logging.
- Created quick-deploy.sh for fast deployment without detailed logging.
- Both scripts handle building the React frontend, copying build files, and restarting the PM2 service.
2025-09-17 07:53:28 +02:00
alex 60eeb71681 Add CompletedQuotes component with styling and functionality
- Implement CompletedQuotes component to display completed quotes.
- Add filtering and sorting options for quotes based on criteria.
- Include functionality to download and delete quotes.
- Create a modal for viewing detailed quote information.
- Style the component with a dedicated CSS file for improved UI.
- Handle loading and error states for better user experience.
2025-09-17 01:30:24 +02:00
alex e888584c7b feat: Add historical data loading and material management features, including sorting and filtering options 2025-09-17 00:23:14 +02:00
alex 9b7e07c533 feat: Enhance error handling and logging in database queries, add historical data and material suggestions endpoints 2025-09-16 23:54:52 +02:00
alex de73f2a29f Add Nginx configuration for tilbudsgiveren backend with security headers, API proxy, and SPA routing
- Configured server to listen on port 443 for tilbudsgiveren.alw.dk
- Added security headers for improved security
- Set up real IP handling from trusted proxy
- Defined root directory for frontend static files
- Implemented API proxying to backend service on localhost:4030
- Configured SPA routing with fallback to index.html
- Added caching for static assets with long expiration
- Enabled Gzip compression for better performance
2025-09-16 23:14:17 +02:00
alex f2c6ca7aaa Fix login issue: Add production environment config for API URL
- Add .env.production with correct API URL for live server
- Add deploy.sh script for easy deployment
- Fix frontend to use https://tilbudsgiveren.alw.dk for production API calls
- Rebuild frontend with correct environment variables
2025-09-16 18:25:43 +02:00
alex 5923690006 feat(database): Add order_id and order_status to project_quotes, create order_sync_log and dynamic_categories tables, and insert default categories for materials
feat(csv): Add example_materials.csv for material pricing

feat(frontend): Implement material management and upload functionality in App component, including authentication and category filtering

docs(specification): Add byggespecifikation for Tagarbejde og konstruktionsudskiftning project
2025-09-16 17:27:35 +02:00
alex ba09690612 feat: Implement project creation flow with multi-step navigation
- Added ProjectCreation component for creating new projects.
- Integrated GeometryInput, LaborInput, MaterialsManager, and CalculationView components for project management.
- Implemented step navigation to guide users through project creation.
- Added styles for project flow and components.
- Included error handling and loading states for API interactions.
- Enabled selection of existing projects and loading of their details.
2025-09-15 23:54:01 +02:00
alex a02a96667a feat: Implement roof geometry service with complexity calculation, work hour estimation, and carpenter recommendations
- Added RoofGeometryService to handle roof geometry data and calculations.
- Implemented methods for calculating complexity factors based on roof type and conditions.
- Added work hour estimation based on total area and complexity.
- Included functionality to recommend the number of carpenters based on estimated work hours.
- Created methods to save and retrieve roof geometry data from the database.
- Added error handling and logging for database operations.

docs: Update company profile and service descriptions

- Added detailed descriptions of services offered by the company, including roof replacement, renovations, and collaborations with advisors.
- Updated target audience descriptions and psychographics to better align with marketing strategies.
- Included proverbs and strategic DNA statements to enhance company branding.

chore: Add service file for backend deployment

- Created a service file for the backend application to facilitate deployment.
2025-09-15 23:05:56 +02:00
alex 7baa067f5d Enhance labor and material price update endpoints with detailed logging and improved error handling 2025-09-15 07:31:10 +02:00
alex 8ad6c494fb Add mock server and database for Bygma pricing test
- Implemented a mock Express server in `mock-bygma-test.js` to simulate Bygma's web price search API with sample data.
- Created a new SQL file `standard_material_prices.sql` containing standard market prices for various construction materials.
- Added initial files for frontend server and pricing test components.
2025-09-15 00:13:47 +02:00
alex c05047f66a Enhance error checking in logs and update database schema for material prices 2025-09-14 23:11:20 +02:00
alex a860ca40e1 Komplet systemdiagnose og pipeline automatisering
PROBLEMLØSNING:
- Fix database forbindelse (tilbuduser password reset)
- Opdater database schema med setup_advanced_db.sql
- Clean frontend build uden debug kode
- Systematisk error analyse fra PM2 logs

PIPELINE OPRETTET:
- build-and-test.sh script til automatisk verifikation
- Database connectivity test
- Backend API endpoint test
- Frontend build og serve test
- Integration login test
- Error log monitoring

RESULTATER:
✅ Database: Connected og responsive
✅ Backend APIs: Alle endpoints fungerer
✅ Frontend: Bygget og served korrekt
✅ Services: Kører på PM2
✅ Integration: Login og page loading virker

Systemet er nu stabilt og helt testet!
2025-09-14 22:45:45 +02:00
alex d882369e04 Erstat React fragmenter med div containere for bedre stabilitet
Problemdiagnose: React fragmenter (<> </>) kan nogle gange ikke render korrekt
Løsning: Skift til eksplicitte div containere med unikke class navne

- quote: .quote-view
- upload: .upload-view
- labor-prices: .labor-prices-view
- material-prices: .material-prices-view
- openai-usage: .openai-usage-view

Dette skulle løse hvid baggrund på tømrer og materiale tabs
2025-09-14 22:25:20 +02:00
alex ca94e24f52 Fix struktur: Integrer tømrer og materiale tabs i hoved conditional chain
PROBLEM: De 2 tabs viste hvid skærm uden menu fordi de var placeret udenfor hovedstrukturen
LØSNING: Flytte tabs fra separate && blokke til hovedstructur med ternary operators

Før:
- quote/upload: currentView === 'X' ? (...) : null
- labor/material: {currentView === 'X' && (...)}  // UDENFOR hovedcontainer

Nu:
- Alle tabs: currentView === 'quote' ? (...) : currentView === 'labor-prices' ? (...) : currentView === 'material-prices' ? (...) : null

Dette sikrer at alle tabs render inden i samme container med samme header/menu struktur
2025-09-14 22:21:22 +02:00
alex 54e23bfc76 Stabilisér tømrer og materiale tabs med proper state management
- Tilføj explicit data loading når tabs aktiveres
- Implementer loading og error states for bedre UX
- Clear state ved view skift for at undgå stale data
- Disable form inputs under loading
- Tilføj fallback beskeder for tomme kategorier
- Ensartet struktur med andre stabile tabs som OpenAI budget
2025-09-14 22:16:52 +02:00
alex 185eb7664a fix: resolve React frontend path issue causing white screen
- Problem: __dirname resolved to /data/home/alex/git/tilbudgivern in PM2
- Solution: Use absolute paths for frontend build serving
- Changed from path.join(__dirname, 'frontend/build') to absolute path
- Now serving from /home/alex/git/tilbudgivern/frontend/build
- JavaScript and CSS files load correctly with HTTP 200 status
- Fixes white screen issue in all tabs including tømrer and materiale priser
2025-09-14 22:11:07 +02:00
alex fa635cc84a fix: rebuild React frontend with all latest changes
- Created missing package.json, index.js, index.css, and index.html files
- Installed React dependencies and built production bundle
- Fixed white screen issue in tømrer and materiale priser tabs
- New build files (main.3c5db8af.js) now include OpenAI update functionality
- All UI components should now work correctly with updated backend APIs
2025-09-14 22:00:00 +02:00
alex 8c181be737 fix: implement live OpenAI budget update functionality
- Add POST /api/quotes/openai/stats/update endpoint that pings OpenAI API
- Update fetchActualUsageFromAPI() to make real API call for fresh data
- Add gpt-4o-mini pricing support in calculateTokenCost()
- Improve frontend update button with loading state and real-time data
- Replace static token counts with live tracking from OpenAI ping requests
- Reduce cache time to 1 minute for more responsive updates
- Add proper loading states and error handling for budget updates
2025-09-14 21:37:31 +02:00
alex a1cdb97991 fix: dropdown count accuracy and OpenAI budget display - Use database counts instead of hardcoded values for category dropdowns - Correct OpenAI budget display to monthly with .16 current usage - Fix gulvlægning count to show 1 entry instead of 2 2025-09-14 21:34:18 +02:00
alex 18b79e8375 Add intelligent carpenter hours calculator with OpenAI
New features:
- OpenAI-powered carpenter time estimation based on project complexity
- Intelligent multi-carpenter recommendations for large/complex projects
- Detailed time breakdown (preparation, work, cleanup, coordination)
- Cost estimation with confidence scoring
- Database integration to save calculations
- API endpoints: /api/quotes/carpenter-hours and /api/quotes/save-carpenter-calculation

The system analyzes:
- Project complexity and technical requirements
- Physical workload and coordination needs
- Optimal number of carpenters (1-4) based on efficiency
- Specialized tools and preparation time
- Critical factors affecting timeline

Examples:
- Small task (window replacement): 1 carpenter, 4 hours
- Medium project (kitchen renovation): 2 carpenters, 40 hours
- Large project (complex deck): 3 carpenters, 60 hours

Added metadata column to project_quotes table for AI calculation storage.
2025-09-14 21:29:11 +02:00
alex f2c964543c Remove location/region fields - work only on Zealand
- Dropped region columns from labor_prices and material_prices tables
- Updated DatabaseService methods to remove region/location parameters
- Updated API endpoints to not require location input
- Updated create table statements to exclude region fields
- Simplified database structure since work is only done on Zealand
- All location-related logic removed from pricing system
2025-09-14 21:22:20 +02:00
alex c13eb3ea56 Clean up: Removed old backend/frontend services, now using unified-server.js
- Deleted tilbudgivern-backend.service and tilbudgivern-frontend.service files
- Removed old backend/src/index.js and init.js (replaced by unified-server.js)
- Cleaned up frontend directory, keeping only build/ for static serving
- Updated PM2 configuration to only run unified service + deathwatch-server
- All functionality moved to unified-server.js with database integration
2025-09-14 21:17:13 +02:00
alex 535ead3c12 Refactor project structure and unify frontend and backend into a single application
- Renamed project to "tilbudgivern-unified" and updated package.json accordingly.
- Created a new frontend server to proxy API requests and serve static files.
- Added SQL scripts for inserting sample data and setting up pricing tables.
- Configured Nginx for both HTTP and HTTPS with security headers and proxy settings.
- Implemented a unified server to handle API requests and serve the frontend application.
- Added endpoints for labor and material pricing management, including CRUD operations.
- Introduced testing script for frontend API interaction.
2025-09-14 21:15:00 +02:00
alex e0086fa2a2 Add initial setup scripts and OCR testing functionality
- Created setup scripts for advanced database, pricing database, and quote items.
- Added a test script for OCR functionality, including PDF text extraction and price data extraction.
- Included test files for various scenarios: poor categorization, material list, and text with noise.
2025-09-14 17:30:10 +02:00
alex 3f7e772c22 feat: Add authentication routes and styles for login/logout functionality 2025-09-12 00:51:54 +02:00
alex 5f101c61cf feat: Initialize Tilbudgivern project with backend and frontend setup
- Added package.json for project dependencies and scripts
- Created setup_mariadb.sql for database setup and user creation
- Documented project development plan in taskfile.txt
- Implemented test_setup.sh for system requirements and project structure checks
- Configured systemd service files for backend and frontend applications
- Added ubu-deployment-commands.sh for deployment instructions on Ubu server
2025-09-12 00:39:06 +02:00