Files
tilbudgivern/migrations/create_smart_package_components.sql
alexpolo1 b82f9e758b feat: Add Backup & Import functionality for SmartPackages
- 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.
2025-11-07 09:45:19 +00:00

47 lines
3.1 KiB
SQL

-- Migration: Create smart_package_components table
-- Description: LEGO-style reusable components for building SmartPackages
-- Date: 2025-11-07
CREATE TABLE IF NOT EXISTS smart_package_components (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT,
category ENUM('basis', 'special', 'finish', 'service') NOT NULL DEFAULT 'basis',
base_hours DECIMAL(10, 2) DEFAULT 0,
base_price DECIMAL(10, 2) DEFAULT 0,
unit VARCHAR(50) DEFAULT 'stk',
complexity_factors JSON,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX idx_category (category),
INDEX idx_name (name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Insert sample LEGO components
INSERT INTO smart_package_components (name, description, category, base_hours, base_price, unit, complexity_factors) VALUES
('Tag Nedtagning', 'Forsigtig nedtagning af eksisterende tagmaterialer med sortering til genanvendelse', 'basis', 16, 850, '', '{"lille_parcelhus": 0.7, "eternit": 1.6, "tegl": 1.2}'),
('Moderne Isolering', 'Energieffektiv isolering med dampspærre og ventilation for optimal indeklima', 'basis', 32, 1650, '', '{}'),
('Spær Inspektion', 'Grundig inspektion af spærkonstruktion med dokumentation og nødvendige forstærkninger', 'basis', 12, 650, 'stk', '{}'),
('Tagdækning B7', 'Professionel lægning af B7 tagplader inkl. lægter og fastgørelse', 'basis', 24, 1200, '', '{}'),
('Køkken Nedrivning', 'Forsigtig nedrivning af eksisterende køkken med sortering til genanvendelse', 'basis', 14, 720, 'stk', '{}'),
('Køkken Montage', 'Præcis montering af nye køkkenskabe med justering og funktionstest', 'basis', 28, 1450, 'stk', '{}'),
('Badeværelse Membran', 'Vandtæt gulvmembran installation med 20 års vandskade-garanti', 'basis', 12, 850, '', '{}'),
('Smart Home Integration', 'App-styring med automatiserede funktioner for belysning, varme, sikkerhed og energi-optimering', 'special', 16, 18500, 'stk', '{}'),
('Gulvvarme System', 'Komplet gulvvarme installation med smart termostatstyring og energioptimering', 'special', 24, 12500, '', '{}'),
('Energi Optimering', 'A-klasse energimærke med 40% besparelse garanti - inkl. premium isolering og 3-lags vinduer', 'special', 48, 3500, '', '{}'),
('Premium Finish', 'Håndværksmæssig perfektion med ekstra kvalitetskontrol og æstetisk finish', 'finish', 8, 6500, 'stk', '{}'),
('Miljøvenlig Behandling', 'Økologiske materialer med sundhedscertificering og bæredygtig finish', 'finish', 6, 4500, 'stk', '{}'),
('Garanti Plus', '10-års omfattende garanti med årlig servicekontrol og prioriteret support', 'service', 0, 5000, 'stk', '{}'),
('Ekspres Service', '24/7 respons med samme-dag reparation og dedikeret hotline', 'service', 0, 8500, 'stk', '{}')
ON DUPLICATE KEY UPDATE updated_at = CURRENT_TIMESTAMP;
-- Verify insertion
SELECT
category,
COUNT(*) as count,
SUM(base_price) as total_value
FROM smart_package_components
GROUP BY category
ORDER BY
FIELD(category, 'basis', 'special', 'finish', 'service');