fix: complete InvesteMoz validation and error corrections

This commit is contained in:
2026-10-29 21:47:33 +02:00
parent 63147312e2
commit daf8623441
718 changed files with 127308 additions and 20959 deletions
+20 -7
View File
@@ -1,11 +1,24 @@
const territoryKeys=['province_id','district_id','admin_post_id','locality_id'];
const territoryKeys = [
'province_id',
'district_id',
'admin_post_id',
'locality_id',
];
/** No fallback scope: an explicit empty path means all; a selected path replaces its old descendants. */
export function territorialSearchParams(entries: Iterable<[string,FormDataEntryValue]>, path?: {id:string;location_type:string}[]): URLSearchParams {
const params=new URLSearchParams();
for(const [key,value] of entries)if(typeof value==='string'&&value!==''&&key!=='page')params.set(key,value);
if(path){
territoryKeys.forEach(key=>params.delete(key));
for(const node of path){const key=`${node.location_type}_id`;if(territoryKeys.includes(key))params.set(key,node.id);}
export function territorialSearchParams(
entries: Iterable<[string, FormDataEntryValue]>,
path?: { id: string; location_type: string }[],
): URLSearchParams {
const params = new URLSearchParams();
for (const [key, value] of entries)
if (typeof value === 'string' && value !== '' && key !== 'page')
params.set(key, value);
if (path) {
territoryKeys.forEach((key) => params.delete(key));
for (const node of path) {
const key = `${node.location_type}_id`;
if (territoryKeys.includes(key)) params.set(key, node.id);
}
}
return params;
}