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

@@ -37,15 +37,12 @@ export function createProject(data) {
// 2. Generate sequential number and project number
const sequentialNumber = (contractInfo.project_count || 0) + 1;
const projectNumber = `${sequentialNumber}/${contractInfo.contract_number}`;
const stmt = db.prepare(`
const projectNumber = `${sequentialNumber}/${contractInfo.contract_number}`; const stmt = db.prepare(`
INSERT INTO projects (
contract_id, project_name, project_number, address, plot, district, unit, city, investment_number, finish_date,
wp, contact, notes, project_type, project_status
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`);
stmt.run(
wp, contact, notes, project_type, project_status, coordinates
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`);stmt.run(
data.contract_id,
data.project_name,
projectNumber,
@@ -58,17 +55,16 @@ export function createProject(data) {
data.finish_date,
data.wp,
data.contact,
data.notes,
data.project_type || "design",
data.project_status || "registered"
data.notes, data.project_type || "design",
data.project_status || "registered",
data.coordinates || null
);
}
export function updateProject(id, data) {
const stmt = db.prepare(`
export function updateProject(id, data) { const stmt = db.prepare(`
UPDATE projects SET
contract_id = ?, project_name = ?, project_number = ?, address = ?, plot = ?, district = ?, unit = ?, city = ?,
investment_number = ?, finish_date = ?, wp = ?, contact = ?, notes = ?, project_type = ?, project_status = ?
investment_number = ?, finish_date = ?, wp = ?, contact = ?, notes = ?, project_type = ?, project_status = ?, coordinates = ?
WHERE project_id = ?
`);
stmt.run(
@@ -84,9 +80,9 @@ export function updateProject(id, data) {
data.finish_date,
data.wp,
data.contact,
data.notes,
data.project_type || "design",
data.notes, data.project_type || "design",
data.project_status || "registered",
data.coordinates || null,
id
);
}