fix(parcel-sync): scan uses remote GIS layer instead of empty local DB

- scanNoGeometryParcels now fetches TERENURI_ACTIVE features from remote
  ArcGIS (lightweight, no geometry) to cross-reference with eTerra immovable list
- Cross-references by both NATIONAL_CADASTRAL_REFERENCE and IMMOVABLE_ID
- Works correctly regardless of whether user has synced to local DB
- Renamed totalInDb -> withGeometry in NoGeomScanResult, UI, and API
- Extended fetchAllLayer() to forward outFields/returnGeometry options
This commit is contained in:
AI Assistant
2026-03-07 17:32:49 +02:00
parent 40b9522e12
commit b01ea9fc37
4 changed files with 49 additions and 28 deletions
@@ -388,7 +388,7 @@ export function ParcelSyncModule() {
const [noGeomScanning, setNoGeomScanning] = useState(false);
const [noGeomScan, setNoGeomScan] = useState<{
totalImmovables: number;
totalInDb: number;
withGeometry: number;
noGeomCount: number;
} | null>(null);
const [noGeomScanSiruta, setNoGeomScanSiruta] = useState(""); // siruta for which scan was done
@@ -697,23 +697,23 @@ export function ParcelSyncModule() {
});
const data = (await res.json()) as {
totalImmovables?: number;
totalInDb?: number;
withGeometry?: number;
noGeomCount?: number;
error?: string;
};
if (data.error) {
console.warn("[no-geom-scan]", data.error);
setNoGeomScan({ totalImmovables: 0, totalInDb: 0, noGeomCount: 0 });
setNoGeomScan({ totalImmovables: 0, withGeometry: 0, noGeomCount: 0 });
} else {
setNoGeomScan({
totalImmovables: data.totalImmovables ?? 0,
totalInDb: data.totalInDb ?? 0,
withGeometry: data.withGeometry ?? 0,
noGeomCount: data.noGeomCount ?? 0,
});
}
} catch {
// Show zero result on network error
setNoGeomScan({ totalImmovables: 0, totalInDb: 0, noGeomCount: 0 });
setNoGeomScan({ totalImmovables: 0, withGeometry: 0, noGeomCount: 0 });
}
setNoGeomScanning(false);
},
@@ -2407,7 +2407,7 @@ export function ParcelSyncModule() {
</span>{" "}
imobile în eTerra:{" "}
<span className="text-emerald-600 dark:text-emerald-400 font-medium">
{noGeomScan.totalInDb.toLocaleString("ro-RO")}
{noGeomScan.withGeometry.toLocaleString("ro-RO")}
</span>{" "}
cu geometrie,{" "}
<span className="font-semibold text-amber-600 dark:text-amber-400">