Commit Graph
15 Commits
Author SHA1 Message Date
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