feat(parcel-sync): county-aware UAT autocomplete with workspace resolution
- New /api/eterra/uats endpoint fetches all counties + UATs from eTerra, caches server-side for 1 hour, returns enriched data with county name and workspacePk for each UAT - When eTerra is connected, auto-fetches enriched UAT list (replaces static uat.json fallback) shows 'FELEACU (57582), CLUJ' format - UAT autocomplete now searches both UAT name and county name - Selected UAT stores workspacePk in state, passes it directly to /api/eterra/search eliminates slow per-search county resolution - Search route accepts optional workspacePk, falls back to resolveWorkspace() - Dropdown shows UAT name, SIRUTA code, and county prominently - Increased autocomplete results from 8 to 12 items
This commit is contained in:
@@ -408,23 +408,52 @@ export class EterraClient {
|
||||
/* ---- Magic-mode methods (eTerra application APIs) ------------- */
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async fetchImmAppsByImmovable(immovableId: string | number, workspaceId: string | number): Promise<any[]> {
|
||||
async fetchImmAppsByImmovable(
|
||||
immovableId: string | number,
|
||||
workspaceId: string | number,
|
||||
): Promise<any[]> {
|
||||
const url = `${BASE_URL}/api/immApps/byImm/list/${immovableId}/${workspaceId}`;
|
||||
return this.getRawJson(url);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async fetchParcelFolosinte(workspaceId: string | number, immovableId: string | number, applicationId: string | number, page = 1): Promise<any[]> {
|
||||
async fetchParcelFolosinte(
|
||||
workspaceId: string | number,
|
||||
immovableId: string | number,
|
||||
applicationId: string | number,
|
||||
page = 1,
|
||||
): Promise<any[]> {
|
||||
const url = `${BASE_URL}/api/immApps/parcels/list/${workspaceId}/${immovableId}/${applicationId}/${page}`;
|
||||
return this.getRawJson(url);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async fetchImmovableListByAdminUnit(workspaceId: string | number, adminUnitId: string | number, page = 0, size = 200, includeInscrisCF = true): Promise<any> {
|
||||
async fetchImmovableListByAdminUnit(
|
||||
workspaceId: string | number,
|
||||
adminUnitId: string | number,
|
||||
page = 0,
|
||||
size = 200,
|
||||
includeInscrisCF = true,
|
||||
): Promise<any> {
|
||||
const url = `${BASE_URL}/api/immovable/list`;
|
||||
const filters: Array<{ value: string | number; type: "NUMBER" | "STRING"; key: string; op: string }> = [
|
||||
{ value: Number(workspaceId), type: "NUMBER", key: "workspace.nomenPk", op: "=" },
|
||||
{ value: Number(adminUnitId), type: "NUMBER", key: "adminUnit.nomenPk", op: "=" },
|
||||
const filters: Array<{
|
||||
value: string | number;
|
||||
type: "NUMBER" | "STRING";
|
||||
key: string;
|
||||
op: string;
|
||||
}> = [
|
||||
{
|
||||
value: Number(workspaceId),
|
||||
type: "NUMBER",
|
||||
key: "workspace.nomenPk",
|
||||
op: "=",
|
||||
},
|
||||
{
|
||||
value: Number(adminUnitId),
|
||||
type: "NUMBER",
|
||||
key: "adminUnit.nomenPk",
|
||||
op: "=",
|
||||
},
|
||||
{ value: "C", type: "STRING", key: "immovableType", op: "<>C" },
|
||||
];
|
||||
if (includeInscrisCF) {
|
||||
@@ -440,7 +469,10 @@ export class EterraClient {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async fetchDocumentationData(workspaceId: string | number, immovableIds: Array<string | number>): Promise<any> {
|
||||
async fetchDocumentationData(
|
||||
workspaceId: string | number,
|
||||
immovableIds: Array<string | number>,
|
||||
): Promise<any> {
|
||||
const url = `${BASE_URL}/api/documentation/data/`;
|
||||
const payload = {
|
||||
workflowCode: "EXPLORE_DATABASE",
|
||||
@@ -458,7 +490,12 @@ export class EterraClient {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async fetchImmovableParcelDetails(workspaceId: string | number, immovableId: string | number, page = 1, size = 1): Promise<any[]> {
|
||||
async fetchImmovableParcelDetails(
|
||||
workspaceId: string | number,
|
||||
immovableId: string | number,
|
||||
page = 1,
|
||||
size = 1,
|
||||
): Promise<any[]> {
|
||||
const url = `${BASE_URL}/api/immovable/details/parcels/list/${workspaceId}/${immovableId}/${page}/${size}`;
|
||||
return this.getRawJson(url);
|
||||
}
|
||||
@@ -469,12 +506,38 @@ export class EterraClient {
|
||||
* a cadastral number in the search box.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async searchImmovableByIdentifier(workspaceId: string | number, adminUnitId: string | number, identifierDetails: string, page = 0, size = 10): Promise<any> {
|
||||
async searchImmovableByIdentifier(
|
||||
workspaceId: string | number,
|
||||
adminUnitId: string | number,
|
||||
identifierDetails: string,
|
||||
page = 0,
|
||||
size = 10,
|
||||
): Promise<any> {
|
||||
const url = `${BASE_URL}/api/immovable/list`;
|
||||
const filters: Array<{ value: string | number; type: "NUMBER" | "STRING"; key: string; op: string }> = [
|
||||
{ value: Number(workspaceId), type: "NUMBER", key: "workspace.nomenPk", op: "=" },
|
||||
{ value: Number(adminUnitId), type: "NUMBER", key: "adminUnit.nomenPk", op: "=" },
|
||||
{ value: identifierDetails, type: "STRING", key: "identifierDetails", op: "=" },
|
||||
const filters: Array<{
|
||||
value: string | number;
|
||||
type: "NUMBER" | "STRING";
|
||||
key: string;
|
||||
op: string;
|
||||
}> = [
|
||||
{
|
||||
value: Number(workspaceId),
|
||||
type: "NUMBER",
|
||||
key: "workspace.nomenPk",
|
||||
op: "=",
|
||||
},
|
||||
{
|
||||
value: Number(adminUnitId),
|
||||
type: "NUMBER",
|
||||
key: "adminUnit.nomenPk",
|
||||
op: "=",
|
||||
},
|
||||
{
|
||||
value: identifierDetails,
|
||||
type: "STRING",
|
||||
key: "identifierDetails",
|
||||
op: "=",
|
||||
},
|
||||
{ value: -1, type: "NUMBER", key: "inscrisCF", op: "=" },
|
||||
{ value: "P", type: "STRING", key: "immovableType", op: "<>C" },
|
||||
];
|
||||
@@ -502,7 +565,9 @@ export class EterraClient {
|
||||
* Returns array of { nomenPk, name, parentNomenPk, ... }
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async fetchAdminUnitsByCounty(countyNomenPk: string | number): Promise<any[]> {
|
||||
async fetchAdminUnitsByCounty(
|
||||
countyNomenPk: string | number,
|
||||
): Promise<any[]> {
|
||||
const url = `${BASE_URL}/api/adm/nomen/ADMINISTRATIVEUNIT/filterByParent/${countyNomenPk}`;
|
||||
return this.getRawJson(url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user