novas funcionalidades dos formulario
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-02 11:13:37 +02:00
parent a6afb4e97a
commit 4f35313d06
104 changed files with 7653 additions and 178 deletions
@@ -1,5 +1,6 @@
import { useEffect, useId, useState } from "react";
import { api } from "@/pages/investment/shared";
import { replaceTerritoryPath } from "@/lib/territory-path.js";
export type TerritoryOption = {
id: string;
@@ -18,7 +19,7 @@ const emptyTerritoryPath: TerritoryOption[] = [];
export function ProvinceSelect({
value,
onChange,
endpoint = "/api/v1/investment/territory-options",
endpoint = "/api/v1/catalogs/jurisdictions",
placeholder = "Seleccione uma província",
className = control,
label = "Província",
@@ -94,7 +95,7 @@ export function ProvinceSelect({
export function TerritoryFields({
initial = emptyTerritoryPath,
onChange,
endpoint = "/api/v1/investment/territory-options",
endpoint = "/api/v1/catalogs/jurisdictions",
}: {
initial?: TerritoryOption[];
onChange?: (path: TerritoryOption[]) => void;
@@ -114,7 +115,7 @@ export function TerritoryFields({
selected={path[index]}
endpoint={endpoint}
onChange={(value) => {
const next = [...path.slice(0, index), ...(value ? [value] : [])];
const next = replaceTerritoryPath(path, index, value);
setPath(next);
onChange?.(next);
}}
@@ -285,7 +286,7 @@ export default function InvestmentTerritory({ kind, id }: { kind: string; id: st
parent={path[index - 1]?.id ?? ""}
selected={path[index]}
onChange={(value) => {
setPath([...path.slice(0, index), ...(value ? [value] : [])]);
setPath(replaceTerritoryPath(path, index, value));
setMessage("");
}}
/>