Files
panel/scripts/create-test-data.js
RKWojs 603634e8a4 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.
2025-06-18 12:47:04 +02:00

33 lines
1.0 KiB
JavaScript

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);