fix: dynamic workspaceId for no-geometry scan (was hardcoded 65)
- resolveWorkspacePk chain: explicit param -> GisUat DB -> ArcGIS layer query - UI passes workspacePk from UAT selection to scan API - Fixes: FELEACU (Cluj, workspace!=65) returning 0 immovables - Better messaging: shows X total, Y with geometry, Z without - Shows warning when 0 immovables found (workspace resolution failed)
This commit is contained in:
@@ -690,7 +690,10 @@ export function ParcelSyncModule() {
|
||||
const res = await fetch("/api/eterra/no-geom-scan", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ siruta: s }),
|
||||
body: JSON.stringify({
|
||||
siruta: s,
|
||||
workspacePk: workspacePk ?? undefined,
|
||||
}),
|
||||
});
|
||||
const data = (await res.json()) as {
|
||||
totalImmovables?: number;
|
||||
@@ -699,7 +702,7 @@ export function ParcelSyncModule() {
|
||||
error?: string;
|
||||
};
|
||||
if (data.error) {
|
||||
// Show zero result instead of hiding the card entirely
|
||||
console.warn("[no-geom-scan]", data.error);
|
||||
setNoGeomScan({ totalImmovables: 0, totalInDb: 0, noGeomCount: 0 });
|
||||
} else {
|
||||
setNoGeomScan({
|
||||
@@ -714,7 +717,7 @@ export function ParcelSyncModule() {
|
||||
}
|
||||
setNoGeomScanning(false);
|
||||
},
|
||||
[siruta],
|
||||
[siruta, workspacePk],
|
||||
);
|
||||
|
||||
// Auto-scan for no-geometry parcels when UAT is selected + connected
|
||||
@@ -2376,7 +2379,7 @@ export function ParcelSyncModule() {
|
||||
<CardContent className="py-3 px-4">
|
||||
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||
<Loader2 className="h-4 w-4 animate-spin text-amber-500" />
|
||||
Se verifică parcele fără geometrie în eTerra…
|
||||
Se scanează lista de imobile din eTerra…
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
@@ -2398,19 +2401,23 @@ export function ParcelSyncModule() {
|
||||
<AlertTriangle className="h-4 w-4 text-amber-500 shrink-0" />
|
||||
<div className="flex-1 min-w-0">
|
||||
<p className="text-sm">
|
||||
Din{" "}
|
||||
<span className="font-semibold">
|
||||
{noGeomScan.totalImmovables.toLocaleString("ro-RO")}
|
||||
</span>{" "}
|
||||
imobile în eTerra:{" "}
|
||||
<span className="text-emerald-600 dark:text-emerald-400 font-medium">
|
||||
{noGeomScan.totalInDb.toLocaleString("ro-RO")}
|
||||
</span>{" "}
|
||||
cu geometrie,{" "}
|
||||
<span className="font-semibold text-amber-600 dark:text-amber-400">
|
||||
{noGeomScan.noGeomCount.toLocaleString("ro-RO")}
|
||||
</span>{" "}
|
||||
parcele există în eTerra dar{" "}
|
||||
<span className="font-medium">nu au geometrie</span>{" "}
|
||||
în layerul GIS
|
||||
<span className="font-medium">fără geometrie</span>
|
||||
</p>
|
||||
<p className="text-[11px] text-muted-foreground mt-0.5">
|
||||
Din{" "}
|
||||
{noGeomScan.totalImmovables.toLocaleString("ro-RO")}{" "}
|
||||
imobile total în eTerra,{" "}
|
||||
{noGeomScan.totalInDb.toLocaleString("ro-RO")} sunt
|
||||
deja în baza de date cu geometrie.
|
||||
Cele fără geometrie există în baza de date eTerra dar
|
||||
nu au contur desenat în layerul GIS.
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
@@ -2446,17 +2453,27 @@ export function ParcelSyncModule() {
|
||||
</Card>
|
||||
);
|
||||
|
||||
// Scan done, all parcels have geometry
|
||||
// Scan done, all parcels have geometry (or totalImmovables=0 ⇒ workspace issue)
|
||||
if (scanDone && !hasNoGeomParcels)
|
||||
return (
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="py-2.5 px-4">
|
||||
<div className="flex items-center gap-2 text-xs text-muted-foreground">
|
||||
<CheckCircle2 className="h-3.5 w-3.5 text-emerald-500" />
|
||||
Toate cele{" "}
|
||||
{noGeomScan.totalImmovables.toLocaleString("ro-RO")}{" "}
|
||||
parcele din eTerra au geometrie — nimic de importat
|
||||
suplimentar.
|
||||
{noGeomScan.totalImmovables > 0 ? (
|
||||
<>
|
||||
<CheckCircle2 className="h-3.5 w-3.5 text-emerald-500" />
|
||||
Toate cele{" "}
|
||||
{noGeomScan.totalImmovables.toLocaleString("ro-RO")}{" "}
|
||||
imobile din eTerra au geometrie — nimic de importat
|
||||
suplimentar.
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<AlertTriangle className="h-3.5 w-3.5 text-muted-foreground" />
|
||||
Nu s-au găsit imobile în lista eTerra pentru acest
|
||||
UAT. Verifică sesiunea eTerra.
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user