diff --git a/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/[funcionarioId]/editar/+page.svelte b/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/[funcionarioId]/editar/+page.svelte index e07eb3c..c0dc440 100644 --- a/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/[funcionarioId]/editar/+page.svelte +++ b/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/[funcionarioId]/editar/+page.svelte @@ -25,9 +25,9 @@ nome: string; tipo: SimboloTipo; descricao: string; - }> = []; + }> = $state([]); - let tipo: SimboloTipo = "cargo_comissionado"; + let tipo = $state("cargo_comissionado"); let loading = $state(false); let loadingData = $state(true); let notice = $state<{ kind: "success" | "error"; text: string } | null>(null); @@ -318,6 +318,12 @@ init(); } }); + + // Resetar simboloId quando tipo mudar + $effect(() => { + tipo; // track tipo + simboloId = ""; // reset selection when tipo changes + }); {#if loadingData} diff --git a/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/cadastro/+page.svelte b/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/cadastro/+page.svelte index 0c72b74..d064f56 100644 --- a/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/cadastro/+page.svelte +++ b/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/cadastro/+page.svelte @@ -22,9 +22,9 @@ nome: string; tipo: SimboloTipo; descricao: string; - }> = []; + }> = $state([]); - let tipo: SimboloTipo = "cargo_comissionado"; + let tipo = $state("cargo_comissionado"); let loading = $state(false); let notice = $state<{ kind: "success" | "error"; text: string } | null>(null); @@ -246,7 +246,15 @@ } } - loadSimbolos(); + $effect(() => { + loadSimbolos(); + }); + + // Resetar simboloId quando tipo mudar + $effect(() => { + tipo; // track tipo + simboloId = ""; // reset selection when tipo changes + });
diff --git a/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/relatorios/+page.svelte b/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/relatorios/+page.svelte index 55c997c..f9e1dee 100644 --- a/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/relatorios/+page.svelte +++ b/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/relatorios/+page.svelte @@ -6,9 +6,10 @@ const client = useConvexClient(); type Row = { _id: string; nome: string; valor: number; count: number }; - let rows: Array = []; - let isLoading = true; - let notice: { kind: "error" | "success"; text: string } | null = null; + let rows: Array = $state>([]); + let isLoading = $state(true); + let notice = $state<{ kind: "error" | "success"; text: string } | null>(null); + let containerWidth = $state(1200); onMount(async () => { try { @@ -29,9 +30,25 @@ } }); - let chartWidth = 900; - let chartHeight = 400; - const padding = { top: 40, right: 30, bottom: 100, left: 80 }; + // Dimensões responsivas + $effect(() => { + const updateSize = () => { + const container = document.querySelector('.chart-container'); + if (container) { + containerWidth = Math.min(container.clientWidth - 32, 1200); + } + }; + + updateSize(); + window.addEventListener('resize', updateSize); + + return () => window.removeEventListener('resize', updateSize); + }); + + const chartHeight = 350; + const padding = { top: 20, right: 20, bottom: 80, left: 70 }; + + let chartWidth = $derived(containerWidth); function getMax(arr: Array, sel: (t: T) => number): number { let m = 0; @@ -67,19 +84,19 @@ } -
+
-