diff --git a/src/modules/parcel-sync/components/parcel-sync-module.tsx b/src/modules/parcel-sync/components/parcel-sync-module.tsx index 3ce69a5..1b8623d 100644 --- a/src/modules/parcel-sync/components/parcel-sync-module.tsx +++ b/src/modules/parcel-sync/components/parcel-sync-module.tsx @@ -24,6 +24,7 @@ import { HardDrive, Clock, ArrowDownToLine, + AlertTriangle, } from "lucide-react"; import { Button } from "@/shared/components/ui/button"; import { Input } from "@/shared/components/ui/input"; @@ -710,6 +711,15 @@ export function ParcelSyncModule() { setNoGeomScanning(false); }, [siruta, noGeomScanning]); + // Auto-scan for no-geometry parcels when UAT is selected + connected + useEffect(() => { + if (!siruta || !session.connected || noGeomScanning) return; + // Don't re-scan if we already scanned this siruta + if (noGeomScanSiruta === siruta && noGeomScan !== null) return; + void handleNoGeomScan(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [siruta, session.connected]); + /* ════════════════════════════════════════════════════════════ */ /* Layer feature counts */ /* ════════════════════════════════════════════════════════════ */ @@ -2344,70 +2354,109 @@ export function ParcelSyncModule() { )} - {/* No-geometry option */} - {sirutaValid && session.connected && ( - - -
- - +
+ + {includeNoGeom && ( +

+ Vor fi importate în DB și incluse în CSV (coloana + HAS_GEOMETRY=0). Nu apar în GPKG. +

)} - - )} - - {includeNoGeom && ( -

- Parcelele fără geometrie vor apărea doar în CSV (coloana - HAS_GEOMETRY=0), nu în GPKG. -

- )} -
-
- )} + + + ); + + // Scan done, all parcels have geometry + if (scanDone && !hasNoGeomParcels) + return ( + + +
+ + Toate cele{" "} + {noGeomScan.totalImmovables.toLocaleString("ro-RO")}{" "} + parcele din eTerra au geometrie — nimic de importat + suplimentar. +
+
+
+ ); + + return null; + })()} {/* Progress bar */} {exportProgress && diff --git a/temp-add-col.cjs b/temp-add-col.cjs new file mode 100644 index 0000000..565d3e0 --- /dev/null +++ b/temp-add-col.cjs @@ -0,0 +1,19 @@ +const { PrismaClient } = require("@prisma/client"); +const p = new PrismaClient(); +const exec = p.$executeRawUnsafe.bind(p); +const disconnect = p.$disconnect.bind(p); +async function main() { + await exec( + 'ALTER TABLE "GisFeature" ADD COLUMN IF NOT EXISTS "geometrySource" TEXT', + ); + console.log("OK: geometrySource column added"); + await exec( + 'CREATE INDEX IF NOT EXISTS "GisFeature_geometrySource_idx" ON "GisFeature" ("geometrySource")', + ); + console.log("OK: index created"); + await disconnect(); +} +main().catch((e) => { + console.log("ERR:", e.message); + disconnect(); +}); diff --git a/temp-add-col.js b/temp-add-col.js new file mode 100644 index 0000000..07bfaa6 --- /dev/null +++ b/temp-add-col.js @@ -0,0 +1,10 @@ +const { PrismaClient } = require('@prisma/client'); +const p = new PrismaClient(); +async function main() { + await p['']('ALTER TABLE "GisFeature" ADD COLUMN IF NOT EXISTS "geometrySource" TEXT'); + console.log('OK: geometrySource column added'); + await p['']('CREATE INDEX IF NOT EXISTS "GisFeature_geometrySource_idx" ON "GisFeature" ("geometrySource")'); + console.log('OK: index created'); + await p[''](); +} +main().catch(e => { console.log('ERR:', e.message); p[''](); });