174 Commits

Author SHA1 Message Date
Alex
8b16d35287 fix: keep Smart Packages compatible with roof material (#30)
Some checks are pending
CI - Test & Build / Lint & Type Check (push) Waiting to run
CI - Test & Build / Backend Unit Tests (push) Waiting to run
CI - Test & Build / Frontend Build (push) Waiting to run
CI - Test & Build / E2E Tests (Playwright) (push) Blocked by required conditions
CI - Test & Build / Security Scan (push) Waiting to run
CI - Test & Build / CI Summary (push) Blocked by required conditions
Co-authored-by: alexpolo1 <alexpolo1@users.noreply.github.com>
2026-09-02 07:19:39 +02:00
Alex
4f0ba89cbe fix: make material name matches safe and automatic (#27)
Co-authored-by: alexpolo1 <alexpolo1@users.noreply.github.com>
2026-08-29 20:56:18 +02:00
Alex
c0e2010075 feat: add fail-closed quote realism checks (#26)
Co-authored-by: alexpolo1 <alexpolo1@users.noreply.github.com>
2026-08-29 20:29:49 +02:00
alexpolo1
4e1fd77ee5 [verified] fix: retain server rental baseline 2026-08-27 12:09:58 +02:00
alexpolo1
377d61a07c [verified] fix: persist reference lines before review 2026-08-27 12:05:57 +02:00
alexpolo1
823e072702 [verified] fix: preserve rental pricing in projects 2026-08-26 19:11:35 +02:00
alexpolo1
81b6e1ea21 fix: make Jannick price import usable and safe 2026-08-24 08:31:55 +02:00
alexpolo1
9b7df90385 feat: add carpenter walkthrough release gate (hydration, readiness, material link review)
Implements the plan from the carpenter walkthrough audit: make the
project flow -> final review -> PDF path measurable and safe to gate
CI on.

- projectHydrationService loads a project's geometry/labor/materials/
  rentals/packages/calculation in parallel and reports per-resource
  timing plus the slowest resource, so hydration SLA breaches are
  visible instead of silent
- projectReadiness centralizes the blocking checks final review must
  pass before a quote can be sent (name, customer, description,
  materials/labor present, zero-price lines)
- pdfSourceSignature detects when a generated PDF is stale relative to
  the current project data, so a carpenter doesn't send an outdated
  quote
- MaterialLinkReview + new customer-projects match-preview/link
  endpoints let a user review and confirm suggested master-material
  matches instead of silently auto-linking
- ProjectFlow refactored around the new hydration/readiness utilities;
  FinalReview surfaces readiness checks and unlinked material counts
- CI: the carpenter smoke test (full-roof-quote-flow.spec.js) is now
  a blocking gate on main, with the rest of the Playwright suite
  running best-effort alongside it
- docs/qa/CARPENTER_WALKTHROUGH_RELEASE_GATE.md documents the gate and
  the monthly production audit procedure

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-20 13:20:33 +02:00
alexpolo1
db34ee96ed fix: make all verified smart packages selectable, not just 5
Root cause (from support tickets #333382 and #775903): a one-off
integrity migration archived 40 Excel-imported carpenter task packages
(is_active=0, blocked) because their material lines couldn't be
auto-linked to the material database, and even a verified component
package had nowhere to appear since the quote flow only fetched
packageType=complete_offer.

- verifyPackage now reactivates a package (is_active=1) once its
  materials/tasks pass integrity checks
- getPackageDetails/updatePackage can reach blocked-but-inactive
  packages so admins can repair them, without exposing genuinely
  deleted packages; fixes a latent bug where updatePackage's final
  UPDATE still hardcoded is_active=1 and would have silently no-op'd
- new GET /api/smart-packages/review-queue + SmartPackageReviewQueue
  admin panel to relink materials (with fuzzy-match suggestions) and
  verify archived packages in one step
- InlineSmartPackage gains an "Enkelte opgaver" à la carte picker
  (search-by-word, additive multi-select) for verified component
  packages, alongside the existing single complete-offer picker;
  geometry-based quantity/hours math extracted into
  utils/smartPackageGeometryCalculations.js so both flows share it

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-20 13:00:08 +02:00
alexpolo1
c3e3255aff [verified] fix: harden material and smart package errors 2026-08-18 12:50:24 +02:00
alexpolo1
77cddbf704 fix: harden mobile offer review flow 2026-08-18 00:49:25 +02:00
alexpolo1
a2a99e1595 chore: stop tracking generated artifacts 2026-08-17 09:11:12 +02:00
alexpolo1
f9c0b7bc57 feat: harden smart package field workflow 2026-08-15 00:34:28 +02:00
alexpolo1
3ab5e8cf5e fix: resolve open smart package issues 2026-08-13 23:58:36 +02:00
alexpolo1
9c00074327 feat: add image attachments to support feedback 2026-08-13 13:28:29 +02:00
Alex
d5f65f74d4 feat: mobil tømrerflow og Codex CLI-generering (#8)
Flyt brugerrettet indholdsgenerering til Codex CLI, forbedr mobilflowet og ret CI-miljøets afhængigheder og testkonfiguration.
2026-08-13 11:47:14 +02:00
alexpolo1
11ad6b7f0b feat: enforce verified smart package catalog 2026-08-10 12:38:52 +02:00
alexpolo1
fe4f11fe32 ci: survive artifact quota, update actions, clean lint warnings
The last CI run failed only because GitHub artifact storage quota was
exhausted: backend tests and frontend build were green but their
upload-artifact steps failed the jobs.

- Mark all artifact uploads continue-on-error and cut retention to 3
  days (deploy workflows kept artifacts up to 30 days, which is what
  filled the quota)
- E2E job builds the frontend itself instead of downloading the
  frontend-build artifact, so it no longer depends on artifact storage
- Bump actions/checkout v4->v7, setup-node v4->v6, upload-artifact
  v4->v7, download-artifact v4->v8 (Node 20 runtime deprecation) and
  CI Node 18 (EOL) -> 22 to match production
- Fix all frontend lint warnings: remove unused imports/state and the
  dead Stepper-based form UI in SmartPackageForm (renderStepContent,
  parseAndAddMaterialsFromDescription were unreferenced), disable
  exhaustive-deps where the effect is intentionally scoped
2026-07-08 13:05:28 +02:00
alexpolo1
581204c235 fix: persist geometry and smart package before leaving flow steps
Both steps relied on a debounced 5-second autosave as the only path
that wrote to the database. Continuing to the next step within those
5 seconds unmounted the component, cancelled the pending timer and
silently lost the data: Final Review then showed 0 m dimensions and
'Tagtype: unknown', and package materials/tasks were missing after a
project reload.

- EnhancedGeometry: handleNext now awaits handleGeometryCalculation
  and blocks navigation if the save fails; the continue button shows
  'Gemmer geometri...' while saving
- InlineSmartPackage: 'Gem Smart Pakke' and 'Naeste: Final Review' now
  await autoSavePackageData (which syncs materials/rentals/status)
  instead of only updating parent session state; autoSavePackageData
  reports success; selecting a package marks the step as interacted so
  the periodic autosave arms correctly
- InlineSmartPackage: rentals read and similar-experience lookup use
  the correct /api/customer-projects/projects/{id}/... paths

Found by driving five different quote flows end to end: three runs
happened to win the autosave race, two lost it and persisted nothing.
2026-07-08 07:57:36 +02:00
alexpolo1
1c2ec2b1fc fix: correct rentals and similar-experience API paths
GET rentals used /api/customer-projects/{id}/rentals but the backend
route lives at /api/customer-projects/projects/{id}/rentals, so saved
rental lines were never loaded back into the flow. The
similar-experience lookup used /api/customer/projects/... and always
404'ed, so historical experience data never appeared in the smart
package step.
2026-07-08 07:57:19 +02:00
alexpolo1
7ed6494762 fix: correct design issues across desktop and mobile
- Scope global .materials-header rule to used-materials so the
  Materialer page header stacks correctly on mobile
- Collapse system status indicator to a compact dot so it no longer
  covers content
- Remove redundant current-view chip from header navigation
- Scope FinalReview button styles and switch submit gradient from red
  to green so the danger color no longer leaks into project creation
- Remove duplicate title and category chip on smart package cards
- Stop absolute positioning of logout button that clipped the logo
2026-07-08 07:32:23 +02:00
alexpolo1
cc9fc941a6 test: cover mobile order readiness flow 2026-07-07 22:01:03 +02:00
alexpolo1
4da87de9ae fix: remove frontend hook build warnings 2026-07-07 21:57:40 +02:00
alexpolo1
c5fd46eba0 feat: add mobile order readiness checks 2026-07-07 21:55:54 +02:00
alexpolo1
46c0025e49 feat: add AI usage and quote output polish 2026-07-07 21:30:34 +02:00
alexpolo1
a6a643fd46 feat: add mobile order field workflow 2026-07-07 21:30:28 +02:00
alexpolo1
ca4ce44bef feat: improve roof quote readiness 2026-07-07 21:30:23 +02:00
alexpolo1
01ad8f4a49 feat: consolidate ordrestyring quote workflow 2026-07-05 08:10:59 +00:00
alexpolo1
83a5af07d8 fix: strengthen tilbudsgivern flow validation and automation
- tighten carpenter AI e2e success criteria to require real ordrestyring submission

- improve login field usability (labels/placeholders/autocomplete)

- add final review gating for missing core quote data

- normalize window task naming in carpenter API fixtures
2026-05-13 09:25:51 +00:00
alexpolo1
002e05bfc7 fix(ordrestyring): close hours-without-case gap and harden local-first sync 2026-04-08 05:56:01 +00:00
alexpolo1
10d94c7ff1 feat: persist carpenter workflow status and price freshness 2026-03-29 12:27:06 +00:00
alexpolo1
3b7772c697 chore: ignore test data and checkpoint current changes 2026-03-04 10:08:49 +00:00
alexpolo1
bbb75ccce2 feat: Add Advanced Dashboard and perform repo cleanup
This commit introduces a new Advanced Dashboard feature, which provides enhanced analytics and system health monitoring.

Additionally, this commit includes a general repository cleanup, which consists of:

- Removal of a duplicate  file from the root directory.
- Addition of temporary report and documentation files to .
- Relocation of several test files from the root to the  directory.
- Staging of various other modified files that were previously uncommitted.

The new Advanced Dashboard feature includes:
-  and  for the UI.
-  for the backend API.
-  for API documentation.

New tests for smart packages and autosave functionality have also been added.
2026-02-28 17:38:23 +00:00
copilot-swe-agent[bot]
ea8c40a90a Fix syntax error in EnhancedGeometry.js - add missing closing parenthesis for React.memo()
Co-authored-by: alexpolo1 <14327609+alexpolo1@users.noreply.github.com>
2026-01-25 11:07:29 +00:00
Alex
9469a896d3 Merge pull request #1 from alexpolo1/copilot/identify-slow-code-improvements
Optimize database operations and async workflows for 5-20x performance gains
2026-01-25 12:01:05 +01:00
Alex
03071eb7b0 Merge pull request #2 from alexpolo1/copilot/secure-secret-handling
Security: Remove hardcoded JWT secrets and client-side refresh token storage
2026-01-25 11:57:25 +01:00
Claude
1ed77551a0 feat: Add comprehensive CI/CD pipelines and fix lint errors
CI/CD Pipelines:
- ci.yml: Enhanced with lint, unit tests, E2E tests, security scan
- deploy-test.yml: Test environment deployment workflow
- deploy-prod.yml: Production deployment with backup, rollback, smoke tests

Test Fixes:
- supportTickets.test.js: Fix field names (topic_id, priority_id)

Lint Fixes:
- CalendarGrid.js: Mark unused employeeTypeFilter
- CustomerSearch.js: Mark unused setTaskType
- EnhancedGeometry.js: Mark unused variables
- InlineSmartPackage.js: Add eslint-disable for unused handlers
- ProjectFlow.js: Remove unused imports and handlers
- WhosFreeWidget.js: Add eslint-disable for useEffect
- BackupImport.js: Remove unused TextField import
2026-01-25 10:47:16 +00:00
alexpolo1
a03b6df348 feat: Crew scheduling system (Phase 1-3) - 8.5/10 rating
Phase 1: Quick Wins
- Calendar default tab, simplified 3-option filters
- Show all employees including free ones

Phase 2: Core Functionality
- POST /api/calendar/allocate endpoint
- AllocationModal component with validation
- Integration with Ordrestyring GraphQL API

Phase 2.5: UX Polish
- Prominent employee names with type badges
- NotificationToast system for success/error feedback
- Auto-refresh after allocation
- Removed confusing employee-type filter

Phase 3: Enhanced UX
- WhosFreeWidget with tabs (I dag | I morgen | Denne uge)
- Job names displayed on busy employees
- Quick-allocate with employee pre-selection
- Fixed undefined name sorting bugs

Lars validation: 8.5/10 - 'Replaces whiteboard for 90% of planning'
Real impact: 97% faster than manual process (5s vs 2-3 min)
2026-01-22 21:59:34 +00:00
alexpolo1
0905469c13 feat: Complete Smart Pakker & Opgaver unified integration with test data and validation 2026-01-21 16:48:56 +00:00
alexpolo1
a3f07a7d04 fix: support ticket API configuration and error handling
- Fix loadSupportConfig to properly use environment variables as fallback
- Improve error logging with detailed diagnostics for debugging
- Handle database lookup failures gracefully
- Add better error messages with config status information

Tested: Support ticket API now works correctly with osTicket integration
2026-01-21 07:35:29 +00:00
alexpolo1
f60a0dfd48 feat: add support ticket system with osTicket integration
- Add SupportDialog React component for user support requests
- Add backend /api/support/tickets endpoint with osTicket API integration
- Add comprehensive test suite for support tickets (Jest)
- Add system_settings table migration for dynamic osTicket config
- Fix OpenAI costs API query parameter bug
- Clean up ESLint warnings across frontend components
- Add Claude AI project configuration (.claude/ directory)
- Add comprehensive code quality rules and patterns
- Add security review and TDD workflow skills
- Add analysis report documenting project state

Technical details:
- Support dialog with form validation and rate limiting
- Database and env var fallback for osTicket credentials
- Input sanitization and XSS protection
- IP forwarding for ticket context
- Full test coverage (backend unit tests: 69/69 passing)
2026-01-21 07:29:20 +00:00
alexpolo1
e736645432 feat: Add task saving to database in Smart Packages + cleanup
Smart Package improvements:
- InlineSmartPackage.js: Add saveTaskToDatabase() to persist tasks
- smartPackagesRoutes.js: Add timeUnit and timePerUnit fields

Fixes:
- package.json: Fix playwright path to use local node_modules

Cleanup:
- .gitignore: Add test-results and playwright-report to ignore
- Remove old backup files from tracking (already in .gitignore)
- Remove test result artifacts from tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 11:04:50 +00:00
copilot-swe-agent[bot]
7f42aa7d89 Add prominent warnings about incomplete refresh token implementation
Co-authored-by: alexpolo1 <14327609+alexpolo1@users.noreply.github.com>
2026-01-06 07:29:29 +00:00
copilot-swe-agent[bot]
8d0e7c159d Address code review: remove JWT secret exports and clarify incomplete refresh implementation
Co-authored-by: alexpolo1 <14327609+alexpolo1@users.noreply.github.com>
2026-01-06 07:27:17 +00:00
copilot-swe-agent[bot]
be642f5c1d Implement security improvements: enforce JWT secrets, remove client-side refresh token storage
Co-authored-by: alexpolo1 <14327609+alexpolo1@users.noreply.github.com>
2026-01-06 07:20:24 +00:00
copilot-swe-agent[bot]
f828106d68 Optimize backend: parallelize async operations and batch database inserts
Co-authored-by: alexpolo1 <14327609+alexpolo1@users.noreply.github.com>
2025-12-27 08:34:29 +00:00
alexpolo1
aa69197a2e Add initial test results for carpenter Lars Nielsen's project quote 2025-12-23 02:09:41 +00:00
alexpolo1
78595bbf6f feat: Complete SVG validation and enhancements for all roof types
- Added comprehensive SVG validation and fixes in EnhancedGeometry.js
- Created SVG_VALIDATION_COMPLETE.md to document validation results and improvements
- Developed a quick test guide for all 7 roof types in TEST_ROOF_TYPES_QUICK.md
- Summarized test results in TEST_SUMMARY.md, highlighting core functionality and API status
- Implemented Playwright tests for roof types API and UI interactions, ensuring all roof types are selectable and functional
- Enhanced error handling and accessibility features across the application
- Verified successful integration of SVG rendering with React components
2025-12-23 01:37:04 +00:00
alexpolo1
b93784b340 feat: Massiv UX forbedring af Smart Pakker - Nem wizard og hjælp
🎯 Problemet: Kunder synes det er svært at lave smart pakker
 Løsningen: Komplet redesign med guidet oprettelse

🚀 Nye Funktioner:

1. SMART PACKAGE WIZARD (SmartPackageWizard.js)
   - Trin-for-trin guide gennem 4 nemme steps
   - Trin 1: Grundinfo med templates og tooltips
   - Trin 2: Materialer med visuelt overblik
   - Trin 3: Opgaver med auto-beregning
   - Trin 4: Gennemgang før gemning
   - Indbygget validation på hvert trin
   - Auto-save i edit mode
   - Responsive design (mobil + desktop)

2. QUICK START DIALOG (QuickStartDialog.js)
   - Vælg mellem 3 oprettelsesmetoder:
     * Guidet Wizard (anbefalet for begyndere)
     * Start med Skabelon (hurtigst)
     * Avanceret (fuld kontrol)
   - Visuelle cards med ikoner og forklaring
   - Template selector med preview

3. HJÆLPE-PANEL (SmartPackagesHelpPanel.js)
   - Sticky sidebar med kontekstuel hjælp
   - "Kom i gang" guide i 4 trin
   - Tips & Tricks sektion
   - "Undgå disse fejl" warnings
   - Tommelfingerregler (timepris, buffer, spild)
   - Kan åbnes/lukkes efter behov
   - Drawer på mobil

4. INTEGRATION AF CARPENTER UX KOMPONENTER
   - FormField: Real-time validation på alle inputs
   - Tooltips: Hjælpetekst ved svære felter
   - AutosaveIndicator: Viser gem-status
   - LoadingSpinner: Bedre loading states

💡 UX Forbedringer:

✓ Klare instruktioner ved hvert trin
✓ Visual feedback (ikoner, farver, progress)
✓ Foreslåede værdier (standard timepris: 580 kr)
✓ Template system til hurtig start
✓ Automatisk beregning af totaler
✓ Fejlmeddelelser med forklaringer
✓ Responsivt design (mobil/tablet/desktop)
✓ Hjælp altid tilgængelig
✓ Kan ikke gå videre uden at udfylde påkrævet
✓ Gennemse alt før gemning

📊 Validering:
- Pakkenavn: min 3 tegn
- Beskrivelse: min 10 tegn
- Timepris: 100-2000 kr.
- Mindst 1 materiale
- Mindst 1 opgave
- Estimeret tid > 0

🎨 Visuelle Elementer:
- Stepper viser fremskridt
- Alert boxes med vigtige tips
- Ikoner for hver sektion
- Chips for templates
- Cards for materialer/opgaver
- Farvekodet totaler (grøn for success)

📱 Responsive Features:
- Hjælpepanel: Sidebar på desktop, drawer på mobil
- Grid layouts tilpasser sig skærmstørrelse
- Touch-venlige buttons
- Optimeret scrolling

🔧 Tekniske Detaljer:
- Bruger useState hooks for lokal state
- useEffect for data loading
- Axios for API kald
- Material-UI komponenter
- React Beautiful DnD ready
- Validering før navigation
- Auto-save med 2s debounce

Dette gør det 10x nemmere at lave smart pakker! 🎉
2025-12-23 00:20:03 +00:00
alexpolo1
5012129818 feat: Comprehensive carpenter UX improvements
- Add FormField component with real-time validation and error feedback
- Add LoadingSpinner component for better loading states
- Implement autosave for project drafts with AutosaveIndicator
- Add Tooltip component with helpful measurement guidance
- Implement intelligent API caching to speed up quote generation
- Integrate tooltips into GeometryInput for carpenter guidance
- Cache material searches, prices, and categories for faster lookups

Benefits:
- Carpenters don't lose work with autosave functionality
- Clear validation feedback reduces form errors
- Tooltips provide measurement examples and guidance
- Faster material searches with 5-10 minute caching
- Professional loading states improve perceived performance

Files: 11 new components/utils, 3 modified core components
Total: ~797 lines of new code
2025-12-22 22:49:27 +00:00