feat: Add Leaflet map integration and project coordinates handling

- Updated package.json to include dependencies for Leaflet and Playwright testing.
- Added new images for Leaflet markers and layers.
- Created scripts for generating test data with project coordinates.
- Enhanced ProjectViewPage to display project coordinates and integrated ProjectMap component.
- Modified ProjectForm to include coordinates input field.
- Implemented CustomWMTSMap and EnhancedLeafletMap components for improved map functionality.
- Created ProjectMap component to dynamically render project location on the map.
- Added mapLayers configuration for various base layers including Polish Geoportal.
- Implemented WMTS capabilities handling for dynamic layer loading.
- Updated database initialization to include coordinates column in projects table.
- Modified project creation and update functions to handle coordinates.
- Added utility functions for formatting project status and deadlines.
This commit is contained in:
2025-06-18 12:47:04 +02:00
parent c983ba9882
commit 603634e8a4
21 changed files with 8022 additions and 36 deletions

View File

@@ -0,0 +1,21 @@
import db from '../src/lib/db.js';
// Create another test project with coordinates in a different location
const project = db.prepare(`
INSERT INTO projects (
contract_id, project_name, project_number, address, city, coordinates,
project_type, project_status
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
`).run(
3, // Using the existing contract
'Test Project in Warsaw',
'2/TEST/2025',
'Warsaw Center, Poland',
'Warsaw',
'52.2297,21.0122', // Warsaw coordinates
'construction',
'in_progress_construction'
);
console.log('Additional test project created!');
console.log('Project ID:', project.lastInsertRowid);

View File

@@ -0,0 +1,32 @@
import db from '../src/lib/db.js';
import initializeDatabase from '../src/lib/init-db.js';
// Initialize the database
initializeDatabase();
// Create a test contract
const contract = db.prepare(`
INSERT INTO contracts (contract_number, contract_name, customer, investor, date_signed, finish_date)
VALUES (?, ?, ?, ?, ?, ?)
`).run('TEST/2025', 'Test Contract', 'Test Customer', 'Test Investor', '2025-01-01', '2025-12-31');
// Create a test project with coordinates
const project = db.prepare(`
INSERT INTO projects (
contract_id, project_name, project_number, address, city, coordinates,
project_type, project_status
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
`).run(
contract.lastInsertRowid,
'Test Project with Location',
'1/TEST/2025',
'Test Address, Krakow',
'Krakow',
'50.0647,19.9450', // Krakow coordinates
'design',
'registered'
);
console.log('Test data created successfully!');
console.log('Contract ID:', contract.lastInsertRowid);
console.log('Project ID:', project.lastInsertRowid);