Compare commits
No commits in common. "main" and "release(DSAAS)" have entirely different histories.
main
...
release(DS
993 changed files with 19561 additions and 31337 deletions
117
.code-workspace
117
.code-workspace
|
|
@ -1,117 +0,0 @@
|
|||
{
|
||||
"folders": [{ "path": "D:/IIS/Orius/app" }],
|
||||
"settings": {
|
||||
// === GERAL ===
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll": "explicit",
|
||||
"source.organizeImports": "explicit",
|
||||
},
|
||||
"editor.formatOnPaste": false,
|
||||
"editor.formatOnType": false,
|
||||
"editor.minimap.enabled": false,
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"files.autoSave": "onFocusChange",
|
||||
"telemetry.telemetryLevel": "off",
|
||||
"update.mode": "manual",
|
||||
|
||||
// === PERFORMANCE ===
|
||||
"files.watcherExclude": {
|
||||
"**/node_modules/**": true,
|
||||
"**/dist/**": true,
|
||||
"**/build/**": true,
|
||||
"**/.next/**": true,
|
||||
"**/.git/**": true,
|
||||
},
|
||||
"search.exclude": {
|
||||
"**/node_modules": true,
|
||||
"**/dist": true,
|
||||
"**/.next": true,
|
||||
"**/.git": true,
|
||||
},
|
||||
|
||||
// === FRONTEND ===
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "vscode.typescript-language-features",
|
||||
},
|
||||
"[typescriptreact]": {
|
||||
"editor.defaultFormatter": "vscode.typescript-language-features",
|
||||
},
|
||||
|
||||
// === TAILWIND ===
|
||||
"files.associations": {
|
||||
"*.css": "tailwindcss",
|
||||
},
|
||||
"tailwindCSS.includeLanguages": {
|
||||
"plaintext": "html",
|
||||
"javascript": "javascript",
|
||||
"typescriptreact": "typescriptreact",
|
||||
},
|
||||
|
||||
// === TERMINAIS ===
|
||||
"terminal.integrated.profiles.windows": {
|
||||
"Next.js Dev": {
|
||||
"path": "cmd.exe",
|
||||
"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"],
|
||||
},
|
||||
"Git Bash": {
|
||||
"path": "C:\\Program Files\\Git\\bin\\bash.exe",
|
||||
},
|
||||
},
|
||||
"terminal.integrated.defaultProfile.windows": "Git Bash",
|
||||
|
||||
// === GIT ===
|
||||
"git.enabled": true,
|
||||
"git.autorefresh": false,
|
||||
"git.fetchOnPull": true,
|
||||
"git.confirmSync": false,
|
||||
|
||||
// === VISUAL ===
|
||||
"workbench.colorTheme": "Default Dark Modern",
|
||||
"window.zoomLevel": 0,
|
||||
"breadcrumbs.enabled": true,
|
||||
"explorer.compactFolders": false,
|
||||
|
||||
// === MISC ===
|
||||
"files.exclude": {
|
||||
"**/.DS_Store": true,
|
||||
"**/*.log": true,
|
||||
},
|
||||
},
|
||||
"launch": {
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Next.js: Debug Development Server",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "npm",
|
||||
"runtimeArgs": ["run", "dev"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"port": 9229,
|
||||
},
|
||||
],
|
||||
},
|
||||
"extensions": {
|
||||
"recommendations": [
|
||||
// === FRONTEND CORE ===
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode",
|
||||
"bradlc.vscode-tailwindcss",
|
||||
"ms-vscode.vscode-typescript-next",
|
||||
|
||||
// === DEV EXPERIENCE ===
|
||||
"formulahendry.code-runner",
|
||||
"streetsidesoftware.code-spell-checker",
|
||||
"eamodio.gitlens",
|
||||
"mhutchie.git-graph",
|
||||
"donjayamanne.githistory",
|
||||
],
|
||||
},
|
||||
}
|
||||
33
.eslintrc.json
Normal file
33
.eslintrc.json
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// .eslintrc.json
|
||||
{
|
||||
"extends": [
|
||||
// 1. Configurações base do Next/React
|
||||
"next/core-web-vitals",
|
||||
// 2. Regras para ordenar e gerenciar importações
|
||||
"plugin:import/recommended",
|
||||
// 3. DESATIVA as regras do ESLint que conflitam com o Prettier (DEVE SER O ÚLTIMO)
|
||||
"prettier"
|
||||
],
|
||||
"plugins": ["import"],
|
||||
"rules": {
|
||||
/* --- Qualidade do Código (Next.js/React) --- */
|
||||
// Essa regra (já incluída no Next.js, mas bom reforçar) é a que remove imports não usados
|
||||
"no-unused-vars": "error",
|
||||
"react/jsx-uses-vars": "error",
|
||||
/* --- Ordem e Remoção de Importações (eslint-plugin-import) --- */
|
||||
// Configura a regra para a ordem das importações (groups/grupos)
|
||||
"import/order": [
|
||||
"error",
|
||||
{
|
||||
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
|
||||
"newlines-between": "always",
|
||||
"alphabetize": {
|
||||
"order": "asc",
|
||||
"caseInsensitive": true
|
||||
}
|
||||
}
|
||||
],
|
||||
// Garante que o Next.js reconheça imports (como 'next/image', 'next/link')
|
||||
"import/no-unresolved": "error"
|
||||
}
|
||||
}
|
||||
65
Dockerfile
65
Dockerfile
|
|
@ -1,59 +1,22 @@
|
|||
# ============================
|
||||
# STAGE 1 – Build
|
||||
# ============================
|
||||
FROM node:20-alpine AS builder
|
||||
# Use uma imagem Node.js completa para o desenvolvimento
|
||||
FROM node:20-alpine
|
||||
|
||||
# Define o diretório de trabalho no container
|
||||
WORKDIR /app
|
||||
|
||||
# Copia pacotes e instala dependências
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
# Copia os arquivos de configuração do projeto
|
||||
COPY package.json package-lock.json ./
|
||||
|
||||
# Copia o restante do código
|
||||
# Instala todas as dependências do projeto
|
||||
# Isso é necessário para o modo de desenvolvimento, pois o build não pré-compila os arquivos.
|
||||
RUN npm install
|
||||
|
||||
# Copia o restante do código da sua aplicação
|
||||
COPY . .
|
||||
|
||||
# ---------- Variáveis de build ----------
|
||||
# Estas variáveis são usadas pelo Next.js durante o "build"
|
||||
# para embutir no bundle do frontend.
|
||||
ARG NEXT_PUBLIC_ORIUS_APP_STATE
|
||||
ARG NEXT_PUBLIC_ORIUS_APP_API_URL
|
||||
ARG NEXT_PUBLIC_ORIUS_APP_API_PREFIX
|
||||
ARG NEXT_PUBLIC_ORIUS_APP_API_CONTENT_TYPE
|
||||
|
||||
ENV NEXT_PUBLIC_ORIUS_APP_STATE=$NEXT_PUBLIC_ORIUS_APP_STATE
|
||||
ENV NEXT_PUBLIC_ORIUS_APP_API_URL=$NEXT_PUBLIC_ORIUS_APP_API_URL
|
||||
ENV NEXT_PUBLIC_ORIUS_APP_API_PREFIX=$NEXT_PUBLIC_ORIUS_APP_API_PREFIX
|
||||
ENV NEXT_PUBLIC_ORIUS_APP_API_CONTENT_TYPE=$NEXT_PUBLIC_ORIUS_APP_API_CONTENT_TYPE
|
||||
|
||||
# ---------- Build ----------
|
||||
ENV NODE_ENV=production
|
||||
RUN npm run build
|
||||
|
||||
# ============================
|
||||
# STAGE 2 – Runner (standalone)
|
||||
# ============================
|
||||
FROM node:20-alpine AS runner
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# ---------- Variáveis em runtime ----------
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
# Copia apenas o necessário do build
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
COPY --from=builder /app/.next/static ./.next/static
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/package*.json ./
|
||||
|
||||
# ---------- Corrige permissões ----------
|
||||
RUN addgroup -S nodejs && adduser -S nextjs -G nodejs \
|
||||
&& mkdir -p .next/cache/images \
|
||||
&& chown -R nextjs:nodejs /app
|
||||
|
||||
USER nextjs
|
||||
|
||||
# Expõe a porta de desenvolvimento padrão do Next.js
|
||||
EXPOSE 3000
|
||||
|
||||
# ---------- Executa o servidor ----------
|
||||
CMD ["node", "server.js"]
|
||||
# Define o comando para iniciar a aplicação em modo de desenvolvimento
|
||||
# Isso ativará o servidor de desenvolvimento e a recarga automática
|
||||
CMD ["npm", "run", "dev"]
|
||||
|
|
|
|||
41
Dockerfile-homologacao
Normal file
41
Dockerfile-homologacao
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# Etapa 1: Construir a aplicação
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
# Define o diretório de trabalho
|
||||
WORKDIR /app
|
||||
|
||||
# Copia os arquivos de configuração do pacote
|
||||
COPY package.json package-lock.json ./
|
||||
|
||||
# Instala as dependências do projeto
|
||||
RUN npm install
|
||||
|
||||
# Copia todo o código da aplicação para o container
|
||||
COPY . .
|
||||
|
||||
# Constrói a aplicação com o output 'standalone'
|
||||
RUN npm run build
|
||||
|
||||
# Etapa 2: Executar a aplicação
|
||||
# Usa uma imagem Node.js leve
|
||||
FROM node:20-alpine AS runner
|
||||
|
||||
# Define o diretório de trabalho
|
||||
WORKDIR /app
|
||||
|
||||
# Copia o diretório 'standalone' da etapa de build, que já contém o servidor e as dependências
|
||||
# O diretório 'standalone' é a pasta .next/standalone gerada pela configuração 'output: standalone'
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
|
||||
# Copia os arquivos públicos
|
||||
COPY --from=builder /app/public ./public
|
||||
|
||||
# Copia os arquivos estáticos gerados pelo build. É aqui que os arquivos CSS e JS ficam.
|
||||
COPY --from=builder /app/.next/static ./.next/static
|
||||
|
||||
# Expõe a porta padrão do Next.js
|
||||
EXPOSE 3000
|
||||
|
||||
# Define o comando para iniciar a aplicação
|
||||
# O 'start' do package.json não é necessário, o próprio servidor standalone já está no container
|
||||
CMD ["node", "server.js"]
|
||||
57
README.md
57
README.md
|
|
@ -1,58 +1 @@
|
|||
# saas_app
|
||||
|
||||
Criar envlocal para usar variaveis de ambiente no em desenvolvimento
|
||||
NEXT_PUBLIC_ORIUS_APP_STATE=GO
|
||||
NEXT_PUBLIC_ORIUS_APP_API_URL=<http://localhost:8000/>
|
||||
NEXT_PUBLIC_ORIUS_APP_API_PREFIX=api/v1/
|
||||
NEXT_PUBLIC_ORIUS_APP_API_CONTENT_TYPE=application/json
|
||||
|
||||
## Modo Debug
|
||||
|
||||
Abra Run → Add Configuration… → Attach to Node.js
|
||||
|
||||
Configure:
|
||||
|
||||
{
|
||||
"name": "Attach Next.js (9230)",
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"port": 9230,
|
||||
"restart": true,
|
||||
"smartStep": true,
|
||||
"skipFiles": ["<node_internals>/**"]
|
||||
}
|
||||
|
||||
npm run dev:debug
|
||||
|
||||
## onlyoffice
|
||||
|
||||
docker run -i -t -d -p 8081:80 --restart=always -e JWT_ENABLED=false onlyoffice/documentserver
|
||||
|
||||
## next em rede
|
||||
|
||||
```
|
||||
npx next dev -H 0.0.0.0
|
||||
```
|
||||
|
||||
```
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"dev:lan": "next dev -H 0.0.0.0" <-- Adicione esta linha
|
||||
},
|
||||
```
|
||||
|
||||
Como acessar no outro dispositivo
|
||||
Descubra seu IP Local:
|
||||
|
||||
No Windows (seu caso), abra um terminal (CMD ou PowerShell) e digite:
|
||||
|
||||
Bash
|
||||
|
||||
ipconfig
|
||||
Procure por Endereço IPv4 (geralmente começa com 192.168.x.x ou 10.0.x.x).
|
||||
|
||||
Acesse no navegador: No celular ou outro computador, digite: http://SEU_IP_AQUI:3000
|
||||
|
||||
Exemplo: <http://192.168.0.15:3000>
|
||||
|
|
|
|||
23
eslint.config.js
Normal file
23
eslint.config.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import next from 'eslint-config-next';
|
||||
import importPlugin from 'eslint-plugin-import';
|
||||
|
||||
export default [
|
||||
next,
|
||||
{
|
||||
plugins: {
|
||||
import: importPlugin,
|
||||
},
|
||||
rules: {
|
||||
'import/order': [
|
||||
'error',
|
||||
{
|
||||
groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index']],
|
||||
'newlines-between': 'always',
|
||||
alphabetize: { order: 'asc', caseInsensitive: true },
|
||||
},
|
||||
],
|
||||
semi: ['error', 'always'],
|
||||
quotes: ['error', 'double'],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
import js from '@eslint/js';
|
||||
import reactPlugin from 'eslint-plugin-react';
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
||||
import importPlugin from 'eslint-plugin-import';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
export default [
|
||||
js.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
ignores: ['node_modules/**', '.next/**', 'out/**', 'dist/**'],
|
||||
languageOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
parser: tseslint.parser,
|
||||
parserOptions: {
|
||||
project: './tsconfig.json',
|
||||
},
|
||||
globals: {
|
||||
React: true,
|
||||
JSX: true,
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
react: reactPlugin,
|
||||
'react-hooks': reactHooks,
|
||||
'jsx-a11y': jsxA11y,
|
||||
import: importPlugin,
|
||||
},
|
||||
settings: {
|
||||
react: { version: 'detect' },
|
||||
'import/resolver': {
|
||||
typescript: {
|
||||
alwaysTryTypes: true,
|
||||
project: './tsconfig.json',
|
||||
},
|
||||
node: {
|
||||
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
||||
},
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'react/jsx-uses-react': 'off',
|
||||
'react/jsx-uses-vars': 'warn',
|
||||
'react-hooks/rules-of-hooks': 'error',
|
||||
'react-hooks/exhaustive-deps': 'warn',
|
||||
'import/order': [
|
||||
'error',
|
||||
{
|
||||
groups: [['builtin', 'external'], ['internal'], ['parent', 'sibling', 'index']],
|
||||
pathGroups: [
|
||||
{
|
||||
pattern: '@/**',
|
||||
group: 'internal',
|
||||
position: 'after',
|
||||
},
|
||||
],
|
||||
alphabetize: { order: 'asc', caseInsensitive: true },
|
||||
'newlines-between': 'always',
|
||||
},
|
||||
],
|
||||
'import/no-duplicates': 'error',
|
||||
'import/newline-after-import': ['error', { count: 1 }],
|
||||
'no-unused-vars': 'warn',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
@ -1,17 +1,8 @@
|
|||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
// Gera build autônomo para rodar com "node server.js"
|
||||
import type { NextConfig } from 'next';
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
// Isso gera um diretório otimizado que inclui tudo o que a aplicação precisa para rodar
|
||||
output: 'standalone',
|
||||
|
||||
// Configurações gerais
|
||||
reactStrictMode: true,
|
||||
poweredByHeader: false,
|
||||
compress: true,
|
||||
|
||||
// Desativa verificações no build de produção
|
||||
eslint: { ignoreDuringBuilds: true },
|
||||
typescript: { ignoreBuildErrors: true },
|
||||
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
export default nextConfig;
|
||||
|
|
|
|||
2678
package-lock.json
generated
2678
package-lock.json
generated
File diff suppressed because it is too large
Load diff
37
package.json
37
package.json
|
|
@ -4,17 +4,16 @@
|
|||
"version": "25.9.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"dev:debug": "cross-env NEXT_USE_TURBOPACK=0 NODE_OPTIONS=\"--inspect=9230\" next dev",
|
||||
"dev": "next dev --turbopack",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"postinstall": "shx mkdir -p public/libs && shx cp -r node_modules/tinymce public/libs/tinymce"
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
"format": "prettier --write . --ignore-path .gitignore"
|
||||
},
|
||||
"dependencies": {
|
||||
"@faker-js/faker": "^10.0.0",
|
||||
"@hookform/resolvers": "^5.2.1",
|
||||
"@onlyoffice/document-editor-react": "^2.1.1",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.15",
|
||||
"@radix-ui/react-avatar": "^1.1.10",
|
||||
"@radix-ui/react-checkbox": "^1.3.3",
|
||||
|
|
@ -23,13 +22,9 @@
|
|||
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
||||
"@radix-ui/react-label": "^2.1.7",
|
||||
"@radix-ui/react-popover": "^1.1.15",
|
||||
"@radix-ui/react-progress": "^1.1.7",
|
||||
"@radix-ui/react-radio-group": "^1.3.8",
|
||||
"@radix-ui/react-scroll-area": "^1.2.10",
|
||||
"@radix-ui/react-select": "^2.2.6",
|
||||
"@radix-ui/react-separator": "^1.1.8",
|
||||
"@radix-ui/react-slot": "^1.2.4",
|
||||
"@radix-ui/react-switch": "^1.2.6",
|
||||
"@radix-ui/react-separator": "^1.1.7",
|
||||
"@radix-ui/react-slot": "^1.2.3",
|
||||
"@radix-ui/react-tabs": "^1.1.13",
|
||||
"@radix-ui/react-tooltip": "^1.2.8",
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
|
|
@ -38,9 +33,7 @@
|
|||
"clsx": "^2.1.1",
|
||||
"cmdk": "^1.1.1",
|
||||
"cookies-next": "^6.1.0",
|
||||
"date-fns": "^3.6.0",
|
||||
"faker-js": "^1.0.0",
|
||||
"framer-motion": "^12.23.24",
|
||||
"input-otp": "^1.4.2",
|
||||
"js-cookie": "^3.0.5",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
|
|
@ -52,38 +45,32 @@
|
|||
"react-dom": "19.1.0",
|
||||
"react-hook-form": "^7.62.0",
|
||||
"react-masked-text": "^1.0.5",
|
||||
"recharts": "^3.3.0",
|
||||
"recharts": "^2.15.4",
|
||||
"sonner": "^2.0.7",
|
||||
"tailwind-merge": "^3.3.1",
|
||||
"tinymce": "^8.1.2",
|
||||
"zod": "^4.0.17"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rushstack/eslint-patch": "^1.12.0",
|
||||
"@tailwindcss/postcss": "^4",
|
||||
"@types/date-fns": "^2.5.3",
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
"@types/jsonwebtoken": "^9.0.10",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"@typescript-eslint/eslint-plugin": "^8.46.1",
|
||||
"@typescript-eslint/parser": "^8.46.1",
|
||||
"cross-env": "^10.1.0",
|
||||
"eslint": "^9.38.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.45.0",
|
||||
"@typescript-eslint/parser": "^8.45.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-next": "^15.5.4",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-import-resolver-typescript": "^4.4.4",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||
"eslint-plugin-prettier": "^5.5.4",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-react-hooks": "^7.0.0",
|
||||
"eslint-plugin-unused-imports": "^4.2.0",
|
||||
"prettier": "^3.6.2",
|
||||
"prettier-plugin-tailwindcss": "^0.6.14",
|
||||
"shx": "^0.4.0",
|
||||
"tailwindcss": "^4",
|
||||
"tw-animate-css": "^1.3.7",
|
||||
"typescript": "5.9.3",
|
||||
"typescript-eslint": "^8.46.1"
|
||||
"typescript": "5.9.3"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,51 @@
|
|||
'use client';
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { useParams } from 'next/navigation';
|
||||
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useGUsuarioReadHooks } from '@/app/(protected)/(administrativo)/_hooks/g_usuario/useGUsuarioReadHooks';
|
||||
import Usuario from '@/app/(protected)/(administrativo)/_interfaces/GUsuarioInterface';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
export default function UsuarioDetalhes() {
|
||||
const params = useParams();
|
||||
|
||||
const { usuario, fetchUsuario } = useGUsuarioReadHooks();
|
||||
|
||||
useEffect(() => {
|
||||
if (params.id) {
|
||||
fetchUsuario({ usuario_id: Number(params.id) } as Usuario);
|
||||
}
|
||||
console.log('pagina', usuario);
|
||||
}, []);
|
||||
|
||||
if (!usuario) return <Loading type={1} />;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Card>
|
||||
<CardContent>
|
||||
<div className="mb-4 grid grid-cols-4 gap-4">
|
||||
<div>
|
||||
<div className="text-2xl font-semibold">Nome</div>
|
||||
<div className="text-xl">{usuario?.nome_completo}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-2xl font-semibold">CPF</div>
|
||||
<div className="text-xl">{usuario?.cpf}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-2xl font-semibold">Função</div>
|
||||
<div className="text-xl">{usuario?.funcao}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-2xl font-semibold">Email</div>
|
||||
<div className="text-xl">{usuario?.email}</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
'use client';
|
||||
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { z } from 'zod';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { GUsuarioSchema } from '../../../_schemas/GUsuarioSchema';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from '@/components/ui/form';
|
||||
|
||||
import { useGUsuarioSaveHook } from '../../../_hooks/g_usuario/useGUsuarioSaveHook';
|
||||
|
||||
type FormValues = z.infer<typeof GUsuarioSchema>;
|
||||
|
||||
export default function UsuarioFormularioPage() {
|
||||
const { usuario, saveUsuario } = useGUsuarioSaveHook();
|
||||
|
||||
const form = useForm<FormValues>({
|
||||
resolver: zodResolver(GUsuarioSchema),
|
||||
defaultValues: {
|
||||
login: '',
|
||||
nome_completo: '',
|
||||
funcao: '',
|
||||
email: '',
|
||||
cpf: '',
|
||||
},
|
||||
});
|
||||
|
||||
async function onSubmit(values: FormValues) {
|
||||
saveUsuario(values);
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Card>
|
||||
<CardContent>
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="login"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Login</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="nome_completo"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Nome Completo</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="funcao"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Função</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="email"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Email</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="cpf"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Cpf</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Button type="submit">Salvar</Button>
|
||||
</form>
|
||||
</Form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
'use client';
|
||||
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
|
||||
import Usuario from '../../_interfaces/GUsuarioInterface';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import Link from 'next/link';
|
||||
import { useGUsuarioIndexHook } from '../../_hooks/g_usuario/useGUsuarioIndexHook';
|
||||
import { useEffect } from 'react';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
export default function UsuarioPage() {
|
||||
const { usuarios, fetchUsuarios } = useGUsuarioIndexHook();
|
||||
|
||||
useEffect(() => {
|
||||
fetchUsuarios();
|
||||
}, []);
|
||||
|
||||
if (!usuarios) return <Loading type={2} />;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Card>
|
||||
<CardContent>
|
||||
<div className="grid grid-cols-2">
|
||||
<div className="text-2xl font-semibold">Usuarios</div>
|
||||
<div className="text-right">
|
||||
<Button asChild>
|
||||
<Link href="/usuarios/formulario">+ Usuário</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="text-center">#</TableHead>
|
||||
<TableHead>Situação</TableHead>
|
||||
<TableHead>CPF</TableHead>
|
||||
<TableHead>Login / Sigla / Nome</TableHead>
|
||||
<TableHead>Função</TableHead>
|
||||
<TableHead></TableHead>
|
||||
<TableHead></TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{usuarios.map((usuario: Usuario) => (
|
||||
<TableRow key={usuario.usuario_id} className="cursor-pointer">
|
||||
<TableCell className="text-center">{usuario.usuario_id}</TableCell>
|
||||
<TableCell className="font-medium">{usuario.situacao}</TableCell>
|
||||
<TableCell className="font-medium">{usuario.cpf}</TableCell>
|
||||
<TableCell>
|
||||
<div className="text-xs font-semibold">
|
||||
{usuario.login} - {usuario.sigla}
|
||||
</div>
|
||||
<div className="text-base">{usuario.nome_completo}</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="text-base">{usuario.funcao}</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Button asChild>
|
||||
<Link href={`/usuarios/${usuario.usuario_id}/detalhes`}>Detalhes</Link>
|
||||
</Button>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,11 +1,15 @@
|
|||
'use server';
|
||||
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function TMinutaIndexData() {
|
||||
export default async function GUsuarioIndexData() {
|
||||
const api = new API();
|
||||
const dados = await api.send({
|
||||
|
||||
const response = await api.send({
|
||||
method: Methods.GET,
|
||||
endpoint: `administrativo/t_minuta/`,
|
||||
endpoint: `administrativo/g_usuario/`,
|
||||
});
|
||||
return dados;
|
||||
|
||||
return response;
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
'use server';
|
||||
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
|
||||
export default async function GUsuarioLoginData(form: any) {
|
||||
const api = new API();
|
||||
|
|
@ -1,20 +1,17 @@
|
|||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
|
||||
import Usuario from '@/packages/administrativo/interfaces/GUsuario/GUsuarioInterface';
|
||||
import Usuario from '../../_interfaces/GUsuarioInterface';
|
||||
import GUsuarioIndex from '../../_services/g_usuario/GUsuarioIndex';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
import GUsuarioIndexInterface from '@/packages/administrativo/interfaces/GUsuario/GUsuarioIndexInterface';
|
||||
import GUsuarioIndex from '@/packages/administrativo/services/GUsuario/GUsuarioIndex';
|
||||
|
||||
export const useGUsuarioIndexHook = () => {
|
||||
const { setResponse } = useResponse();
|
||||
|
||||
const [usuarios, setUsuarios] = useState<Usuario[] | null>(null);
|
||||
|
||||
const fetchUsuarios = async (data: GUsuarioIndexInterface) => {
|
||||
const response = await GUsuarioIndex(data);
|
||||
const fetchUsuarios = async () => {
|
||||
const response = await GUsuarioIndex();
|
||||
|
||||
setUsuarios(response.data);
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import GUsuarioLogoutService from '@/packages/administrativo/services/GUsuario/GUsuarioLogoutService';
|
||||
import GUsuarioLogoutService from '../../_services/g_usuario/GUsuarioLogoutService';
|
||||
|
||||
export const useGUsuarioLogoutHook = () => {
|
||||
const logoutUsuario = async () => {
|
||||
|
|
@ -1,12 +1,10 @@
|
|||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
|
||||
import Usuario from '../../_interfaces/GUsuarioInterface';
|
||||
import GUsuarioRead from '../../_services/g_usuario/GUsuarioRead';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
import Usuario from '@/packages/administrativo/interfaces/GUsuario/GUsuarioInterface';
|
||||
import GUsuarioRead from '@/packages/administrativo/services/GUsuario/GUsuarioRead';
|
||||
|
||||
export const useGUsuarioReadHooks = () => {
|
||||
const { setResponse } = useResponse();
|
||||
|
||||
|
|
@ -14,7 +12,10 @@ export const useGUsuarioReadHooks = () => {
|
|||
|
||||
const fetchUsuario = async (Usuario: Usuario) => {
|
||||
const response = await GUsuarioRead(Usuario.usuario_id);
|
||||
console.log('hook', response.data);
|
||||
|
||||
setUsuario(response.data);
|
||||
|
||||
setResponse(response);
|
||||
};
|
||||
|
||||
|
|
@ -1,12 +1,10 @@
|
|||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
|
||||
import Usuario from '../../_interfaces/GUsuarioInterface';
|
||||
import GUsuarioSave from '../../_services/g_usuario/GUsuarioSave';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
import Usuario from '@/packages/administrativo/interfaces/GUsuario/GUsuarioInterface';
|
||||
import GUsuarioSave from '@/packages/administrativo/services/GUsuario/GUsuarioSave';
|
||||
|
||||
export const useGUsuarioSaveHook = () => {
|
||||
const { setResponse } = useResponse();
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
'use server';
|
||||
|
||||
import GUsuarioIndexData from '../../_data/g_usuario/GUsuarioIndexData';
|
||||
|
||||
export default async function GUsuarioIndex() {
|
||||
const response = await GUsuarioIndexData();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
'use server';
|
||||
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
import GUsuarioLoginData from '../../_data/g_usuario/GUsuarioLoginData';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
export default async function GUsuarioLoginService(form: any) {
|
||||
// Obtem a resposta da requisição
|
||||
const response = await GUsuarioLoginData(form);
|
||||
|
||||
// Verifica se localizou o usuário
|
||||
if (response.data.usuario_id <= 0) {
|
||||
return {
|
||||
code: 404,
|
||||
message: 'Não foi localizado o usuário',
|
||||
};
|
||||
}
|
||||
|
||||
// Importação do manipulador de cookies
|
||||
const cookieStore = await cookies();
|
||||
|
||||
// Cria um novo cookie
|
||||
cookieStore.set('access_token', response.data.token, {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === 'production',
|
||||
sameSite: 'strict',
|
||||
path: '/',
|
||||
maxAge: 60 * 60 * 24,
|
||||
});
|
||||
|
||||
// Redireciona para a págian desejada
|
||||
redirect('/servicos');
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
'use server';
|
||||
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
export default async function GUsuarioLogoutService(token: string) {
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
'use server';
|
||||
|
||||
import GUsuarioReadData from '../../_data/g_usuario/GUsuarioReadData';
|
||||
|
||||
export default async function GUsuarioRead(usuarioId: number) {
|
||||
// Verifica se o id informado é válido
|
||||
if (usuarioId <= 0) {
|
||||
return {
|
||||
code: 400,
|
||||
message: 'Usuário informado inválido',
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await GUsuarioReadData(usuarioId);
|
||||
console.log('service', response);
|
||||
return response;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use server';
|
||||
|
||||
import GUsuarioSaveData from '@/packages/administrativo/data/GUsuario/GUsuarioSaveData';
|
||||
import GUsuarioSaveData from '../../_data/g_usuario/GUsuarioSaveData';
|
||||
|
||||
export default async function GUsuarioSave(form: any) {
|
||||
return await GUsuarioSaveData(form);
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import TTBAndamentoServicoIndex from '@/packages/administrativo/components/TTBAndamentoServico/TTBAndamentoServicoIndex';
|
||||
|
||||
export default function TAtoParteTipo() {
|
||||
return <TTBAndamentoServicoIndex />;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import TAtoParteTipoIndex from '@/packages/administrativo/components/TAtoParteTipo/TAtoParteTipoIndex';
|
||||
|
||||
export default function TAtoParteTipo() {
|
||||
return <TAtoParteTipoIndex />;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import GTBBairroIndex from '@/packages/administrativo/components/GTBBairro/GTBBairroIndex';
|
||||
|
||||
export default function GCidadePage() {
|
||||
return <GTBBairroIndex />;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import GCartorioIndex from '@/packages/administrativo/components/GCartorio/GCartorioIndex';
|
||||
|
||||
export default function GCartorioPage() {
|
||||
return <GCartorioIndex />;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import TCensecTipoNaturezaIndex from '@/packages/administrativo/components/TCensecTipoNatureza/TCensecTipoNaturezaIndex';
|
||||
|
||||
export default function TCensecTipoNaturezaPage() {
|
||||
return <TCensecTipoNaturezaIndex />;
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export default function TCensecPage() {
|
||||
return <div></div>;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import TCensecQualidadeIndex from '@/packages/administrativo/components/TCensecQualidade/TCensecQualidadeIndex';
|
||||
|
||||
export default function TCensecQualidadePage() {
|
||||
return <TCensecQualidadeIndex />;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import TCensecIndex from '@/packages/administrativo/components/TCensec/TCensecIndex';
|
||||
|
||||
export default function GTBEstadoCivilPage() {
|
||||
return <TCensecIndex />;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import TCensecNaturezaLitigioIndex from '@/packages/administrativo/components/TCensecNaturezaLitigio/TCensecNaturezaLitigioIndex';
|
||||
|
||||
export default function GCidadePage() {
|
||||
return <TCensecNaturezaLitigioIndex />;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import TCensecQualidadeIndex from '@/packages/administrativo/components/TCensecQualidade/TCensecQualidadeIndex';
|
||||
|
||||
export default function GTBEstadoCivilPage() {
|
||||
return <TCensecQualidadeIndex />;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import TCensecTipoAtoIndex from '@/packages/administrativo/components/TCensecTipoAto/TCensecTipoAtoIndex';
|
||||
|
||||
export default function GTBEstadoCivilPage() {
|
||||
return <TCensecTipoAtoIndex />;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import GCidadeIndex from '@/packages/administrativo/components/GCidade/GCidadeIndex';
|
||||
|
||||
export default function GCidadePage() {
|
||||
return <GCidadeIndex />;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import GCalculoIndex from '@/packages/administrativo/components/GCalculo/GCalculoIndex';
|
||||
|
||||
export default function GEmolumentoPeriodoPage() {
|
||||
return <GCalculoIndex />;
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import { useParams } from 'next/navigation';
|
||||
|
||||
import GEmolumentoItemIndex from '@/packages/administrativo/components/GEmolumentoItem/GEmolumentoItemIndex';
|
||||
|
||||
export default function GGramaticaPage() {
|
||||
const params = useParams();
|
||||
|
||||
return (
|
||||
<GEmolumentoItemIndex
|
||||
emolumento_id={Number(params.emolumentoId)}
|
||||
emolumento_periodo_id={Number(params.emolumentoPeriodoId)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import GEmolumentoIndex from '@/packages/administrativo/components/GEmolumento/GEmolumentoIndex';
|
||||
|
||||
export default function GEmolumentoPeriodoPage() {
|
||||
return <GEmolumentoIndex />;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import GEmolumentoPeriodoIndex from '@/packages/administrativo/components/GEmolumentoPeriodo/GEmolumentoPeriodoIndex';
|
||||
|
||||
export default function GEmolumentoPeriodoPage() {
|
||||
return <GEmolumentoPeriodoIndex />;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import GGramaticaIndex from '@/packages/administrativo/components/GGramatica/GGramaticaIndex';
|
||||
|
||||
export default function GGramaticaPage() {
|
||||
return <GGramaticaIndex />;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import TImovelDashboard from '@/packages/administrativo/components/TImovel/TImovelDashboard';
|
||||
|
||||
export default function TImovelDashboardPage() {
|
||||
return <TImovelDashboard />;
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import TImovelIndex from '@/packages/administrativo/components/TImovel/TImovelIndex';
|
||||
import TImovelIndex from "@/packages/administrativo/components/TImovel/TImovelIndex";
|
||||
|
||||
export default function TImovelRuralPage() {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import GTBTipoLogradouroIndex from '@/packages/administrativo/components/GTBTipoLogradouro/GTBTipoLogradouroIndex';
|
||||
|
||||
export default function GMedidaTipoPage() {
|
||||
return <GTBTipoLogradouroIndex />;
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import TImovelIndex from '@/packages/administrativo/components/TImovel/TImovelIndex';
|
||||
import TImovelIndex from "@/packages/administrativo/components/TImovel/TImovelIndex";
|
||||
|
||||
export default function TImovelUrbanoPage() {
|
||||
return (
|
||||
|
|
@ -10,4 +10,4 @@ export default function TImovelUrbanoPage() {
|
|||
tipoClasse={1}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import GMedidaTipoIndex from '@/packages/administrativo/components/GMedidaTipo/GMedidaTipoIndex';
|
||||
|
||||
export default function GMedidaTipoPage() {
|
||||
return <GMedidaTipoIndex />;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import GNaturezaIndex from '@/packages/administrativo/components/GNatureza/GNaturezaIndex';
|
||||
|
||||
export default function GNaturezaPage() {
|
||||
return <GNaturezaIndex sistema_id={2} />;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import TPessoaDashboard from '@/packages/administrativo/components/TPessoa/TPessoaDashboard';
|
||||
|
||||
export default function TPessoaDashboardPage() {
|
||||
return <TPessoaDashboard />;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import GTBEstadoCivilIndex from '@/packages/administrativo/components/GTBEstadoCivil/GTBEstadoCivilIndex';
|
||||
|
||||
export default function GTBEstadoCivilPage() {
|
||||
return <GTBEstadoCivilIndex />;
|
||||
}
|
||||
|
|
@ -3,5 +3,7 @@
|
|||
import TPessoaFisicaIndex from '@/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaIndex';
|
||||
|
||||
export default function TPessoaFisica() {
|
||||
return <TPessoaFisicaIndex />;
|
||||
return (
|
||||
<TPessoaFisicaIndex />
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,5 +3,8 @@
|
|||
import TPessoaJuridicaIndex from '@/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaIndex';
|
||||
|
||||
export default function TPessoaFisica() {
|
||||
return <TPessoaJuridicaIndex />;
|
||||
|
||||
return (
|
||||
<TPessoaJuridicaIndex />
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import GTBProfissaoIndex from '@/packages/administrativo/components/GTBProfissao/GTBProfissaoIndex';
|
||||
|
||||
export default function GTBEstadoCivilPage() {
|
||||
return <GTBProfissaoIndex />;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import GTBRegimeBensIndex from '@/packages/administrativo/components/GTBRegimeBens/GTBRegimeBensIndex';
|
||||
|
||||
export default function GTBRegimeBensPage() {
|
||||
return <GTBRegimeBensIndex />;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use client';
|
||||
|
||||
import GTBRegimeComunhaoIndex from '@/packages/administrativo/components/GTBRegimeComunhao/GTBRegimeComunhaoIndex';
|
||||
|
||||
export default function GTBRegimeBensPage() {
|
||||
return <GTBRegimeComunhaoIndex />;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import TTBReconhecimentoTipoIndex from '@/packages/administrativo/components/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndex';
|
||||
|
||||
export default function TAtoParteTipo() {
|
||||
return <TTBReconhecimentoTipoIndex />;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import GSeloGrupoIndex from '@/packages/administrativo/components/GSeloGrupo/GSeloGrupoIndex';
|
||||
|
||||
export default function GSeloGrupoPage() {
|
||||
return <GSeloGrupoIndex />;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import TServicoTipoIndex from '@/packages/administrativo/components/TServicoTipo/TServicoTipoIndex';
|
||||
|
||||
export default function TServicoTipoPage() {
|
||||
return <TServicoTipoIndex />;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import GNaturezaTituloIndex from '@/packages/administrativo/components/GNaturezaTitulo/GNaturezaTituloIndex';
|
||||
|
||||
export default function GNaturezaPage() {
|
||||
return <GNaturezaTituloIndex sistema_id={2} />;
|
||||
}
|
||||
|
|
@ -1,20 +1,23 @@
|
|||
'use client';
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import GCidadeForm from '@/packages/administrativo/components/GCidade/GCidadeForm';
|
||||
import GCidadeTable from '@/packages/administrativo/components/GCidade/GCidadeTable';
|
||||
import { useGCidadeReadHook } from '@/packages/administrativo/hooks/GCidade/useGCidadeReadHook';
|
||||
import { useGCidadeRemoveHook } from '@/packages/administrativo/hooks/GCidade/useGCidadeRemoveHook';
|
||||
import { useGCidadeSaveHook } from '@/packages/administrativo/hooks/GCidade/useGCidadeSaveHook';
|
||||
import GCidadeInterface from '@/packages/administrativo/interfaces/GCidade/GCidadeInterface';
|
||||
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GCidadeTable from '../../_components/g_cidade/GCidadeTable';
|
||||
import GCidadeForm from '../../_components/g_cidade/GCidadeForm';
|
||||
|
||||
import { useGCidadeReadHook } from '../../_hooks/g_cidade/useGCidadeReadHook';
|
||||
import { useGCidadeSaveHook } from '../../_hooks/g_cidade/useGCidadeSaveHook';
|
||||
import { useGCidadeRemoveHook } from '../../_hooks/g_cidade/useGCidadeRemoveHook';
|
||||
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
import GCidadeInterface from '../../_interfaces/GCidadeInterface';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
export default function GCidadeIndex() {
|
||||
export default function GCidadePage() {
|
||||
// Hooks para leitura e salvamento
|
||||
const { gCidade, fetchGCidade } = useGCidadeReadHook();
|
||||
const { saveGCidade } = useGCidadeSaveHook();
|
||||
|
|
@ -45,21 +48,22 @@ export default function GCidadeIndex() {
|
|||
setIsFormOpen(true);
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* Fecha o formulário e limpa o andamento selecionado
|
||||
*/
|
||||
const handleCloseForm = useCallback((_: null, __: boolean) => {
|
||||
setSelectedCidade(null);
|
||||
setIsFormOpen(false);
|
||||
}, []);
|
||||
/**
|
||||
* Fecha o formulário e limpa o andamento selecionado
|
||||
*/
|
||||
const handleCloseForm = useCallback((_: null, __: boolean) => {
|
||||
setSelectedCidade(null);
|
||||
setIsFormOpen(false);
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* Salva os dados do formulário
|
||||
*/
|
||||
const handleSave = useCallback(
|
||||
async (formData: GCidadeInterface) => {
|
||||
// Aguarda salvar o registro
|
||||
await saveGCidade(formData);
|
||||
/**
|
||||
* Salva os dados do formulário
|
||||
*/
|
||||
const handleSave = useCallback(async (formData: GCidadeInterface) => {
|
||||
|
||||
|
||||
// Aguarda salvar o registro
|
||||
await saveGCidade(formData);
|
||||
|
||||
// Atualiza a lista de dados
|
||||
fetchGCidade();
|
||||
|
|
@ -1,20 +1,22 @@
|
|||
'use client';
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useGMedidaTipoReadHook } from '@/packages/administrativo/hooks/GMedidaTipo/useGMedidaTipoReadHook';
|
||||
import { useGMedidaTipoRemoveHook } from '@/packages/administrativo/hooks/GMedidaTipo/useGMedidaTipoRemoveHook';
|
||||
import { useGMedidaTipoSaveHook } from '@/packages/administrativo/hooks/GMedidaTipo/useGMedidaTipoSaveHook';
|
||||
import { GMedidaTipoInterface } from '@/packages/administrativo/interfaces/GMedidaTipo/GMedidaTipoInterface';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
import GMedidaTipoForm from './GMedidaTipoForm';
|
||||
import GMedidaTipoTable from './GMedidaTipoTable';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GMedidaTipoTable from '../../_components/g_medidatipo/GMedidaTipoTable';
|
||||
import GMedidaTipoForm from '../../_components/g_medidatipo/GMedidaTipoForm';
|
||||
|
||||
import { useGMedidaTipoReadHook } from '../../_hooks/g_medidatipo/useGMedidaTipoReadHook';
|
||||
import { useGMedidaTipoSaveHook } from '../../_hooks/g_medidatipo/useGMedidaTipoSaveHook';
|
||||
import { useGMedidaTipoRemoveHook } from '../../_hooks/g_medidatipo/useGMedidaTipoRemoveHook';
|
||||
|
||||
import { GMedidaTipoInterface } from '../../_interfaces/GMedidaTipoInterface';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
|
||||
const initialMedidaTipo: GMedidaTipoInterface = {
|
||||
medida_tipo_id: 0,
|
||||
|
|
@ -22,7 +24,7 @@ const initialMedidaTipo: GMedidaTipoInterface = {
|
|||
descricao: '',
|
||||
};
|
||||
|
||||
export default function GMedidaTipoIndex() {
|
||||
export default function GMedidaTipoPage() {
|
||||
// Controle de exibição de respostas
|
||||
const { setResponse } = useResponse();
|
||||
|
||||
|
|
@ -108,8 +110,8 @@ export default function GMedidaTipoIndex() {
|
|||
title={'Tipos de Medida'}
|
||||
description={'Gerenciamento de tipos de medida'}
|
||||
buttonText={'Novo Tipo de Medida'}
|
||||
buttonAction={() => {
|
||||
handleOpenForm(null);
|
||||
buttonAction={(data) => {
|
||||
handleOpenForm((data = initialMedidaTipo));
|
||||
}}
|
||||
/>
|
||||
|
||||
|
|
@ -1,21 +1,22 @@
|
|||
'use client';
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useGTBBairroReadHook } from '@/packages/administrativo/hooks/GTBBairro/useGTBBairroReadHook';
|
||||
import { useGTBBairroRemoveHook } from '@/packages/administrativo/hooks/GTBBairro/useGTBBairroRemoveHook';
|
||||
import { useGTBBairroSaveHook } from '@/packages/administrativo/hooks/GTBBairro/useGTBBairroSaveHook';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
|
||||
import { GTBBairroInterface } from '@/packages/administrativo/interfaces/GTBBairro/GTBBairroInterface';
|
||||
import GTBBairroForm from './GTBBairroForm';
|
||||
import GTBBairroTable from './GTBBairroTable';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GTBBairroTable from '../../_components/g_tb_bairro/GTBBairroTable';
|
||||
import GTBBairroForm from '../../_components/g_tb_bairro/GTBBairroForm';
|
||||
|
||||
import { useGTBBairroReadHook } from '../../_hooks/g_tb_bairro/useGTBBairroReadHook';
|
||||
import { useGTBBairroSaveHook } from '../../_hooks/g_tb_bairro/useGTBBairroSaveHook';
|
||||
import { useGTBBairroRemoveHook } from '../../_hooks/g_tb_bairro/useGTBBairroRemoveHook';
|
||||
|
||||
import { GTBBairroInterface } from '../../_interfaces/GTBBairroInterface';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
|
||||
const initialBairro: GTBBairroInterface = {
|
||||
sistema_id: null,
|
||||
|
|
@ -24,7 +25,7 @@ const initialBairro: GTBBairroInterface = {
|
|||
situacao: SituacoesEnum.A,
|
||||
};
|
||||
|
||||
export default function GTBBairroIndex() {
|
||||
export default function GTBBairroPage() {
|
||||
// Controle de exibição de respostas
|
||||
const { setResponse } = useResponse();
|
||||
|
||||
|
|
@ -123,8 +124,8 @@ export default function GTBBairroIndex() {
|
|||
title={'Bairros'}
|
||||
description={'Gerenciamento de Bairros'}
|
||||
buttonText={'Novo Bairro'}
|
||||
buttonAction={() => {
|
||||
handleOpenForm(null);
|
||||
buttonAction={(data) => {
|
||||
handleOpenForm((data = initialBairro));
|
||||
}}
|
||||
/>
|
||||
|
||||
|
|
@ -1,20 +1,21 @@
|
|||
'use client';
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
import { useGTBEstadoCivilReadHook } from '@/packages/administrativo/hooks/GTBEstadoCivil/useGTBEstadoCivilReadHook';
|
||||
import { useGTBEstadoCivilRemoveHook } from '@/packages/administrativo/hooks/GTBEstadoCivil/useGTBEstadoCivilRemoveHook';
|
||||
import { useGTBEstadoCivilSaveHook } from '@/packages/administrativo/hooks/GTBEstadoCivil/useGTBEstadoCivilSaveHook';
|
||||
import { GTBEstadoCivilInterface } from '@/packages/administrativo/interfaces/GTBEstadoCivil/GTBEstadoCivilInterface';
|
||||
import GTBEstadoCivilForm from './GTBEstadoCivilForm';
|
||||
import GTBEstadoCivilTable from './GTBEstadoCivilTable';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GTBEstadoCivilTable from '../../_components/g_tb_estadocivil/GTBEstadoCivilTable';
|
||||
import GTBEstadoCivilForm from '../../_components/g_tb_estadocivil/GTBEstadoCivilForm';
|
||||
|
||||
import { useGTBEstadoCivilReadHook } from '../../_hooks/g_tb_estadocivil/useGTBEstadoCivilReadHook';
|
||||
import { useGTBEstadoCivilSaveHook } from '../../_hooks/g_tb_estadocivil/useGTBEstadoCivilSaveHook';
|
||||
import { useGTBEstadoCivilRemoveHook } from '../../_hooks/g_tb_estadocivil/useGTBEstadoCivilRemoveHook';
|
||||
|
||||
import { GTBEstadoCivilInterface } from '../../_interfaces/GTBEstadoCivilInterface';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
const initalEstadoCivil: GTBEstadoCivilInterface = {
|
||||
tb_estadocivil_id: 0,
|
||||
|
|
@ -23,7 +24,7 @@ const initalEstadoCivil: GTBEstadoCivilInterface = {
|
|||
situacao: 'A',
|
||||
};
|
||||
|
||||
export default function GTBEstadoCivilIndex() {
|
||||
export default function TBEstadoCivilPage() {
|
||||
// Controle de exibição de respostas
|
||||
const { setResponse } = useResponse();
|
||||
|
||||
|
|
@ -109,8 +110,8 @@ export default function GTBEstadoCivilIndex() {
|
|||
title={'Estados Civis'}
|
||||
description={'Gerenciamento de Estados Civis'}
|
||||
buttonText={'Novo Estado Civil'}
|
||||
buttonAction={() => {
|
||||
handleOpenForm(null);
|
||||
buttonAction={(data) => {
|
||||
handleOpenForm((data = initalEstadoCivil));
|
||||
}}
|
||||
/>
|
||||
|
||||
|
|
@ -1,21 +1,23 @@
|
|||
'use client';
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useGTBProfissaoReadHook } from '@/packages/administrativo/hooks/GTBProfissao/useGTBProfissaoReadHook';
|
||||
import { useGTBProfissaoRemoveHook } from '@/packages/administrativo/hooks/GTBProfissao/useGTBProfissaoRemoveHook';
|
||||
import { useGTBProfissaoSaveHook } from '@/packages/administrativo/hooks/GTBProfissao/useGTBProfissaoSaveHook';
|
||||
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GTBProfissaoTable from '../../_components/g_tb_profissao/GTBProfissaoTable';
|
||||
import GTBProfissaoForm from '../../_components/g_tb_profissao/GTBProfissaoForm';
|
||||
|
||||
import { useGTBProfissaoReadHook } from '../../_hooks/g_tb_profissao/useGTBProfissaoReadHook';
|
||||
import { useGTBProfissaoSaveHook } from '../../_hooks/g_tb_profissao/useGTBProfissaoSaveHook';
|
||||
import { useGTBProfissaoRemoveHook } from '../../_hooks/g_tb_profissao/useGTBProfissaoRemoveHook';
|
||||
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
import GTBProfissaoInterface from '../../_interfaces/GTBProfissaoInterface';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
import GTBProfissaoInterface from '@/packages/administrativo/interfaces/GTBProfissao/GTBProfissaoInterface';
|
||||
import GTBProfissaoForm from './GTBProfissaoForm';
|
||||
import GTBProfissaoTable from './GTBProfissaoTable';
|
||||
|
||||
export default function GTBProfissaoIndex() {
|
||||
export default function TTBAndamentoServico() {
|
||||
// Hooks para leitura e salvamento
|
||||
const { gTBProfissao, fetchGTBProfissao } = useGTBProfissaoReadHook();
|
||||
const { saveGTBProfissao } = useGTBProfissaoSaveHook();
|
||||
|
|
@ -1,21 +1,23 @@
|
|||
'use client';
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import GTBRegimeBensForm from '@/packages/administrativo/components/GTBRegimeBens/GTBRegimeBensForm';
|
||||
import GTBRegimeBensTable from '@/packages/administrativo/components/GTBRegimeBens/GTBRegimeBensTable';
|
||||
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GTBRegimeBensTable from '../../_components/g_tb_regimebens/GTBRegimeBensTable';
|
||||
import GTBRegimeBensForm from '../../_components/g_tb_regimebens/GTBRegimeBensForm';
|
||||
|
||||
import { useGTBRegimeBensReadHook } from '../../_hooks/g_tb_regimebens/useGTBRegimeBensReadHook';
|
||||
import { useGTBRegimeBensSaveHook } from '../../_hooks/g_tb_regimebens/useGTBRegimeBensSaveHook';
|
||||
import { useGTBRegimeBensRemoveHook } from '../../_hooks/g_tb_regimebens/useGTBRegimeBensRemoveHook';
|
||||
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
import GTBRegimeBensInterface from '../../_interfaces/GTBRegimeBensInterface';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
import { useGTBRegimeBensReadHook } from '@/packages/administrativo/hooks/GTBRegimeBens/useGTBRegimeBensReadHook';
|
||||
import { useGTBRegimeBensRemoveHook } from '@/packages/administrativo/hooks/GTBRegimeBens/useGTBRegimeBensRemoveHook';
|
||||
import { useGTBRegimeBensSaveHook } from '@/packages/administrativo/hooks/GTBRegimeBens/useGTBRegimeBensSaveHook';
|
||||
import GTBRegimeBensInterface from '@/packages/administrativo/interfaces/GTBRegimeBens/GTBRegimeBensInterface';
|
||||
|
||||
export default function GTBRegimeBensIndex() {
|
||||
export default function TTBAndamentoServico() {
|
||||
// Hooks para leitura e salvamento
|
||||
const { gTBRegimeBens, fetchGTBRegimeBens } = useGTBRegimeBensReadHook();
|
||||
const { saveGTBRegimeComunhao } = useGTBRegimeBensSaveHook();
|
||||
|
|
@ -1,21 +1,23 @@
|
|||
'use client';
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GTBRegimeComunhaoTable from '../../_components/g_tb_regimecomunhao/GTBRegimeComunhaoTable';
|
||||
import GTBRegimeComunhaoForm from '../../_components/g_tb_regimecomunhao/GTBRegimeComunhaoForm';
|
||||
|
||||
import { useGTBRegimeComunhaoReadHook } from '../../_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoReadHook';
|
||||
import { useGTBRegimeComunhaoSaveHook } from '../../_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoSaveHook';
|
||||
import { useGTBRegimeComunhaoRemoveHook } from '../../_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoRemoveHook';
|
||||
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
import GTBRegimeComunhaoInterface from '../../_interfaces/GTBRegimeComunhaoInterface';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
import { useGTBRegimeComunhaoReadHook } from '@/packages/administrativo/hooks/GTBRegimeComunhao/useGTBRegimeComunhaoReadHook';
|
||||
import { useGTBRegimeComunhaoRemoveHook } from '@/packages/administrativo/hooks/GTBRegimeComunhao/useGTBRegimeComunhaoRemoveHook';
|
||||
import { useGTBRegimeComunhaoSaveHook } from '@/packages/administrativo/hooks/GTBRegimeComunhao/useGTBRegimeComunhaoSaveHook';
|
||||
import GTBRegimeComunhaoInterface from '@/packages/administrativo/interfaces/GTBRegimeComunhao/GTBRegimeComunhaoInterface';
|
||||
import GTBRegimeComunhaoForm from './GTBRegimeComunhaoForm';
|
||||
import GTBRegimeComunhaoTable from './GTBRegimeComunhaoTable';
|
||||
|
||||
export default function GTBRegimeComunhaoIndex() {
|
||||
export default function TTBAndamentoServico() {
|
||||
// Hooks para leitura e salvamento
|
||||
const { gTBRegimeComunhao, fetchGTBRegimeComunhao } = useGTBRegimeComunhaoReadHook();
|
||||
const { saveGTBRegimeComunhao } = useGTBRegimeComunhaoSaveHook();
|
||||
|
|
@ -1,22 +1,24 @@
|
|||
'use client';
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GTBTipoLogradouroTable from '../../_components/g_tb_tipologradouro/GTBTipoLogradouroTable';
|
||||
import GTBTipoLogradouroForm from '../../_components/g_tb_tipologradouro/GTBTipoLogradouroForm';
|
||||
|
||||
import { useGTBTipoLogradouroReadHook } from '@/packages/administrativo/hooks/GTBTipoLogradouro/useGTBTipoLogradouroReadHook';
|
||||
import { useGTBTipoLogradouroRemoveHook } from '@/packages/administrativo/hooks/GTBTipoLogradouro/useGTBTipoLogradouroRemoveHook';
|
||||
import { useGTBTipoLogradouroSaveHook } from '@/packages/administrativo/hooks/GTBTipoLogradouro/useGTBTipoLogradouroSaveHook';
|
||||
import { GTBTipoLogradouroInterface } from '@/packages/administrativo/interfaces/GTBTipoLogradouro/GTBTipoLogradouroInterface';
|
||||
import GTBTipoLogradouroForm from './GTBTipoLogradouroForm';
|
||||
import GTBTipoLogradouroTable from './GTBTipoLogradouroTable';
|
||||
import { useGTBTipoLogradouroReadHook } from '../../_hooks/g_tb_tipologradouro/useGTBTipoLogradouroReadHook';
|
||||
import { useGTBTipoLogradouroSaveHook } from '../../_hooks/g_tb_tipologradouro/useGTBTipoLogradouroSaveHook';
|
||||
import { useGTBTipoLogradouroRemoveHook } from '../../_hooks/g_tb_tipologradouro/useGTBTipoLogradouroRemoveHook';
|
||||
|
||||
export default function GTBTipoLogradouroIndex() {
|
||||
import { GTBTipoLogradouroInterface } from '../../_interfaces/GTBTipoLogradouroInterface';
|
||||
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
export default function TTBAndamentoServico() {
|
||||
// Controle de exibição de respostas
|
||||
const { setResponse } = useResponse();
|
||||
|
||||
|
|
@ -1,21 +1,23 @@
|
|||
'use client';
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import TCensecTable from '../../_components/t_censec/TCensecTable';
|
||||
import TCensecForm from '../../_components/t_censec/TCensecForm';
|
||||
|
||||
import { useTCensecReadHook } from '../../_hooks/t_censec/useTCensecReadHook';
|
||||
import { useTCensecSaveHook } from '../../_hooks/t_censec/useTCensecSaveHook';
|
||||
import { useTCensecDeleteHook } from '../../_hooks/t_censec/useTCensecDeleteHook';
|
||||
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
import TCensecInterface from '../../_interfaces/TCensecInterface';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
import { useTCensecDeleteHook } from '@/packages/administrativo/hooks/TCensec/useTCensecDeleteHook';
|
||||
import { useTCensecReadHook } from '@/packages/administrativo/hooks/TCensec/useTCensecReadHook';
|
||||
import { useTCensecSaveHook } from '@/packages/administrativo/hooks/TCensec/useTCensecSaveHook';
|
||||
import TCensecInterface from '@/packages/administrativo/interfaces/TCensec/TCensecInterface';
|
||||
import TCensecForm from './TCensecForm';
|
||||
import TCensecTable from './TCensecTable';
|
||||
|
||||
export default function TCensecIndex() {
|
||||
export default function TTBAndamentoServico() {
|
||||
// Controle de estado do botão
|
||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||
|
||||
|
|
@ -1,40 +1,42 @@
|
|||
'use client';
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { useEffect, useState, useCallback } from "react";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { useConfirmDialog } from "@/shared/components/confirmDialog/useConfirmDialog";
|
||||
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
import Header from "@/shared/components/structure/Header";
|
||||
import ConfirmDialog from "@/shared/components/confirmDialog/ConfirmDialog";
|
||||
import Loading from "@/shared/components/loading/loading";
|
||||
|
||||
import { useTCensecReadHook } from '@/packages/administrativo/hooks/TCensec/useTCensecReadHook';
|
||||
import { useTCensecTipoAtoReadHook } from '@/packages/administrativo/hooks/TCensecTipoAto/useTCensecTipoAtoReadHook';
|
||||
import { useTCensecTipoAtoRemoveHook } from '@/packages/administrativo/hooks/TCensecTipoAto/useTCensecTipoAtoRemoveHook';
|
||||
import { useTCensecTipoAtoSaveHook } from '@/packages/administrativo/hooks/TCensecTipoAto/useTCensecTipoAtoSaveHook';
|
||||
import { TCensecTipoAtoInterface } from '@/packages/administrativo/interfaces/TCensecTipoAto/TCensecTipoAtoInterface';
|
||||
import TCensecTipoAtoForm from './TCensecTipoAtoForm';
|
||||
import TCensecTipoAtoTable from './TCensecTipoAtoTable';
|
||||
import TCensecTipoAtoTable from "../../_components/t_censec_tipoato/TCensecTipoAtoTable";
|
||||
import TCensecTipoAtoForm from "../../_components/t_censec_tipoato/TCensecTipoAtoForm";
|
||||
|
||||
import { useTCensecTipoAtoReadHook } from "../../_hooks/t_censec_tipoato/useTCensecTipoAtoReadHook";
|
||||
import { useTCensecTipoAtoSaveHook } from "../../_hooks/t_censec_tipoato/useTCensecTipoAtoSaveHook";
|
||||
import { useTCensecTipoAtoRemoveHook } from "../../_hooks/t_censec_tipoato/useTCensecTipoAtoRemoveHook";
|
||||
import { useTCensecReadHook } from "../../_hooks/t_censec/useTCensecReadHook";
|
||||
|
||||
import { TCensecTipoAtoInterface } from "../../_interfaces/TCensecTipoAtoInterface";
|
||||
import { SituacoesEnum } from "@/enums/SituacoesEnum";
|
||||
|
||||
// Estado inicial para criação
|
||||
const initialTCensecTipoAto: TCensecTipoAtoInterface = {
|
||||
censec_tipoato_id: 0,
|
||||
censec_id: 0,
|
||||
codigo: null,
|
||||
descricao: '',
|
||||
descricao: "",
|
||||
situacao: SituacoesEnum.A,
|
||||
tipo_separacao: null,
|
||||
tipo_revogacao: null,
|
||||
};
|
||||
|
||||
export default function TCensecTipoAtoIndex() {
|
||||
export default function TCensecTipoAtoPage() {
|
||||
// Hooks para leitura, salvamento e remoção
|
||||
const { tCensecTipoAto, fetchTCensecTipoAto } = useTCensecTipoAtoReadHook();
|
||||
const { saveTCensecTipoAto } = useTCensecTipoAtoSaveHook();
|
||||
const { removeTCensecTipoAto } = useTCensecTipoAtoRemoveHook();
|
||||
|
||||
const { tCensec, fetchTCensec } = useTCensecReadHook();
|
||||
const { tCensec, fetchTCensec } = useTCensecReadHook()
|
||||
|
||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||
|
||||
|
|
@ -69,7 +71,7 @@ export default function TCensecTipoAtoIndex() {
|
|||
await fetchTCensecTipoAto();
|
||||
handleCloseForm();
|
||||
},
|
||||
[saveTCensecTipoAto, fetchTCensecTipoAto],
|
||||
[saveTCensecTipoAto, fetchTCensecTipoAto]
|
||||
);
|
||||
|
||||
// Deleção
|
||||
|
|
@ -78,7 +80,7 @@ export default function TCensecTipoAtoIndex() {
|
|||
setItemToDelete(item);
|
||||
openConfirmDialog();
|
||||
},
|
||||
[openConfirmDialog],
|
||||
[openConfirmDialog]
|
||||
);
|
||||
|
||||
const handleDelete = useCallback(async () => {
|
||||
|
|
@ -92,7 +94,7 @@ export default function TCensecTipoAtoIndex() {
|
|||
// Carregar dados ao montar
|
||||
useEffect(() => {
|
||||
fetchTCensecTipoAto();
|
||||
fetchTCensec();
|
||||
fetchTCensec()
|
||||
}, []);
|
||||
|
||||
if (!tCensecTipoAto) {
|
||||
|
|
@ -106,8 +108,8 @@ export default function TCensecTipoAtoIndex() {
|
|||
title="Tipos de Ato CENSEC"
|
||||
description="Gerenciamento de Tipos de Ato vinculados ao CENSEC"
|
||||
buttonText="Novo Tipo de Ato"
|
||||
buttonAction={() => {
|
||||
handleOpenForm(null);
|
||||
buttonAction={(data) => {
|
||||
handleOpenForm((data = initialTCensecTipoAto));
|
||||
}}
|
||||
/>
|
||||
|
||||
|
|
@ -1,21 +1,23 @@
|
|||
'use client';
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useTCensecNaturezaLitigioReadHook } from '@/packages/administrativo/hooks/TCensecNaturezaLitigio/useTCensecNaturezaLitigioReadHook';
|
||||
import { useTCensecNaturezaLitigioRemoveHook } from '@/packages/administrativo/hooks/TCensecNaturezaLitigio/useTCensecNaturezaLitigioRemoveHook';
|
||||
import { useTCensecNaturezaLitigioSaveHook } from '@/packages/administrativo/hooks/TCensecNaturezaLitigio/useTCensecNaturezaLitigioSaveHook';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
|
||||
import { TCensecNaturezaLitigioInterface } from '@/packages/administrativo/interfaces/TCensecNaturezaLitigio/TCensecNaturezaLitigioInterface';
|
||||
import TCensecNaturezaLitigioForm from './TCensecNaturezaLitigioForm';
|
||||
import TCensecNaturezaLitigioTable from './TCensecNaturezaLitigioTable';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
import TCensecNaturezaLitigioTable from '../../_components/t_censecnaturezalitigio/TCensecNaturezaLitigioTable';
|
||||
import TCensecNaturezaLitigioForm from '../../_components/t_censecnaturezalitigio/TCensecNaturezaLitigioForm';
|
||||
|
||||
import { useTCensecNaturezaLitigioReadHook } from '../../_hooks/t_censecnaturezalitigio/useTCensecNaturezaLitigioReadHook';
|
||||
import { useTCensecNaturezaLitigioSaveHook } from '../../_hooks/t_censecnaturezalitigio/useTCensecNaturezaLitigioSaveHook';
|
||||
import { useTCensecNaturezaLitigioRemoveHook } from '../../_hooks/t_censecnaturezalitigio/useTCensecNaturezaLitigioRemoveHook';
|
||||
|
||||
import { TCensecNaturezaLitigioInterface } from '../../_interfaces/TCensecNaturezaLitigioInterface';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
|
||||
const initialCensecNaturezaLitigio: TCensecNaturezaLitigioInterface = {
|
||||
censec_naturezalitigio_id: 0,
|
||||
|
|
@ -23,7 +25,7 @@ const initialCensecNaturezaLitigio: TCensecNaturezaLitigioInterface = {
|
|||
situacao: SituacoesEnum.A,
|
||||
};
|
||||
|
||||
export default function TCensecNaturezaLitigioIndex() {
|
||||
export default function TCensecNaturezaLitigioPage() {
|
||||
// Controle de exibição de respostas
|
||||
const { setResponse } = useResponse();
|
||||
|
||||
|
|
@ -112,9 +114,7 @@ export default function TCensecNaturezaLitigioIndex() {
|
|||
title={'Natureza do Litígio'}
|
||||
description={'Gerenciamento de Naturezas do Litígio'}
|
||||
buttonText={'Nova Natureza'}
|
||||
buttonAction={() => {
|
||||
handleOpenForm(null);
|
||||
}}
|
||||
buttonAction={(data) => handleOpenForm((data = initialCensecNaturezaLitigio))}
|
||||
/>
|
||||
|
||||
{/* Tabela */}
|
||||
|
|
@ -1,13 +1,14 @@
|
|||
'use client';
|
||||
|
||||
import { useParams } from 'next/navigation';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useParams } from 'next/navigation';
|
||||
|
||||
import MainEditor from '@/components/MainEditor';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useTMinutaReadHook } from '@/packages/administrativo/hooks/TMinuta/useTMinutaReadHook';
|
||||
import { TMinutaInterface } from '@/packages/administrativo/interfaces/TMinuta/TMinutaInterface';
|
||||
import MainEditor from '@/components/MainEditor';
|
||||
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import { useTMinutaReadHook } from '../../../../_hooks/t_minuta/useTMinutaReadHook';
|
||||
import { TMinutaInterface } from '../../../../_interfaces/TMinutaInterface';
|
||||
|
||||
export default function TMinutaDetalhes() {
|
||||
const params = useParams();
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
'use client';
|
||||
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import z from 'zod';
|
||||
import { useEffect } from 'react';
|
||||
import { useForm, Controller } from 'react-hook-form';
|
||||
import z from 'zod';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
|
||||
import MainEditor from '@/components/MainEditor';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import {
|
||||
Form,
|
||||
|
|
@ -19,8 +17,11 @@ import {
|
|||
} from '@/components/ui/form';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { useTMinutaSaveHook } from '@/packages/administrativo/hooks/TMinuta/useTMinutaSaveHook';
|
||||
import { TMinutaSchema } from '@/packages/administrativo/schemas/TMinuta/TMinutaSchema';
|
||||
|
||||
import MainEditor from '@/components/MainEditor';
|
||||
import { TMinutaSchema } from '../../../_schemas/TMinutaSchema';
|
||||
import { useTMinutaSaveHook } from '../../../_hooks/t_minuta/useTMinutaSaveHook';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
type FormValues = z.infer<typeof TMinutaSchema>;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,22 @@
|
|||
'use client';
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import TMinutaForm from '@/packages/administrativo/components/TMinuta/TMinutaForm';
|
||||
import TMinutaTable from '@/packages/administrativo/components/TMinuta/TMinutaTable';
|
||||
import { useTMinutaIndexHook } from '@/packages/administrativo/hooks/TMinuta/useTMinutaIndexHook';
|
||||
import { useTMinutaReadHook } from '@/packages/administrativo/hooks/TMinuta/useTMinutaReadHook';
|
||||
import { useTMinutaRemoveHook } from '@/packages/administrativo/hooks/TMinuta/useTMinutaRemoveHook';
|
||||
import { useTMinutaSaveHook } from '@/packages/administrativo/hooks/TMinuta/useTMinutaSaveHook';
|
||||
import { TMinutaInterface } from '@/packages/administrativo/interfaces/TMinuta/TMinutaInterface';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
import TMinutaTable from '../../_components/t_minuta/TMinutaTable';
|
||||
import TMinutaForm from '../../_components/t_minuta/TMinutaForm';
|
||||
|
||||
import { useTMinutaReadHook } from '../../_hooks/t_minuta/useTMinutaReadHook';
|
||||
import { useTMinutaSaveHook } from '../../_hooks/t_minuta/useTMinutaSaveHook';
|
||||
import { useTMinutaRemoveHook } from '../../_hooks/t_minuta/useTMinutaRemoveHook';
|
||||
|
||||
import { TMinutaInterface } from '../../_interfaces/TMinutaInterface';
|
||||
import { useTMinutaIndexHook } from '../../_hooks/t_minuta/useTMinutaIndexHook';
|
||||
|
||||
export default function TMinutaPage() {
|
||||
// Hooks de leitura e escrita
|
||||
|
|
|
|||
|
|
@ -0,0 +1,278 @@
|
|||
'use client'
|
||||
|
||||
import React, { useMemo, useState } from "react";
|
||||
import {
|
||||
Card,
|
||||
CardTitle,
|
||||
CardContent,
|
||||
} from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
PieChart,
|
||||
Pie,
|
||||
Cell,
|
||||
ResponsiveContainer,
|
||||
BarChart,
|
||||
Bar,
|
||||
XAxis,
|
||||
YAxis,
|
||||
Tooltip,
|
||||
Legend,
|
||||
} from "recharts";
|
||||
|
||||
// Função de agregação
|
||||
function sampleAggregations(data) {
|
||||
const bySexo: Record<string, number> = {};
|
||||
const byUF: Record<string, number> = {};
|
||||
const byProf: Record<string, number> = {};
|
||||
const byEstCivil: Record<string, number> = {};
|
||||
const byInstr: Record<string, number> = {};
|
||||
const docsExpiry: any[] = [];
|
||||
|
||||
const now = new Date();
|
||||
for (const p of data) {
|
||||
const sexo = p.SEXO || "Não informado";
|
||||
bySexo[sexo] = (bySexo[sexo] || 0) + 1;
|
||||
|
||||
const uf = p.UF_RESIDENCIA || p.UF || "Não informado";
|
||||
byUF[uf] = (byUF[uf] || 0) + 1;
|
||||
|
||||
const prof = p.TB_PROFISSAO_ID || "Outros";
|
||||
byProf[prof] = (byProf[prof] || 0) + 1;
|
||||
|
||||
const ec = p.TB_ESTADOCIVIL_ID || "Não informado";
|
||||
byEstCivil[ec] = (byEstCivil[ec] || 0) + 1;
|
||||
|
||||
const gi = p.GRAU_INSTRUCAO || "Não informado";
|
||||
byInstr[gi] = (byInstr[gi] || 0) + 1;
|
||||
|
||||
if (p.DOCUMENTO_VALIDADE) {
|
||||
const dv = new Date(p.DOCUMENTO_VALIDADE);
|
||||
const days = Math.ceil((dv.getTime() - now.getTime()) / (1000 * 60 * 60 * 24));
|
||||
docsExpiry.push({
|
||||
id: p.PESSOA_ID || p.DOCUMENTO_NUMERO || Math.random(),
|
||||
days,
|
||||
date: p.DOCUMENTO_VALIDADE
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
sexo: Object.entries(bySexo).map(([key, value]) => ({ name: key, value })),
|
||||
uf: Object.entries(byUF).map(([key, value]) => ({ name: key, value })),
|
||||
prof: Object.entries(byProf)
|
||||
.map(([key, value]) => ({ name: String(key), value }))
|
||||
.sort((a, b) => b.value - a.value)
|
||||
.slice(0, 10),
|
||||
estCivil: Object.entries(byEstCivil).map(([key, value]) => ({ name: key, value })),
|
||||
instr: Object.entries(byInstr).map(([key, value]) => ({ name: key, value })),
|
||||
docsExpiry,
|
||||
};
|
||||
}
|
||||
|
||||
// Paleta
|
||||
const COLORS = [
|
||||
"#4F46E5",
|
||||
"#06B6D4",
|
||||
"#F59E0B",
|
||||
"#EF4444",
|
||||
"#10B981",
|
||||
"#8B5CF6",
|
||||
"#F97316",
|
||||
"#6366F1",
|
||||
"#EC4899",
|
||||
"#334155",
|
||||
];
|
||||
|
||||
export default function PessoasDashboard({ dataset = null }) {
|
||||
const mock = useMemo(() => {
|
||||
if (dataset) return dataset;
|
||||
// Mock realista
|
||||
const nomes = ["Ana Clara", "Bruno Silva", "Carlos Souza", "Daniela Oliveira", "Eduardo Lima", "Fernanda Rocha", "Gustavo Alves", "Helena Martins"];
|
||||
const sexos = ["Masculino", "Feminino", "Outro"];
|
||||
const ufs = ["São Paulo", "Rio de Janeiro", "Minas Gerais", "Goiás", "Distrito Federal"];
|
||||
const profs = ["Advogado", "Professor", "Agricultor", "Engenheiro Civil", "Estudante Universitário", "Médico", "Enfermeiro", "Empresário"];
|
||||
const estc = ["Solteiro(a)", "Casado(a)", "Divorciado(a)", "Viúvo(a)", "União Estável"];
|
||||
const instrucao = ["Ensino Fundamental", "Ensino Médio", "Ensino Superior", "Pós-Graduação", "Mestrado", "Doutorado"];
|
||||
const arr: any[] = [];
|
||||
for (let i = 0; i < 200; i++) {
|
||||
const birth = new Date(1960 + Math.floor(Math.random() * 50), Math.floor(Math.random() * 12), Math.floor(Math.random() * 28) + 1);
|
||||
const docVal = new Date();
|
||||
docVal.setFullYear(docVal.getFullYear() + Math.floor(Math.random() * 5));
|
||||
arr.push({
|
||||
PESSOA_ID: i + 1,
|
||||
NOME: nomes[Math.floor(Math.random() * nomes.length)],
|
||||
SEXO: sexos[Math.floor(Math.random() * sexos.length)],
|
||||
UF_RESIDENCIA: ufs[Math.floor(Math.random() * ufs.length)],
|
||||
TB_PROFISSAO_ID: profs[Math.floor(Math.random() * profs.length)],
|
||||
TB_ESTADOCIVIL_ID: estc[Math.floor(Math.random() * estc.length)],
|
||||
GRAU_INSTRUCAO: instrucao[Math.floor(Math.random() * instrucao.length)],
|
||||
DOCUMENTO_VALIDADE: docVal.toISOString().slice(0, 10),
|
||||
DATA_NASCIMENTO: birth.toISOString().slice(0, 10),
|
||||
});
|
||||
}
|
||||
return arr;
|
||||
}, [dataset]);
|
||||
|
||||
const aggregations = useMemo(() => sampleAggregations(mock), [mock]);
|
||||
|
||||
return (
|
||||
<div className="p-6 space-y-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-2xl font-semibold">Dashboard de Pessoas</h1>
|
||||
<div className="flex gap-2">
|
||||
<Button onClick={() => {}}>Exportar CSV</Button>
|
||||
<Button variant="ghost" onClick={() => window.location.reload()}>Atualizar</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Linha 1 */}
|
||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
||||
<Card>
|
||||
<CardTitle>Distribuição por Sexo</CardTitle>
|
||||
<CardContent className="h-64 p-4">
|
||||
<ResponsiveContainer>
|
||||
<PieChart>
|
||||
<Pie data={aggregations.sexo} dataKey="value" nameKey="name" outerRadius={80} label>
|
||||
{aggregations.sexo.map((entry, index) => (
|
||||
<Cell key={`cell-${index}`} fill={COLORS[index % COLORS.length]} />
|
||||
))}
|
||||
</Pie>
|
||||
<Tooltip />
|
||||
</PieChart>
|
||||
</ResponsiveContainer>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardTitle>Idade (faixas etárias)</CardTitle>
|
||||
<CardContent className="h-64 p-4">
|
||||
<ResponsiveContainer>
|
||||
<BarChart data={(() => {
|
||||
const now = new Date();
|
||||
const ages = mock.map((p) => {
|
||||
const d = p.DATA_NASCIMENTO ? new Date(p.DATA_NASCIMENTO) : null;
|
||||
if (!d) return null;
|
||||
return Math.floor((now.getTime() - d.getTime()) / (1000 * 60 * 60 * 24 * 365.25));
|
||||
}).filter(Boolean) as number[];
|
||||
const buckets = ["0-17","18-25","26-35","36-45","46-60","61+"];
|
||||
const counts: Record<string, number> = {"0-17":0,"18-25":0,"26-35":0,"36-45":0,"46-60":0,"61+":0};
|
||||
for (const a of ages) {
|
||||
if (a<=17) counts['0-17']++;
|
||||
else if (a<=25) counts['18-25']++;
|
||||
else if (a<=35) counts['26-35']++;
|
||||
else if (a<=45) counts['36-45']++;
|
||||
else if (a<=60) counts['46-60']++;
|
||||
else counts['61+']++;
|
||||
}
|
||||
return buckets.map(b => ({ bucket: b, value: counts[b]}));
|
||||
})()}>
|
||||
<XAxis dataKey="bucket" />
|
||||
<YAxis />
|
||||
<Tooltip />
|
||||
<Bar dataKey="value" fill={COLORS[0]} />
|
||||
</BarChart>
|
||||
</ResponsiveContainer>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardTitle>Top Profissões</CardTitle>
|
||||
<CardContent className="h-64 p-4">
|
||||
<ResponsiveContainer>
|
||||
<BarChart data={aggregations.prof} layout="vertical">
|
||||
<XAxis type="number" />
|
||||
<YAxis dataKey="name" type="category" />
|
||||
<Tooltip />
|
||||
<Bar dataKey="value" fill={COLORS[3]} />
|
||||
</BarChart>
|
||||
</ResponsiveContainer>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* Linha 2 */}
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||
<Card>
|
||||
<CardTitle>Distribuição por Unidade Federativa</CardTitle>
|
||||
<CardContent className="h-72 p-4">
|
||||
<ResponsiveContainer>
|
||||
<BarChart data={aggregations.uf}>
|
||||
<XAxis dataKey="name" />
|
||||
<YAxis />
|
||||
<Tooltip />
|
||||
<Bar dataKey="value" fill={COLORS[1]} />
|
||||
</BarChart>
|
||||
</ResponsiveContainer>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardTitle>Documentos próximos ao vencimento</CardTitle>
|
||||
<CardContent className="h-72 p-4 overflow-auto">
|
||||
<ul className="text-sm space-y-2">
|
||||
{aggregations.docsExpiry
|
||||
.sort((a,b) => a.days - b.days)
|
||||
.slice(0, 15)
|
||||
.map((d) => (
|
||||
<li key={d.id} className="flex justify-between">
|
||||
<div>Documento #{d.id}</div>
|
||||
<div>{d.date} ({d.days} dias)</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* Linha 3 */}
|
||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
||||
<Card>
|
||||
<CardTitle>Estado Civil</CardTitle>
|
||||
<CardContent className="h-56 p-4">
|
||||
<ResponsiveContainer>
|
||||
<PieChart>
|
||||
<Pie data={aggregations.estCivil} dataKey="value" nameKey="name" outerRadius={70} label />
|
||||
<Tooltip />
|
||||
</PieChart>
|
||||
</ResponsiveContainer>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardTitle>Grau de Instrução</CardTitle>
|
||||
<CardContent className="h-56 p-4">
|
||||
<ResponsiveContainer>
|
||||
<BarChart data={aggregations.instr}>
|
||||
<XAxis dataKey="name" />
|
||||
<YAxis />
|
||||
<Tooltip />
|
||||
<Bar dataKey="value" fill={COLORS[2]} />
|
||||
</BarChart>
|
||||
</ResponsiveContainer>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardTitle>Documentos por Tipo (placeholder)</CardTitle>
|
||||
<CardContent className="h-56 p-4">
|
||||
<ResponsiveContainer>
|
||||
<BarChart data={aggregations.prof /* trocar por tipos de documento no dataset real */}>
|
||||
<XAxis dataKey="name" />
|
||||
<YAxis />
|
||||
<Tooltip />
|
||||
<Bar dataKey="value" fill={COLORS[4]} />
|
||||
</BarChart>
|
||||
</ResponsiveContainer>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<div className="mt-6">
|
||||
<small className="text-muted text-sm">
|
||||
Dica: ao conectar seu dataset real, ajuste o mapeamento em <code>sampleAggregations</code> (por exemplo, <b>TB_PROFISSAO_ID → nome da profissão</b>, <b>TB_ESTADOCIVIL_ID → descrição</b>).
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,21 +1,23 @@
|
|||
'use client';
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useTTBAndamentoServicoDeleteHook } from '@/packages/administrativo/hooks/TTBAndamentoServico/useTTBAndamentoServicoDeleteHook';
|
||||
import { useTTBAndamentoServicoReadHook } from '@/packages/administrativo/hooks/TTBAndamentoServico/useTTBAndamentoServicoReadHook';
|
||||
import { useTTBAndamentoServicoSaveHook } from '@/packages/administrativo/hooks/TTBAndamentoServico/useTTBAndamentoServicoSaveHook';
|
||||
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import TTBAndamentoServicoTable from '../../_components/t_tb_andamentoservico/TTBAndamentoServicoTable';
|
||||
import TTBAndamentoServicoForm from '../../_components/t_tb_andamentoservico/TTBAndamentoServicoForm';
|
||||
|
||||
import { useTTBAndamentoServicoReadHook } from '../../_hooks/t_tb_andamentoservico/useTTBAndamentoServicoReadHook';
|
||||
import { useTTBAndamentoServicoSaveHook } from '../../_hooks/t_tb_andamentoservico/useTTBAndamentoServicoSaveHook';
|
||||
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
import TTBAndamentoServicoInterface from '../../_interfaces/TTBAndamentoServicoInterface';
|
||||
import { useTTBAndamentoServicoDeleteHook } from '../../_hooks/t_tb_andamentoservico/useTTBAndamentoServicoDeleteHook';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
import TTBAndamentoServicoInterface from '@/packages/administrativo/interfaces/TTBAndamentoServico/TTBAndamentoServicoInterface';
|
||||
import TTBAndamentoServicoForm from './TTBAndamentoServicoForm';
|
||||
import TTBAndamentoServicoTable from './TTBAndamentoServicoTable';
|
||||
|
||||
export default function TTBAndamentoServicoIndex() {
|
||||
export default function TTBAndamentoServico() {
|
||||
// Hooks para leitura e salvamento
|
||||
const { tTBAndamentosServicos, fetchTTBAndamentoServico } = useTTBAndamentoServicoReadHook();
|
||||
const { saveTTBAndamentoServico } = useTTBAndamentoServicoSaveHook();
|
||||
|
|
@ -0,0 +1,271 @@
|
|||
'use client';
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import TTBReconhecimentoTipoTable from '../../_components/t_tb_reconhecimentotipo/TTBReconhecimentoTipoTable';
|
||||
import TTBReconhecimentoTipoForm from '../../_components/t_tb_reconhecimentotipo/TTBReconhecimentoTipoForm';
|
||||
|
||||
import { useTTBReconhecimentoTipoReadHook } from '../../_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoReadHook';
|
||||
import { useTTBReconhecimentoTipoSaveHook } from '../../_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoSaveHook';
|
||||
import { useTTBReconhecimentoTipoDeleteHook } from '../../_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoDeleteHook';
|
||||
|
||||
<<<<<<< HEAD
|
||||
import ConfirmExclusion from "@/app/_components/confirm_exclusion/ConfirmExclusion";
|
||||
import { useConfirmExclusion } from "@/app/_components/confirm_exclusion/useConfirmExclusion";
|
||||
=======
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
>>>>>>> origin/release(MVP/Sprint6)
|
||||
|
||||
import TTBReconhecimentoTipoInterface from '../../_interfaces/TTBReconhecimentoTipoInterface';
|
||||
|
||||
export default function TTBAndamentoServico() {
|
||||
// Hooks para leitura e salvamento
|
||||
const { tTBReconhecimentosTipos, fetchTTBReconhecimentosTipos } =
|
||||
useTTBReconhecimentoTipoReadHook();
|
||||
const { saveTTBReconhecimentoTipo } = useTTBReconhecimentoTipoSaveHook();
|
||||
const { deleteTTBReconhecimentoTipo } = useTTBReconhecimentoTipoDeleteHook();
|
||||
|
||||
// Estados
|
||||
const [selectedReconhecimentoTipo, setReconhecimentoTipo] =
|
||||
useState<TTBReconhecimentoTipoInterface | null>(null);
|
||||
const [isFormOpen, setIsFormOpen] = useState(false);
|
||||
|
||||
// Estado para saber qual item será deletado
|
||||
const [itemToDelete, setItemToDelete] = useState<TTBReconhecimentoTipoInterface | null>(null);
|
||||
|
||||
/**
|
||||
* Hook do modal de confirmação
|
||||
*/
|
||||
const {
|
||||
isOpen: isConfirmOpen,
|
||||
openDialog: openConfirmDialog,
|
||||
handleConfirm,
|
||||
handleCancel,
|
||||
} = useConfirmDialog();
|
||||
|
||||
<<<<<<< HEAD
|
||||
/**
|
||||
* Hook do modal de exclusão com OTP
|
||||
*/
|
||||
const {
|
||||
isOpen: isConfirmOpen,
|
||||
openDialog: openConfirmDialog,
|
||||
handleConfirm,
|
||||
handleCancel,
|
||||
code,
|
||||
isValid,
|
||||
handleChange,
|
||||
} = useConfirmExclusion({
|
||||
expectedCode: "123456", // 🔑 aqui você define o código esperado
|
||||
onConfirm: () => {
|
||||
console.log("Confirmação aceita com código OTP válido");
|
||||
},
|
||||
onCancel: () => {
|
||||
console.log("Ação cancelada");
|
||||
},
|
||||
});
|
||||
|
||||
=======
|
||||
/**
|
||||
* Abre o formulário no modo de edição ou criação
|
||||
*/
|
||||
const handleOpenForm = useCallback((data: TTBReconhecimentoTipoInterface | null) => {
|
||||
setReconhecimentoTipo(data);
|
||||
setIsFormOpen(true);
|
||||
}, []);
|
||||
>>>>>>> origin/release(MVP/Sprint6)
|
||||
|
||||
/**
|
||||
* Fecha o formulário e limpa o andamento selecionado
|
||||
*/
|
||||
const handleCloseForm = useCallback(() => {
|
||||
setReconhecimentoTipo(null);
|
||||
setIsFormOpen(false);
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* Salva os dados do formulário
|
||||
*/
|
||||
const handleSave = useCallback(
|
||||
async (formData: TTBReconhecimentoTipoInterface) => {
|
||||
// Aguarda salvar o registro
|
||||
await saveTTBReconhecimentoTipo(formData);
|
||||
|
||||
// Atualiza a lista de dados
|
||||
fetchTTBReconhecimentosTipos();
|
||||
},
|
||||
[saveTTBReconhecimentoTipo, fetchTTBReconhecimentosTipos],
|
||||
);
|
||||
|
||||
/**
|
||||
* Quando o usuário clica em "remover" na tabela
|
||||
*/
|
||||
const handleConfirmDelete = useCallback(
|
||||
(item: TTBReconhecimentoTipoInterface) => {
|
||||
// Define o item atual para remoção
|
||||
setItemToDelete(item);
|
||||
|
||||
// Abre o modal de confirmação
|
||||
openConfirmDialog();
|
||||
},
|
||||
[openConfirmDialog],
|
||||
);
|
||||
|
||||
/**
|
||||
* Executa a exclusão de fato quando o usuário confirma
|
||||
*/
|
||||
const handleDelete = useCallback(async () => {
|
||||
// Protege contra null
|
||||
if (!itemToDelete) return;
|
||||
|
||||
// Executa o Hook de remoção
|
||||
await deleteTTBReconhecimentoTipo(itemToDelete);
|
||||
|
||||
// Atualiza a lista
|
||||
await fetchTTBReconhecimentosTipos();
|
||||
|
||||
<<<<<<< HEAD
|
||||
// Abre o modal de exclusão
|
||||
openConfirmDialog();
|
||||
=======
|
||||
// Limpa o item selecionado
|
||||
setItemToDelete(null);
|
||||
>>>>>>> origin/release(MVP/Sprint6)
|
||||
|
||||
// Fecha o modal
|
||||
handleCancel();
|
||||
}, [itemToDelete, fetchTTBReconhecimentosTipos, handleCancel]);
|
||||
|
||||
/**
|
||||
* Busca inicial dos dados
|
||||
*/
|
||||
useEffect(() => {
|
||||
fetchTTBReconhecimentosTipos();
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* Tela de loading enquanto carrega os dados
|
||||
*/
|
||||
if (!tTBReconhecimentosTipos) {
|
||||
return <Loading type={2} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* Cabeçalho */}
|
||||
<Header
|
||||
title={'Reconhecimentos'}
|
||||
description={'Gerenciamento de tipos de reconhecimentos'}
|
||||
buttonText={'Novo Tipo'}
|
||||
buttonAction={() => {
|
||||
handleOpenForm(null);
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* Tabela de andamentos */}
|
||||
<Card>
|
||||
<CardContent>
|
||||
<TTBReconhecimentoTipoTable
|
||||
data={tTBReconhecimentosTipos}
|
||||
onEdit={handleOpenForm}
|
||||
onDelete={handleConfirmDelete}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Modal de confirmação */}
|
||||
<ConfirmDialog
|
||||
isOpen={isConfirmOpen}
|
||||
title="Confirmar exclusão"
|
||||
description="Atenção"
|
||||
message={`Deseja realmente excluir o andamento "${itemToDelete?.descricao}"?`}
|
||||
confirmText="Sim, excluir"
|
||||
cancelText="Cancelar"
|
||||
onConfirm={handleDelete}
|
||||
onCancel={handleCancel}
|
||||
/>
|
||||
|
||||
<<<<<<< HEAD
|
||||
// Fecha o modal
|
||||
handleCancel();
|
||||
|
||||
}, [itemToDelete, fetchTTBReconhecimentosTipos, handleCancel]);
|
||||
|
||||
const handleResendCode = (async () => {
|
||||
return alert("Reenviando código de exclusão")
|
||||
})
|
||||
|
||||
/**
|
||||
* Busca inicial dos dados
|
||||
*/
|
||||
useEffect(() => {
|
||||
fetchTTBReconhecimentosTipos();
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* Tela de loading enquanto carrega os dados
|
||||
*/
|
||||
if (!tTBReconhecimentosTipos) {
|
||||
return <Loading type={2} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* Cabeçalho */}
|
||||
<Header
|
||||
title={"Reconhecimentos"}
|
||||
description={"Gerenciamento de tipos de reconhecimentos"}
|
||||
buttonText={"Novo Tipo"}
|
||||
buttonAction={() => { handleOpenForm(null) }}
|
||||
/>
|
||||
|
||||
{/* Tabela de andamentos */}
|
||||
<Card>
|
||||
<CardContent>
|
||||
<TTBReconhecimentoTipoTable
|
||||
data={tTBReconhecimentosTipos}
|
||||
onEdit={handleOpenForm}
|
||||
onDelete={handleConfirmDelete}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Modal de confirmação de exclusão com OTP */}
|
||||
<ConfirmExclusion
|
||||
isOpen={isConfirmOpen}
|
||||
title="Confirmar exclusão"
|
||||
description="Digite o código de exclusão para confirmar:"
|
||||
confirmText="Continuar"
|
||||
cancelText="Cancelar"
|
||||
onConfirm={handleDelete}
|
||||
onCancel={handleCancel}
|
||||
expectedCode={"123456"}
|
||||
onResendCode={handleResendCode}
|
||||
/>
|
||||
|
||||
|
||||
{/* Formulário de criação/edição */}
|
||||
<TTBReconhecimentoTipoForm
|
||||
isOpen={isFormOpen}
|
||||
data={selectedReconhecimentoTipo}
|
||||
onClose={handleCloseForm}
|
||||
onSave={handleSave}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
=======
|
||||
{/* Formulário de criação/edição */}
|
||||
<TTBReconhecimentoTipoForm
|
||||
isOpen={isFormOpen}
|
||||
data={selectedReconhecimentoTipo}
|
||||
onClose={handleCloseForm}
|
||||
onSave={handleSave}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
>>>>>>> origin/release(MVP/Sprint6)
|
||||
}
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
'use client';
|
||||
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useEffect } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import z from 'zod';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
|
|
@ -24,6 +23,12 @@ import {
|
|||
FormMessage,
|
||||
} from '@/components/ui/form';
|
||||
import { Input } from '@/components/ui/input';
|
||||
|
||||
import { GCidadeSchema } from '../../_schemas/GCidadeSchema';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
// Hook responsável em trazer todos os estados brasileiros
|
||||
import { useGUfReadHook } from '../../_hooks/g_uf/useGUfReadHook';
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
|
|
@ -31,11 +36,6 @@ import {
|
|||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import { useGUfReadHook } from '@/packages/administrativo/hooks/GUF/useGUfReadHook';
|
||||
|
||||
import { GCidadeSchema } from '@/packages/administrativo/schemas/GCidade/GCidadeSchema';
|
||||
|
||||
// Hook responsável em trazer todos os estados brasileiros
|
||||
|
||||
// Define o tipo do formulário com base no schema Zod
|
||||
type FormValues = z.infer<typeof GCidadeSchema>;
|
||||
|
|
@ -67,6 +67,7 @@ export default function GCidadeForm({ isOpen, data, onClose, onSave }: Props) {
|
|||
|
||||
// Quando recebe dados para edição, atualiza os valores do formulário
|
||||
useEffect(() => {
|
||||
|
||||
if (data) {
|
||||
// Se for edição, carrega os dados recebidos
|
||||
form.reset({
|
||||
|
|
@ -87,7 +88,7 @@ export default function GCidadeForm({ isOpen, data, onClose, onSave }: Props) {
|
|||
});
|
||||
}
|
||||
|
||||
// Carrega todos os estados
|
||||
// Carrega todos os estados
|
||||
// brasileiros para o formulário
|
||||
const loadData = async () => {
|
||||
// Aguarda a busca terminar
|
||||
|
|
@ -96,6 +97,7 @@ export default function GCidadeForm({ isOpen, data, onClose, onSave }: Props) {
|
|||
|
||||
// Dispara a função
|
||||
loadData();
|
||||
|
||||
}, [data, form]);
|
||||
|
||||
return (
|
||||
|
|
@ -153,10 +155,10 @@ export default function GCidadeForm({ isOpen, data, onClose, onSave }: Props) {
|
|||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>UF</FormLabel>
|
||||
<Select
|
||||
value={field.value ?? ''} // garante que não será null
|
||||
onValueChange={(val) => field.onChange(val)}
|
||||
>
|
||||
<Select
|
||||
value={field.value ?? ''} // garante que não será null
|
||||
onValueChange={(val) => field.onChange(val)}
|
||||
>
|
||||
<FormControl className="w-full">
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Selecione o estado desejado" />
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
'use client';
|
||||
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DropdownMenu,
|
||||
|
|
@ -20,7 +18,8 @@ import {
|
|||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
|
||||
import GCidadeInterface from '@/packages/administrativo/interfaces/GCidade/GCidadeInterface';
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
import GCidadeInterface from '../../_interfaces/GCidadeInterface';
|
||||
|
||||
// Tipagem das props do componente da tabela
|
||||
interface GCidadeTableProps {
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
'use client';
|
||||
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import z from 'zod';
|
||||
import { useEffect } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import z from 'zod';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
|
|
@ -25,8 +25,8 @@ import {
|
|||
} from '@/components/ui/form';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
|
||||
import { GMedidaTipoSchema } from '@/packages/administrativo/schemas/GMedidaTipo/GMedidaTipoSchema';
|
||||
import { GMedidaTipoSchema } from '../../_schemas/GMedidaTipoSchema';
|
||||
import { GMedidaTipoInterface } from '../../_interfaces/GMedidaTipoInterface';
|
||||
|
||||
type FormValues = z.infer<typeof GMedidaTipoSchema>;
|
||||
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
'use client';
|
||||
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DropdownMenu,
|
||||
|
|
@ -19,8 +17,8 @@ import {
|
|||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
|
||||
import { GMedidaTipoInterface } from '@/packages/administrativo/interfaces/GMedidaTipo/GMedidaTipoInterface';
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
import { GMedidaTipoInterface } from '../../_interfaces/GMedidaTipoInterface';
|
||||
|
||||
interface GMedidaTipoTableProps {
|
||||
data: GMedidaTipoInterface[];
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
'use client';
|
||||
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useEffect } from 'react';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
import z from 'zod';
|
||||
import { useEffect } from 'react';
|
||||
import { useForm, Controller } from 'react-hook-form';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import {
|
||||
Dialog,
|
||||
DialogClose,
|
||||
|
|
@ -25,11 +26,10 @@ import {
|
|||
} from '@/components/ui/form';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
import SituacoesSelect from '@/shared/components/situacoes/SituacoesSelect';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
|
||||
import { GTBBairroSchema } from '@/packages/administrativo/schemas/GTBBairro/GTBBairroSchema';
|
||||
import { GTBBairroSchema } from '../../_schemas/GTBBairroSchema';
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
|
||||
type FormValues = z.infer<typeof GTBBairroSchema>;
|
||||
|
||||
|
|
@ -73,8 +73,12 @@ export default function GTBBairroForm({
|
|||
>
|
||||
<DialogContent className="sm:max-w-[425px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Bairro</DialogTitle>
|
||||
<DialogDescription>Crie ou edite um bairro</DialogDescription>
|
||||
<DialogTitle>
|
||||
Bairro
|
||||
</DialogTitle>
|
||||
<DialogDescription>
|
||||
Crie ou edite um bairro
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSave)} className="space-y-6">
|
||||
|
|
@ -98,7 +102,10 @@ export default function GTBBairroForm({
|
|||
control={form.control}
|
||||
render={({ field }) => (
|
||||
<div className="flex items-center space-x-2">
|
||||
<SituacoesSelect field={field} />
|
||||
<Checkbox
|
||||
checked={field.value === 'A'}
|
||||
onCheckedChange={(checked) => field.onChange(checked ? 'A' : 'I')}
|
||||
/>
|
||||
<Label>Ativo</Label>
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
'use client';
|
||||
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DropdownMenu,
|
||||
|
|
@ -19,9 +17,8 @@ import {
|
|||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
|
||||
import { GTBBairroInterface } from '@/packages/administrativo/interfaces/GTBBairro/GTBBairroInterface';
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
import { GTBBairroInterface } from '../../_interfaces/GTBBairroInterface';
|
||||
|
||||
interface GTBBairroTableProps {
|
||||
data: GTBBairroInterface[];
|
||||
|
|
@ -32,15 +29,18 @@ interface GTBBairroTableProps {
|
|||
/**
|
||||
* Renderiza o badge de situação
|
||||
*/
|
||||
function StatusBadge({ situacao }: { situacao: SituacoesEnum }) {
|
||||
const isActive = situacao === SituacoesEnum.A;
|
||||
function StatusBadge({ situacao }: { situacao: 'A' | 'I' }) {
|
||||
const isActive = situacao === 'A';
|
||||
|
||||
const baseClasses = 'text-xs font-medium px-2.5 py-0.5 rounded-sm me-2';
|
||||
|
||||
const activeClasses = 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300';
|
||||
|
||||
const inactiveClasses = 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300';
|
||||
|
||||
return (
|
||||
<span className={`${baseClasses} ${isActive ? activeClasses : inactiveClasses}`}>
|
||||
{situacao}
|
||||
{isActive ? 'Ativo' : 'Inativo'}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
'use client';
|
||||
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useEffect } from 'react';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
import z from 'zod';
|
||||
import { useEffect } from 'react';
|
||||
import { useForm, Controller } from 'react-hook-form';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import {
|
||||
|
|
@ -26,9 +27,9 @@ import {
|
|||
} from '@/components/ui/form';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
|
||||
import { GTBEstadoCivilSchema } from '@/packages/administrativo/schemas/GTBEstadoCivil/GTBEstadoCivilSchema';
|
||||
import { GTBEstadoCivilSchema } from '../../_schemas/GTBEstadoCivilSchema';
|
||||
import { GTBEstadoCivilInterface } from '../../_interfaces/GTBEstadoCivilInterface';
|
||||
|
||||
type FormValues = z.infer<typeof GTBEstadoCivilSchema>;
|
||||
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
'use client';
|
||||
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DropdownMenu,
|
||||
|
|
@ -19,8 +17,8 @@ import {
|
|||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
|
||||
import { GTBEstadoCivilInterface } from '@/packages/administrativo/interfaces/GTBEstadoCivil/GTBEstadoCivilInterface';
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
import { GTBEstadoCivilInterface } from '../../_interfaces/GTBEstadoCivilInterface';
|
||||
|
||||
interface TBEstadoCivilTableProps {
|
||||
data: GTBEstadoCivilInterface[];
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
'use client';
|
||||
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useEffect } from 'react';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
import z from 'zod';
|
||||
import { useEffect } from 'react';
|
||||
import { useForm, Controller } from 'react-hook-form';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
|
|
@ -27,7 +27,7 @@ import {
|
|||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
|
||||
import { GTBProfissaoSchema } from '@/packages/administrativo/schemas/GTBProfissao/GTBProfissaoSchema';
|
||||
import { GTBProfissaoSchema } from '../../_schemas/GTBProfissaoSchema';
|
||||
|
||||
type FormValues = z.infer<typeof GTBProfissaoSchema>;
|
||||
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
'use client';
|
||||
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DropdownMenu,
|
||||
|
|
@ -20,7 +18,8 @@ import {
|
|||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
|
||||
import GTBProfissaoInterface from '@/packages/administrativo/interfaces/GTBProfissao/GTBProfissaoInterface';
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
import GTBProfissaoInterface from '../../_interfaces/GTBProfissaoInterface';
|
||||
|
||||
interface GTBProfissaoTableProps {
|
||||
data: GTBProfissaoInterface[];
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
'use client';
|
||||
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useEffect } from 'react';
|
||||
import { useForm, Controller } from 'react-hook-form';
|
||||
import z from 'zod';
|
||||
import { useForm, Controller } from 'react-hook-form';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
|
|
@ -26,7 +25,9 @@ import {
|
|||
} from '@/components/ui/form';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { GTBRegimeBensSchema } from '@/packages/administrativo/schemas/GTBRegimeBens/GTBRegimeBensSchema';
|
||||
|
||||
import { GTBRegimeBensSchema } from '../../_schemas/GTBRegimeBensSchema';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
type FormValues = z.infer<typeof GTBRegimeBensSchema>;
|
||||
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
'use client';
|
||||
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DropdownMenu,
|
||||
|
|
@ -19,7 +17,9 @@ import {
|
|||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
import GTBRegimeBensInterface from '@/packages/administrativo/interfaces/GTBRegimeBens/GTBRegimeBensInterface';
|
||||
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
import GTBRegimeBensInterface from '../../_interfaces/GTBRegimeBensInterface';
|
||||
|
||||
interface GTBRegimeBensTableProps {
|
||||
data: GTBRegimeBensInterface[];
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
'use client';
|
||||
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useEffect } from 'react';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
import z from 'zod';
|
||||
import { useEffect } from 'react';
|
||||
import { useForm, Controller } from 'react-hook-form';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
|
|
@ -26,6 +26,8 @@ import {
|
|||
} from '@/components/ui/form';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
|
||||
import { GTBRegimeComunhaoSchema } from '../../_schemas/GTBRegimeComunhaoSchema';
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
|
|
@ -33,9 +35,7 @@ import {
|
|||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
|
||||
import { useGTBRegimeBensReadHook } from '@/packages/administrativo/hooks/GTBRegimeBens/useGTBRegimeBensReadHook';
|
||||
import { GTBRegimeComunhaoSchema } from '@/packages/administrativo/schemas/GTBRegimeComunhao/GTBRegimeComunhaoSchema';
|
||||
import { useGTBRegimeBensReadHook } from '../../_hooks/g_tb_regimebens/useGTBRegimeBensReadHook';
|
||||
|
||||
type FormValues = z.infer<typeof GTBRegimeComunhaoSchema>;
|
||||
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
'use client';
|
||||
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DropdownMenu,
|
||||
|
|
@ -20,7 +18,8 @@ import {
|
|||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
|
||||
import GTBRegimeComunhaoInterface from '@/packages/administrativo/interfaces/GTBRegimeComunhao/GTBRegimeComunhaoInterface';
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
import GTBRegimeComunhaoInterface from '../../_interfaces/GTBRegimeComunhaoInterface';
|
||||
|
||||
interface GTBRegimeComunhaoTableProps {
|
||||
data: GTBRegimeComunhaoInterface[];
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
'use client';
|
||||
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useEffect } from 'react';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
import z from 'zod';
|
||||
import { useEffect } from 'react';
|
||||
import { useForm, Controller } from 'react-hook-form';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
|
|
@ -26,9 +26,11 @@ import {
|
|||
} from '@/components/ui/form';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
|
||||
import { GTBTipoLogradouroSchema } from '@/packages/administrativo/schemas/GTBTipoLogradouro/GTBTipoLogradouroSchema';
|
||||
import { GTBTipoLogradouroSchema } from '../../_schemas/GTBTipoLogradouroSchema';
|
||||
import { GTBTipoLogradouroInterface } from '../../_interfaces/GTBTipoLogradouroInterface';
|
||||
|
||||
type FormValues = z.infer<typeof GTBTipoLogradouroSchema>;
|
||||
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
'use client';
|
||||
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DropdownMenu,
|
||||
|
|
@ -19,8 +17,8 @@ import {
|
|||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
|
||||
import { GTBTipoLogradouroInterface } from '@/packages/administrativo/interfaces/GTBTipoLogradouro/GTBTipoLogradouroInterface';
|
||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||
import { GTBTipoLogradouroInterface } from '../../_interfaces/GTBTipoLogradouroInterface';
|
||||
|
||||
interface GTBTipoLogradouroTableProps {
|
||||
data: GTBTipoLogradouroInterface[];
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
'use client';
|
||||
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import z from 'zod';
|
||||
import { useEffect } from 'react';
|
||||
import { useForm, Controller } from 'react-hook-form';
|
||||
import z from 'zod';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
|
|
@ -26,9 +26,10 @@ import {
|
|||
} from '@/components/ui/form';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { TCensecSchema } from '@/packages/administrativo/schemas/TCensec/TCensecSchema';
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
|
||||
import { TCensecSchema } from '../../_schemas/TCensecSchema';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
|
||||
type FormValues = z.infer<typeof TCensecSchema>;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue