fix(Prettier): Fix automático do código
This commit is contained in:
parent
0dc065d9bb
commit
df46a60b81
242 changed files with 4240 additions and 4415 deletions
|
|
@ -1,13 +1,11 @@
|
|||
{
|
||||
"folders": [
|
||||
{ "path": "D:/IIS/Orius/app" }
|
||||
],
|
||||
"folders": [{ "path": "D:/IIS/Orius/app" }],
|
||||
"settings": {
|
||||
// === GERAL ===
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll": "explicit",
|
||||
"source.organizeImports": "explicit"
|
||||
"source.organizeImports": "explicit",
|
||||
},
|
||||
"editor.formatOnPaste": false,
|
||||
"editor.formatOnType": false,
|
||||
|
|
@ -23,53 +21,48 @@
|
|||
"**/dist/**": true,
|
||||
"**/build/**": true,
|
||||
"**/.next/**": true,
|
||||
"**/.git/**": true
|
||||
"**/.git/**": true,
|
||||
},
|
||||
"search.exclude": {
|
||||
"**/node_modules": true,
|
||||
"**/dist": true,
|
||||
"**/.next": true,
|
||||
"**/.git": true
|
||||
"**/.git": true,
|
||||
},
|
||||
|
||||
// === FRONTEND ===
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact"
|
||||
],
|
||||
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "vscode.typescript-language-features"
|
||||
"editor.defaultFormatter": "vscode.typescript-language-features",
|
||||
},
|
||||
"[typescriptreact]": {
|
||||
"editor.defaultFormatter": "vscode.typescript-language-features"
|
||||
"editor.defaultFormatter": "vscode.typescript-language-features",
|
||||
},
|
||||
|
||||
// === TAILWIND ===
|
||||
"files.associations": {
|
||||
"*.css": "tailwindcss"
|
||||
"*.css": "tailwindcss",
|
||||
},
|
||||
"tailwindCSS.includeLanguages": {
|
||||
"plaintext": "html",
|
||||
"javascript": "javascript",
|
||||
"typescriptreact": "typescriptreact"
|
||||
"typescriptreact": "typescriptreact",
|
||||
},
|
||||
|
||||
// === TERMINAIS ===
|
||||
"terminal.integrated.profiles.windows": {
|
||||
"Next.js Dev": {
|
||||
"path": "cmd.exe",
|
||||
"args": ["/k", "cd D:\\IIS\\Orius\\app && npm run dev"]
|
||||
"args": ["/k", "cd D:\\IIS\\Orius\\app && npm run dev"],
|
||||
},
|
||||
"Build & Preview": {
|
||||
"path": "cmd.exe",
|
||||
"args": ["/k", "cd D:\\IIS\\Orius\\app && npm run build && npm run start"]
|
||||
"args": ["/k", "cd D:\\IIS\\Orius\\app && npm run build && npm run start"],
|
||||
},
|
||||
"Git Bash": {
|
||||
"path": "C:\\Program Files\\Git\\bin\\bash.exe"
|
||||
}
|
||||
"path": "C:\\Program Files\\Git\\bin\\bash.exe",
|
||||
},
|
||||
},
|
||||
"terminal.integrated.defaultProfile.windows": "Git Bash",
|
||||
|
||||
|
|
@ -88,8 +81,8 @@
|
|||
// === MISC ===
|
||||
"files.exclude": {
|
||||
"**/.DS_Store": true,
|
||||
"**/*.log": true
|
||||
}
|
||||
"**/*.log": true,
|
||||
},
|
||||
},
|
||||
"launch": {
|
||||
"version": "0.2.0",
|
||||
|
|
@ -101,9 +94,9 @@
|
|||
"runtimeExecutable": "npm",
|
||||
"runtimeArgs": ["run", "dev"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"port": 9229
|
||||
}
|
||||
]
|
||||
"port": 9229,
|
||||
},
|
||||
],
|
||||
},
|
||||
"extensions": {
|
||||
"recommendations": [
|
||||
|
|
@ -118,7 +111,7 @@
|
|||
"streetsidesoftware.code-spell-checker",
|
||||
"eamodio.gitlens",
|
||||
"mhutchie.git-graph",
|
||||
"donjayamanne.githistory"
|
||||
]
|
||||
}
|
||||
"donjayamanne.githistory",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import GCartorioIndex from "@/packages/administrativo/components/GCartorio/GCartorioIndex";
|
||||
import GCartorioIndex from '@/packages/administrativo/components/GCartorio/GCartorioIndex';
|
||||
|
||||
export default function GCartorioPage() {
|
||||
return (
|
||||
< GCartorioIndex />
|
||||
);
|
||||
return <GCartorioIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
export default function TCensecPage() {
|
||||
return (
|
||||
<div></div>
|
||||
);
|
||||
return <div></div>;
|
||||
}
|
||||
|
|
@ -1,9 +1,5 @@
|
|||
import GCalculoIndex from "@/packages/administrativo/components/GCalculo/GCalculoIndex";
|
||||
import GCalculoIndex from '@/packages/administrativo/components/GCalculo/GCalculoIndex';
|
||||
|
||||
export default function GEmolumentoPeriodoPage() {
|
||||
|
||||
return (
|
||||
<GCalculoIndex />
|
||||
);
|
||||
|
||||
return <GCalculoIndex />;
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
'use client'
|
||||
'use client';
|
||||
|
||||
import { useParams } from "next/navigation";
|
||||
import { useParams } from 'next/navigation';
|
||||
|
||||
import GEmolumentoItemIndex from "@/packages/administrativo/components/GEmolumentoItem/GEmolumentoItemIndex";
|
||||
import GEmolumentoItemIndex from '@/packages/administrativo/components/GEmolumentoItem/GEmolumentoItemIndex';
|
||||
|
||||
export default function GGramaticaPage() {
|
||||
|
||||
const params = useParams();
|
||||
|
||||
return (
|
||||
|
|
@ -14,5 +13,4 @@ export default function GGramaticaPage() {
|
|||
emolumento_periodo_id={Number(params.emolumentoPeriodoId)}
|
||||
/>
|
||||
);
|
||||
|
||||
}
|
||||
|
|
@ -1,9 +1,5 @@
|
|||
import GEmolumentoIndex from "@/packages/administrativo/components/GEmolumento/GEmolumentoIndex";
|
||||
import GEmolumentoIndex from '@/packages/administrativo/components/GEmolumento/GEmolumentoIndex';
|
||||
|
||||
export default function GEmolumentoPeriodoPage() {
|
||||
|
||||
return (
|
||||
<GEmolumentoIndex />
|
||||
);
|
||||
|
||||
return <GEmolumentoIndex />;
|
||||
}
|
||||
|
|
@ -1,9 +1,5 @@
|
|||
import GEmolumentoPeriodoIndex from "@/packages/administrativo/components/GEmolumentoPeriodo/GEmolumentoPeriodoIndex";
|
||||
import GEmolumentoPeriodoIndex from '@/packages/administrativo/components/GEmolumentoPeriodo/GEmolumentoPeriodoIndex';
|
||||
|
||||
export default function GEmolumentoPeriodoPage() {
|
||||
|
||||
return (
|
||||
<GEmolumentoPeriodoIndex />
|
||||
);
|
||||
|
||||
return <GEmolumentoPeriodoIndex />;
|
||||
}
|
||||
|
|
@ -1,9 +1,5 @@
|
|||
import GGramaticaIndex from "@/packages/administrativo/components/GGramatica/GGramaticaIndex";
|
||||
import GGramaticaIndex from '@/packages/administrativo/components/GGramatica/GGramaticaIndex';
|
||||
|
||||
export default function GGramaticaPage() {
|
||||
|
||||
return (
|
||||
<GGramaticaIndex />
|
||||
);
|
||||
|
||||
return <GGramaticaIndex />;
|
||||
}
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import TImovelDashboard from "@/packages/administrativo/components/TImovel/TImovelDashboard";
|
||||
import TImovelDashboard from '@/packages/administrativo/components/TImovel/TImovelDashboard';
|
||||
|
||||
export default function TImovelDashboardPage() {
|
||||
return (
|
||||
<TImovelDashboard />
|
||||
);
|
||||
return <TImovelDashboard />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import TPessoaDashboard from "@/packages/administrativo/components/TPessoa/TPessoaDashboard";
|
||||
import TPessoaDashboard from '@/packages/administrativo/components/TPessoa/TPessoaDashboard';
|
||||
|
||||
export default function TPessoaDashboardPage() {
|
||||
return (
|
||||
<TPessoaDashboard />
|
||||
);
|
||||
return <TPessoaDashboard />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
import GSeloGrupoIndex from "@/packages/administrativo/components/GSeloGrupo/GSeloGrupoIndex";
|
||||
import GSeloGrupoIndex from '@/packages/administrativo/components/GSeloGrupo/GSeloGrupoIndex';
|
||||
|
||||
export default function GSeloGrupoPage() {
|
||||
|
||||
return (
|
||||
<GSeloGrupoIndex />
|
||||
);
|
||||
|
||||
return <GSeloGrupoIndex />;
|
||||
}
|
||||
|
|
@ -1,9 +1,5 @@
|
|||
import TServicoTipoIndex from "@/packages/administrativo/components/TServicoTipo/TServicoTipoIndex";
|
||||
import TServicoTipoIndex from '@/packages/administrativo/components/TServicoTipo/TServicoTipoIndex';
|
||||
|
||||
export default function TServicoTipoPage() {
|
||||
|
||||
return (
|
||||
<TServicoTipoIndex />
|
||||
);
|
||||
|
||||
return <TServicoTipoIndex />;
|
||||
}
|
||||
|
|
@ -1,11 +1,5 @@
|
|||
import GNaturezaTituloIndex from "@/packages/administrativo/components/GNaturezaTitulo/GNaturezaTituloIndex";
|
||||
import GNaturezaTituloIndex from '@/packages/administrativo/components/GNaturezaTitulo/GNaturezaTituloIndex';
|
||||
|
||||
export default function GNaturezaPage() {
|
||||
|
||||
return (
|
||||
<GNaturezaTituloIndex
|
||||
sistema_id={2}
|
||||
/>
|
||||
);
|
||||
|
||||
return <GNaturezaTituloIndex sistema_id={2} />;
|
||||
}
|
||||
|
|
@ -19,7 +19,6 @@ import { Toaster } from '@/components/ui/sonner';
|
|||
import Response from '../../shared/components/response/response';
|
||||
import { ResponseProvider } from '../../shared/components/response/ResponseContext';
|
||||
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: '--font-geist-sans',
|
||||
subsets: ['latin'],
|
||||
|
|
@ -57,9 +56,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|||
<Breadcrumb>
|
||||
<BreadcrumbList>
|
||||
<BreadcrumbItem className="hidden md:block">
|
||||
<BreadcrumbLink href="#">
|
||||
Building Your Application
|
||||
</BreadcrumbLink>
|
||||
<BreadcrumbLink href="#">Building Your Application</BreadcrumbLink>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbSeparator className="hidden md:block" />
|
||||
<BreadcrumbItem>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,11 @@
|
|||
'use client'
|
||||
'use client';
|
||||
|
||||
import { useParams } from "next/navigation";
|
||||
import { useParams } from 'next/navigation';
|
||||
|
||||
import TServicoPedidoDetails from "@/packages/servicos/components/TServicoPedido/TServicoPedidoDetails";
|
||||
import TServicoPedidoDetails from '@/packages/servicos/components/TServicoPedido/TServicoPedidoDetails';
|
||||
|
||||
export default function TServicoPedidoDetailsPage() {
|
||||
|
||||
const params = useParams();
|
||||
|
||||
return (
|
||||
<TServicoPedidoDetails
|
||||
servico_pedido_id={Number(params.servicoPedidoId)}
|
||||
/>
|
||||
)
|
||||
return <TServicoPedidoDetails servico_pedido_id={Number(params.servicoPedidoId)} />;
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
import TServicoPedidoIndex from "@/packages/servicos/components/TServicoPedido/TServicoPedidoIndex";
|
||||
import TServicoPedidoIndex from '@/packages/servicos/components/TServicoPedido/TServicoPedidoIndex';
|
||||
|
||||
export default function TServicoPedidoPage() {
|
||||
return (
|
||||
<TServicoPedidoIndex />
|
||||
)
|
||||
return <TServicoPedidoIndex />;
|
||||
}
|
||||
|
|
@ -1,16 +1,11 @@
|
|||
'use client'
|
||||
'use client';
|
||||
|
||||
import { useParams } from "next/navigation";
|
||||
import { useParams } from 'next/navigation';
|
||||
|
||||
import TServicoPedidoForm from "@/packages/servicos/components/TServicoPedido/TServicoPedidoForm";
|
||||
import TServicoPedidoForm from '@/packages/servicos/components/TServicoPedido/TServicoPedidoForm';
|
||||
|
||||
export default function TServicoPedidoPage() {
|
||||
|
||||
const params = useParams();
|
||||
|
||||
return (
|
||||
<TServicoPedidoForm
|
||||
servico_pedido_id={Number(params.servicoPedidoId)}
|
||||
/>
|
||||
)
|
||||
return <TServicoPedidoForm servico_pedido_id={Number(params.servicoPedidoId)} />;
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
import TServicoPedidoForm from "@/packages/servicos/components/TServicoPedido/TServicoPedidoForm"
|
||||
import TServicoPedidoForm from '@/packages/servicos/components/TServicoPedido/TServicoPedidoForm';
|
||||
|
||||
export default function TServicoPedidoPage() {
|
||||
return (
|
||||
<TServicoPedidoForm />
|
||||
)
|
||||
return <TServicoPedidoForm />;
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
import TServicoPedidoDashboard from "@/packages/servicos/components/TServicoPedido/TServicoPedidoDashboard";
|
||||
import TServicoPedidoDashboard from '@/packages/servicos/components/TServicoPedido/TServicoPedidoDashboard';
|
||||
|
||||
export default function TServicoPedidoPage() {
|
||||
return (
|
||||
<TServicoPedidoDashboard />
|
||||
)
|
||||
return <TServicoPedidoDashboard />;
|
||||
}
|
||||
|
|
@ -6,39 +6,44 @@
|
|||
:root {
|
||||
--background: oklch(0.9911 0 0);
|
||||
--foreground: oklch(0.2988 0.0123 222.4429);
|
||||
--card: oklch(1.0000 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.2988 0.0123 222.4429);
|
||||
--popover: oklch(0.9881 0 0);
|
||||
--popover-foreground: oklch(0.2988 0.0123 222.4429);
|
||||
--primary: oklch(0.7210 0.1873 47.5640);
|
||||
--primary-foreground: oklch(1.0000 0 0);
|
||||
--primary: oklch(0.721 0.1873 47.564);
|
||||
--primary-foreground: oklch(1 0 0);
|
||||
--secondary: oklch(0.2988 0.0123 222.4429);
|
||||
--secondary-foreground: oklch(1.0000 0 0);
|
||||
--muted: oklch(0.9700 0 0);
|
||||
--muted-foreground: oklch(0.5560 0 0);
|
||||
--secondary-foreground: oklch(1 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.9551 0 0);
|
||||
--accent-foreground: oklch(0.2988 0.0123 222.4429);
|
||||
--destructive: oklch(0.5770 0.2450 27.3250);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--destructive-foreground: oklch(1 0 0);
|
||||
--border: oklch(0.9220 0 0);
|
||||
--input: oklch(0.9220 0 0);
|
||||
--ring: oklch(0.7080 0 0);
|
||||
--chart-1: oklch(0.8100 0.1000 252);
|
||||
--chart-2: oklch(0.6200 0.1900 260);
|
||||
--chart-3: oklch(0.5500 0.2200 263);
|
||||
--chart-4: oklch(0.4900 0.2200 264);
|
||||
--chart-5: oklch(0.4200 0.1800 266);
|
||||
--sidebar: oklch(1.0000 0 0);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.81 0.1 252);
|
||||
--chart-2: oklch(0.62 0.19 260);
|
||||
--chart-3: oklch(0.55 0.22 263);
|
||||
--chart-4: oklch(0.49 0.22 264);
|
||||
--chart-5: oklch(0.42 0.18 266);
|
||||
--sidebar: oklch(1 0 0);
|
||||
--sidebar-foreground: oklch(0.2988 0.0123 222.4429);
|
||||
--sidebar-primary: oklch(0.2364 0.0083 240.2365);
|
||||
--sidebar-primary-foreground: oklch(0.9850 0 0);
|
||||
--sidebar-accent: oklch(0.9700 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.2050 0 0);
|
||||
--sidebar-border: oklch(0.9220 0 0);
|
||||
--sidebar-ring: oklch(0.7080 0 0);
|
||||
--font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
||||
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
--font-sans:
|
||||
ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
||||
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
||||
'Segoe UI Symbol', 'Noto Color Emoji';
|
||||
--font-serif: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;
|
||||
--font-mono:
|
||||
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
|
||||
monospace;
|
||||
--radius: 0.625rem;
|
||||
--shadow-x: 0;
|
||||
--shadow-y: 1px;
|
||||
|
|
@ -48,11 +53,11 @@
|
|||
--shadow-color: oklch(0 0 0);
|
||||
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
|
||||
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
|
||||
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 2px 4px -1px hsl(0 0% 0% / 0.10);
|
||||
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 4px 6px -1px hsl(0 0% 0% / 0.10);
|
||||
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 8px 10px -1px hsl(0 0% 0% / 0.10);
|
||||
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
|
||||
--tracking-normal: 0em;
|
||||
--spacing: 0.25rem;
|
||||
|
|
@ -68,35 +73,40 @@
|
|||
--card-foreground: oklch(0.9881 0 0);
|
||||
--popover: oklch(0.2988 0.0123 222.4429);
|
||||
--popover-foreground: oklch(0.9881 0 0);
|
||||
--primary: oklch(0.7210 0.1873 47.5640);
|
||||
--primary: oklch(0.721 0.1873 47.564);
|
||||
--primary-foreground: oklch(0.2988 0.0123 222.4429);
|
||||
--secondary: oklch(0.2988 0.0123 222.4429);
|
||||
--secondary-foreground: oklch(1.0000 0 0);
|
||||
--muted: oklch(0.2690 0 0);
|
||||
--muted-foreground: oklch(0.7080 0 0);
|
||||
--secondary-foreground: oklch(1 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.2988 0.0123 222.4429);
|
||||
--accent-foreground: oklch(1.0000 0 0);
|
||||
--destructive: oklch(0.7040 0.1910 22.2160);
|
||||
--destructive-foreground: oklch(0.9850 0 0);
|
||||
--border: oklch(0.2750 0 0);
|
||||
--input: oklch(0.3250 0 0);
|
||||
--ring: oklch(0.5560 0 0);
|
||||
--chart-1: oklch(0.8100 0.1000 252);
|
||||
--chart-2: oklch(0.6200 0.1900 260);
|
||||
--chart-3: oklch(0.5500 0.2200 263);
|
||||
--chart-4: oklch(0.4900 0.2200 264);
|
||||
--chart-5: oklch(0.4200 0.1800 266);
|
||||
--accent-foreground: oklch(1 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--destructive-foreground: oklch(0.985 0 0);
|
||||
--border: oklch(0.275 0 0);
|
||||
--input: oklch(0.325 0 0);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.81 0.1 252);
|
||||
--chart-2: oklch(0.62 0.19 260);
|
||||
--chart-3: oklch(0.55 0.22 263);
|
||||
--chart-4: oklch(0.49 0.22 264);
|
||||
--chart-5: oklch(0.42 0.18 266);
|
||||
--sidebar: oklch(0.2364 0.0083 240.2365);
|
||||
--sidebar-foreground: oklch(0.9881 0 0);
|
||||
--sidebar-primary: oklch(0.4880 0.2430 264.3760);
|
||||
--sidebar-primary-foreground: oklch(0.9850 0 0);
|
||||
--sidebar-accent: oklch(0.2690 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.9850 0 0);
|
||||
--sidebar-border: oklch(0.2750 0 0);
|
||||
--sidebar-ring: oklch(0.4390 0 0);
|
||||
--font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
||||
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(0.275 0 0);
|
||||
--sidebar-ring: oklch(0.439 0 0);
|
||||
--font-sans:
|
||||
ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
||||
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
||||
'Segoe UI Symbol', 'Noto Color Emoji';
|
||||
--font-serif: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;
|
||||
--font-mono:
|
||||
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
|
||||
monospace;
|
||||
--radius: 0.625rem;
|
||||
--shadow-x: 0;
|
||||
--shadow-y: 1px;
|
||||
|
|
@ -106,11 +116,11 @@
|
|||
--shadow-color: oklch(0 0 0);
|
||||
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
|
||||
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
|
||||
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 2px 4px -1px hsl(0 0% 0% / 0.10);
|
||||
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 4px 6px -1px hsl(0 0% 0% / 0.10);
|
||||
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 8px 10px -1px hsl(0 0% 0% / 0.10);
|
||||
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
|
||||
--shadow-offset-x: 0;
|
||||
--shadow-offset-y: 1px;
|
||||
|
|
@ -152,9 +162,14 @@
|
|||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
|
||||
--font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
||||
--font-sans:
|
||||
ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
||||
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
||||
'Segoe UI Symbol', 'Noto Color Emoji';
|
||||
--font-mono:
|
||||
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
|
||||
monospace;
|
||||
--font-serif: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;
|
||||
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import {
|
|||
HouseIcon,
|
||||
SquareMousePointer,
|
||||
SquareTerminal,
|
||||
UsersIcon
|
||||
UsersIcon,
|
||||
} from 'lucide-react';
|
||||
import Image from 'next/image';
|
||||
import * as React from 'react';
|
||||
|
|
@ -27,8 +27,6 @@ import {
|
|||
} from '@/components/ui/sidebar';
|
||||
import useGUsuarioGetJWTHook from '@/shared/hooks/auth/useGUsuarioGetJWTHook';
|
||||
|
||||
|
||||
|
||||
// This is sample data.
|
||||
const data = {
|
||||
teams: [],
|
||||
|
|
@ -179,33 +177,33 @@ const data = {
|
|||
url: '/administrativo/atos/partes-tipos',
|
||||
},
|
||||
{
|
||||
title: "Valores de Serviços",
|
||||
url: "/administrativo/valores-de-servicos",
|
||||
title: 'Valores de Serviços',
|
||||
url: '/administrativo/valores-de-servicos',
|
||||
},
|
||||
{
|
||||
title: "Gramatica",
|
||||
url: "/administrativo/gramatica",
|
||||
title: 'Gramatica',
|
||||
url: '/administrativo/gramatica',
|
||||
},
|
||||
{
|
||||
title: "Cartório",
|
||||
url: "/administrativo/cartorio",
|
||||
title: 'Cartório',
|
||||
url: '/administrativo/cartorio',
|
||||
},
|
||||
{
|
||||
title: "Financeiro/Periodo",
|
||||
url: "/administrativo/financeiro/periodos",
|
||||
title: 'Financeiro/Periodo',
|
||||
url: '/administrativo/financeiro/periodos',
|
||||
},
|
||||
{
|
||||
title: "Financeiro/Emolumentos",
|
||||
url: "/administrativo/financeiro/emolumentos",
|
||||
title: 'Financeiro/Emolumentos',
|
||||
url: '/administrativo/financeiro/emolumentos',
|
||||
},
|
||||
{
|
||||
title: "Selos/Grupos",
|
||||
url: "/administrativo/selos/grupos",
|
||||
title: 'Selos/Grupos',
|
||||
url: '/administrativo/selos/grupos',
|
||||
},
|
||||
{
|
||||
title: "Financeiro/Cálculo Rápido",
|
||||
url: "/administrativo/financeiro/calculo-rapido",
|
||||
}
|
||||
title: 'Financeiro/Cálculo Rápido',
|
||||
url: '/administrativo/financeiro/calculo-rapido',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
|||
import { Button } from './ui/button';
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from './ui/form';
|
||||
|
||||
|
||||
type FormValues = z.infer<typeof GUsuarioLoginSchema>;
|
||||
|
||||
export function LoginForm({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import {
|
||||
ChevronsUpDown,
|
||||
LogOut,
|
||||
Moon,
|
||||
Sparkles,
|
||||
Sun,
|
||||
} from 'lucide-react';
|
||||
import { ChevronsUpDown, LogOut, Moon, Sparkles, Sun } from 'lucide-react';
|
||||
import { useTheme } from 'next-themes';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
|
|
@ -75,9 +69,7 @@ export function NavUser({ user }: { user: GUsuarioAuthenticatedInterface }) {
|
|||
>
|
||||
<Avatar className="h-8 w-8 rounded-lg">
|
||||
<AvatarImage src={user.sigla} alt={user.nome} />
|
||||
<AvatarFallback className="rounded-lg">
|
||||
{user.sigla}
|
||||
</AvatarFallback>
|
||||
<AvatarFallback className="rounded-lg">{user.sigla}</AvatarFallback>
|
||||
</Avatar>
|
||||
|
||||
<div className="grid flex-1 text-left text-sm leading-tight">
|
||||
|
|
@ -99,9 +91,7 @@ export function NavUser({ user }: { user: GUsuarioAuthenticatedInterface }) {
|
|||
<div className="flex items-center gap-2 px-1 py-1.5 text-left text-sm">
|
||||
<Avatar className="h-8 w-8 rounded-lg">
|
||||
<AvatarImage src={user.sigla} alt={user.nome} />
|
||||
<AvatarFallback className="rounded-lg">
|
||||
{user.sigla}
|
||||
</AvatarFallback>
|
||||
<AvatarFallback className="rounded-lg">{user.sigla}</AvatarFallback>
|
||||
</Avatar>
|
||||
|
||||
<div className="grid flex-1 text-left text-sm leading-tight">
|
||||
|
|
@ -115,15 +105,8 @@ export function NavUser({ user }: { user: GUsuarioAuthenticatedInterface }) {
|
|||
|
||||
<DropdownMenuGroup>
|
||||
{/* Alternância de tema */}
|
||||
<DropdownMenuItem
|
||||
className="cursor-pointer"
|
||||
onClick={handleToggleTheme}
|
||||
>
|
||||
{isDark ? (
|
||||
<Sun className="mr-2 h-4 w-4" />
|
||||
) : (
|
||||
<Moon className="mr-2 h-4 w-4" />
|
||||
)}
|
||||
<DropdownMenuItem className="cursor-pointer" onClick={handleToggleTheme}>
|
||||
{isDark ? <Sun className="mr-2 h-4 w-4" /> : <Moon className="mr-2 h-4 w-4" />}
|
||||
{isDark ? 'Modo claro' : 'Modo escuro'}
|
||||
</DropdownMenuItem>
|
||||
|
||||
|
|
@ -135,10 +118,7 @@ export function NavUser({ user }: { user: GUsuarioAuthenticatedInterface }) {
|
|||
|
||||
<DropdownMenuSeparator />
|
||||
|
||||
<DropdownMenuItem
|
||||
className="cursor-pointer"
|
||||
onClick={handleConfirmOpen}
|
||||
>
|
||||
<DropdownMenuItem className="cursor-pointer" onClick={handleConfirmOpen}>
|
||||
<LogOut className="mr-2 h-4 w-4" />
|
||||
Log out
|
||||
</DropdownMenuItem>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use client";
|
||||
'use client';
|
||||
|
||||
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
||||
import * as React from "react";
|
||||
import { ThemeProvider as NextThemesProvider } from 'next-themes';
|
||||
import * as React from 'react';
|
||||
|
||||
export function ThemeProvider({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,46 +1,39 @@
|
|||
import { Slot } from "@radix-ui/react-slot"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import * as React from "react"
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const badgeVariants = cva(
|
||||
"inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
||||
'inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden',
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default:
|
||||
"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
||||
default: 'border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90',
|
||||
secondary:
|
||||
"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
||||
'border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90',
|
||||
destructive:
|
||||
"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
||||
outline:
|
||||
"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
||||
'border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
||||
outline: 'text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
variant: 'default',
|
||||
},
|
||||
}
|
||||
)
|
||||
},
|
||||
);
|
||||
|
||||
function Badge({
|
||||
className,
|
||||
variant,
|
||||
asChild = false,
|
||||
...props
|
||||
}: React.ComponentProps<"span"> &
|
||||
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
||||
const Comp = asChild ? Slot : "span"
|
||||
}: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
||||
const Comp = asChild ? Slot : 'span';
|
||||
|
||||
return (
|
||||
<Comp
|
||||
data-slot="badge"
|
||||
className={cn(badgeVariants({ variant }), className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
<Comp data-slot="badge" className={cn(badgeVariants({ variant }), className)} {...props} />
|
||||
);
|
||||
}
|
||||
|
||||
export { Badge, badgeVariants }
|
||||
export { Badge, badgeVariants };
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { Slot } from "@radix-ui/react-slot"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const buttonGroupVariants = cva(
|
||||
"flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",
|
||||
|
|
@ -10,22 +10,22 @@ const buttonGroupVariants = cva(
|
|||
variants: {
|
||||
orientation: {
|
||||
horizontal:
|
||||
"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
|
||||
'[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none',
|
||||
vertical:
|
||||
"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none",
|
||||
'flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
orientation: "horizontal",
|
||||
orientation: 'horizontal',
|
||||
},
|
||||
}
|
||||
)
|
||||
},
|
||||
);
|
||||
|
||||
function ButtonGroup({
|
||||
className,
|
||||
orientation,
|
||||
...props
|
||||
}: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
|
||||
}: React.ComponentProps<'div'> & VariantProps<typeof buttonGroupVariants>) {
|
||||
return (
|
||||
<div
|
||||
role="group"
|
||||
|
|
@ -34,32 +34,32 @@ function ButtonGroup({
|
|||
className={cn(buttonGroupVariants({ orientation }), className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function ButtonGroupText({
|
||||
className,
|
||||
asChild = false,
|
||||
...props
|
||||
}: React.ComponentProps<"div"> & {
|
||||
asChild?: boolean
|
||||
}: React.ComponentProps<'div'> & {
|
||||
asChild?: boolean;
|
||||
}) {
|
||||
const Comp = asChild ? Slot : "div"
|
||||
const Comp = asChild ? Slot : 'div';
|
||||
|
||||
return (
|
||||
<Comp
|
||||
className={cn(
|
||||
"bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
||||
className
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function ButtonGroupSeparator({
|
||||
className,
|
||||
orientation = "vertical",
|
||||
orientation = 'vertical',
|
||||
...props
|
||||
}: React.ComponentProps<typeof Separator>) {
|
||||
return (
|
||||
|
|
@ -67,17 +67,12 @@ function ButtonGroupSeparator({
|
|||
data-slot="button-group-separator"
|
||||
orientation={orientation}
|
||||
className={cn(
|
||||
"bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto",
|
||||
className
|
||||
'bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
ButtonGroup,
|
||||
ButtonGroupSeparator,
|
||||
ButtonGroupText,
|
||||
buttonGroupVariants,
|
||||
}
|
||||
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
|
||||
|
|
|
|||
|
|
@ -1,40 +1,38 @@
|
|||
import { Slot } from "@radix-ui/react-slot"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import * as React from "react"
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const buttonVariants = cva(
|
||||
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
||||
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
||||
destructive:
|
||||
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
||||
'bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
||||
outline:
|
||||
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
||||
secondary:
|
||||
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
||||
ghost:
|
||||
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
||||
link: "text-primary underline-offset-4 hover:underline",
|
||||
'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
||||
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
||||
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
||||
link: 'text-primary underline-offset-4 hover:underline',
|
||||
},
|
||||
size: {
|
||||
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
||||
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
||||
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
||||
icon: "size-9",
|
||||
"icon-sm": "size-8",
|
||||
"icon-lg": "size-10",
|
||||
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
||||
sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',
|
||||
lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
|
||||
icon: 'size-9',
|
||||
'icon-sm': 'size-8',
|
||||
'icon-lg': 'size-10',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
size: "default",
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
},
|
||||
}
|
||||
)
|
||||
},
|
||||
);
|
||||
|
||||
function Button({
|
||||
className,
|
||||
|
|
@ -42,11 +40,11 @@ function Button({
|
|||
size,
|
||||
asChild = false,
|
||||
...props
|
||||
}: React.ComponentProps<"button"> &
|
||||
}: React.ComponentProps<'button'> &
|
||||
VariantProps<typeof buttonVariants> & {
|
||||
asChild?: boolean
|
||||
asChild?: boolean;
|
||||
}) {
|
||||
const Comp = asChild ? Slot : "button"
|
||||
const Comp = asChild ? Slot : 'button';
|
||||
|
||||
return (
|
||||
<Comp
|
||||
|
|
@ -54,7 +52,7 @@ function Button({
|
|||
className={cn(buttonVariants({ variant, size, className }))}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export { Button, buttonVariants }
|
||||
export { Button, buttonVariants };
|
||||
|
|
|
|||
|
|
@ -1,92 +1,75 @@
|
|||
import * as React from "react"
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function Card({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card"
|
||||
className={cn(
|
||||
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
||||
className
|
||||
'bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-header"
|
||||
className={cn(
|
||||
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
||||
className
|
||||
'@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-title"
|
||||
className={cn("leading-none font-semibold", className)}
|
||||
className={cn('leading-none font-semibold', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function CardDescription({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-description"
|
||||
className={cn("text-muted-foreground text-sm", className)}
|
||||
className={cn('text-muted-foreground text-sm', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function CardAction({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-action"
|
||||
className={cn(
|
||||
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
||||
className
|
||||
)}
|
||||
className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-content"
|
||||
className={cn("px-6", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return <div data-slot="card-content" className={cn('px-6', className)} {...props} />;
|
||||
}
|
||||
|
||||
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-footer"
|
||||
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
||||
className={cn('flex items-center px-6 [.border-t]:pt-6', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
Card,
|
||||
CardHeader,
|
||||
CardFooter,
|
||||
CardTitle,
|
||||
CardAction,
|
||||
CardDescription,
|
||||
CardContent,
|
||||
}
|
||||
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent };
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const ChartTooltip = RechartsPrimitive.Tooltip
|
||||
const ChartTooltip = RechartsPrimitive.Tooltip;
|
||||
|
||||
function ChartTooltipContent(props: any) {
|
||||
const {
|
||||
active,
|
||||
payload,
|
||||
className,
|
||||
indicator = "dot",
|
||||
indicator = 'dot',
|
||||
hideLabel = false,
|
||||
hideIndicator = false,
|
||||
label,
|
||||
|
|
@ -15,74 +15,64 @@ function ChartTooltipContent(props: any) {
|
|||
color,
|
||||
nameKey,
|
||||
labelKey,
|
||||
} = props
|
||||
} = props;
|
||||
|
||||
const { config } = useChart()
|
||||
const { config } = useChart();
|
||||
|
||||
const tooltipLabel = React.useMemo(() => {
|
||||
if (hideLabel || !payload?.length) {
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
|
||||
const [item] = payload
|
||||
const key = `${labelKey || item?.dataKey || item?.name || "value"}`
|
||||
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
||||
const [item] = payload;
|
||||
const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;
|
||||
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
||||
const value =
|
||||
!labelKey && typeof label === "string"
|
||||
!labelKey && typeof label === 'string'
|
||||
? config[label as keyof typeof config]?.label || label
|
||||
: itemConfig?.label
|
||||
: itemConfig?.label;
|
||||
|
||||
if (labelFormatter) {
|
||||
return (
|
||||
<div className={cn("font-medium", labelClassName)}>
|
||||
{labelFormatter(value, payload)}
|
||||
</div>
|
||||
)
|
||||
<div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
|
||||
return <div className={cn("font-medium", labelClassName)}>{value}</div>
|
||||
}, [
|
||||
label,
|
||||
labelFormatter,
|
||||
payload,
|
||||
hideLabel,
|
||||
labelClassName,
|
||||
config,
|
||||
labelKey,
|
||||
])
|
||||
return <div className={cn('font-medium', labelClassName)}>{value}</div>;
|
||||
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
||||
|
||||
if (!active || !payload?.length) {
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
|
||||
const nestLabel = payload.length === 1 && indicator !== "dot"
|
||||
const nestLabel = payload.length === 1 && indicator !== 'dot';
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
|
||||
className
|
||||
'border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{!nestLabel ? tooltipLabel : null}
|
||||
<div className="grid gap-1.5">
|
||||
{payload
|
||||
.filter((item: any) => item.type !== "none")
|
||||
.filter((item: any) => item.type !== 'none')
|
||||
.map((item: any, index: number) => {
|
||||
const key = `${nameKey || item.name || item.dataKey || "value"}`
|
||||
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
||||
const indicatorColor = color || item.payload?.fill || item.color
|
||||
const key = `${nameKey || item.name || item.dataKey || 'value'}`;
|
||||
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
||||
const indicatorColor = color || item.payload?.fill || item.color;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={item.dataKey}
|
||||
className={cn(
|
||||
"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
|
||||
indicator === "dot" && "items-center"
|
||||
'[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5',
|
||||
indicator === 'dot' && 'items-center',
|
||||
)}
|
||||
>
|
||||
{formatter && item?.value !== undefined && item.name ? (
|
||||
|
|
@ -95,19 +85,19 @@ function ChartTooltipContent(props: any) {
|
|||
!hideIndicator && (
|
||||
<div
|
||||
className={cn(
|
||||
"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
|
||||
'shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)',
|
||||
{
|
||||
"h-2.5 w-2.5": indicator === "dot",
|
||||
"w-1": indicator === "line",
|
||||
"w-0 border-[1.5px] border-dashed bg-transparent":
|
||||
indicator === "dashed",
|
||||
"my-0.5": nestLabel && indicator === "dashed",
|
||||
}
|
||||
'h-2.5 w-2.5': indicator === 'dot',
|
||||
'w-1': indicator === 'line',
|
||||
'w-0 border-[1.5px] border-dashed bg-transparent':
|
||||
indicator === 'dashed',
|
||||
'my-0.5': nestLabel && indicator === 'dashed',
|
||||
},
|
||||
)}
|
||||
style={
|
||||
{
|
||||
"--color-bg": indicatorColor,
|
||||
"--color-border": indicatorColor,
|
||||
'--color-bg': indicatorColor,
|
||||
'--color-border': indicatorColor,
|
||||
} as React.CSSProperties
|
||||
}
|
||||
/>
|
||||
|
|
@ -115,8 +105,8 @@ function ChartTooltipContent(props: any) {
|
|||
)}
|
||||
<div
|
||||
className={cn(
|
||||
"flex flex-1 justify-between leading-none",
|
||||
nestLabel ? "items-end" : "items-center"
|
||||
'flex flex-1 justify-between leading-none',
|
||||
nestLabel ? 'items-end' : 'items-center',
|
||||
)}
|
||||
>
|
||||
<div className="grid gap-1.5">
|
||||
|
|
@ -134,9 +124,9 @@ function ChartTooltipContent(props: any) {
|
|||
</>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
import * as React from "react"
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
||||
function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
||||
return (
|
||||
<input
|
||||
type={type}
|
||||
data-slot="input"
|
||||
className={cn(
|
||||
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
||||
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
||||
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
className
|
||||
'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
|
||||
'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
|
||||
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export { Input }
|
||||
export { Input };
|
||||
|
|
|
|||
|
|
@ -1,65 +1,61 @@
|
|||
import { Slot } from "@radix-ui/react-slot"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import * as React from "react"
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
import * as React from 'react';
|
||||
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function ItemGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
role="list"
|
||||
data-slot="item-group"
|
||||
className={cn("group/item-group flex flex-col", className)}
|
||||
className={cn('group/item-group flex flex-col', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function ItemSeparator({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof Separator>) {
|
||||
function ItemSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {
|
||||
return (
|
||||
<Separator
|
||||
data-slot="item-separator"
|
||||
orientation="horizontal"
|
||||
className={cn("my-0", className)}
|
||||
className={cn('my-0', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const itemVariants = cva(
|
||||
"group/item flex items-center border border-transparent text-sm rounded-md transition-colors [a]:hover:bg-accent/50 [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
||||
'group/item flex items-center border border-transparent text-sm rounded-md transition-colors [a]:hover:bg-accent/50 [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-transparent",
|
||||
outline: "border-border",
|
||||
muted: "bg-muted/50",
|
||||
default: 'bg-transparent',
|
||||
outline: 'border-border',
|
||||
muted: 'bg-muted/50',
|
||||
},
|
||||
size: {
|
||||
default: "p-4 gap-4 ",
|
||||
sm: "py-3 px-4 gap-2.5",
|
||||
default: 'p-4 gap-4 ',
|
||||
sm: 'py-3 px-4 gap-2.5',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
size: "default",
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
},
|
||||
}
|
||||
)
|
||||
},
|
||||
);
|
||||
|
||||
function Item({
|
||||
className,
|
||||
variant = "default",
|
||||
size = "default",
|
||||
variant = 'default',
|
||||
size = 'default',
|
||||
asChild = false,
|
||||
...props
|
||||
}: React.ComponentProps<"div"> &
|
||||
VariantProps<typeof itemVariants> & { asChild?: boolean }) {
|
||||
const Comp = asChild ? Slot : "div"
|
||||
}: React.ComponentProps<'div'> & VariantProps<typeof itemVariants> & { asChild?: boolean }) {
|
||||
const Comp = asChild ? Slot : 'div';
|
||||
return (
|
||||
<Comp
|
||||
data-slot="item"
|
||||
|
|
@ -68,31 +64,30 @@ function Item({
|
|||
className={cn(itemVariants({ variant, size, className }))}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const itemMediaVariants = cva(
|
||||
"flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5",
|
||||
'flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5',
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-transparent",
|
||||
default: 'bg-transparent',
|
||||
icon: "size-8 border rounded-sm bg-muted [&_svg:not([class*='size-'])]:size-4",
|
||||
image:
|
||||
"size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover",
|
||||
image: 'size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
variant: 'default',
|
||||
},
|
||||
}
|
||||
)
|
||||
},
|
||||
);
|
||||
|
||||
function ItemMedia({
|
||||
className,
|
||||
variant = "default",
|
||||
variant = 'default',
|
||||
...props
|
||||
}: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>) {
|
||||
}: React.ComponentProps<'div'> & VariantProps<typeof itemMediaVariants>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="item-media"
|
||||
|
|
@ -100,83 +95,67 @@ function ItemMedia({
|
|||
className={cn(itemMediaVariants({ variant, className }))}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function ItemContent({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="item-content"
|
||||
className={cn(
|
||||
"flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none",
|
||||
className
|
||||
)}
|
||||
className={cn('flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function ItemTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="item-title"
|
||||
className={cn(
|
||||
"flex w-fit items-center gap-2 text-sm leading-snug font-medium",
|
||||
className
|
||||
)}
|
||||
className={cn('flex w-fit items-center gap-2 text-sm leading-snug font-medium', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function ItemDescription({ className, ...props }: React.ComponentProps<"p">) {
|
||||
function ItemDescription({ className, ...props }: React.ComponentProps<'p'>) {
|
||||
return (
|
||||
<p
|
||||
data-slot="item-description"
|
||||
className={cn(
|
||||
"text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance",
|
||||
"[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
|
||||
className
|
||||
'text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance',
|
||||
'[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function ItemActions({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="item-actions"
|
||||
className={cn("flex items-center gap-2", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
<div data-slot="item-actions" className={cn('flex items-center gap-2', className)} {...props} />
|
||||
);
|
||||
}
|
||||
|
||||
function ItemHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function ItemHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="item-header"
|
||||
className={cn(
|
||||
"flex basis-full items-center justify-between gap-2",
|
||||
className
|
||||
)}
|
||||
className={cn('flex basis-full items-center justify-between gap-2', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function ItemFooter({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function ItemFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="item-footer"
|
||||
className={cn(
|
||||
"flex basis-full items-center justify-between gap-2",
|
||||
className
|
||||
)}
|
||||
className={cn('flex basis-full items-center justify-between gap-2', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
|
|
@ -190,4 +169,4 @@ export {
|
|||
ItemDescription,
|
||||
ItemHeader,
|
||||
ItemFooter,
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
"use client"
|
||||
'use client';
|
||||
|
||||
import * as ProgressPrimitive from "@radix-ui/react-progress"
|
||||
import * as React from "react"
|
||||
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
function Progress({
|
||||
className,
|
||||
|
|
@ -13,10 +13,7 @@ function Progress({
|
|||
return (
|
||||
<ProgressPrimitive.Root
|
||||
data-slot="progress"
|
||||
className={cn(
|
||||
"bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",
|
||||
className
|
||||
)}
|
||||
className={cn('bg-primary/20 relative h-2 w-full overflow-hidden rounded-full', className)}
|
||||
{...props}
|
||||
>
|
||||
<ProgressPrimitive.Indicator
|
||||
|
|
@ -25,7 +22,7 @@ function Progress({
|
|||
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
||||
/>
|
||||
</ProgressPrimitive.Root>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export { Progress }
|
||||
export { Progress };
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
"use client"
|
||||
'use client';
|
||||
|
||||
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
|
||||
import * as React from "react"
|
||||
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
function ScrollArea({
|
||||
className,
|
||||
|
|
@ -13,7 +13,7 @@ function ScrollArea({
|
|||
return (
|
||||
<ScrollAreaPrimitive.Root
|
||||
data-slot="scroll-area"
|
||||
className={cn("relative", className)}
|
||||
className={cn('relative', className)}
|
||||
{...props}
|
||||
>
|
||||
<ScrollAreaPrimitive.Viewport
|
||||
|
|
@ -25,12 +25,12 @@ function ScrollArea({
|
|||
<ScrollBar />
|
||||
<ScrollAreaPrimitive.Corner />
|
||||
</ScrollAreaPrimitive.Root>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function ScrollBar({
|
||||
className,
|
||||
orientation = "vertical",
|
||||
orientation = 'vertical',
|
||||
...props
|
||||
}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
|
||||
return (
|
||||
|
|
@ -38,12 +38,10 @@ function ScrollBar({
|
|||
data-slot="scroll-area-scrollbar"
|
||||
orientation={orientation}
|
||||
className={cn(
|
||||
"flex touch-none p-px transition-colors select-none",
|
||||
orientation === "vertical" &&
|
||||
"h-full w-2.5 border-l border-l-transparent",
|
||||
orientation === "horizontal" &&
|
||||
"h-2.5 flex-col border-t border-t-transparent",
|
||||
className
|
||||
'flex touch-none p-px transition-colors select-none',
|
||||
orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent',
|
||||
orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
|
|
@ -52,7 +50,7 @@ function ScrollBar({
|
|||
className="bg-border relative flex-1 rounded-full"
|
||||
/>
|
||||
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export { ScrollArea, ScrollBar }
|
||||
export { ScrollArea, ScrollBar };
|
||||
|
|
|
|||
|
|
@ -1,36 +1,30 @@
|
|||
"use client"
|
||||
'use client';
|
||||
|
||||
import * as SelectPrimitive from "@radix-ui/react-select"
|
||||
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"
|
||||
import * as React from "react"
|
||||
import * as SelectPrimitive from '@radix-ui/react-select';
|
||||
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
function Select({
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
||||
return <SelectPrimitive.Root data-slot="select" {...props} />
|
||||
function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
||||
return <SelectPrimitive.Root data-slot="select" {...props} />;
|
||||
}
|
||||
|
||||
function SelectGroup({
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
||||
return <SelectPrimitive.Group data-slot="select-group" {...props} />
|
||||
function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
||||
return <SelectPrimitive.Group data-slot="select-group" {...props} />;
|
||||
}
|
||||
|
||||
function SelectValue({
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
||||
return <SelectPrimitive.Value data-slot="select-value" {...props} />
|
||||
function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
||||
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
|
||||
}
|
||||
|
||||
function SelectTrigger({
|
||||
className,
|
||||
size = "default",
|
||||
size = 'default',
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
||||
size?: "sm" | "default"
|
||||
size?: 'sm' | 'default';
|
||||
}) {
|
||||
return (
|
||||
<SelectPrimitive.Trigger
|
||||
|
|
@ -38,7 +32,7 @@ function SelectTrigger({
|
|||
data-size={size}
|
||||
className={cn(
|
||||
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
className
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
|
|
@ -47,14 +41,14 @@ function SelectTrigger({
|
|||
<ChevronDownIcon className="size-4 opacity-50" />
|
||||
</SelectPrimitive.Icon>
|
||||
</SelectPrimitive.Trigger>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function SelectContent({
|
||||
className,
|
||||
children,
|
||||
position = "popper",
|
||||
align = "center",
|
||||
position = 'popper',
|
||||
align = 'center',
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
||||
return (
|
||||
|
|
@ -62,10 +56,10 @@ function SelectContent({
|
|||
<SelectPrimitive.Content
|
||||
data-slot="select-content"
|
||||
className={cn(
|
||||
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
||||
position === "popper" &&
|
||||
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
||||
className
|
||||
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md',
|
||||
position === 'popper' &&
|
||||
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
||||
className,
|
||||
)}
|
||||
position={position}
|
||||
align={align}
|
||||
|
|
@ -74,9 +68,9 @@ function SelectContent({
|
|||
<SelectScrollUpButton />
|
||||
<SelectPrimitive.Viewport
|
||||
className={cn(
|
||||
"p-1",
|
||||
position === "popper" &&
|
||||
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
||||
'p-1',
|
||||
position === 'popper' &&
|
||||
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1',
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
|
|
@ -84,20 +78,17 @@ function SelectContent({
|
|||
<SelectScrollDownButton />
|
||||
</SelectPrimitive.Content>
|
||||
</SelectPrimitive.Portal>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function SelectLabel({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
||||
function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
||||
return (
|
||||
<SelectPrimitive.Label
|
||||
data-slot="select-label"
|
||||
className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
|
||||
className={cn('text-muted-foreground px-2 py-1.5 text-xs', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function SelectItem({
|
||||
|
|
@ -110,7 +101,7 @@ function SelectItem({
|
|||
data-slot="select-item"
|
||||
className={cn(
|
||||
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
||||
className
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
|
|
@ -121,7 +112,7 @@ function SelectItem({
|
|||
</span>
|
||||
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
||||
</SelectPrimitive.Item>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function SelectSeparator({
|
||||
|
|
@ -131,10 +122,10 @@ function SelectSeparator({
|
|||
return (
|
||||
<SelectPrimitive.Separator
|
||||
data-slot="select-separator"
|
||||
className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
|
||||
className={cn('bg-border pointer-events-none -mx-1 my-1 h-px', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function SelectScrollUpButton({
|
||||
|
|
@ -144,15 +135,12 @@ function SelectScrollUpButton({
|
|||
return (
|
||||
<SelectPrimitive.ScrollUpButton
|
||||
data-slot="select-scroll-up-button"
|
||||
className={cn(
|
||||
"flex cursor-default items-center justify-center py-1",
|
||||
className
|
||||
)}
|
||||
className={cn('flex cursor-default items-center justify-center py-1', className)}
|
||||
{...props}
|
||||
>
|
||||
<ChevronUpIcon className="size-4" />
|
||||
</SelectPrimitive.ScrollUpButton>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function SelectScrollDownButton({
|
||||
|
|
@ -162,15 +150,12 @@ function SelectScrollDownButton({
|
|||
return (
|
||||
<SelectPrimitive.ScrollDownButton
|
||||
data-slot="select-scroll-down-button"
|
||||
className={cn(
|
||||
"flex cursor-default items-center justify-center py-1",
|
||||
className
|
||||
)}
|
||||
className={cn('flex cursor-default items-center justify-center py-1', className)}
|
||||
{...props}
|
||||
>
|
||||
<ChevronDownIcon className="size-4" />
|
||||
</SelectPrimitive.ScrollDownButton>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
|
|
@ -184,4 +169,4 @@ export {
|
|||
SelectSeparator,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
"use client"
|
||||
'use client';
|
||||
|
||||
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
||||
import * as React from "react"
|
||||
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
function Separator({
|
||||
className,
|
||||
orientation = "horizontal",
|
||||
orientation = 'horizontal',
|
||||
decorative = true,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
||||
|
|
@ -17,12 +17,12 @@ function Separator({
|
|||
decorative={decorative}
|
||||
orientation={orientation}
|
||||
className={cn(
|
||||
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
||||
className
|
||||
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export { Separator }
|
||||
export { Separator };
|
||||
|
|
|
|||
|
|
@ -690,6 +690,5 @@ export {
|
|||
SidebarRail,
|
||||
SidebarSeparator,
|
||||
SidebarTrigger,
|
||||
useSidebar
|
||||
useSidebar,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,13 +14,11 @@ import GCalculoInterface from '@/packages/administrativo/interfaces/GCalculo/GCa
|
|||
import GetCapitalize from '@/shared/actions/text/GetCapitalize';
|
||||
import { SortableHeader } from '@/shared/components/dataTable/SortableHeader';
|
||||
|
||||
|
||||
export default function GCalculoColumns(
|
||||
onEdit: (item: GCalculoInterface, isEditingFormStatus: boolean) => void,
|
||||
onDelete: (item: GCalculoInterface, isEditingFormStatus: boolean) => void,
|
||||
): ColumnDef<GCalculoInterface>[] {
|
||||
return [
|
||||
|
||||
// Descrição
|
||||
{
|
||||
accessorKey: 'apresentante',
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ export default function GCalculoForm({
|
|||
onSave,
|
||||
buttonIsLoading,
|
||||
}: GCalculoFormInterface) {
|
||||
|
||||
const form = useGCalculoFormHook({});
|
||||
|
||||
// Atualiza o formulário quando recebe dados para edição
|
||||
|
|
@ -78,10 +77,7 @@ export default function GCalculoForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Apresentante</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
/>
|
||||
<Input {...field} type="text" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
@ -97,10 +93,7 @@ export default function GCalculoForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Observação</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
/>
|
||||
<Input {...field} type="text" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
@ -115,10 +108,7 @@ export default function GCalculoForm({
|
|||
render={({ field }) => (
|
||||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Emolumento</FormLabel>
|
||||
<GEmolumentoSelect
|
||||
field={field}
|
||||
sistema_id={2}
|
||||
/>
|
||||
<GEmolumentoSelect field={field} sistema_id={2} />
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
|
|
@ -133,10 +123,7 @@ export default function GCalculoForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Valor Documento</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="number"
|
||||
/>
|
||||
<Input {...field} type="number" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
@ -152,10 +139,7 @@ export default function GCalculoForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Quantidade</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="number"
|
||||
/>
|
||||
<Input {...field} type="number" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
|
||||
import { useGCalculoDeleteHook } from '@/packages/administrativo/hooks/GCalculo/useGCalculoDeleteHook';
|
||||
import { useGCalculoIndexHook } from '@/packages/administrativo/hooks/GCalculo/useGCalculoIndexHook';
|
||||
import { useGCalculoSaveHook } from '@/packages/administrativo/hooks/GCalculo/useGCalculoSaveHook';
|
||||
|
|
@ -15,7 +14,6 @@ import GCalculoForm from './GCalculoForm';
|
|||
import GCalculoTable from './GCalculoTable';
|
||||
|
||||
export default function GCalculoIndex() {
|
||||
|
||||
// Controle de estado do botão
|
||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||
|
||||
|
|
@ -96,9 +94,7 @@ export default function GCalculoIndex() {
|
|||
await deleteGCalculo(itemToDelete);
|
||||
|
||||
// Atualiza a lista de cálculos em memória, removendo o item pelo índice
|
||||
setGCalculo((prev) =>
|
||||
prev.filter((_, index) => index !== itemToDelete.index)
|
||||
);
|
||||
setGCalculo((prev) => prev.filter((_, index) => index !== itemToDelete.index));
|
||||
|
||||
// Limpa o item selecionado para exclusão
|
||||
setItemToDelete(null);
|
||||
|
|
@ -119,10 +115,7 @@ export default function GCalculoIndex() {
|
|||
}}
|
||||
/>
|
||||
{/* Tabela de andamentos */}
|
||||
<GCalculoTable
|
||||
data={gCalculo}
|
||||
onEdit={handleOpenForm}
|
||||
onDelete={handleConfirmDelete} />
|
||||
<GCalculoTable data={gCalculo} onEdit={handleOpenForm} onDelete={handleConfirmDelete} />
|
||||
{/* Modal de confirmação */}
|
||||
{isConfirmOpen && (
|
||||
<ConfirmDialog
|
||||
|
|
|
|||
|
|
@ -6,11 +6,9 @@ import { DataTable } from '@/shared/components/dataTable/DataTable';
|
|||
import GCalculoColumns from './GCalculoColumns';
|
||||
|
||||
export default function GCalculoTable({ data, onEdit, onDelete }: GCalculoTableInterface) {
|
||||
|
||||
const columns = GCalculoColumns(onEdit, onDelete);
|
||||
|
||||
return (
|
||||
|
||||
<div>
|
||||
<DataTable
|
||||
data={data}
|
||||
|
|
@ -19,6 +17,5 @@ export default function GCalculoTable({ data, onEdit, onDelete }: GCalculoTableI
|
|||
filterPlaceholder="Buscar por apresentante da natureza..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,7 +409,6 @@ export default function GCartorioForm({
|
|||
</form>
|
||||
</Form>
|
||||
</DialogContent>
|
||||
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
|
||||
|
||||
import { useGCartorioDeleteHook } from '@/packages/administrativo/hooks/GCartorio/useGCartorioDeleteHook';
|
||||
import { useGCartorioIndexHook } from '@/packages/administrativo/hooks/GCartorio/useGCartorioIndexHook';
|
||||
import { useGCartorioSaveHook } from '@/packages/administrativo/hooks/GCartorio/useGCartorioSaveHook';
|
||||
|
|
@ -16,7 +15,6 @@ import GCartorioForm from './GCartorioForm';
|
|||
import GCartorioTable from './GCartorioTable';
|
||||
|
||||
export default function GCartorioIndex() {
|
||||
|
||||
// Controle de estado do botão
|
||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@ export default function GEmolumentoColumns(
|
|||
onDelete: (item: GEmolumentoInterface, isEditingFormStatus: boolean) => void,
|
||||
emolumentoPeriodoId: number,
|
||||
): ColumnDef<GEmolumentoInterface>[] {
|
||||
|
||||
return [
|
||||
|
||||
// ID
|
||||
{
|
||||
accessorKey: 'emolumento_id',
|
||||
|
|
@ -60,7 +58,9 @@ export default function GEmolumentoColumns(
|
|||
</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem asChild>
|
||||
<Link href={`/administrativo/financeiro/emolumentos/${Number(row.getValue('emolumento_id'))}/${emolumentoPeriodoId}/itens`}>
|
||||
<Link
|
||||
href={`/administrativo/financeiro/emolumentos/${Number(row.getValue('emolumento_id'))}/${emolumentoPeriodoId}/itens`}
|
||||
>
|
||||
<ListIcon className="mr-2 h-4 w-4" />
|
||||
Itens
|
||||
</Link>
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ export default function GEmolumentoForm({
|
|||
control={form.control}
|
||||
name="selo_grupo_id"
|
||||
render={({ field }) => (
|
||||
<FormItem className='w-full'>
|
||||
<FormItem className="w-full">
|
||||
<FormLabel>Selo Grupo</FormLabel>
|
||||
<GSeloGrupoSelect field={field} />
|
||||
<FormMessage />
|
||||
|
|
@ -155,7 +155,7 @@ export default function GEmolumentoForm({
|
|||
control={form.control}
|
||||
name="reg_averb"
|
||||
render={({ field }) => (
|
||||
<FormItem className='w-full'>
|
||||
<FormItem className="w-full">
|
||||
<FormLabel>Registro/Averbação</FormLabel>
|
||||
<Input {...field} type="text" maxLength={1} />
|
||||
<FormMessage />
|
||||
|
|
@ -218,7 +218,8 @@ export default function GEmolumentoForm({
|
|||
<FormItem>
|
||||
<FormLabel>Código Nota</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field}
|
||||
<Input
|
||||
{...field}
|
||||
type="number"
|
||||
step="0.01"
|
||||
onChange={(e) => field.onChange(parseNumberInput(e))}
|
||||
|
|
@ -271,7 +272,8 @@ export default function GEmolumentoForm({
|
|||
<FormItem>
|
||||
<FormLabel>Valor Máximo Certidão</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field}
|
||||
<Input
|
||||
{...field}
|
||||
type="number"
|
||||
step="0.001"
|
||||
onChange={(e) => field.onChange(parseNumberInput(e))}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import GEmolumentoForm from './GEmolumentoForm';
|
|||
import GEmolumentoTable from './GEmolumentoTable';
|
||||
|
||||
export default function GEmolumentoIndex() {
|
||||
|
||||
// Controle de estado do botão
|
||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,10 @@ export default function GEmolumentoServicoSelect({
|
|||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
// Define parâmetros de leitura para o hook que busca os emolumentos
|
||||
const gEmolumentoReadParams: GEmolumentoReadInterface = { sistema_id, urlParams: { situacao: 'A' } };
|
||||
const gEmolumentoReadParams: GEmolumentoReadInterface = {
|
||||
sistema_id,
|
||||
urlParams: { situacao: 'A' },
|
||||
};
|
||||
const { gEmolumento = [], fetchGEmolumento } = useGEmolumentoReadHook();
|
||||
|
||||
/**
|
||||
|
|
@ -59,10 +62,7 @@ export default function GEmolumentoServicoSelect({
|
|||
* Memoriza o item selecionado para evitar reprocessamentos.
|
||||
*/
|
||||
const selected = useMemo(
|
||||
() =>
|
||||
gEmolumento.find(
|
||||
(item) => String(item.emolumento_id) === String(field?.value?.id ?? ''),
|
||||
),
|
||||
() => gEmolumento.find((item) => String(item.emolumento_id) === String(field?.value?.id ?? '')),
|
||||
[gEmolumento, field?.value],
|
||||
);
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ export default function GEmolumentoServicoSelect({
|
|||
aria-expanded={open}
|
||||
disabled={isLoading}
|
||||
className={cn(
|
||||
'justify-between min-h-[2.5rem] w-full text-left break-words whitespace-normal',
|
||||
'min-h-[2.5rem] w-full justify-between text-left break-words whitespace-normal',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
|
|
@ -133,8 +133,7 @@ export default function GEmolumentoServicoSelect({
|
|||
<CheckIcon
|
||||
className={cn(
|
||||
'mr-2 h-4 w-4',
|
||||
String(field?.value?.emolumento_id ?? '') ===
|
||||
String(item.emolumento_id)
|
||||
String(field?.value?.emolumento_id ?? '') === String(item.emolumento_id)
|
||||
? 'opacity-100'
|
||||
: 'opacity-0',
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -9,13 +9,17 @@ import GEmolumentoPeriodoSelect from '../GEmolumentoPeriodo/GEmolumentoPeriodoSe
|
|||
/**
|
||||
* Componente principal da tabela de Naturezas
|
||||
*/
|
||||
export default function GEmolumentoTable({ data, onEdit, onDelete, onSelectedEmolumentoPeriodo, emolumentoPeriodoId }: GEmolumentoTableInterface) {
|
||||
export default function GEmolumentoTable({
|
||||
data,
|
||||
onEdit,
|
||||
onDelete,
|
||||
onSelectedEmolumentoPeriodo,
|
||||
emolumentoPeriodoId,
|
||||
}: GEmolumentoTableInterface) {
|
||||
const columns = GEmolumentoColumns(onEdit, onDelete, emolumentoPeriodoId);
|
||||
return (
|
||||
<div>
|
||||
<GEmolumentoPeriodoSelect
|
||||
onSelectedEmolumentoPeriodo={onSelectedEmolumentoPeriodo}
|
||||
/>
|
||||
<GEmolumentoPeriodoSelect onSelectedEmolumentoPeriodo={onSelectedEmolumentoPeriodo} />
|
||||
<DataTable
|
||||
data={data}
|
||||
columns={columns}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ export default function GEmolumentoItemForm({
|
|||
onSave,
|
||||
buttonIsLoading,
|
||||
}: GEmolumentoItemFormInterface) {
|
||||
|
||||
// Inicializa o formulário
|
||||
const form = useGEmolumentoItemFormHook({});
|
||||
|
||||
|
|
@ -86,7 +85,8 @@ export default function GEmolumentoItemForm({
|
|||
<FormItem>
|
||||
<FormLabel>Valor Início</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field}
|
||||
<Input
|
||||
{...field}
|
||||
type="number"
|
||||
onChange={(e) => field.onChange(parseNumberInput(e))}
|
||||
/>
|
||||
|
|
@ -104,7 +104,8 @@ export default function GEmolumentoItemForm({
|
|||
<FormItem>
|
||||
<FormLabel>Valor Fim</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field}
|
||||
<Input
|
||||
{...field}
|
||||
type="number"
|
||||
onChange={(e) => field.onChange(parseNumberInput(e))}
|
||||
/>
|
||||
|
|
@ -122,7 +123,8 @@ export default function GEmolumentoItemForm({
|
|||
<FormItem>
|
||||
<FormLabel>Valor Taxa Judiciária</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field}
|
||||
<Input
|
||||
{...field}
|
||||
type="number"
|
||||
onChange={(e) => field.onChange(parseNumberInput(e))}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -12,16 +12,17 @@ import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDi
|
|||
import Loading from '@/shared/components/loading/loading';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
|
||||
import GEmolumentoItemForm from './GEmolumentoItemForm';
|
||||
import GEmolumentoItemTable from './GEmolumentoItemTable';
|
||||
|
||||
export default function GEmolumentoItemIndex({ emolumento_id, emolumento_periodo_id }: GEmolumentoItemIndexInterface) {
|
||||
|
||||
export default function GEmolumentoItemIndex({
|
||||
emolumento_id,
|
||||
emolumento_periodo_id,
|
||||
}: GEmolumentoItemIndexInterface) {
|
||||
const gEmolumentoItemParams = {
|
||||
emolumento_id: emolumento_id,
|
||||
emolumento_periodo_id: emolumento_periodo_id
|
||||
}
|
||||
emolumento_periodo_id: emolumento_periodo_id,
|
||||
};
|
||||
|
||||
// Controle de estado do botão
|
||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||
|
|
@ -48,7 +49,8 @@ export default function GEmolumentoItemIndex({ emolumento_id, emolumento_periodo
|
|||
*/
|
||||
const handleOpenForm = useCallback((data: GEmolumentoItemInterface | null) => {
|
||||
// Se não houver dados (criação), cria um objeto inicial com imovel_id
|
||||
const initialData: GEmolumentoItemInterface = data ?? ({ emolumento_id, emolumento_periodo_id } as GEmolumentoItemInterface);
|
||||
const initialData: GEmolumentoItemInterface =
|
||||
data ?? ({ emolumento_id, emolumento_periodo_id } as GEmolumentoItemInterface);
|
||||
setSelectedData(initialData);
|
||||
setIsFormOpen(true);
|
||||
}, []);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,11 @@ import GEmolumentoItemColumns from './GEmolumentoItemColumns';
|
|||
/**
|
||||
* Componente principal da tabela de Naturezas
|
||||
*/
|
||||
export default function GEmolumentoItemTable({ data, onEdit, onDelete }: GEmolumentoItemTableInterface) {
|
||||
export default function GEmolumentoItemTable({
|
||||
data,
|
||||
onEdit,
|
||||
onDelete,
|
||||
}: GEmolumentoItemTableInterface) {
|
||||
const columns = GEmolumentoItemColumns(onEdit, onDelete);
|
||||
return (
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -77,10 +77,7 @@ export default function GEmolumentoPeriodoForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Palavra</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
/>
|
||||
<Input {...field} type="text" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
|
||||
|
||||
import { useGEmolumentoPeriodoDeleteHook } from '@/packages/administrativo/hooks/GEmolumentoPeriodo/useGEmolumentoPeriodoDeleteHook';
|
||||
import { useGEmolumentoPeriodoIndexHook } from '@/packages/administrativo/hooks/GEmolumentoPeriodo/useGEmolumentoPeriodoIndexHook';
|
||||
import { useGEmolumentoPeriodoSaveHook } from '@/packages/administrativo/hooks/GEmolumentoPeriodo/useGEmolumentoPeriodoSaveHook';
|
||||
|
|
@ -16,7 +15,6 @@ import GEmolumentoPeriodoForm from './GEmolumentoPeriodoForm';
|
|||
import GEmolumentoPeriodoTable from './GEmolumentoPeriodoTable';
|
||||
|
||||
export default function GEmolumentoPeriodoIndex() {
|
||||
|
||||
// Controle de estado do botão
|
||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||
|
||||
|
|
@ -132,7 +130,11 @@ export default function GEmolumentoPeriodoIndex() {
|
|||
}}
|
||||
/>
|
||||
{/* Tabela de andamentos */}
|
||||
<GEmolumentoPeriodoTable data={gEmolumentoPeriodo} onEdit={handleOpenForm} onDelete={handleConfirmDelete} />
|
||||
<GEmolumentoPeriodoTable
|
||||
data={gEmolumentoPeriodo}
|
||||
onEdit={handleOpenForm}
|
||||
onDelete={handleConfirmDelete}
|
||||
/>
|
||||
{/* Modal de confirmação */}
|
||||
{isConfirmOpen && (
|
||||
<ConfirmDialog
|
||||
|
|
|
|||
|
|
@ -19,8 +19,9 @@ import GetCapitalize from '@/shared/actions/text/GetCapitalize';
|
|||
import { useGEmolumentoPeriodoIndexHook } from '../../hooks/GEmolumentoPeriodo/useGEmolumentoPeriodoIndexHook';
|
||||
import GEmolumentoPeriodoSelectInterface from '../../interfaces/GEmolumentoPeriodo/GEmolumentoPeriodoSelectInterface';
|
||||
|
||||
export default function GEmolumentoPeriodoSelect({ onSelectedEmolumentoPeriodo }: GEmolumentoPeriodoSelectInterface) {
|
||||
|
||||
export default function GEmolumentoPeriodoSelect({
|
||||
onSelectedEmolumentoPeriodo,
|
||||
}: GEmolumentoPeriodoSelectInterface) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [selectedId, setSelectedId] = useState<number | null>(null);
|
||||
|
|
@ -45,8 +46,9 @@ export default function GEmolumentoPeriodoSelect({ onSelectedEmolumentoPeriodo }
|
|||
// Item selecionado
|
||||
// ---------------------------------------------------------------------------
|
||||
const selected = useMemo(
|
||||
() => gEmolumentoPeriodo.find((b) => String(b.emolumento_periodo_id) === String(selectedId ?? '')),
|
||||
[gEmolumentoPeriodo, selectedId]
|
||||
() =>
|
||||
gEmolumentoPeriodo.find((b) => String(b.emolumento_periodo_id) === String(selectedId ?? '')),
|
||||
[gEmolumentoPeriodo, selectedId],
|
||||
);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -76,7 +78,7 @@ export default function GEmolumentoPeriodoSelect({ onSelectedEmolumentoPeriodo }
|
|||
<ChevronsUpDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-full p-0 mb-5">
|
||||
<PopoverContent className="mb-5 w-full p-0">
|
||||
<Command>
|
||||
<CommandInput placeholder="Buscar período..." disabled={isLoading} />
|
||||
<CommandList>
|
||||
|
|
@ -95,7 +97,7 @@ export default function GEmolumentoPeriodoSelect({ onSelectedEmolumentoPeriodo }
|
|||
'mr-2 h-4 w-4',
|
||||
String(selectedId ?? '') === String(item.emolumento_periodo_id)
|
||||
? 'opacity-100'
|
||||
: 'opacity-0'
|
||||
: 'opacity-0',
|
||||
)}
|
||||
/>
|
||||
{GetCapitalize(item.descricao ?? '')}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,11 @@ import GEmolumentoPeriodoTableInterface from '../../interfaces/GEmolumentoPeriod
|
|||
/**
|
||||
* Componente principal da tabela de Naturezas
|
||||
*/
|
||||
export default function GEmolumentoPeriodoTable({ data, onEdit, onDelete }: GEmolumentoPeriodoTableInterface) {
|
||||
export default function GEmolumentoPeriodoTable({
|
||||
data,
|
||||
onEdit,
|
||||
onDelete,
|
||||
}: GEmolumentoPeriodoTableInterface) {
|
||||
const columns = GEmolumentoPeriodoColumns(onEdit, onDelete);
|
||||
return (
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ export default function GGramaticaForm({
|
|||
onSave,
|
||||
buttonIsLoading,
|
||||
}: GGramaticaFormInterface) {
|
||||
|
||||
const form = useGGramaticaFormHook({});
|
||||
|
||||
// Atualiza o formulário quando recebe dados para edição
|
||||
|
|
@ -78,10 +77,7 @@ export default function GGramaticaForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Palavra</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
/>
|
||||
<Input {...field} type="text" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
@ -97,10 +93,7 @@ export default function GGramaticaForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Prefixo</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
/>
|
||||
<Input {...field} type="text" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
@ -116,10 +109,7 @@ export default function GGramaticaForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Sufixo Masculino Singular</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
/>
|
||||
<Input {...field} type="text" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
@ -135,10 +125,7 @@ export default function GGramaticaForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Sufixo Masculino Plural</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
/>
|
||||
<Input {...field} type="text" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
@ -154,10 +141,7 @@ export default function GGramaticaForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Sufixo Feminino Singular</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
/>
|
||||
<Input {...field} type="text" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
@ -173,10 +157,7 @@ export default function GGramaticaForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Sufixo Feminino Plural</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
/>
|
||||
<Input {...field} type="text" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
|
||||
import { useGGramaticaDeleteHook } from '@/packages/administrativo/hooks/GGramatica/useGGramaticaDeleteHook';
|
||||
import { useGGramaticaIndexHook } from '@/packages/administrativo/hooks/GGramatica/useGGramaticaIndexHook';
|
||||
import { useGGramaticaSaveHook } from '@/packages/administrativo/hooks/GGramatica/useGGramaticaSaveHook';
|
||||
|
|
@ -16,7 +15,6 @@ import GGramaticaForm from './GGramaticaForm';
|
|||
import GGramaticaTable from './GGramaticaTable';
|
||||
|
||||
export default function GGramaticaIndex() {
|
||||
|
||||
// Controle de estado do botão
|
||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
|
||||
|
||||
import { useGNaturezaTituloDeleteHook } from '@/packages/administrativo/hooks/GNaturezaTitulo/useGNaturezaTituloDeleteHook';
|
||||
import { useGNaturezaTituloIndexHook } from '@/packages/administrativo/hooks/GNaturezaTitulo/useGNaturezaTituloIndexHook';
|
||||
import { useGNaturezaTituloSaveHook } from '@/packages/administrativo/hooks/GNaturezaTitulo/useGNaturezaTituloSaveHook';
|
||||
|
|
@ -139,7 +138,11 @@ export default function GNaturezaTituloIndex({ sistema_id }: GNaturezaTituloInde
|
|||
}}
|
||||
/>
|
||||
{/* Tabela de andamentos */}
|
||||
<GNaturezaTituloTable data={gNaturezaTitulo} onEdit={handleOpenForm} onDelete={handleConfirmDelete} />
|
||||
<GNaturezaTituloTable
|
||||
data={gNaturezaTitulo}
|
||||
onEdit={handleOpenForm}
|
||||
onDelete={handleConfirmDelete}
|
||||
/>
|
||||
{/* Modal de confirmação */}
|
||||
{isConfirmOpen && (
|
||||
<ConfirmDialog
|
||||
|
|
|
|||
|
|
@ -8,7 +8,11 @@ import GNaturezaTituloTableInterface from '../../interfaces/GNaturezaTitulo/GNat
|
|||
/**
|
||||
* Componente principal da tabela de Naturezas
|
||||
*/
|
||||
export default function GNaturezaTituloTable({ data, onEdit, onDelete }: GNaturezaTituloTableInterface) {
|
||||
export default function GNaturezaTituloTable({
|
||||
data,
|
||||
onEdit,
|
||||
onDelete,
|
||||
}: GNaturezaTituloTableInterface) {
|
||||
const columns = GNaturezaTituloColumns(onEdit, onDelete);
|
||||
return (
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -81,10 +81,7 @@ export default function GSeloGrupoForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Código</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="number"
|
||||
/>
|
||||
<Input {...field} type="number" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
@ -114,10 +111,7 @@ export default function GSeloGrupoForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Descrição</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
/>
|
||||
<Input {...field} type="text" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
@ -133,10 +127,7 @@ export default function GSeloGrupoForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Descrição Completa</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
/>
|
||||
<Input {...field} type="text" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
@ -226,10 +217,7 @@ export default function GSeloGrupoForm({
|
|||
<FormItem className="col-span-1 sm:col-span-2">
|
||||
<FormLabel>Grupos Principal</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
/>
|
||||
<Input {...field} type="text" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
|
||||
|
||||
import { useGSeloGrupoDeleteHook } from '@/packages/administrativo/hooks/GSeloGrupo/useGSeloGrupoDeleteHook';
|
||||
import { useGSeloGrupoIndexHook } from '@/packages/administrativo/hooks/GSeloGrupo/useGSeloGrupoIndexHook';
|
||||
import { useGSeloGrupoSaveHook } from '@/packages/administrativo/hooks/GSeloGrupo/useGSeloGrupoSaveHook';
|
||||
|
|
@ -16,7 +15,6 @@ import GSeloGrupoForm from './GSeloGrupoForm';
|
|||
import GSeloGrupoTable from './GSeloGrupoTable';
|
||||
|
||||
export default function GSeloGrupoIndex() {
|
||||
|
||||
// Controle de estado do botão
|
||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||
|
||||
|
|
|
|||
|
|
@ -76,11 +76,7 @@ export default function GUsuarioSelect({ field }: GUsuarioSelectInterface) {
|
|||
|
||||
<PopoverContent className="w-[var(--radix-popover-trigger-width)] p-0">
|
||||
<Command className="w-full">
|
||||
<CommandInput
|
||||
placeholder="Buscar usuário..."
|
||||
disabled={isLoading}
|
||||
className="w-full"
|
||||
/>
|
||||
<CommandInput placeholder="Buscar usuário..." disabled={isLoading} className="w-full" />
|
||||
<CommandList className="w-full">
|
||||
<CommandEmpty>
|
||||
{isLoading ? 'Carregando...' : 'Nenhum resultado encontrado.'}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
'use client'
|
||||
'use client';
|
||||
|
||||
import { motion } from 'framer-motion'
|
||||
import {
|
||||
AlertTriangle,
|
||||
Building2,
|
||||
CheckCircle2,
|
||||
Home,
|
||||
Layers3,
|
||||
MapPin,
|
||||
Ruler
|
||||
} from 'lucide-react'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { motion } from 'framer-motion';
|
||||
import { AlertTriangle, Building2, CheckCircle2, Home, Layers3, MapPin, Ruler } from 'lucide-react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
Area,
|
||||
AreaChart,
|
||||
|
|
@ -21,61 +13,61 @@ import {
|
|||
ResponsiveContainer,
|
||||
Tooltip,
|
||||
XAxis,
|
||||
YAxis
|
||||
} from 'recharts'
|
||||
YAxis,
|
||||
} from 'recharts';
|
||||
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Progress } from '@/components/ui/progress';
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardHeader,
|
||||
CardTitle
|
||||
} from '@/components/ui/card'
|
||||
import { Progress } from '@/components/ui/progress'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
||||
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
|
||||
// =====================
|
||||
// Types
|
||||
// =====================
|
||||
|
||||
type Kpis = {
|
||||
totalImoveis: number
|
||||
totalUnidades: number
|
||||
mediaPorImovel: number
|
||||
geoReferenciados: number
|
||||
semArea: number
|
||||
novosMes: number
|
||||
tendenciaMes: number
|
||||
}
|
||||
totalImoveis: number;
|
||||
totalUnidades: number;
|
||||
mediaPorImovel: number;
|
||||
geoReferenciados: number;
|
||||
semArea: number;
|
||||
novosMes: number;
|
||||
tendenciaMes: number;
|
||||
};
|
||||
|
||||
type AreaStats = {
|
||||
media: number
|
||||
minima: number
|
||||
maxima: number
|
||||
}
|
||||
media: number;
|
||||
minima: number;
|
||||
maxima: number;
|
||||
};
|
||||
|
||||
type Distribuicao = { label: string; total: number }
|
||||
type Distribuicao = { label: string; total: number };
|
||||
|
||||
type Qualidade = {
|
||||
geoReferenciadoPct: number
|
||||
areaPreenchidaPct: number
|
||||
enderecoCompletoPct: number
|
||||
inconsistencias: number
|
||||
}
|
||||
geoReferenciadoPct: number;
|
||||
areaPreenchidaPct: number;
|
||||
enderecoCompletoPct: number;
|
||||
inconsistencias: number;
|
||||
};
|
||||
|
||||
type ApiResponse = {
|
||||
kpis: Kpis
|
||||
area: AreaStats
|
||||
tiposClasse: Distribuicao[]
|
||||
tiposRegistro: Distribuicao[]
|
||||
distribuicaoUF: Distribuicao[]
|
||||
distribuicaoCidade: Distribuicao[]
|
||||
auditoria: Distribuicao[]
|
||||
evolucao: { mes: string; total: number }[]
|
||||
qualidade: Qualidade
|
||||
}
|
||||
kpis: Kpis;
|
||||
area: AreaStats;
|
||||
tiposClasse: Distribuicao[];
|
||||
tiposRegistro: Distribuicao[];
|
||||
distribuicaoUF: Distribuicao[];
|
||||
distribuicaoCidade: Distribuicao[];
|
||||
auditoria: Distribuicao[];
|
||||
evolucao: { mes: string; total: number }[];
|
||||
qualidade: Qualidade;
|
||||
};
|
||||
|
||||
// =====================
|
||||
// Mock de fallback
|
||||
|
|
@ -89,28 +81,28 @@ const MOCK: ApiResponse = {
|
|||
geoReferenciados: 5620,
|
||||
semArea: 230,
|
||||
novosMes: 110,
|
||||
tendenciaMes: 5.8
|
||||
tendenciaMes: 5.8,
|
||||
},
|
||||
area: {
|
||||
media: 82.4,
|
||||
minima: 30.5,
|
||||
maxima: 250.0
|
||||
maxima: 250.0,
|
||||
},
|
||||
tiposClasse: [
|
||||
{ label: 'Urbano', total: 780 },
|
||||
{ label: 'Rural', total: 420 },
|
||||
{ label: 'Não informado', total: 40 }
|
||||
{ label: 'Não informado', total: 40 },
|
||||
],
|
||||
tiposRegistro: [
|
||||
{ label: 'Matrícula', total: 900 },
|
||||
{ label: 'Transcrição', total: 280 },
|
||||
{ label: 'Outros', total: 60 }
|
||||
{ label: 'Outros', total: 60 },
|
||||
],
|
||||
distribuicaoUF: [
|
||||
{ label: 'GO', total: 540 },
|
||||
{ label: 'DF', total: 230 },
|
||||
{ label: 'MT', total: 150 },
|
||||
{ label: 'TO', total: 120 }
|
||||
{ label: 'TO', total: 120 },
|
||||
],
|
||||
distribuicaoCidade: [
|
||||
{ label: 'Goiânia', total: 320 },
|
||||
|
|
@ -122,43 +114,43 @@ const MOCK: ApiResponse = {
|
|||
{ label: 'Luziânia', total: 120 },
|
||||
{ label: 'Rio Verde', total: 110 },
|
||||
{ label: 'Itumbiara', total: 90 },
|
||||
{ label: 'Jataí', total: 80 }
|
||||
{ label: 'Jataí', total: 80 },
|
||||
],
|
||||
auditoria: [
|
||||
{ label: 'Unidades sem área', total: 230 },
|
||||
{ label: 'Imóveis sem UF', total: 15 },
|
||||
{ label: 'Sem logradouro', total: 48 }
|
||||
{ label: 'Sem logradouro', total: 48 },
|
||||
],
|
||||
evolucao: Array.from({ length: 12 }, (_, i) => ({
|
||||
mes: new Date(2025, i).toLocaleString('pt-BR', { month: 'short' }),
|
||||
total: 100 + i * 25 + (i % 2 === 0 ? 40 : 0)
|
||||
total: 100 + i * 25 + (i % 2 === 0 ? 40 : 0),
|
||||
})),
|
||||
qualidade: {
|
||||
geoReferenciadoPct: 72.5,
|
||||
areaPreenchidaPct: 88.2,
|
||||
enderecoCompletoPct: 93.4,
|
||||
inconsistencias: 48
|
||||
}
|
||||
}
|
||||
inconsistencias: 48,
|
||||
},
|
||||
};
|
||||
|
||||
// =====================
|
||||
// Função de fetch (com fallback)
|
||||
// =====================
|
||||
|
||||
async function fetchApi(periodo: string, uf: string | null): Promise<ApiResponse> {
|
||||
const params = new URLSearchParams()
|
||||
params.set('periodo', periodo)
|
||||
if (uf) params.set('uf', uf)
|
||||
const params = new URLSearchParams();
|
||||
params.set('periodo', periodo);
|
||||
if (uf) params.set('uf', uf);
|
||||
|
||||
try {
|
||||
const ctrl = new AbortController()
|
||||
const timeout = setTimeout(() => ctrl.abort(), 6000)
|
||||
const res = await fetch(`/api/dashboard/imoveis?${params.toString()}`, { signal: ctrl.signal })
|
||||
clearTimeout(timeout)
|
||||
if (!res.ok) throw new Error('Erro HTTP')
|
||||
return await res.json()
|
||||
const ctrl = new AbortController();
|
||||
const timeout = setTimeout(() => ctrl.abort(), 6000);
|
||||
const res = await fetch(`/api/dashboard/imoveis?${params.toString()}`, { signal: ctrl.signal });
|
||||
clearTimeout(timeout);
|
||||
if (!res.ok) throw new Error('Erro HTTP');
|
||||
return await res.json();
|
||||
} catch {
|
||||
return MOCK
|
||||
return MOCK;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -171,38 +163,47 @@ function Kpi({
|
|||
label,
|
||||
value,
|
||||
hint,
|
||||
trend
|
||||
trend,
|
||||
}: {
|
||||
icon: any
|
||||
label: string
|
||||
value: React.ReactNode
|
||||
hint?: string
|
||||
trend?: number
|
||||
icon: any;
|
||||
label: string;
|
||||
value: React.ReactNode;
|
||||
hint?: string;
|
||||
trend?: number;
|
||||
}) {
|
||||
const trendColor =
|
||||
trend == null ? '' : trend > 0 ? 'text-emerald-600' : trend < 0 ? 'text-rose-600' : 'text-muted-foreground'
|
||||
const prefix = trend != null && trend > 0 ? '+' : ''
|
||||
trend == null
|
||||
? ''
|
||||
: trend > 0
|
||||
? 'text-emerald-600'
|
||||
: trend < 0
|
||||
? 'text-rose-600'
|
||||
: 'text-muted-foreground';
|
||||
const prefix = trend != null && trend > 0 ? '+' : '';
|
||||
return (
|
||||
<Card className="shadow-sm border-muted/40">
|
||||
<Card className="border-muted/40 shadow-sm">
|
||||
<CardHeader className="flex flex-row items-center justify-between pb-2">
|
||||
<CardTitle className="text-sm text-muted-foreground">{label}</CardTitle>
|
||||
<Icon className="h-5 w-5 text-muted-foreground" />
|
||||
<CardTitle className="text-muted-foreground text-sm">{label}</CardTitle>
|
||||
<Icon className="text-muted-foreground h-5 w-5" />
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="text-2xl font-bold">{value}</div>
|
||||
<p className="text-xs text-muted-foreground mt-1 flex gap-2">
|
||||
<p className="text-muted-foreground mt-1 flex gap-2 text-xs">
|
||||
{hint && <span>{hint}</span>}
|
||||
{trend != null && (
|
||||
<span className={`font-medium ${trendColor}`}>{prefix}{trend.toFixed(1)}%</span>
|
||||
<span className={`font-medium ${trendColor}`}>
|
||||
{prefix}
|
||||
{trend.toFixed(1)}%
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function DataProgress({ label, value, goal }: { label: string; value: number; goal: number }) {
|
||||
const color = value >= goal ? 'text-emerald-600' : 'text-amber-600'
|
||||
const color = value >= goal ? 'text-emerald-600' : 'text-amber-600';
|
||||
return (
|
||||
<div className="space-y-1">
|
||||
<div className="flex items-center justify-between text-sm">
|
||||
|
|
@ -213,7 +214,7 @@ function DataProgress({ label, value, goal }: { label: string; value: number; go
|
|||
</div>
|
||||
<Progress value={Math.min(100, value)} />
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// =====================
|
||||
|
|
@ -221,35 +222,43 @@ function DataProgress({ label, value, goal }: { label: string; value: number; go
|
|||
// =====================
|
||||
|
||||
export default function DashboardImoveis() {
|
||||
const [periodo, setPeriodo] = useState('12m')
|
||||
const [uf, setUf] = useState<string | null>(null)
|
||||
const [data, setData] = useState<ApiResponse | null>(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [periodo, setPeriodo] = useState('12m');
|
||||
const [uf, setUf] = useState<string | null>(null);
|
||||
const [data, setData] = useState<ApiResponse | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
setLoading(true)
|
||||
setLoading(true);
|
||||
fetchApi(periodo, uf).then((d) => {
|
||||
setData(d)
|
||||
setLoading(false)
|
||||
})
|
||||
}, [periodo, uf])
|
||||
setData(d);
|
||||
setLoading(false);
|
||||
});
|
||||
}, [periodo, uf]);
|
||||
|
||||
const COLORS = ['#1A292F', '#8FB6C1', '#D1E6EA', '#F36F28', '#EAECEA']
|
||||
const COLORS = ['#1A292F', '#8FB6C1', '#D1E6EA', '#F36F28', '#EAECEA'];
|
||||
|
||||
return (
|
||||
<div className="p-4 md:p-6 space-y-6">
|
||||
<div className="space-y-6 p-4 md:p-6">
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between flex-wrap gap-4">
|
||||
<div className="flex flex-wrap items-center justify-between gap-4">
|
||||
<div>
|
||||
<motion.h1 initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} className="text-2xl font-semibold tracking-tight">
|
||||
<motion.h1
|
||||
initial={{ opacity: 0, y: 6 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
className="text-2xl font-semibold tracking-tight"
|
||||
>
|
||||
Painel de Imóveis e Unidades
|
||||
</motion.h1>
|
||||
<p className="text-sm text-muted-foreground">Gestão cadastral, georreferenciamento e auditoria</p>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
Gestão cadastral, georreferenciamento e auditoria
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<Select value={periodo} onValueChange={(v) => setPeriodo(v)}>
|
||||
<SelectTrigger className="w-[140px]"><SelectValue placeholder="Período" /></SelectTrigger>
|
||||
<SelectTrigger className="w-[140px]">
|
||||
<SelectValue placeholder="Período" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="6m">Últimos 6 meses</SelectItem>
|
||||
<SelectItem value="12m">Últimos 12 meses</SelectItem>
|
||||
|
|
@ -271,13 +280,21 @@ export default function DashboardImoveis() {
|
|||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<Button variant="outline" onClick={() => setUf(null)}>Limpar</Button>
|
||||
<Button variant="outline" onClick={() => setUf(null)}>
|
||||
Limpar
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* KPIs */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-5 gap-4">
|
||||
<Kpi icon={Home} label="Imóveis" value={data?.kpis.totalImoveis ?? 0} hint={`${data?.kpis.novosMes ?? 0} novos`} trend={data?.kpis.tendenciaMes} />
|
||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-5">
|
||||
<Kpi
|
||||
icon={Home}
|
||||
label="Imóveis"
|
||||
value={data?.kpis.totalImoveis ?? 0}
|
||||
hint={`${data?.kpis.novosMes ?? 0} novos`}
|
||||
trend={data?.kpis.tendenciaMes}
|
||||
/>
|
||||
<Kpi icon={Building2} label="Unidades" value={data?.kpis.totalUnidades ?? 0} />
|
||||
<Kpi icon={Layers3} label="Média por Imóvel" value={data?.kpis.mediaPorImovel.toFixed(1)} />
|
||||
<Kpi icon={MapPin} label="GeoRef." value={`${data?.qualidade.geoReferenciadoPct ?? 0}%`} />
|
||||
|
|
@ -286,7 +303,9 @@ export default function DashboardImoveis() {
|
|||
|
||||
{/* Evolução */}
|
||||
<Card>
|
||||
<CardHeader><CardTitle>Evolução de Cadastros</CardTitle></CardHeader>
|
||||
<CardHeader>
|
||||
<CardTitle>Evolução de Cadastros</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="h-[300px]">
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<AreaChart data={data?.evolucao ?? []}>
|
||||
|
|
@ -300,16 +319,24 @@ export default function DashboardImoveis() {
|
|||
<XAxis dataKey="mes" />
|
||||
<YAxis />
|
||||
<Tooltip />
|
||||
<Area type="monotone" dataKey="total" stroke="#F36F28" fill="url(#gradImovel)" strokeWidth={2} />
|
||||
<Area
|
||||
type="monotone"
|
||||
dataKey="total"
|
||||
stroke="#F36F28"
|
||||
fill="url(#gradImovel)"
|
||||
strokeWidth={2}
|
||||
/>
|
||||
</AreaChart>
|
||||
</ResponsiveContainer>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Distribuição por UF e Cidades */}
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
||||
<Card>
|
||||
<CardHeader><CardTitle>Imóveis por UF</CardTitle></CardHeader>
|
||||
<CardHeader>
|
||||
<CardTitle>Imóveis por UF</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="h-[300px]">
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<BarChart data={data?.distribuicaoUF ?? []}>
|
||||
|
|
@ -328,7 +355,9 @@ export default function DashboardImoveis() {
|
|||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader><CardTitle>Top 10 Cidades</CardTitle></CardHeader>
|
||||
<CardHeader>
|
||||
<CardTitle>Top 10 Cidades</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="h-[300px]">
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<BarChart data={data?.distribuicaoCidade ?? []} layout="vertical">
|
||||
|
|
@ -349,17 +378,33 @@ export default function DashboardImoveis() {
|
|||
|
||||
{/* Qualidade de Dados */}
|
||||
<Card>
|
||||
<CardHeader><CardTitle>Qualidade de Dados</CardTitle></CardHeader>
|
||||
<CardContent className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<CardHeader>
|
||||
<CardTitle>Qualidade de Dados</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="grid grid-cols-1 gap-4 md:grid-cols-3">
|
||||
<div className="space-y-3">
|
||||
<DataProgress label="GeoReferenciados" value={data?.qualidade.geoReferenciadoPct ?? 0} goal={80} />
|
||||
<DataProgress label="Área preenchida" value={data?.qualidade.areaPreenchidaPct ?? 0} goal={90} />
|
||||
<DataProgress label="Endereço completo" value={data?.qualidade.enderecoCompletoPct ?? 0} goal={90} />
|
||||
<DataProgress
|
||||
label="GeoReferenciados"
|
||||
value={data?.qualidade.geoReferenciadoPct ?? 0}
|
||||
goal={80}
|
||||
/>
|
||||
<DataProgress
|
||||
label="Área preenchida"
|
||||
value={data?.qualidade.areaPreenchidaPct ?? 0}
|
||||
goal={90}
|
||||
/>
|
||||
<DataProgress
|
||||
label="Endereço completo"
|
||||
value={data?.qualidade.enderecoCompletoPct ?? 0}
|
||||
goal={90}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col justify-center items-center">
|
||||
<Ruler className="h-10 w-10 text-[#8FB6C1] mb-2" />
|
||||
<p className="text-sm text-muted-foreground text-center">Área média cadastrada</p>
|
||||
<p className="text-2xl font-semibold text-[#1A292F] dark:text-white">{data?.area.media.toFixed(1)} m²</p>
|
||||
<div className="flex flex-col items-center justify-center">
|
||||
<Ruler className="mb-2 h-10 w-10 text-[#8FB6C1]" />
|
||||
<p className="text-muted-foreground text-center text-sm">Área média cadastrada</p>
|
||||
<p className="text-2xl font-semibold text-[#1A292F] dark:text-white">
|
||||
{data?.area.media.toFixed(1)} m²
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-col items-center justify-center space-y-1">
|
||||
<CheckCircle2 className="h-8 w-8 text-emerald-600" />
|
||||
|
|
@ -370,9 +415,9 @@ export default function DashboardImoveis() {
|
|||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<p className="text-xs text-muted-foreground text-center pt-4">
|
||||
<p className="text-muted-foreground pt-4 text-center text-xs">
|
||||
Fonte: VIEW VW_T_IMOVEL_ANALYTICS — fallback automático para mock.
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
'use client'
|
||||
'use client';
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
import { Building2, CalendarClock, Loader2, Mail, Users } from "lucide-react";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import { motion } from 'framer-motion';
|
||||
import { Building2, CalendarClock, Loader2, Mail, Users } from 'lucide-react';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import {
|
||||
Area,
|
||||
AreaChart,
|
||||
|
|
@ -17,20 +17,20 @@ import {
|
|||
Tooltip,
|
||||
XAxis,
|
||||
YAxis,
|
||||
} from "recharts";
|
||||
} from 'recharts';
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Progress } from '@/components/ui/progress';
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Progress } from "@/components/ui/progress";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
|
||||
// =====================
|
||||
// Types
|
||||
|
|
@ -88,54 +88,58 @@ const MOCK: ApiResponse = {
|
|||
tendenciaMes: 6.3,
|
||||
},
|
||||
sexo: [
|
||||
{ genero: "Masculino", total: 5840 },
|
||||
{ genero: "Feminino", total: 5210 },
|
||||
{ genero: "Não informado", total: 184 }
|
||||
{ genero: 'Masculino', total: 5840 },
|
||||
{ genero: 'Feminino', total: 5210 },
|
||||
{ genero: 'Não informado', total: 184 },
|
||||
],
|
||||
evolucao: Array.from({ length: 12 }, (_, i) => ({ ano: 2025, mes: i + 1, total: 120 + i * 15 + (i % 2 === 0 ? 30 : 0) })),
|
||||
evolucao: Array.from({ length: 12 }, (_, i) => ({
|
||||
ano: 2025,
|
||||
mes: i + 1,
|
||||
total: 120 + i * 15 + (i % 2 === 0 ? 30 : 0),
|
||||
})),
|
||||
estadoCivil: [
|
||||
{ label: "Solteiro(a)", total: 4312 },
|
||||
{ label: "Casado(a)", total: 5120 },
|
||||
{ label: "Divorciado(a)", total: 812 },
|
||||
{ label: "Viúvo(a)", total: 210 },
|
||||
{ label: 'Solteiro(a)', total: 4312 },
|
||||
{ label: 'Casado(a)', total: 5120 },
|
||||
{ label: 'Divorciado(a)', total: 812 },
|
||||
{ label: 'Viúvo(a)', total: 210 },
|
||||
],
|
||||
faixasEtarias: [
|
||||
{ label: "<18", total: 420 },
|
||||
{ label: "18-30", total: 3420 },
|
||||
{ label: "31-45", total: 5180 },
|
||||
{ label: "46-60", total: 2780 },
|
||||
{ label: "60+", total: 1076 },
|
||||
{ label: '<18', total: 420 },
|
||||
{ label: '18-30', total: 3420 },
|
||||
{ label: '31-45', total: 5180 },
|
||||
{ label: '46-60', total: 2780 },
|
||||
{ label: '60+', total: 1076 },
|
||||
],
|
||||
profissoesTop10: [
|
||||
{ label: "Estudante", total: 780 },
|
||||
{ label: "Comerciante", total: 620 },
|
||||
{ label: "Professor(a)", total: 570 },
|
||||
{ label: "Autônomo(a)", total: 510 },
|
||||
{ label: "Servidor(a) Público(a)", total: 450 },
|
||||
{ label: "Engenheiro(a)", total: 430 },
|
||||
{ label: "Advogado(a)", total: 410 },
|
||||
{ label: "Médico(a)", total: 385 },
|
||||
{ label: "Enfermeiro(a)", total: 360 },
|
||||
{ label: "Agricultor(a)", total: 350 },
|
||||
{ label: 'Estudante', total: 780 },
|
||||
{ label: 'Comerciante', total: 620 },
|
||||
{ label: 'Professor(a)', total: 570 },
|
||||
{ label: 'Autônomo(a)', total: 510 },
|
||||
{ label: 'Servidor(a) Público(a)', total: 450 },
|
||||
{ label: 'Engenheiro(a)', total: 430 },
|
||||
{ label: 'Advogado(a)', total: 410 },
|
||||
{ label: 'Médico(a)', total: 385 },
|
||||
{ label: 'Enfermeiro(a)', total: 360 },
|
||||
{ label: 'Agricultor(a)', total: 350 },
|
||||
],
|
||||
ufDistribuicao: [
|
||||
{ label: "GO", total: 5080 },
|
||||
{ label: "DF", total: 1840 },
|
||||
{ label: "MG", total: 980 },
|
||||
{ label: "SP", total: 820 },
|
||||
{ label: "BA", total: 740 },
|
||||
{ label: 'GO', total: 5080 },
|
||||
{ label: 'DF', total: 1840 },
|
||||
{ label: 'MG', total: 980 },
|
||||
{ label: 'SP', total: 820 },
|
||||
{ label: 'BA', total: 740 },
|
||||
],
|
||||
cidadesTop10: [
|
||||
{ label: "Goiânia", total: 2200 },
|
||||
{ label: "Aparecida de Goiânia", total: 980 },
|
||||
{ label: "Anápolis", total: 640 },
|
||||
{ label: "Formosa", total: 510 },
|
||||
{ label: "Trindade", total: 480 },
|
||||
{ label: "Luziânia", total: 465 },
|
||||
{ label: "Catalão", total: 430 },
|
||||
{ label: "Rio Verde", total: 415 },
|
||||
{ label: "Itumbiara", total: 400 },
|
||||
{ label: "Jataí", total: 395 },
|
||||
{ label: 'Goiânia', total: 2200 },
|
||||
{ label: 'Aparecida de Goiânia', total: 980 },
|
||||
{ label: 'Anápolis', total: 640 },
|
||||
{ label: 'Formosa', total: 510 },
|
||||
{ label: 'Trindade', total: 480 },
|
||||
{ label: 'Luziânia', total: 465 },
|
||||
{ label: 'Catalão', total: 430 },
|
||||
{ label: 'Rio Verde', total: 415 },
|
||||
{ label: 'Itumbiara', total: 400 },
|
||||
{ label: 'Jataí', total: 395 },
|
||||
],
|
||||
qualidade: {
|
||||
email: 91.2,
|
||||
|
|
@ -149,20 +153,25 @@ const MOCK: ApiResponse = {
|
|||
// Helpers
|
||||
// =====================
|
||||
|
||||
const monthName = (m: number) => new Date(2025, m - 1, 1).toLocaleDateString("pt-BR", { month: "short" }).replace(".", "");
|
||||
const monthName = (m: number) =>
|
||||
new Date(2025, m - 1, 1).toLocaleDateString('pt-BR', { month: 'short' }).replace('.', '');
|
||||
|
||||
async function fetchApi(periodo: string, uf: string | null, cidade: string | null): Promise<ApiResponse> {
|
||||
async function fetchApi(
|
||||
periodo: string,
|
||||
uf: string | null,
|
||||
cidade: string | null,
|
||||
): Promise<ApiResponse> {
|
||||
const params = new URLSearchParams();
|
||||
params.set("periodo", periodo); // ex: "12m", "24m", "ytd"
|
||||
if (uf) params.set("uf", uf);
|
||||
if (cidade) params.set("cidade", cidade);
|
||||
params.set('periodo', periodo); // ex: "12m", "24m", "ytd"
|
||||
if (uf) params.set('uf', uf);
|
||||
if (cidade) params.set('cidade', cidade);
|
||||
|
||||
try {
|
||||
const ctrl = new AbortController();
|
||||
const to = setTimeout(() => ctrl.abort(), 6000);
|
||||
const res = await fetch(`/api/dashboard/pessoas?${params.toString()}`, { signal: ctrl.signal });
|
||||
clearTimeout(to);
|
||||
if (!res.ok) throw new Error("HTTP error");
|
||||
if (!res.ok) throw new Error('HTTP error');
|
||||
const data = (await res.json()) as ApiResponse;
|
||||
return data;
|
||||
} catch {
|
||||
|
|
@ -175,21 +184,43 @@ async function fetchApi(periodo: string, uf: string | null, cidade: string | nul
|
|||
// Subcomponents
|
||||
// =====================
|
||||
|
||||
function Kpi({ icon: Icon, label, value, hint, trend }: { icon: any; label: string; value: React.ReactNode; hint?: string; trend?: number }) {
|
||||
const trendColor = trend == null ? "" : trend > 0 ? "text-emerald-600" : trend < 0 ? "text-rose-600" : "text-muted-foreground";
|
||||
const trendPrefix = trend == null ? "" : trend > 0 ? "+" : "";
|
||||
function Kpi({
|
||||
icon: Icon,
|
||||
label,
|
||||
value,
|
||||
hint,
|
||||
trend,
|
||||
}: {
|
||||
icon: any;
|
||||
label: string;
|
||||
value: React.ReactNode;
|
||||
hint?: string;
|
||||
trend?: number;
|
||||
}) {
|
||||
const trendColor =
|
||||
trend == null
|
||||
? ''
|
||||
: trend > 0
|
||||
? 'text-emerald-600'
|
||||
: trend < 0
|
||||
? 'text-rose-600'
|
||||
: 'text-muted-foreground';
|
||||
const trendPrefix = trend == null ? '' : trend > 0 ? '+' : '';
|
||||
return (
|
||||
<Card className="shadow-sm border-muted/40">
|
||||
<Card className="border-muted/40 shadow-sm">
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium text-muted-foreground">{label}</CardTitle>
|
||||
<Icon className="h-5 w-5 text-muted-foreground" />
|
||||
<CardTitle className="text-muted-foreground text-sm font-medium">{label}</CardTitle>
|
||||
<Icon className="text-muted-foreground h-5 w-5" />
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="text-2xl font-bold">{value}</div>
|
||||
<p className="text-xs text-muted-foreground mt-1 flex items-center gap-2">
|
||||
<p className="text-muted-foreground mt-1 flex items-center gap-2 text-xs">
|
||||
{hint && <span>{hint}</span>}
|
||||
{trend != null && (
|
||||
<span className={`font-medium ${trendColor}`}>{trendPrefix}{trend.toFixed(1)}%</span>
|
||||
<span className={`font-medium ${trendColor}`}>
|
||||
{trendPrefix}
|
||||
{trend.toFixed(1)}%
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
</CardContent>
|
||||
|
|
@ -197,13 +228,23 @@ function Kpi({ icon: Icon, label, value, hint, trend }: { icon: any; label: stri
|
|||
);
|
||||
}
|
||||
|
||||
function Section({ title, description, children, right = null }: { title: string; description?: string; children: React.ReactNode; right?: React.ReactNode | null }) {
|
||||
function Section({
|
||||
title,
|
||||
description,
|
||||
children,
|
||||
right = null,
|
||||
}: {
|
||||
title: string;
|
||||
description?: string;
|
||||
children: React.ReactNode;
|
||||
right?: React.ReactNode | null;
|
||||
}) {
|
||||
return (
|
||||
<section className="space-y-3">
|
||||
<div className="flex items-end justify-between gap-4">
|
||||
<div>
|
||||
<h3 className="text-base font-semibold">{title}</h3>
|
||||
{description && <p className="text-sm text-muted-foreground">{description}</p>}
|
||||
{description && <p className="text-muted-foreground text-sm">{description}</p>}
|
||||
</div>
|
||||
{right}
|
||||
</div>
|
||||
|
|
@ -213,12 +254,14 @@ function Section({ title, description, children, right = null }: { title: string
|
|||
}
|
||||
|
||||
function DataProgress({ label, value, goal }: { label: string; value: number; goal: number }) {
|
||||
const color = value >= goal ? "text-emerald-600" : "text-amber-600";
|
||||
const color = value >= goal ? 'text-emerald-600' : 'text-amber-600';
|
||||
return (
|
||||
<div className="space-y-1">
|
||||
<div className="flex items-center justify-between text-sm">
|
||||
<span className="text-muted-foreground">{label}</span>
|
||||
<span className={`font-medium ${color}`}>{value.toFixed(1)}% <span className="text-muted-foreground">(meta {goal}%)</span></span>
|
||||
<span className={`font-medium ${color}`}>
|
||||
{value.toFixed(1)}% <span className="text-muted-foreground">(meta {goal}%)</span>
|
||||
</span>
|
||||
</div>
|
||||
<Progress value={Math.min(100, value)} />
|
||||
</div>
|
||||
|
|
@ -230,7 +273,7 @@ function DataProgress({ label, value, goal }: { label: string; value: number; go
|
|||
// =====================
|
||||
|
||||
export default function TPessoaDashboard() {
|
||||
const [periodo, setPeriodo] = useState("12m");
|
||||
const [periodo, setPeriodo] = useState('12m');
|
||||
const [uf, setUf] = useState<string | null>(null);
|
||||
const [cidade, setCidade] = useState<string | null>(null);
|
||||
const [data, setData] = useState<ApiResponse | null>(null);
|
||||
|
|
@ -251,23 +294,34 @@ export default function TPessoaDashboard() {
|
|||
}));
|
||||
}, [data]);
|
||||
|
||||
const sexoFmt = useMemo(() => (data?.sexo ?? []).map((s) => ({ name: s.genero, value: s.total })), [data]);
|
||||
const sexoFmt = useMemo(
|
||||
() => (data?.sexo ?? []).map((s) => ({ name: s.genero, value: s.total })),
|
||||
[data],
|
||||
);
|
||||
|
||||
const COLORS = ["#0ea5e9", "#22c55e", "#a3a3a3", "#a78bfa", "#fb7185", "#fbbf24"]; // não fixa cores globais, apenas define fallback estável
|
||||
const COLORS = ['#0ea5e9', '#22c55e', '#a3a3a3', '#a78bfa', '#fb7185', '#fbbf24']; // não fixa cores globais, apenas define fallback estável
|
||||
|
||||
return (
|
||||
<div className="p-4 md:p-6 space-y-6">
|
||||
<div className="space-y-6 p-4 md:p-6">
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between flex-wrap gap-4">
|
||||
<div className="flex flex-wrap items-center justify-between gap-4">
|
||||
<div>
|
||||
<motion.h1 initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} className="text-2xl font-semibold tracking-tight">
|
||||
<motion.h1
|
||||
initial={{ opacity: 0, y: 6 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
className="text-2xl font-semibold tracking-tight"
|
||||
>
|
||||
Painel de Pessoas
|
||||
</motion.h1>
|
||||
<p className="text-sm text-muted-foreground">Análise demográfica, documental e cadastral</p>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
Análise demográfica, documental e cadastral
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Select value={periodo} onValueChange={(v) => setPeriodo(v)}>
|
||||
<SelectTrigger className="w-[140px]"><SelectValue placeholder="Período" /></SelectTrigger>
|
||||
<SelectTrigger className="w-[140px]">
|
||||
<SelectValue placeholder="Período" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="6m">Últimos 6 meses</SelectItem>
|
||||
<SelectItem value="12m">Últimos 12 meses</SelectItem>
|
||||
|
|
@ -276,35 +330,87 @@ export default function TPessoaDashboard() {
|
|||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<Select value={uf ?? "all"} onValueChange={(v) => setUf(v === "all" ? null : v)}>
|
||||
<Select value={uf ?? 'all'} onValueChange={(v) => setUf(v === 'all' ? null : v)}>
|
||||
<SelectTrigger className="w-[120px]">
|
||||
<SelectValue placeholder="UF" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">Todas UFs</SelectItem>
|
||||
{(data?.ufDistribuicao ?? []).map((u) => (
|
||||
<SelectItem key={u.label} value={u.label}>{u.label}</SelectItem>
|
||||
<SelectItem key={u.label} value={u.label}>
|
||||
{u.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<Input
|
||||
placeholder="Filtrar cidade"
|
||||
className="w-[200px]"
|
||||
onChange={(e) => setCidade(e.target.value || null)}
|
||||
/>
|
||||
|
||||
<Input placeholder="Filtrar cidade" className="w-[200px]" onChange={(e) => setCidade(e.target.value || null)} />
|
||||
|
||||
<Button variant="outline" onClick={() => { setUf(null); setCidade(null); }}>Limpar</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => {
|
||||
setUf(null);
|
||||
setCidade(null);
|
||||
}}
|
||||
>
|
||||
Limpar
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* KPIs */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4">
|
||||
<Kpi icon={Users} label="Total de Pessoas" value={loading ? <Loader2 className="h-5 w-5 animate-spin" /> : data?.kpis.total.toLocaleString("pt-BR")} hint={`${data?.kpis.novosMes ?? 0} novos no mês`} trend={data?.kpis.tendenciaMes} />
|
||||
<Kpi icon={CalendarClock} label="Média de idade" value={loading ? <Loader2 className="h-5 w-5 animate-spin" /> : (data?.kpis.mediaIdade ?? 0)} hint="anos" />
|
||||
<Kpi icon={Building2} label="% CPF/CNPJ válidos" value={loading ? <Loader2 className="h-5 w-5 animate-spin" /> : `${data?.kpis.pctCpfCnpjValidos.toFixed(1)}%`} />
|
||||
<Kpi icon={Mail} label="% E-mail preenchido" value={loading ? <Loader2 className="h-5 w-5 animate-spin" /> : `${data?.kpis.pctEmailPreenchido.toFixed(1)}%`} />
|
||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<Kpi
|
||||
icon={Users}
|
||||
label="Total de Pessoas"
|
||||
value={
|
||||
loading ? (
|
||||
<Loader2 className="h-5 w-5 animate-spin" />
|
||||
) : (
|
||||
data?.kpis.total.toLocaleString('pt-BR')
|
||||
)
|
||||
}
|
||||
hint={`${data?.kpis.novosMes ?? 0} novos no mês`}
|
||||
trend={data?.kpis.tendenciaMes}
|
||||
/>
|
||||
<Kpi
|
||||
icon={CalendarClock}
|
||||
label="Média de idade"
|
||||
value={
|
||||
loading ? <Loader2 className="h-5 w-5 animate-spin" /> : (data?.kpis.mediaIdade ?? 0)
|
||||
}
|
||||
hint="anos"
|
||||
/>
|
||||
<Kpi
|
||||
icon={Building2}
|
||||
label="% CPF/CNPJ válidos"
|
||||
value={
|
||||
loading ? (
|
||||
<Loader2 className="h-5 w-5 animate-spin" />
|
||||
) : (
|
||||
`${data?.kpis.pctCpfCnpjValidos.toFixed(1)}%`
|
||||
)
|
||||
}
|
||||
/>
|
||||
<Kpi
|
||||
icon={Mail}
|
||||
label="% E-mail preenchido"
|
||||
value={
|
||||
loading ? (
|
||||
<Loader2 className="h-5 w-5 animate-spin" />
|
||||
) : (
|
||||
`${data?.kpis.pctEmailPreenchido.toFixed(1)}%`
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Evolução & Sexo */}
|
||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
||||
<div className="grid grid-cols-1 gap-4 lg:grid-cols-3">
|
||||
<Card className="lg:col-span-2">
|
||||
<CardHeader>
|
||||
<CardTitle>Evolução de Cadastros</CardTitle>
|
||||
|
|
@ -322,7 +428,13 @@ export default function TPessoaDashboard() {
|
|||
<XAxis dataKey="mes" interval={1} tickMargin={8} />
|
||||
<YAxis />
|
||||
<Tooltip />
|
||||
<Area type="monotone" dataKey="total" stroke="#0ea5e9" fill="url(#grad1)" strokeWidth={2} />
|
||||
<Area
|
||||
type="monotone"
|
||||
dataKey="total"
|
||||
stroke="#0ea5e9"
|
||||
fill="url(#grad1)"
|
||||
strokeWidth={2}
|
||||
/>
|
||||
</AreaChart>
|
||||
</ResponsiveContainer>
|
||||
</CardContent>
|
||||
|
|
@ -337,7 +449,15 @@ export default function TPessoaDashboard() {
|
|||
<PieChart>
|
||||
<Tooltip />
|
||||
<Legend />
|
||||
<Pie data={sexoFmt} dataKey="value" nameKey="name" cx="50%" cy="50%" outerRadius={90} label>
|
||||
<Pie
|
||||
data={sexoFmt}
|
||||
dataKey="value"
|
||||
nameKey="name"
|
||||
cx="50%"
|
||||
cy="50%"
|
||||
outerRadius={90}
|
||||
label
|
||||
>
|
||||
{sexoFmt.map((entry, index) => (
|
||||
<Cell key={`cell-${index}`} fill={COLORS[index % COLORS.length]} />
|
||||
))}
|
||||
|
|
@ -349,14 +469,17 @@ export default function TPessoaDashboard() {
|
|||
</div>
|
||||
|
||||
{/* Estado Civil & Faixa etária */}
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Estado Civil</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="h-[300px]">
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<BarChart data={data?.estadoCivil ?? []} margin={{ left: 8, right: 8, top: 10, bottom: 0 }}>
|
||||
<BarChart
|
||||
data={data?.estadoCivil ?? []}
|
||||
margin={{ left: 8, right: 8, top: 10, bottom: 0 }}
|
||||
>
|
||||
<CartesianGrid strokeDasharray="3 3" opacity={0.3} />
|
||||
<XAxis dataKey="label" tickMargin={8} />
|
||||
<YAxis />
|
||||
|
|
@ -377,7 +500,10 @@ export default function TPessoaDashboard() {
|
|||
</CardHeader>
|
||||
<CardContent className="h-[300px]">
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<BarChart data={data?.faixasEtarias ?? []} margin={{ left: 8, right: 8, top: 10, bottom: 0 }}>
|
||||
<BarChart
|
||||
data={data?.faixasEtarias ?? []}
|
||||
margin={{ left: 8, right: 8, top: 10, bottom: 0 }}
|
||||
>
|
||||
<CartesianGrid strokeDasharray="3 3" opacity={0.3} />
|
||||
<XAxis dataKey="label" tickMargin={8} />
|
||||
<YAxis />
|
||||
|
|
@ -394,14 +520,17 @@ export default function TPessoaDashboard() {
|
|||
</div>
|
||||
|
||||
{/* Geografia */}
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Distribuição por UF</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="h-[300px]">
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<BarChart data={data?.ufDistribuicao ?? []} margin={{ left: 8, right: 8, top: 10, bottom: 0 }}>
|
||||
<BarChart
|
||||
data={data?.ufDistribuicao ?? []}
|
||||
margin={{ left: 8, right: 8, top: 10, bottom: 0 }}
|
||||
>
|
||||
<CartesianGrid strokeDasharray="3 3" opacity={0.3} />
|
||||
<XAxis dataKey="label" tickMargin={8} />
|
||||
<YAxis />
|
||||
|
|
@ -422,7 +551,11 @@ export default function TPessoaDashboard() {
|
|||
</CardHeader>
|
||||
<CardContent className="h-[300px]">
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<BarChart data={data?.cidadesTop10 ?? []} layout="vertical" margin={{ left: 24, right: 8, top: 10, bottom: 0 }}>
|
||||
<BarChart
|
||||
data={data?.cidadesTop10 ?? []}
|
||||
layout="vertical"
|
||||
margin={{ left: 24, right: 8, top: 10, bottom: 0 }}
|
||||
>
|
||||
<CartesianGrid strokeDasharray="3 3" opacity={0.3} />
|
||||
<XAxis type="number" />
|
||||
<YAxis type="category" dataKey="label" width={120} />
|
||||
|
|
@ -439,11 +572,17 @@ export default function TPessoaDashboard() {
|
|||
</div>
|
||||
|
||||
{/* Profissões */}
|
||||
<Section title="Top 10 Profissões" description="Profissões mais frequentes entre os registros">
|
||||
<Section
|
||||
title="Top 10 Profissões"
|
||||
description="Profissões mais frequentes entre os registros"
|
||||
>
|
||||
<Card>
|
||||
<CardContent className="h-[320px] pt-6">
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<BarChart data={data?.profissoesTop10 ?? []} margin={{ left: 8, right: 8, top: 10, bottom: 0 }}>
|
||||
<BarChart
|
||||
data={data?.profissoesTop10 ?? []}
|
||||
margin={{ left: 8, right: 8, top: 10, bottom: 0 }}
|
||||
>
|
||||
<CartesianGrid strokeDasharray="3 3" opacity={0.3} />
|
||||
<XAxis dataKey="label" tickMargin={8} angle={-20} height={60} textAnchor="end" />
|
||||
<YAxis />
|
||||
|
|
@ -460,19 +599,38 @@ export default function TPessoaDashboard() {
|
|||
</Section>
|
||||
|
||||
{/* Qualidade de Dados */}
|
||||
<Section title="Qualidade de Dados" description="Cobertura de campos críticos e inconsistências">
|
||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
||||
<Section
|
||||
title="Qualidade de Dados"
|
||||
description="Cobertura de campos críticos e inconsistências"
|
||||
>
|
||||
<div className="grid grid-cols-1 gap-4 lg:grid-cols-3">
|
||||
<Card>
|
||||
<CardHeader className="pb-4"><CardTitle>Cobertura</CardTitle></CardHeader>
|
||||
<CardHeader className="pb-4">
|
||||
<CardTitle>Cobertura</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-3">
|
||||
<DataProgress label="E-mail preenchido" value={data?.qualidade.email ?? 0} goal={90} />
|
||||
<DataProgress label="Endereço completo" value={data?.qualidade.enderecoCompleto ?? 0} goal={85} />
|
||||
<DataProgress label="Telefone válido" value={data?.qualidade.telefoneValido ?? 0} goal={80} />
|
||||
<DataProgress
|
||||
label="E-mail preenchido"
|
||||
value={data?.qualidade.email ?? 0}
|
||||
goal={90}
|
||||
/>
|
||||
<DataProgress
|
||||
label="Endereço completo"
|
||||
value={data?.qualidade.enderecoCompleto ?? 0}
|
||||
goal={85}
|
||||
/>
|
||||
<DataProgress
|
||||
label="Telefone válido"
|
||||
value={data?.qualidade.telefoneValido ?? 0}
|
||||
goal={80}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader className="pb-4"><CardTitle>Indicadores</CardTitle></CardHeader>
|
||||
<CardHeader className="pb-4">
|
||||
<CardTitle>Indicadores</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-3">
|
||||
<div className="flex items-center justify-between text-sm">
|
||||
<span className="text-muted-foreground">% CPF/CNPJ válidos</span>
|
||||
|
|
@ -484,23 +642,46 @@ export default function TPessoaDashboard() {
|
|||
</div>
|
||||
<div className="flex items-center justify-between text-sm">
|
||||
<span className="text-muted-foreground">Registros com CPF inconsistente</span>
|
||||
<Badge variant="destructive" className="font-mono">{data?.qualidade.cpfInvalido.toLocaleString("pt-BR")}</Badge>
|
||||
<Badge variant="destructive" className="font-mono">
|
||||
{data?.qualidade.cpfInvalido.toLocaleString('pt-BR')}
|
||||
</Badge>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader className="pb-4"><CardTitle>Ações rápidas</CardTitle></CardHeader>
|
||||
<CardHeader className="pb-4">
|
||||
<CardTitle>Ações rápidas</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-2">
|
||||
<Button variant="secondary" className="w-full" onClick={() => alert("Exportar inconsistências (CSV)")}>Exportar inconsistências</Button>
|
||||
<Button variant="outline" className="w-full" onClick={() => alert("Abrir relatório detalhado")}>Abrir relatório detalhado</Button>
|
||||
<Button className="w-full" onClick={() => window.scrollTo({ top: 0, behavior: "smooth" })}>Voltar ao topo</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
className="w-full"
|
||||
onClick={() => alert('Exportar inconsistências (CSV)')}
|
||||
>
|
||||
Exportar inconsistências
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
className="w-full"
|
||||
onClick={() => alert('Abrir relatório detalhado')}
|
||||
>
|
||||
Abrir relatório detalhado
|
||||
</Button>
|
||||
<Button
|
||||
className="w-full"
|
||||
onClick={() => window.scrollTo({ top: 0, behavior: 'smooth' })}
|
||||
>
|
||||
Voltar ao topo
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
<p className="text-xs text-muted-foreground text-center pt-4">Fonte de dados: API /api/dashboard/pessoas — fallback automático para mock se indisponível.</p>
|
||||
<p className="text-muted-foreground pt-4 text-center text-xs">
|
||||
Fonte de dados: API /api/dashboard/pessoas — fallback automático para mock se indisponível.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ import { Sexo } from '@/shared/enums/SexoEnum';
|
|||
import { useGTBEstadoCivilReadHook } from '../../../hooks/GTBEstadoCivil/useGTBEstadoCivilReadHook';
|
||||
import { useGTBRegimeComunhaoReadHook } from '../../../hooks/GTBRegimeComunhao/useGTBRegimeComunhaoReadHook';
|
||||
|
||||
|
||||
export default function TPessoaFisicaForm({
|
||||
isOpen,
|
||||
data,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@ import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface';
|
|||
/**
|
||||
* Função para criar a definição das colunas da tabela
|
||||
*/
|
||||
export function TPessoaTableFormColumnsDialog(setSelectedTPessoa: React.Dispatch<React.SetStateAction<any | null>>): ColumnDef<TPessoaInterface>[] {
|
||||
export function TPessoaTableFormColumnsDialog(
|
||||
setSelectedTPessoa: React.Dispatch<React.SetStateAction<any | null>>,
|
||||
): ColumnDef<TPessoaInterface>[] {
|
||||
return [
|
||||
{
|
||||
id: 'select',
|
||||
|
|
@ -156,6 +158,5 @@ export function TPessoaTableFormColumnsDialog(setSelectedTPessoa: React.Dispatch
|
|||
cell: ({ row }) => FormatDateTime(row.getValue('data_cadastro')),
|
||||
sortingFn: 'datetime',
|
||||
},
|
||||
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import { useTPessoaFisicaIndexHook } from '@/packages/administrativo/hooks/TPessoa/TPessoaFisica/useTPessoaFisicaIndexHook';
|
||||
import { useTPessoaJuridicaIndexHook } from '@/packages/administrativo/hooks/TPessoa/TPessoaJuridica/useTPessoaJuridicaIndexHook';
|
||||
|
|
@ -28,56 +28,41 @@ export default function TPessoaTableFormDialog({
|
|||
onSave,
|
||||
buttonIsLoading,
|
||||
}: TPessoaTableFormInterface) {
|
||||
|
||||
const { tPessoaFisica, fetchTPessoaFisica } = useTPessoaFisicaIndexHook();
|
||||
const { tPessoaJuridica, fetchTPessoaJuridica } = useTPessoaJuridicaIndexHook();
|
||||
const [pessoas, setPessoas] = useState<any>()
|
||||
const [pessoas, setPessoas] = useState<any>();
|
||||
const [selectedTPessoa, setSelectedTPessoa] = useState<TPessoaInterface | null>(null);
|
||||
|
||||
// Executa o Hook de Acordo com o tipo de pessoa informado
|
||||
const loadData = async (tipoPessoa: string) => {
|
||||
|
||||
switch (tipoPessoa) {
|
||||
|
||||
case "F":
|
||||
|
||||
case 'F':
|
||||
await fetchTPessoaFisica();
|
||||
break;
|
||||
|
||||
case "J":
|
||||
|
||||
case 'J':
|
||||
await fetchTPessoaJuridica();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Atualiza a variavel de pessoa quando tiver alteração na variavel de pessoas fisicas
|
||||
useEffect(() => {
|
||||
|
||||
setPessoas(tPessoaFisica)
|
||||
|
||||
}, [tPessoaFisica])
|
||||
setPessoas(tPessoaFisica);
|
||||
}, [tPessoaFisica]);
|
||||
|
||||
// Atualiza a variavel de pessoa quando tiver alteração na variavel de pessoas juridicas
|
||||
useEffect(() => {
|
||||
|
||||
setPessoas(tPessoaJuridica)
|
||||
|
||||
}, [tPessoaJuridica])
|
||||
setPessoas(tPessoaJuridica);
|
||||
}, [tPessoaJuridica]);
|
||||
|
||||
// Executa o hook correspondente ao tipo de pessoa, sempre que o tipo pessoa mudar
|
||||
useEffect(() => {
|
||||
|
||||
// Verifica se o tipo pessoa esta preenchido
|
||||
if (tipoPessoa) {
|
||||
|
||||
// Dispara o carregamento de informações
|
||||
loadData(tipoPessoa);
|
||||
|
||||
}
|
||||
|
||||
}, [tipoPessoa]);
|
||||
|
||||
const columns = TPessoaTableFormColumnsDialog(setSelectedTPessoa);
|
||||
|
|
@ -119,7 +104,10 @@ export default function TPessoaTableFormDialog({
|
|||
textLoading="Aguarde..."
|
||||
loading={buttonIsLoading}
|
||||
type="button"
|
||||
onClick={() => { onSave(selectedTPessoa); onClose(null, false); }}
|
||||
onClick={() => {
|
||||
onSave(selectedTPessoa);
|
||||
onClose(null, false);
|
||||
}}
|
||||
/>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
import { FingerprintIcon, WebcamIcon } from 'lucide-react';
|
||||
import {
|
||||
memo,
|
||||
useCallback,
|
||||
useMemo,
|
||||
useState
|
||||
} from 'react';
|
||||
import { memo, useCallback, useMemo, useState } from 'react';
|
||||
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
|
@ -14,7 +9,7 @@ import {
|
|||
ItemContent,
|
||||
ItemDescription,
|
||||
ItemMedia,
|
||||
ItemTitle
|
||||
ItemTitle,
|
||||
} from '@/components/ui/item';
|
||||
import TPessoaCartaoForm from '@/packages/servicos/components/TPessoaCartao/TPessoaCartaoForm';
|
||||
import GetNameInitials from '@/shared/actions/text/GetNameInitials';
|
||||
|
|
@ -29,16 +24,13 @@ function TPessoaTableFormSubview({
|
|||
params,
|
||||
form,
|
||||
}: TPessoaTableFormSubviewInterface) {
|
||||
|
||||
const [isWebCamOpenDialog, setIsWebCamOpenDialog] = useState(false)
|
||||
const [isWebCamOpenDialog, setIsWebCamOpenDialog] = useState(false);
|
||||
const { base64, captureFingerTech } = useFingerTechCaptureHook();
|
||||
|
||||
// Chama o leitor biométrico
|
||||
const handleBiometria = useCallback(() => {
|
||||
|
||||
console.log(captureFingerTech())
|
||||
|
||||
}, [])
|
||||
console.log(captureFingerTech());
|
||||
}, []);
|
||||
|
||||
const biometriaButtonClass = useMemo(() => {
|
||||
const status = 1 as number; // força tipo number
|
||||
|
|
@ -61,28 +53,19 @@ function TPessoaTableFormSubview({
|
|||
<ItemMedia>
|
||||
<Avatar className="size-10">
|
||||
<AvatarImage src={``} />
|
||||
<AvatarFallback>
|
||||
{GetNameInitials(data.pessoa?.nome)}
|
||||
</AvatarFallback>
|
||||
<AvatarFallback>{GetNameInitials(data.pessoa?.nome)}</AvatarFallback>
|
||||
</Avatar>
|
||||
</ItemMedia>
|
||||
<ItemContent>
|
||||
<ItemTitle>
|
||||
{data.pessoa?.cpf_cnpj} - {data.pessoa?.nome}
|
||||
</ItemTitle>
|
||||
<ItemDescription>
|
||||
{data.pessoa?.email || 'Email não informado'}
|
||||
</ItemDescription>
|
||||
<ItemDescription>{data.pessoa?.email || 'Email não informado'}</ItemDescription>
|
||||
{params
|
||||
.filter((param) => Number(param.valor) === data.servico.servico_tipo_id)
|
||||
.map((param) => (
|
||||
<TPessoaCartaoForm
|
||||
form={form}
|
||||
index={item_index}
|
||||
key={param.config_id}
|
||||
/>
|
||||
<TPessoaCartaoForm form={form} index={item_index} key={param.config_id} />
|
||||
))}
|
||||
|
||||
</ItemContent>
|
||||
<ItemActions>
|
||||
{data.servico.requer_biometria === 'S' && (
|
||||
|
|
@ -90,9 +73,11 @@ function TPessoaTableFormSubview({
|
|||
type="button"
|
||||
size="icon-lg"
|
||||
variant="outline"
|
||||
className={`rounded-full cursor-pointer ${biometriaButtonClass}`}
|
||||
className={`cursor-pointer rounded-full ${biometriaButtonClass}`}
|
||||
aria-label="Capturar biometria"
|
||||
onClick={() => { handleBiometria() }}
|
||||
onClick={() => {
|
||||
handleBiometria();
|
||||
}}
|
||||
>
|
||||
<FingerprintIcon />
|
||||
</Button>
|
||||
|
|
@ -102,9 +87,11 @@ function TPessoaTableFormSubview({
|
|||
type="button"
|
||||
size="icon-lg"
|
||||
variant="outline"
|
||||
className="rounded-full cursor-pointer"
|
||||
className="cursor-pointer rounded-full"
|
||||
aria-label="Capturar imagem"
|
||||
onClick={() => { setIsWebCamOpenDialog(true) }}
|
||||
onClick={() => {
|
||||
setIsWebCamOpenDialog(true);
|
||||
}}
|
||||
>
|
||||
<WebcamIcon />
|
||||
</Button>
|
||||
|
|
@ -114,7 +101,9 @@ function TPessoaTableFormSubview({
|
|||
{isWebCamOpenDialog && (
|
||||
<WebCamDialog
|
||||
isOpen={isWebCamOpenDialog}
|
||||
onClose={() => { setIsWebCamOpenDialog(false) }}
|
||||
onClose={() => {
|
||||
setIsWebCamOpenDialog(false);
|
||||
}}
|
||||
onSave={() => {}}
|
||||
key={item_index}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import TServicoTipoInterface from '@/packages/administrativo/interfaces/TServico
|
|||
import GetCapitalize from '@/shared/actions/text/GetCapitalize';
|
||||
import { SortableHeader } from '@/shared/components/dataTable/SortableHeader';
|
||||
|
||||
|
||||
export default function TServicoTipoColumns(
|
||||
onEdit: (item: TServicoTipoInterface, isEditingFormStatus: boolean) => void,
|
||||
onDelete: (item: TServicoTipoInterface, isEditingFormStatus: boolean) => void,
|
||||
|
|
@ -55,9 +54,7 @@ export default function TServicoTipoColumns(
|
|||
Editar
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem
|
||||
onSelect={() => onDelete(data, true)}
|
||||
>
|
||||
<DropdownMenuItem onSelect={() => onDelete(data, true)}>
|
||||
<Trash2Icon className="mr-2 h-4 w-4" />
|
||||
Remover
|
||||
</DropdownMenuItem>
|
||||
|
|
|
|||
|
|
@ -432,15 +432,11 @@ export default function TServicoTipoForm({
|
|||
className="cursor-pointer"
|
||||
checked={isChecked}
|
||||
onCheckedChange={(checked) => {
|
||||
field.onChange(
|
||||
checked ? SituacoesEnum.A : SituacoesEnum.I
|
||||
);
|
||||
field.onChange(checked ? SituacoesEnum.A : SituacoesEnum.I);
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormLabel className="cursor-pointer font-normal">
|
||||
Ativo
|
||||
</FormLabel>
|
||||
<FormLabel className="cursor-pointer font-normal">Ativo</FormLabel>
|
||||
</FormItem>
|
||||
);
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@ import Header from '@/shared/components/structure/Header';
|
|||
import TServicoTipoForm from './TServicoTipoForm';
|
||||
import TServicoTipoTable from './TServicoTipoTable';
|
||||
|
||||
|
||||
export default function TServicoTipoIndex() {
|
||||
|
||||
const { tServicoTipo, fetchTServicoTipo } = useTServicoTipoReadHook();
|
||||
const { saveTServicoTipo } = useTServicoTipoSaveHook();
|
||||
const { removeTServicoTipo } = useTServicoTipoRemoveHook();
|
||||
|
|
@ -89,7 +87,6 @@ export default function TServicoTipoIndex() {
|
|||
|
||||
// Atualiza a lista de dados
|
||||
fetchTServicoTipo();
|
||||
|
||||
},
|
||||
[saveTServicoTipo, fetchTServicoTipo],
|
||||
);
|
||||
|
|
@ -139,9 +136,7 @@ export default function TServicoTipoIndex() {
|
|||
* Tela de loading enquanto carrega os dados
|
||||
*/
|
||||
if (!tServicoTipo) {
|
||||
|
||||
return <Loading type={2} />;
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -98,9 +98,7 @@ export default function TServicoTipoSelect({ field }: TServicoTipoSelectInterfac
|
|||
: 'Selecione...';
|
||||
|
||||
const selectedId =
|
||||
typeof value?.servico_tipo_id === 'number'
|
||||
? String(value.servico_tipo_id)
|
||||
: '';
|
||||
typeof value?.servico_tipo_id === 'number' ? String(value.servico_tipo_id) : '';
|
||||
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
|
|
@ -138,10 +136,7 @@ export default function TServicoTipoSelect({ field }: TServicoTipoSelectInterfac
|
|||
onSelect={() => handleSelect(item)}
|
||||
>
|
||||
<CheckIcon
|
||||
className={cn(
|
||||
'mr-2 h-4 w-4',
|
||||
isSelected ? 'opacity-100' : 'opacity-0',
|
||||
)}
|
||||
className={cn('mr-2 h-4 w-4', isSelected ? 'opacity-100' : 'opacity-0')}
|
||||
/>
|
||||
{GetCapitalize(item.descricao ?? '')}
|
||||
</CommandItem>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import { DataTable } from '@/shared/components/dataTable/DataTable';
|
|||
|
||||
import TServicoTipoColumns from './TServicoTipoColumns';
|
||||
|
||||
|
||||
/**
|
||||
* Componente principal da tabela de Naturezas
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -99,9 +99,7 @@ export default function TTBReconhecimentoTipoForm({
|
|||
<Checkbox
|
||||
checked={isAtivo}
|
||||
onCheckedChange={(checked) =>
|
||||
field.onChange(
|
||||
checked ? SituacoesEnum.A : SituacoesEnum.I,
|
||||
)
|
||||
field.onChange(checked ? SituacoesEnum.A : SituacoesEnum.I)
|
||||
}
|
||||
/>
|
||||
<Label>Ativo</Label>
|
||||
|
|
|
|||
|
|
@ -32,11 +32,7 @@ export default function TTBReconhecimentoTipoIndex() {
|
|||
/**
|
||||
* Hook do modal de confirmação
|
||||
*/
|
||||
const {
|
||||
isOpen: isConfirmOpen,
|
||||
openDialog: openConfirmDialog,
|
||||
handleCancel,
|
||||
} = useConfirmDialog();
|
||||
const { isOpen: isConfirmOpen, openDialog: openConfirmDialog, handleCancel } = useConfirmDialog();
|
||||
|
||||
/**
|
||||
* Abre o formulário no modo de edição ou criação
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ async function executeCCaixaServicoIndexData(data: CCaixaServicoReadInterface) {
|
|||
method: Methods.GET,
|
||||
endpoint: endpoint,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Exporta a função encapsulada pelo handler de erro, garantindo tratamento uniforme em caso de falhas
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import API from '@/shared/services/api/Api';
|
|||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseInterface';
|
||||
|
||||
|
||||
async function executeGCalculoCalcularData(data: GCalculoInterface): Promise<ApiResponseInterface> {
|
||||
const api = new API();
|
||||
return api.send({
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import API from '@/shared/services/api/Api';
|
|||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseInterface';
|
||||
|
||||
|
||||
async function executeGCalculoCalcularData(data: GCalculoInterface): Promise<ApiResponseInterface> {
|
||||
const api = new API();
|
||||
return api.send({
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ import API from '@/shared/services/api/Api';
|
|||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseInterface';
|
||||
|
||||
|
||||
async function executeGEmolumentoDeleteData(data: GEmolumentoInterface): Promise<ApiResponseInterface> {
|
||||
async function executeGEmolumentoDeleteData(
|
||||
data: GEmolumentoInterface,
|
||||
): Promise<ApiResponseInterface> {
|
||||
const api = new API();
|
||||
|
||||
return api.send({
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@ import API from '@/shared/services/api/Api';
|
|||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
async function executeGEmolumentoIndexData(data?: GEmolumentoReadInterface) {
|
||||
|
||||
const api = new API();
|
||||
|
||||
const queryString = data?.urlParams ? new URLSearchParams(data.urlParams as Record<string, string>).toString() : '';
|
||||
const queryString = data?.urlParams
|
||||
? new URLSearchParams(data.urlParams as Record<string, string>).toString()
|
||||
: '';
|
||||
|
||||
return await api.send({
|
||||
method: Methods.GET,
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ import API from '@/shared/services/api/Api';
|
|||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseInterface';
|
||||
|
||||
|
||||
async function executeGEmolumentoSaveData(data: GEmolumentoInterface): Promise<ApiResponseInterface> {
|
||||
async function executeGEmolumentoSaveData(
|
||||
data: GEmolumentoInterface,
|
||||
): Promise<ApiResponseInterface> {
|
||||
// Verifica se existe ID para decidir se é atualização (PUT) ou criação (POST)
|
||||
const isUpdate = Boolean(data.emolumento_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ import API from '@/shared/services/api/Api';
|
|||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseInterface';
|
||||
|
||||
|
||||
async function executeGEmolumentoItemDeleteData(data: GEmolumentoItemInterface): Promise<ApiResponseInterface> {
|
||||
async function executeGEmolumentoItemDeleteData(
|
||||
data: GEmolumentoItemInterface,
|
||||
): Promise<ApiResponseInterface> {
|
||||
const api = new API();
|
||||
|
||||
return api.send({
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ import API from '@/shared/services/api/Api';
|
|||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseInterface';
|
||||
|
||||
|
||||
async function executeGEmolumentoItemIndexData(data: GEmolumentoItemIndexInterface): Promise<ApiResponseInterface> {
|
||||
async function executeGEmolumentoItemIndexData(
|
||||
data: GEmolumentoItemIndexInterface,
|
||||
): Promise<ApiResponseInterface> {
|
||||
const api = new API();
|
||||
return api.send({
|
||||
method: Methods.GET,
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ import API from '@/shared/services/api/Api';
|
|||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseInterface';
|
||||
|
||||
|
||||
async function executeGEmolumentoItemSaveData(data: GEmolumentoItemInterface): Promise<ApiResponseInterface> {
|
||||
async function executeGEmolumentoItemSaveData(
|
||||
data: GEmolumentoItemInterface,
|
||||
): Promise<ApiResponseInterface> {
|
||||
// Verifica se existe ID para decidir se é atualização (PUT) ou criação (POST)
|
||||
const isUpdate = Boolean(data.emolumento_item_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseIn
|
|||
|
||||
import GEmolumentoPeriodoInterface from '../../interfaces/GEmolumentoPeriodo/GEmolumentoPeriodoInterface';
|
||||
|
||||
async function executeGEmolumentoPeriodoDeleteData(data: GEmolumentoPeriodoInterface): Promise<ApiResponseInterface> {
|
||||
async function executeGEmolumentoPeriodoDeleteData(
|
||||
data: GEmolumentoPeriodoInterface,
|
||||
): Promise<ApiResponseInterface> {
|
||||
const api = new API();
|
||||
|
||||
return api.send({
|
||||
|
|
@ -14,4 +16,6 @@ async function executeGEmolumentoPeriodoDeleteData(data: GEmolumentoPeriodoInter
|
|||
});
|
||||
}
|
||||
|
||||
export const GEmolumentoPeriodoDeleteData = withClientErrorHandler(executeGEmolumentoPeriodoDeleteData);
|
||||
export const GEmolumentoPeriodoDeleteData = withClientErrorHandler(
|
||||
executeGEmolumentoPeriodoDeleteData,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -12,4 +12,6 @@ async function executeGEmolumentoPeriodoIndexData(): Promise<ApiResponseInterfac
|
|||
});
|
||||
}
|
||||
|
||||
export const GEmolumentoPeriodoIndexData = withClientErrorHandler(executeGEmolumentoPeriodoIndexData);
|
||||
export const GEmolumentoPeriodoIndexData = withClientErrorHandler(
|
||||
executeGEmolumentoPeriodoIndexData,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseIn
|
|||
|
||||
import GEmolumentoPeriodoInterface from '../../interfaces/GEmolumentoPeriodo/GEmolumentoPeriodoInterface';
|
||||
|
||||
async function executeGEmolumentoPeriodoSaveData(data: GEmolumentoPeriodoInterface): Promise<ApiResponseInterface> {
|
||||
async function executeGEmolumentoPeriodoSaveData(
|
||||
data: GEmolumentoPeriodoInterface,
|
||||
): Promise<ApiResponseInterface> {
|
||||
// Verifica se existe ID para decidir se é atualização (PUT) ou criação (POST)
|
||||
const isUpdate = Boolean(data.emolumento_periodo_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseIn
|
|||
|
||||
import GGramaticaInterface from '../../interfaces/GGramatica/GGramaticaInterface';
|
||||
|
||||
async function executeGGramaticaDeleteData(data: GGramaticaInterface): Promise<ApiResponseInterface> {
|
||||
async function executeGGramaticaDeleteData(
|
||||
data: GGramaticaInterface,
|
||||
): Promise<ApiResponseInterface> {
|
||||
const api = new API();
|
||||
|
||||
return api.send({
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseIn
|
|||
|
||||
import GNaturezaTituloInterface from '../../interfaces/GNaturezaTitulo/GNaturezaTituloInterface';
|
||||
|
||||
async function executeGNaturezaTituloDeleteData(data: GNaturezaTituloInterface): Promise<ApiResponseInterface> {
|
||||
async function executeGNaturezaTituloDeleteData(
|
||||
data: GNaturezaTituloInterface,
|
||||
): Promise<ApiResponseInterface> {
|
||||
const api = new API();
|
||||
|
||||
return api.send({
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseIn
|
|||
|
||||
import GNaturezaTituloInterface from '../../interfaces/GNaturezaTitulo/GNaturezaTituloInterface';
|
||||
|
||||
async function executeGNaturezaTituloIndexData(data: GNaturezaTituloInterface): Promise<ApiResponseInterface> {
|
||||
async function executeGNaturezaTituloIndexData(
|
||||
data: GNaturezaTituloInterface,
|
||||
): Promise<ApiResponseInterface> {
|
||||
const api = new API();
|
||||
|
||||
return api.send({
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseIn
|
|||
|
||||
import GNaturezaTituloInterface from '../../interfaces/GNaturezaTitulo/GNaturezaTituloInterface';
|
||||
|
||||
async function executeGNaturezaTituloSaveData(data: GNaturezaTituloInterface): Promise<ApiResponseInterface> {
|
||||
async function executeGNaturezaTituloSaveData(
|
||||
data: GNaturezaTituloInterface,
|
||||
): Promise<ApiResponseInterface> {
|
||||
// Verifica se existe ID para decidir se é atualização (PUT) ou criação (POST)
|
||||
const isUpdate = Boolean(data.natureza_titulo_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import ApiResponseInterface from '@/shared/services/api/interfaces/ApiResponseIn
|
|||
|
||||
import GSeloGrupoInterface from '../../interfaces/GSeloGrupo/GSeloGrupoInterface';
|
||||
|
||||
async function executeGSeloGrupoDeleteData(data: GSeloGrupoInterface): Promise<ApiResponseInterface> {
|
||||
async function executeGSeloGrupoDeleteData(
|
||||
data: GSeloGrupoInterface,
|
||||
): Promise<ApiResponseInterface> {
|
||||
const api = new API();
|
||||
|
||||
return api.send({
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import API from '@/shared/services/api/Api';
|
|||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function GUsuarioIndexData(data?: GUsuarioIndexInterface) {
|
||||
|
||||
const api = new API();
|
||||
|
||||
const response = await api.send({
|
||||
|
|
|
|||
|
|
@ -3,10 +3,7 @@ import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/
|
|||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
|
||||
|
||||
async function executeTServicoTipoIndexData(data?: TServicoTipoIndexInteface) {
|
||||
|
||||
const api = new API();
|
||||
|
||||
return await api.send({
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/
|
|||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
|
||||
// Função assíncrona responsável por executar a requisição para listar os tipos de marcação
|
||||
async function executeTTBReconhecimentoTipoIndexData(data?: TTBReconhecimentoTipoReadInterface) {
|
||||
// Cria uma nova instância da classe API para enviar a requisição
|
||||
|
|
@ -12,7 +11,7 @@ async function executeTTBReconhecimentoTipoIndexData(data?: TTBReconhecimentoTip
|
|||
// Envia uma requisição GET para o endpoint 'administrativo/g_marcacao_tipo/'
|
||||
return await api.send({
|
||||
method: Methods.GET,
|
||||
endpoint: `administrativo/t_tb_reconhecimentotipo/${new URLSearchParams(data?.urlParams).toString()}`
|
||||
endpoint: `administrativo/t_tb_reconhecimentotipo/${new URLSearchParams(data?.urlParams).toString()}`,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@ export const useGCalculoDeleteHook = () => {
|
|||
|
||||
const [gGramatica, setGCalculo] = useState<GCalculoInterface>();
|
||||
|
||||
const deleteGCalculo = async (data: GCalculoInterface) => {
|
||||
|
||||
};
|
||||
const deleteGCalculo = async (data: GCalculoInterface) => {};
|
||||
|
||||
return { gGramatica, deleteGCalculo };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { Resolver, useForm } from "react-hook-form";
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { Resolver, useForm } from 'react-hook-form';
|
||||
|
||||
import { GCalculoFormValues, GCalculoSchema } from "@/packages/administrativo/schemas/GCalculo/GCalculoSchema";
|
||||
import {
|
||||
GCalculoFormValues,
|
||||
GCalculoSchema,
|
||||
} from '@/packages/administrativo/schemas/GCalculo/GCalculoSchema';
|
||||
|
||||
export function useGCalculoFormHook(defaults?: Partial<GCalculoFormValues>) {
|
||||
return useForm<GCalculoFormValues>({
|
||||
resolver: zodResolver(GCalculoSchema) as Resolver<GCalculoFormValues>,
|
||||
defaultValues: defaults as GCalculoFormValues,
|
||||
mode: "onChange",
|
||||
mode: 'onChange',
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,11 @@ import { useState } from 'react';
|
|||
|
||||
import GCalculoInterface from '@/packages/administrativo/interfaces/GCalculo/GCalculoInterface';
|
||||
|
||||
|
||||
export const useGCalculoIndexHook = () => {
|
||||
|
||||
const [gCalculo, setGCalculo] = useState<GCalculoInterface[]>([]);
|
||||
|
||||
const indexGCalculo = async () => {
|
||||
setGCalculo([])
|
||||
setGCalculo([]);
|
||||
};
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@ import GCalculoInterface from '@/packages/administrativo/interfaces/GCalculo/GCa
|
|||
import { GCalculoCalcularService } from '@/packages/administrativo/services/GCalculo/GCalculoCalcularService';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
|
||||
export const useGCalculoSaveHook = (setGCalculo?: React.Dispatch<React.SetStateAction<GCalculoInterface[]>>) => {
|
||||
export const useGCalculoSaveHook = (
|
||||
setGCalculo?: React.Dispatch<React.SetStateAction<GCalculoInterface[]>>,
|
||||
) => {
|
||||
const { setResponse } = useResponse();
|
||||
const [GCalculo, setGCalculoItem] = useState<GCalculoInterface | null>(null);
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { Resolver, useForm } from 'react-hook-form';
|
||||
|
||||
import { GEmolumentoFormValues, GEmolumentoSchema } from '@/packages/administrativo/schemas/GEmolumento/GEmolumentoSchema';
|
||||
import {
|
||||
GEmolumentoFormValues,
|
||||
GEmolumentoSchema,
|
||||
} from '@/packages/administrativo/schemas/GEmolumento/GEmolumentoSchema';
|
||||
|
||||
export function useGEmolumentoFormHook(defaults?: Partial<GEmolumentoFormValues>) {
|
||||
return useForm<GEmolumentoFormValues>({
|
||||
resolver: zodResolver(GEmolumentoSchema) as Resolver<GEmolumentoFormValues>,
|
||||
defaultValues: defaults as GEmolumentoFormValues,
|
||||
mode: "onChange",
|
||||
mode: 'onChange',
|
||||
});
|
||||
}
|
||||
|
|
@ -6,13 +6,11 @@ import { GEmolumentoIndexService } from '@/packages/administrativo/services/GEmo
|
|||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
export const useGEmolumentoReadHook = () => {
|
||||
|
||||
const { setResponse } = useResponse();
|
||||
|
||||
const [gEmolumento, setGEmolumento] = useState<GEmolumentoInterface[]>([]);
|
||||
|
||||
const fetchGEmolumento = async (data?: GEmolumentoReadInterface) => {
|
||||
|
||||
const response = await GEmolumentoIndexService(data as any);
|
||||
|
||||
setGEmolumento(response.data);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue