Compare commits
120 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b664221d5d | ||
|
|
c3511a7065 | ||
|
|
5ef46780a5 | ||
|
|
fd79837fdc | ||
|
|
b5ea5a75a8 | ||
|
|
4561194b6b | ||
|
|
c8863e573f | ||
|
|
fca1d0c293 | ||
|
|
32937c9501 | ||
|
|
790dbe2df3 | ||
|
|
4770c42596 | ||
|
|
aceb17b235 | ||
|
|
21d5d94197 | ||
|
|
8f9659ea5b | ||
|
|
e39970587b | ||
|
|
bcbcc8557b | ||
|
|
f6f4892d09 | ||
|
|
1e9627e924 | ||
|
|
f23decf071 | ||
|
|
43d0863342 | ||
|
|
e24a35709b | ||
|
|
3eb0bd6f0e | ||
|
|
c6217b0520 | ||
|
|
7a2305c918 | ||
|
|
26f0016813 | ||
|
|
0ec57bd6f8 | ||
|
|
50814c9b14 | ||
|
|
2f891ffc38 | ||
|
|
52d16a1548 | ||
|
|
26df474611 | ||
|
|
cdc5e953a5 | ||
|
|
f1abddb383 | ||
|
|
824ac5da24 | ||
|
|
386b8b0307 | ||
|
|
a400bd233e | ||
|
|
60dce3876a | ||
|
|
7745961ff6 | ||
|
|
69d34c713e | ||
|
|
91346bfb19 | ||
|
|
d2494f20b7 | ||
|
|
4ef0517cb7 | ||
|
|
714a0e1f97 | ||
|
|
df46a60b81 | ||
|
|
0dc065d9bb | ||
|
|
99791bd06f | ||
|
|
5f8d2cf670 | ||
|
|
369dfcdfc3 | ||
|
|
f4b0118b36 | ||
|
|
053b86ee69 | ||
|
|
f7b13648a1 | ||
|
|
744e51d215 | ||
|
|
41f31ed2f1 | ||
|
|
0e3cb35309 | ||
|
|
24e259fc16 | ||
|
|
6fc76254c0 | ||
|
|
1c4d52ebe9 | ||
|
|
6e4646c96b | ||
|
|
f09b152192 | ||
|
|
ff3ff6c2e0 | ||
|
|
dfee9eb752 | ||
|
|
e01fa690a3 | ||
|
|
f9df3cd8a3 | ||
|
|
e98a293286 | ||
|
|
4c16b19184 | ||
|
|
de3a022800 | ||
|
|
4da16c3fe2 | ||
|
|
d1732558ff | ||
|
|
58630f8602 | ||
|
|
6b6f2e4fc8 | ||
|
|
2d37d4d421 | ||
|
|
fdd4cf7cfc | ||
|
|
bc2c2ef3dd | ||
|
|
b2e0d50dd6 | ||
|
|
97c958cb00 | ||
|
|
6fe6c86b5d | ||
|
|
b85cd6aeb9 | ||
|
|
88cb6f67c8 | ||
|
|
790c79ede6 | ||
|
|
06d55ec125 | ||
| e50818e52a | |||
| 79f2092882 | |||
| 8d44686717 | |||
| 7162a20d1f | |||
| b362968a4f | |||
| 23604033fe | |||
| 4b7afd6a8f | |||
| feab092f6e | |||
| e39422776e | |||
| 8e035546e9 | |||
| 6051afc3e0 | |||
| 9b9f8b9454 | |||
| 2340cee82a | |||
| 0e21ebfe5b | |||
| 3faf0ebe5e | |||
| b9318f1059 | |||
| 64b897e7e9 | |||
| 77ea800aaa | |||
| 2810abecf5 | |||
| 325ca69317 | |||
| d5b8aad221 | |||
| d3d8ac4a28 | |||
| 8d5e786f74 | |||
| 5297d6ab2e | |||
| 56bca3ba41 | |||
| ab45ac32bf | |||
| 36cbd43ee4 | |||
| b48ffc4bd5 | |||
| 3bd3134d33 | |||
| aaaa04975e | |||
| 519dbf969a | |||
| 4559de0187 | |||
| 6c7967587a | |||
| 742c9bc38f | |||
| a26fc881b2 | |||
| 9e37520615 | |||
|
|
7db6d27035 | ||
|
|
32924cd8da | ||
| 7af4c82dd1 | |||
|
|
3df00e38bc | ||
|
|
7fe725bdeb |
996 changed files with 30564 additions and 5845 deletions
117
.code-workspace
Normal file
117
.code-workspace
Normal file
|
|
@ -0,0 +1,117 @@
|
||||||
|
{
|
||||||
|
"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",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
// .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,22 +1,59 @@
|
||||||
# Use uma imagem Node.js completa para o desenvolvimento
|
# ============================
|
||||||
FROM node:20-alpine
|
# STAGE 1 – Build
|
||||||
|
# ============================
|
||||||
|
FROM node:20-alpine AS builder
|
||||||
|
|
||||||
# Define o diretório de trabalho no container
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copia os arquivos de configuração do projeto
|
# Copia pacotes e instala dependências
|
||||||
COPY package.json package-lock.json ./
|
COPY package*.json ./
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
# Instala todas as dependências do projeto
|
# Copia o restante do código
|
||||||
# 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 . .
|
COPY . .
|
||||||
|
|
||||||
# Expõe a porta de desenvolvimento padrão do Next.js
|
# ---------- 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
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# Define o comando para iniciar a aplicação em modo de desenvolvimento
|
# ---------- Executa o servidor ----------
|
||||||
# Isso ativará o servidor de desenvolvimento e a recarga automática
|
CMD ["node", "server.js"]
|
||||||
CMD ["npm", "run", "dev"]
|
|
||||||
|
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
# 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 +1,58 @@
|
||||||
# saas_app
|
# 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>
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
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'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
70
eslint.config.mjs
Normal file
70
eslint.config.mjs
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
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,8 +1,17 @@
|
||||||
import type { NextConfig } from 'next';
|
/** @type {import('next').NextConfig} */
|
||||||
|
const nextConfig = {
|
||||||
const nextConfig: NextConfig = {
|
// Gera build autônomo para rodar com "node server.js"
|
||||||
// Isso gera um diretório otimizado que inclui tudo o que a aplicação precisa para rodar
|
|
||||||
output: 'standalone',
|
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 },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
module.exports = nextConfig;
|
||||||
|
|
|
||||||
2806
package-lock.json
generated
2806
package-lock.json
generated
File diff suppressed because it is too large
Load diff
38
package.json
38
package.json
|
|
@ -4,14 +4,17 @@
|
||||||
"version": "25.9.1",
|
"version": "25.9.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev --turbopack",
|
"dev": "next dev",
|
||||||
|
"dev:debug": "cross-env NEXT_USE_TURBOPACK=0 NODE_OPTIONS=\"--inspect=9230\" next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint"
|
"lint": "next lint",
|
||||||
|
"postinstall": "shx mkdir -p public/libs && shx cp -r node_modules/tinymce public/libs/tinymce"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@faker-js/faker": "^10.0.0",
|
"@faker-js/faker": "^10.0.0",
|
||||||
"@hookform/resolvers": "^5.2.1",
|
"@hookform/resolvers": "^5.2.1",
|
||||||
|
"@onlyoffice/document-editor-react": "^2.1.1",
|
||||||
"@radix-ui/react-alert-dialog": "^1.1.15",
|
"@radix-ui/react-alert-dialog": "^1.1.15",
|
||||||
"@radix-ui/react-avatar": "^1.1.10",
|
"@radix-ui/react-avatar": "^1.1.10",
|
||||||
"@radix-ui/react-checkbox": "^1.3.3",
|
"@radix-ui/react-checkbox": "^1.3.3",
|
||||||
|
|
@ -20,9 +23,13 @@
|
||||||
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
||||||
"@radix-ui/react-label": "^2.1.7",
|
"@radix-ui/react-label": "^2.1.7",
|
||||||
"@radix-ui/react-popover": "^1.1.15",
|
"@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-select": "^2.2.6",
|
||||||
"@radix-ui/react-separator": "^1.1.7",
|
"@radix-ui/react-separator": "^1.1.8",
|
||||||
"@radix-ui/react-slot": "^1.2.3",
|
"@radix-ui/react-slot": "^1.2.4",
|
||||||
|
"@radix-ui/react-switch": "^1.2.6",
|
||||||
"@radix-ui/react-tabs": "^1.1.13",
|
"@radix-ui/react-tabs": "^1.1.13",
|
||||||
"@radix-ui/react-tooltip": "^1.2.8",
|
"@radix-ui/react-tooltip": "^1.2.8",
|
||||||
"@tanstack/react-table": "^8.21.3",
|
"@tanstack/react-table": "^8.21.3",
|
||||||
|
|
@ -31,7 +38,9 @@
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"cmdk": "^1.1.1",
|
"cmdk": "^1.1.1",
|
||||||
"cookies-next": "^6.1.0",
|
"cookies-next": "^6.1.0",
|
||||||
|
"date-fns": "^3.6.0",
|
||||||
"faker-js": "^1.0.0",
|
"faker-js": "^1.0.0",
|
||||||
|
"framer-motion": "^12.23.24",
|
||||||
"input-otp": "^1.4.2",
|
"input-otp": "^1.4.2",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
|
|
@ -43,31 +52,38 @@
|
||||||
"react-dom": "19.1.0",
|
"react-dom": "19.1.0",
|
||||||
"react-hook-form": "^7.62.0",
|
"react-hook-form": "^7.62.0",
|
||||||
"react-masked-text": "^1.0.5",
|
"react-masked-text": "^1.0.5",
|
||||||
|
"recharts": "^3.3.0",
|
||||||
"sonner": "^2.0.7",
|
"sonner": "^2.0.7",
|
||||||
"tailwind-merge": "^3.3.1",
|
"tailwind-merge": "^3.3.1",
|
||||||
"tinymce": "^8.1.2",
|
"tinymce": "^8.1.2",
|
||||||
"zod": "^4.0.17"
|
"zod": "^4.0.17"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rushstack/eslint-patch": "^1.12.0",
|
|
||||||
"@tailwindcss/postcss": "^4",
|
"@tailwindcss/postcss": "^4",
|
||||||
|
"@types/date-fns": "^2.5.3",
|
||||||
"@types/js-cookie": "^3.0.6",
|
"@types/js-cookie": "^3.0.6",
|
||||||
"@types/jsonwebtoken": "^9.0.10",
|
"@types/jsonwebtoken": "^9.0.10",
|
||||||
"@types/node": "^20",
|
"@types/node": "^20",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19",
|
||||||
"@types/react-dom": "^19",
|
"@types/react-dom": "^19",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.45.0",
|
"@typescript-eslint/eslint-plugin": "^8.46.1",
|
||||||
"@typescript-eslint/parser": "^8.45.0",
|
"@typescript-eslint/parser": "^8.46.1",
|
||||||
"eslint": "^8.57.1",
|
"cross-env": "^10.1.0",
|
||||||
"eslint-config-next": "^15.5.4",
|
"eslint": "^9.38.0",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
|
"eslint-import-resolver-typescript": "^4.4.4",
|
||||||
"eslint-plugin-import": "^2.32.0",
|
"eslint-plugin-import": "^2.32.0",
|
||||||
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||||
"eslint-plugin-prettier": "^5.5.4",
|
"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",
|
"eslint-plugin-unused-imports": "^4.2.0",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"prettier-plugin-tailwindcss": "^0.6.14",
|
"prettier-plugin-tailwindcss": "^0.6.14",
|
||||||
|
"shx": "^0.4.0",
|
||||||
"tailwindcss": "^4",
|
"tailwindcss": "^4",
|
||||||
"tw-animate-css": "^1.3.7",
|
"tw-animate-css": "^1.3.7",
|
||||||
"typescript": "^5"
|
"typescript": "5.9.3",
|
||||||
|
"typescript-eslint": "^8.46.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
public/modelo.docx
Normal file
BIN
public/modelo.docx
Normal file
Binary file not shown.
BIN
public/sounds/success.mp3
Normal file
BIN
public/sounds/success.mp3
Normal file
Binary file not shown.
|
|
@ -1,50 +0,0 @@
|
||||||
'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);
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
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>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
||||||
'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>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
'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,15 +0,0 @@
|
||||||
'use server';
|
|
||||||
|
|
||||||
import API from '@/shared/services/api/Api';
|
|
||||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
|
||||||
|
|
||||||
export default async function GUsuarioIndexData() {
|
|
||||||
const api = new API();
|
|
||||||
|
|
||||||
const response = await api.send({
|
|
||||||
method: Methods.GET,
|
|
||||||
endpoint: `administrativo/g_usuario/`,
|
|
||||||
});
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
'use server';
|
|
||||||
|
|
||||||
import GUsuarioIndexData from '../../_data/g_usuario/GUsuarioIndexData';
|
|
||||||
|
|
||||||
export default async function GUsuarioIndex() {
|
|
||||||
const response = await GUsuarioIndexData();
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
'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('/');
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
import TTBAndamentoServicoIndex from '@/packages/administrativo/components/TTBAndamentoServico/TTBAndamentoServicoIndex';
|
||||||
|
|
||||||
|
export default function TAtoParteTipo() {
|
||||||
|
return <TTBAndamentoServicoIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
import TAtoParteTipoIndex from '@/packages/administrativo/components/TAtoParteTipo/TAtoParteTipoIndex';
|
||||||
|
|
||||||
|
export default function TAtoParteTipo() {
|
||||||
|
return <TAtoParteTipoIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import GTBBairroIndex from '@/packages/administrativo/components/GTBBairro/GTBBairroIndex';
|
||||||
|
|
||||||
|
export default function GCidadePage() {
|
||||||
|
return <GTBBairroIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import GCartorioIndex from '@/packages/administrativo/components/GCartorio/GCartorioIndex';
|
||||||
|
|
||||||
|
export default function GCartorioPage() {
|
||||||
|
return <GCartorioIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import TCensecTipoNaturezaIndex from '@/packages/administrativo/components/TCensecTipoNatureza/TCensecTipoNaturezaIndex';
|
||||||
|
|
||||||
|
export default function TCensecTipoNaturezaPage() {
|
||||||
|
return <TCensecTipoNaturezaIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
export default function TCensecPage() {
|
||||||
|
return <div></div>;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import TCensecQualidadeIndex from '@/packages/administrativo/components/TCensecQualidade/TCensecQualidadeIndex';
|
||||||
|
|
||||||
|
export default function TCensecQualidadePage() {
|
||||||
|
return <TCensecQualidadeIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import TCensecIndex from '@/packages/administrativo/components/TCensec/TCensecIndex';
|
||||||
|
|
||||||
|
export default function GTBEstadoCivilPage() {
|
||||||
|
return <TCensecIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import TCensecNaturezaLitigioIndex from '@/packages/administrativo/components/TCensecNaturezaLitigio/TCensecNaturezaLitigioIndex';
|
||||||
|
|
||||||
|
export default function GCidadePage() {
|
||||||
|
return <TCensecNaturezaLitigioIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import TCensecQualidadeIndex from '@/packages/administrativo/components/TCensecQualidade/TCensecQualidadeIndex';
|
||||||
|
|
||||||
|
export default function GTBEstadoCivilPage() {
|
||||||
|
return <TCensecQualidadeIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import TCensecTipoAtoIndex from '@/packages/administrativo/components/TCensecTipoAto/TCensecTipoAtoIndex';
|
||||||
|
|
||||||
|
export default function GTBEstadoCivilPage() {
|
||||||
|
return <TCensecTipoAtoIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import GCidadeIndex from '@/packages/administrativo/components/GCidade/GCidadeIndex';
|
||||||
|
|
||||||
|
export default function GCidadePage() {
|
||||||
|
return <GCidadeIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
import GCalculoIndex from '@/packages/administrativo/components/GCalculo/GCalculoIndex';
|
||||||
|
|
||||||
|
export default function GEmolumentoPeriodoPage() {
|
||||||
|
return <GCalculoIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
'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)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
import GEmolumentoIndex from '@/packages/administrativo/components/GEmolumento/GEmolumentoIndex';
|
||||||
|
|
||||||
|
export default function GEmolumentoPeriodoPage() {
|
||||||
|
return <GEmolumentoIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
import GEmolumentoPeriodoIndex from '@/packages/administrativo/components/GEmolumentoPeriodo/GEmolumentoPeriodoIndex';
|
||||||
|
|
||||||
|
export default function GEmolumentoPeriodoPage() {
|
||||||
|
return <GEmolumentoPeriodoIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
import GGramaticaIndex from '@/packages/administrativo/components/GGramatica/GGramaticaIndex';
|
||||||
|
|
||||||
|
export default function GGramaticaPage() {
|
||||||
|
return <GGramaticaIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import TImovelDashboard from '@/packages/administrativo/components/TImovel/TImovelDashboard';
|
||||||
|
|
||||||
|
export default function TImovelDashboardPage() {
|
||||||
|
return <TImovelDashboard />;
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import TImovelIndex from "@/packages/administrativo/components/TImovel/TImovelIndex";
|
import TImovelIndex from '@/packages/administrativo/components/TImovel/TImovelIndex';
|
||||||
|
|
||||||
export default function TImovelRuralPage() {
|
export default function TImovelRuralPage() {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import GTBTipoLogradouroIndex from '@/packages/administrativo/components/GTBTipoLogradouro/GTBTipoLogradouroIndex';
|
||||||
|
|
||||||
|
export default function GMedidaTipoPage() {
|
||||||
|
return <GTBTipoLogradouroIndex />;
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import TImovelIndex from "@/packages/administrativo/components/TImovel/TImovelIndex";
|
import TImovelIndex from '@/packages/administrativo/components/TImovel/TImovelIndex';
|
||||||
|
|
||||||
export default function TImovelUrbanoPage() {
|
export default function TImovelUrbanoPage() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -10,4 +10,4 @@ export default function TImovelUrbanoPage() {
|
||||||
tipoClasse={1}
|
tipoClasse={1}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import GMedidaTipoIndex from '@/packages/administrativo/components/GMedidaTipo/GMedidaTipoIndex';
|
||||||
|
|
||||||
|
export default function GMedidaTipoPage() {
|
||||||
|
return <GMedidaTipoIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
import GNaturezaIndex from '@/packages/administrativo/components/GNatureza/GNaturezaIndex';
|
||||||
|
|
||||||
|
export default function GNaturezaPage() {
|
||||||
|
return <GNaturezaIndex sistema_id={2} />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import TPessoaDashboard from '@/packages/administrativo/components/TPessoa/TPessoaDashboard';
|
||||||
|
|
||||||
|
export default function TPessoaDashboardPage() {
|
||||||
|
return <TPessoaDashboard />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import GTBEstadoCivilIndex from '@/packages/administrativo/components/GTBEstadoCivil/GTBEstadoCivilIndex';
|
||||||
|
|
||||||
|
export default function GTBEstadoCivilPage() {
|
||||||
|
return <GTBEstadoCivilIndex />;
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,5 @@
|
||||||
import TPessoaFisicaIndex from '@/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaIndex';
|
import TPessoaFisicaIndex from '@/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaIndex';
|
||||||
|
|
||||||
export default function TPessoaFisica() {
|
export default function TPessoaFisica() {
|
||||||
return (
|
return <TPessoaFisicaIndex />;
|
||||||
<TPessoaFisicaIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,5 @@
|
||||||
import TPessoaJuridicaIndex from '@/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaIndex';
|
import TPessoaJuridicaIndex from '@/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaIndex';
|
||||||
|
|
||||||
export default function TPessoaFisica() {
|
export default function TPessoaFisica() {
|
||||||
|
return <TPessoaJuridicaIndex />;
|
||||||
return (
|
|
||||||
<TPessoaJuridicaIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import GTBProfissaoIndex from '@/packages/administrativo/components/GTBProfissao/GTBProfissaoIndex';
|
||||||
|
|
||||||
|
export default function GTBEstadoCivilPage() {
|
||||||
|
return <GTBProfissaoIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import GTBRegimeBensIndex from '@/packages/administrativo/components/GTBRegimeBens/GTBRegimeBensIndex';
|
||||||
|
|
||||||
|
export default function GTBRegimeBensPage() {
|
||||||
|
return <GTBRegimeBensIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import GTBRegimeComunhaoIndex from '@/packages/administrativo/components/GTBRegimeComunhao/GTBRegimeComunhaoIndex';
|
||||||
|
|
||||||
|
export default function GTBRegimeBensPage() {
|
||||||
|
return <GTBRegimeComunhaoIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
import TTBReconhecimentoTipoIndex from '@/packages/administrativo/components/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndex';
|
||||||
|
|
||||||
|
export default function TAtoParteTipo() {
|
||||||
|
return <TTBReconhecimentoTipoIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
import GSeloGrupoIndex from '@/packages/administrativo/components/GSeloGrupo/GSeloGrupoIndex';
|
||||||
|
|
||||||
|
export default function GSeloGrupoPage() {
|
||||||
|
return <GSeloGrupoIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
import TServicoTipoIndex from '@/packages/administrativo/components/TServicoTipo/TServicoTipoIndex';
|
||||||
|
|
||||||
|
export default function TServicoTipoPage() {
|
||||||
|
return <TServicoTipoIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
import GNaturezaTituloIndex from '@/packages/administrativo/components/GNaturezaTitulo/GNaturezaTituloIndex';
|
||||||
|
|
||||||
|
export default function GNaturezaPage() {
|
||||||
|
return <GNaturezaTituloIndex sistema_id={2} />;
|
||||||
|
}
|
||||||
|
|
@ -1,14 +1,13 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useEffect, useState } from 'react';
|
|
||||||
import { useParams } from 'next/navigation';
|
import { useParams } from 'next/navigation';
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { Card, CardContent } from '@/components/ui/card';
|
|
||||||
import MainEditor from '@/components/MainEditor';
|
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 Loading from '@/shared/components/loading/loading';
|
import Loading from '@/shared/components/loading/loading';
|
||||||
import { useTMinutaReadHook } from '../../../../_hooks/t_minuta/useTMinutaReadHook';
|
|
||||||
import { TMinutaInterface } from '../../../../_interfaces/TMinutaInterface';
|
|
||||||
|
|
||||||
export default function TMinutaDetalhes() {
|
export default function TMinutaDetalhes() {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import z from 'zod';
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useForm, Controller } from 'react-hook-form';
|
import { useForm, Controller } from 'react-hook-form';
|
||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
import z from 'zod';
|
||||||
|
|
||||||
|
import MainEditor from '@/components/MainEditor';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { Card, CardContent } from '@/components/ui/card';
|
||||||
import { Checkbox } from '@/components/ui/checkbox';
|
import { Checkbox } from '@/components/ui/checkbox';
|
||||||
import {
|
import {
|
||||||
Form,
|
Form,
|
||||||
|
|
@ -17,11 +19,8 @@ import {
|
||||||
} from '@/components/ui/form';
|
} from '@/components/ui/form';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { Label } from '@/components/ui/label';
|
import { Label } from '@/components/ui/label';
|
||||||
|
import { useTMinutaSaveHook } from '@/packages/administrativo/hooks/TMinuta/useTMinutaSaveHook';
|
||||||
import MainEditor from '@/components/MainEditor';
|
import { TMinutaSchema } from '@/packages/administrativo/schemas/TMinuta/TMinutaSchema';
|
||||||
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>;
|
type FormValues = z.infer<typeof TMinutaSchema>;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,19 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useEffect, useState, useCallback } from 'react';
|
import { useEffect, useState, useCallback } from 'react';
|
||||||
|
|
||||||
import { Card, CardContent } from '@/components/ui/card';
|
import { Card, CardContent } from '@/components/ui/card';
|
||||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
import TMinutaForm from '@/packages/administrativo/components/TMinuta/TMinutaForm';
|
||||||
|
import TMinutaTable from '@/packages/administrativo/components/TMinuta/TMinutaTable';
|
||||||
import Header from '@/shared/components/structure/Header';
|
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 ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||||
|
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||||
import Loading from '@/shared/components/loading/loading';
|
import Loading from '@/shared/components/loading/loading';
|
||||||
|
import Header from '@/shared/components/structure/Header';
|
||||||
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() {
|
export default function TMinutaPage() {
|
||||||
// Hooks de leitura e escrita
|
// Hooks de leitura e escrita
|
||||||
|
|
|
||||||
|
|
@ -1,119 +0,0 @@
|
||||||
'use client';
|
|
||||||
|
|
||||||
import z from "zod";
|
|
||||||
import { useEffect } from "react";
|
|
||||||
import { useForm } from "react-hook-form";
|
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
|
||||||
import LoadingButton from "@/shared/components/loadingButton/LoadingButton";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import {
|
|
||||||
Dialog,
|
|
||||||
DialogClose,
|
|
||||||
DialogContent,
|
|
||||||
DialogDescription,
|
|
||||||
DialogFooter,
|
|
||||||
DialogHeader,
|
|
||||||
DialogTitle,
|
|
||||||
} from "@/components/ui/dialog";
|
|
||||||
import {
|
|
||||||
Form,
|
|
||||||
FormControl,
|
|
||||||
FormField,
|
|
||||||
FormItem,
|
|
||||||
FormLabel,
|
|
||||||
FormMessage,
|
|
||||||
} from "@/components/ui/form";
|
|
||||||
import { Input } from "@/components/ui/input";
|
|
||||||
|
|
||||||
import { TCensecQualidadeAtoSchema } from "../../_schemas/TCensecQualidadeAtoSchema";
|
|
||||||
import { parseNumberInput } from "@/shared/actions/form/parseNumberInput";
|
|
||||||
|
|
||||||
type FormValues = z.infer<typeof TCensecQualidadeAtoSchema>;
|
|
||||||
|
|
||||||
interface TCensecQualidadeAtoFormProps {
|
|
||||||
isOpen: boolean;
|
|
||||||
data: FormValues | null;
|
|
||||||
onClose: (item: null, isFormStatus: boolean) => void;
|
|
||||||
onSave: (data: FormValues) => void;
|
|
||||||
buttonIsLoading: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function TCensecQualidadeAtoForm({
|
|
||||||
isOpen,
|
|
||||||
data,
|
|
||||||
onClose,
|
|
||||||
onSave,
|
|
||||||
buttonIsLoading,
|
|
||||||
}: TCensecQualidadeAtoFormProps) {
|
|
||||||
|
|
||||||
// react-hook-form com Zod
|
|
||||||
const form = useForm<FormValues>({
|
|
||||||
resolver: zodResolver(TCensecQualidadeAtoSchema),
|
|
||||||
defaultValues: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
// Atualiza o formulário quando em modo de edição
|
|
||||||
useEffect(() => {
|
|
||||||
console.log(data)
|
|
||||||
if (data) form.reset(data);
|
|
||||||
}, [data, form]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dialog
|
|
||||||
open={isOpen}
|
|
||||||
onOpenChange={(open) => {
|
|
||||||
if (!open) onClose(null, false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<DialogContent className="sm:max-w-[500px]">
|
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>Qualidade de Ato (CENSEC)</DialogTitle>
|
|
||||||
<DialogDescription>
|
|
||||||
Crie ou edite uma Qualidade vinculada a um Tipo de Ato da CENSEC
|
|
||||||
</DialogDescription>
|
|
||||||
</DialogHeader>
|
|
||||||
<Form {...form}>
|
|
||||||
<form onSubmit={form.handleSubmit(onSave)} className="space-y-6">
|
|
||||||
{/* Quantidade Mínima */}
|
|
||||||
<FormField
|
|
||||||
control={form.control}
|
|
||||||
name="qtd_minima"
|
|
||||||
render={({ field }) => (
|
|
||||||
<FormItem>
|
|
||||||
<FormLabel>Quantidade Mínima</FormLabel>
|
|
||||||
<FormControl>
|
|
||||||
<Input
|
|
||||||
type="number"
|
|
||||||
{...field}
|
|
||||||
placeholder="Informe a quantidade mínima"
|
|
||||||
onChange={e => field.onChange(parseNumberInput(e))} />
|
|
||||||
</FormControl>
|
|
||||||
<FormMessage />
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
{/* Rodapé */}
|
|
||||||
<DialogFooter className="mt-4">
|
|
||||||
<DialogClose asChild>
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
type="button"
|
|
||||||
onClick={() => onClose(null, false)}
|
|
||||||
className="cursor-pointer"
|
|
||||||
>
|
|
||||||
Cancelar
|
|
||||||
</Button>
|
|
||||||
</DialogClose>
|
|
||||||
<LoadingButton
|
|
||||||
text="Salvar"
|
|
||||||
textLoading="Aguarde..."
|
|
||||||
type="submit"
|
|
||||||
loading={buttonIsLoading}
|
|
||||||
/>
|
|
||||||
</DialogFooter>
|
|
||||||
</form>
|
|
||||||
</Form>
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,138 +0,0 @@
|
||||||
'use client';
|
|
||||||
|
|
||||||
import { useEffect, useState, useCallback } from "react";
|
|
||||||
import { Card, CardContent } from "@/components/ui/card";
|
|
||||||
import { useConfirmDialog } from "@/shared/components/confirmDialog/useConfirmDialog";
|
|
||||||
|
|
||||||
import Header from "@/shared/components/structure/Header";
|
|
||||||
import ConfirmDialog from "@/shared/components/confirmDialog/ConfirmDialog";
|
|
||||||
|
|
||||||
import { TCensecQualidadeAtoInterface } from "../../_interfaces/TCensecQualidadeAtoInterface";
|
|
||||||
import { useTCensecQualidadeAtoIndexHook } from "../../_hooks/TCensecQualidadeAto/useTCensecQualidadeAtoIndexHook";
|
|
||||||
import { useTCensecQualidadeAtoSaveHook } from "../../_hooks/TCensecQualidadeAto/useTCensecQualidadeAtoSaveHook";
|
|
||||||
import { useTCensecQualidadeAtoRemoveHook } from "../../_hooks/TCensecQualidadeAto/useTCensecQualidadeAtoRemoveHook";
|
|
||||||
import TCensecQualidadeAtoTable from "./TCensecQualidadeAtoTable";
|
|
||||||
import TCensecQualidadeAtoForm from "./TCensecQualidadeAtoForm";
|
|
||||||
|
|
||||||
interface TCensecQulidadeAtoIndexInterface {
|
|
||||||
censec_tipoato_id: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function TCensecQualidadeAtoIndex({ censec_tipoato_id }: TCensecQulidadeAtoIndexInterface) {
|
|
||||||
|
|
||||||
// Hooks para leitura, salvamento e remoção
|
|
||||||
const { tCensecQualidadeAto, fetchTCensecQualidadeAto } = useTCensecQualidadeAtoIndexHook();
|
|
||||||
const { saveTCensecQualidadeAto } = useTCensecQualidadeAtoSaveHook();
|
|
||||||
const { removeTCensecQualidadeAto } = useTCensecQualidadeAtoRemoveHook();
|
|
||||||
|
|
||||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
|
||||||
|
|
||||||
// Estado para controle do form e item selecionado
|
|
||||||
const [selectedItem, setSelectedItem] = useState<TCensecQualidadeAtoInterface | null>(null);
|
|
||||||
const [isFormOpen, setIsFormOpen] = useState(false);
|
|
||||||
const [itemToDelete, setItemToDelete] = useState<TCensecQualidadeAtoInterface | null>(null);
|
|
||||||
|
|
||||||
// Hook do modal de confirmação
|
|
||||||
const {
|
|
||||||
isOpen: isConfirmOpen,
|
|
||||||
openDialog: openConfirmDialog,
|
|
||||||
handleConfirm,
|
|
||||||
handleCancel,
|
|
||||||
} = useConfirmDialog();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Abre o formulário no modo de edição ou criação
|
|
||||||
*/
|
|
||||||
const handleOpenForm = useCallback((data: TCensecQualidadeAtoInterface | null) => {
|
|
||||||
// Se não houver dados (criação), cria um objeto inicial com pessoa_tipo
|
|
||||||
const initialData: TCensecQualidadeAtoInterface = data ?? { censec_tipoato_id: censec_tipoato_id } as TCensecQualidadeAtoInterface;
|
|
||||||
setSelectedItem(initialData);
|
|
||||||
setIsFormOpen(true);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const handleCloseForm = useCallback(() => {
|
|
||||||
setIsFormOpen(false);
|
|
||||||
setSelectedItem(null);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
// Salvar
|
|
||||||
const handleSave = useCallback(
|
|
||||||
async (data: TCensecQualidadeAtoInterface) => {
|
|
||||||
setButtonIsLoading(true);
|
|
||||||
await saveTCensecQualidadeAto(data);
|
|
||||||
await fetchTCensecQualidadeAto(censec_tipoato_id);
|
|
||||||
setButtonIsLoading(false);
|
|
||||||
handleCloseForm();
|
|
||||||
},
|
|
||||||
[saveTCensecQualidadeAto, fetchTCensecQualidadeAto]
|
|
||||||
);
|
|
||||||
|
|
||||||
// Deleção
|
|
||||||
const handleConfirmDelete = useCallback(
|
|
||||||
(item: TCensecQualidadeAtoInterface) => {
|
|
||||||
setItemToDelete(item);
|
|
||||||
openConfirmDialog();
|
|
||||||
},
|
|
||||||
[openConfirmDialog]
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleDelete = useCallback(async () => {
|
|
||||||
if (itemToDelete) {
|
|
||||||
await removeTCensecQualidadeAto(itemToDelete);
|
|
||||||
await fetchTCensecQualidadeAto(censec_tipoato_id);
|
|
||||||
}
|
|
||||||
handleCancel();
|
|
||||||
}, [itemToDelete, fetchTCensecQualidadeAto, handleCancel]);
|
|
||||||
|
|
||||||
// Carregar dados ao montar
|
|
||||||
useEffect(() => {
|
|
||||||
fetchTCensecQualidadeAto(censec_tipoato_id);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
{/* Cabeçalho */}
|
|
||||||
<Header
|
|
||||||
title="Qualidade por Tipo de Ato (CENSEC)"
|
|
||||||
description="Gerenciamento das Qualidades vinculadas a cada Tipo de Ato CENSEC"
|
|
||||||
buttonText="Nova Qualidade de Ato"
|
|
||||||
buttonAction={(data) => {
|
|
||||||
handleOpenForm(null);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{/* Tabela */}
|
|
||||||
<Card>
|
|
||||||
<CardContent>
|
|
||||||
<TCensecQualidadeAtoTable
|
|
||||||
data={tCensecQualidadeAto}
|
|
||||||
onEdit={handleOpenForm}
|
|
||||||
onDelete={handleConfirmDelete}
|
|
||||||
/>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
{/* Dialog de confirmação */}
|
|
||||||
{isConfirmOpen && (
|
|
||||||
<ConfirmDialog
|
|
||||||
isOpen={isConfirmOpen}
|
|
||||||
title="Confirmar exclusão"
|
|
||||||
description="Atenção"
|
|
||||||
message={`Deseja realmente excluir a qualidade de ato ID "${itemToDelete?.censec_qualidadeato_id}"?`}
|
|
||||||
confirmText="Sim, excluir"
|
|
||||||
cancelText="Cancelar"
|
|
||||||
onConfirm={handleDelete}
|
|
||||||
onCancel={handleCancel}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{/* Formulário */}
|
|
||||||
{isFormOpen && (
|
|
||||||
<TCensecQualidadeAtoForm
|
|
||||||
isOpen={isFormOpen}
|
|
||||||
data={selectedItem}
|
|
||||||
onClose={handleCloseForm}
|
|
||||||
onSave={handleSave}
|
|
||||||
buttonIsLoading={buttonIsLoading}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
'use client';
|
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import {
|
|
||||||
DropdownMenu,
|
|
||||||
DropdownMenuContent,
|
|
||||||
DropdownMenuGroup,
|
|
||||||
DropdownMenuItem,
|
|
||||||
DropdownMenuSeparator,
|
|
||||||
DropdownMenuTrigger
|
|
||||||
} from "@/components/ui/dropdown-menu";
|
|
||||||
import {
|
|
||||||
Table,
|
|
||||||
TableBody,
|
|
||||||
TableCell,
|
|
||||||
TableHead,
|
|
||||||
TableHeader,
|
|
||||||
TableRow
|
|
||||||
} from "@/components/ui/table";
|
|
||||||
import { EllipsisIcon, PencilIcon, Trash2Icon } from "lucide-react";
|
|
||||||
|
|
||||||
import { TCensecQualidadeAtoInterface } from "../../_interfaces/TCensecQualidadeAtoInterface";
|
|
||||||
|
|
||||||
interface TCensecQualidadeAtoTableProps {
|
|
||||||
data: TCensecQualidadeAtoInterface[];
|
|
||||||
onEdit: (item: TCensecQualidadeAtoInterface, isEditingFormStatus: boolean) => void;
|
|
||||||
onDelete: (item: TCensecQualidadeAtoInterface, isEditingFormStatus: boolean) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tabela de exibição para registros da tabela T_CENSEC_QUALIDADEATO.
|
|
||||||
*/
|
|
||||||
export default function TCensecQualidadeAtoTable({
|
|
||||||
data,
|
|
||||||
onEdit,
|
|
||||||
onDelete
|
|
||||||
}: TCensecQualidadeAtoTableProps) {
|
|
||||||
return (
|
|
||||||
<Table>
|
|
||||||
<TableHeader>
|
|
||||||
<TableRow>
|
|
||||||
<TableHead>#</TableHead>
|
|
||||||
<TableHead>Tipo de Ato</TableHead>
|
|
||||||
<TableHead>Qualidade</TableHead>
|
|
||||||
<TableHead>Qtd. Mínima</TableHead>
|
|
||||||
<TableHead className="text-right">Ações</TableHead>
|
|
||||||
</TableRow>
|
|
||||||
</TableHeader>
|
|
||||||
|
|
||||||
<TableBody>
|
|
||||||
{data?.map((item) => {
|
|
||||||
return (
|
|
||||||
<TableRow key={item.censec_qualidadeato_id} className="cursor-pointer">
|
|
||||||
<TableCell className="font-medium">
|
|
||||||
{item.censec_qualidadeato_id}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell>{item.qtd_minima ?? "-"}</TableCell>
|
|
||||||
<TableCell className="text-right">
|
|
||||||
<DropdownMenu>
|
|
||||||
<DropdownMenuTrigger asChild>
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
size="icon"
|
|
||||||
className="cursor-pointer"
|
|
||||||
>
|
|
||||||
<EllipsisIcon />
|
|
||||||
</Button>
|
|
||||||
</DropdownMenuTrigger>
|
|
||||||
|
|
||||||
<DropdownMenuContent side="left" align="start">
|
|
||||||
<DropdownMenuGroup>
|
|
||||||
<DropdownMenuItem
|
|
||||||
className="cursor-pointer"
|
|
||||||
onSelect={() => onEdit(item, true)}
|
|
||||||
>
|
|
||||||
<PencilIcon className="mr-2 h-4 w-4" />
|
|
||||||
Editar
|
|
||||||
</DropdownMenuItem>
|
|
||||||
|
|
||||||
<DropdownMenuSeparator />
|
|
||||||
|
|
||||||
<DropdownMenuItem
|
|
||||||
className="cursor-pointer"
|
|
||||||
onSelect={() => onDelete(item, true)}
|
|
||||||
>
|
|
||||||
<Trash2Icon className="mr-2 h-4 w-4" />
|
|
||||||
Remover
|
|
||||||
</DropdownMenuItem>
|
|
||||||
</DropdownMenuGroup>
|
|
||||||
</DropdownMenuContent>
|
|
||||||
</DropdownMenu>
|
|
||||||
</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</TableBody>
|
|
||||||
</Table>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,275 +0,0 @@
|
||||||
'use client';
|
|
||||||
|
|
||||||
import z from "zod";
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import { useForm, Controller } from "react-hook-form";
|
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
|
||||||
import { Checkbox } from "@/components/ui/checkbox";
|
|
||||||
import LoadingButton from "@/shared/components/loadingButton/LoadingButton";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import {
|
|
||||||
Dialog,
|
|
||||||
DialogClose,
|
|
||||||
DialogContent,
|
|
||||||
DialogDescription,
|
|
||||||
DialogFooter,
|
|
||||||
DialogHeader,
|
|
||||||
DialogTitle,
|
|
||||||
} from "@/components/ui/dialog";
|
|
||||||
import {
|
|
||||||
Form,
|
|
||||||
FormControl,
|
|
||||||
FormField,
|
|
||||||
FormItem,
|
|
||||||
FormLabel,
|
|
||||||
FormMessage,
|
|
||||||
} from "@/components/ui/form";
|
|
||||||
import { Input } from "@/components/ui/input";
|
|
||||||
import {
|
|
||||||
Select,
|
|
||||||
SelectContent,
|
|
||||||
SelectItem,
|
|
||||||
SelectTrigger,
|
|
||||||
SelectValue,
|
|
||||||
} from "@/components/ui/select";
|
|
||||||
import { Label } from "@/components/ui/label";
|
|
||||||
import {
|
|
||||||
Tabs,
|
|
||||||
TabsContent,
|
|
||||||
TabsList,
|
|
||||||
TabsTrigger,
|
|
||||||
} from "@/components/ui/tabs";
|
|
||||||
import { IdCardIcon, SettingsIcon } from "lucide-react";
|
|
||||||
|
|
||||||
import { TCensecTipoAtoSchema } from "../../_schemas/TCensecTipoAtoSchema";
|
|
||||||
import TCensecInterface from "../../_interfaces/TCensecInterface";
|
|
||||||
import { SituacoesEnum } from "@/shared/enums/SituacoesEnum";
|
|
||||||
import TCensecQualidadeAtoPage from "../TCensecQualidadeAto/TCensecQualidadeAtoIndex";
|
|
||||||
|
|
||||||
type FormValues = z.infer<typeof TCensecTipoAtoSchema>;
|
|
||||||
|
|
||||||
interface TCensecTipoAtoFormProps {
|
|
||||||
isOpen: boolean;
|
|
||||||
data: FormValues | null;
|
|
||||||
tCensec: TCensecInterface[];
|
|
||||||
onClose: (item: null, isFormStatus: boolean) => void;
|
|
||||||
onSave: (data: FormValues) => void;
|
|
||||||
buttonIsLoading: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function TCensecTipoAtoForm({
|
|
||||||
isOpen,
|
|
||||||
data,
|
|
||||||
tCensec,
|
|
||||||
onClose,
|
|
||||||
onSave,
|
|
||||||
buttonIsLoading,
|
|
||||||
}: TCensecTipoAtoFormProps) {
|
|
||||||
// Estado para controle da aba ativa
|
|
||||||
const [tabValue, setTabValue] = useState("dados");
|
|
||||||
|
|
||||||
// Configuração do formulário
|
|
||||||
const form = useForm<FormValues>({
|
|
||||||
resolver: zodResolver(TCensecTipoAtoSchema),
|
|
||||||
defaultValues: {
|
|
||||||
censec_tipoato_id: 0,
|
|
||||||
censec_id: 0,
|
|
||||||
codigo: null,
|
|
||||||
descricao: "",
|
|
||||||
situacao: SituacoesEnum.A,
|
|
||||||
tipo_separacao: null,
|
|
||||||
tipo_revogacao: null,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// Atualiza o formulário quando há edição
|
|
||||||
useEffect(() => {
|
|
||||||
if (data) form.reset(data);
|
|
||||||
}, [data, form]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dialog
|
|
||||||
open={isOpen}
|
|
||||||
onOpenChange={(open) => {
|
|
||||||
if (!open) onClose(null, false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<DialogContent className="w-full max-w-full p-6 sm:max-w-3xl md:max-w-4xl lg:max-w-5xl">
|
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>Tipo de Ato CENSEC</DialogTitle>
|
|
||||||
<DialogDescription>
|
|
||||||
Crie ou edite um tipo de ato vinculado à Central do CENSEC.
|
|
||||||
</DialogDescription>
|
|
||||||
</DialogHeader>
|
|
||||||
<Tabs value={tabValue} onValueChange={setTabValue} className="space-y-4">
|
|
||||||
{/* Cabeçalho das Tabs */}
|
|
||||||
<TabsList className="grid w-full grid-cols-2">
|
|
||||||
<TabsTrigger value="dados" className="flex items-center justify-center">
|
|
||||||
<SettingsIcon className="w-4 h-4 mr-2" /> Dados Gerais
|
|
||||||
</TabsTrigger>
|
|
||||||
|
|
||||||
{data?.censec_tipoato_id !== 0 && (
|
|
||||||
<TabsTrigger value="qualidades" className="flex items-center justify-center">
|
|
||||||
<IdCardIcon className="w-4 h-4 mr-2" /> Qualidades
|
|
||||||
</TabsTrigger>
|
|
||||||
)}
|
|
||||||
</TabsList>
|
|
||||||
|
|
||||||
{/* Aba: Dados Gerais */}
|
|
||||||
<TabsContent value="dados">
|
|
||||||
<Form {...form}>
|
|
||||||
<form onSubmit={form.handleSubmit(onSave)} className="space-y-6">
|
|
||||||
{/* Descrição */}
|
|
||||||
<FormField
|
|
||||||
control={form.control}
|
|
||||||
name="descricao"
|
|
||||||
render={({ field }) => (
|
|
||||||
<FormItem>
|
|
||||||
<FormLabel>Descrição</FormLabel>
|
|
||||||
<FormControl>
|
|
||||||
<Input {...field} placeholder="Digite a descrição" />
|
|
||||||
</FormControl>
|
|
||||||
<FormMessage />
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* Select Censec */}
|
|
||||||
<FormField
|
|
||||||
control={form.control}
|
|
||||||
name="censec_id"
|
|
||||||
render={({ field }) => (
|
|
||||||
<FormItem>
|
|
||||||
<FormLabel>Central do CENSEC</FormLabel>
|
|
||||||
<Select
|
|
||||||
value={field.value?.toString()}
|
|
||||||
onValueChange={(val) => field.onChange(Number(val))}
|
|
||||||
>
|
|
||||||
<FormControl>
|
|
||||||
<SelectTrigger className="w-full">
|
|
||||||
<SelectValue placeholder="Selecione uma Central" />
|
|
||||||
</SelectTrigger>
|
|
||||||
</FormControl>
|
|
||||||
<SelectContent className="w-full">
|
|
||||||
{tCensec.map((c) => (
|
|
||||||
<SelectItem
|
|
||||||
key={c.censec_id}
|
|
||||||
value={String(c.censec_id)}
|
|
||||||
>
|
|
||||||
{c.descricao}
|
|
||||||
</SelectItem>
|
|
||||||
))}
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
<FormMessage />
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* Situação */}
|
|
||||||
<Controller
|
|
||||||
name="situacao"
|
|
||||||
control={form.control}
|
|
||||||
render={({ field }) => (
|
|
||||||
<div className="flex items-center space-x-2 mt-2">
|
|
||||||
<Checkbox
|
|
||||||
checked={field.value === "A"}
|
|
||||||
onCheckedChange={(checked) =>
|
|
||||||
field.onChange(checked ? "A" : "I")
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Label>Ativo</Label>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* Tipo de Separação */}
|
|
||||||
<FormField
|
|
||||||
control={form.control}
|
|
||||||
name="tipo_separacao"
|
|
||||||
render={({ field }) => (
|
|
||||||
<FormItem>
|
|
||||||
<FormLabel>Tipo de Separação</FormLabel>
|
|
||||||
<Select
|
|
||||||
onValueChange={(val) => field.onChange(val || null)}
|
|
||||||
value={field.value ?? ""}
|
|
||||||
>
|
|
||||||
<FormControl>
|
|
||||||
<SelectTrigger className="w-full">
|
|
||||||
<SelectValue placeholder="Selecione" />
|
|
||||||
</SelectTrigger>
|
|
||||||
</FormControl>
|
|
||||||
<SelectContent className="w-full">
|
|
||||||
<SelectItem value="S">Sim</SelectItem>
|
|
||||||
<SelectItem value="N">Não</SelectItem>
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
<FormMessage />
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* Tipo de Revogação */}
|
|
||||||
<FormField
|
|
||||||
control={form.control}
|
|
||||||
name="tipo_revogacao"
|
|
||||||
render={({ field }) => (
|
|
||||||
<FormItem>
|
|
||||||
<FormLabel>Tipo de Revogação</FormLabel>
|
|
||||||
<Select
|
|
||||||
onValueChange={(val) => field.onChange(val || null)}
|
|
||||||
value={field.value ?? ""}
|
|
||||||
>
|
|
||||||
<FormControl>
|
|
||||||
<SelectTrigger className="w-full">
|
|
||||||
<SelectValue placeholder="Selecione" />
|
|
||||||
</SelectTrigger>
|
|
||||||
</FormControl>
|
|
||||||
<SelectContent className="w-full">
|
|
||||||
<SelectItem value="S">Sim</SelectItem>
|
|
||||||
<SelectItem value="N">Não</SelectItem>
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
<FormMessage />
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* Botões */}
|
|
||||||
<DialogFooter className="mt-4">
|
|
||||||
<DialogClose asChild>
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
type="button"
|
|
||||||
onClick={() => onClose(null, false)}
|
|
||||||
className="cursor-pointer"
|
|
||||||
>
|
|
||||||
Cancelar
|
|
||||||
</Button>
|
|
||||||
</DialogClose>
|
|
||||||
<LoadingButton
|
|
||||||
text="Salvar"
|
|
||||||
textLoading="Aguarde..."
|
|
||||||
type="submit"
|
|
||||||
loading={buttonIsLoading}
|
|
||||||
/>
|
|
||||||
</DialogFooter>
|
|
||||||
|
|
||||||
{/* Campos ocultos */}
|
|
||||||
<input type="hidden" {...form.register("censec_tipoato_id")} />
|
|
||||||
<input type="hidden" {...form.register("codigo")} />
|
|
||||||
</form>
|
|
||||||
</Form>
|
|
||||||
</TabsContent>
|
|
||||||
{data?.censec_tipoato_id !== 0 && (
|
|
||||||
<TabsContent value="qualidades">
|
|
||||||
<TCensecQualidadeAtoPage
|
|
||||||
censec_tipoato_id={Number(data?.censec_tipoato_id)}
|
|
||||||
/>
|
|
||||||
</TabsContent>
|
|
||||||
)}
|
|
||||||
</Tabs>
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
import API from "@/shared/services/api/Api";
|
|
||||||
import { Methods } from "@/shared/services/api/enums/ApiMethodEnum";
|
|
||||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Função responsável por buscar todos os registros da tabela T_CENSEC_QUALIDADEATO.
|
|
||||||
* Utiliza o serviço centralizado de API e tratamento de erros via HOC.
|
|
||||||
*/
|
|
||||||
async function executeTCensecQualidadeAtoIndexData(censec_tipoato_id: number) {
|
|
||||||
const api = new API();
|
|
||||||
return await api.send({
|
|
||||||
method: Methods.GET,
|
|
||||||
endpoint: `administrativo/t_censec_qualidadeato/tipo-ato/${censec_tipoato_id}`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exporta a função decorada com o handler de erros,
|
|
||||||
* garantindo tratamento consistente de respostas no client.
|
|
||||||
*/
|
|
||||||
export const TCensecQualidadeAtoIndexData = withClientErrorHandler(executeTCensecQualidadeAtoIndexData);
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
import API from "@/shared/services/api/Api";
|
|
||||||
import { TCensecQualidadeAtoInterface } from "../../_interfaces/TCensecQualidadeAtoInterface";
|
|
||||||
import { Methods } from "@/shared/services/api/enums/ApiMethodEnum";
|
|
||||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Função responsável por remover um registro da tabela T_CENSEC_QUALIDADEATO.
|
|
||||||
* Utiliza o serviço centralizado de API e o tratador de erros client-side.
|
|
||||||
*/
|
|
||||||
async function executeTCensecQualidadeAtoRemoveData(data: TCensecQualidadeAtoInterface) {
|
|
||||||
const api = new API();
|
|
||||||
|
|
||||||
return await api.send({
|
|
||||||
method: Methods.DELETE,
|
|
||||||
endpoint: `administrativo/t_censec_qualidadeato/${data.censec_qualidadeato_id}`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exporta a função decorada com o handler de erros,
|
|
||||||
* garantindo tratamento consistente de respostas no client.
|
|
||||||
*/
|
|
||||||
export const TCensecQualidadeAtoRemoveData = withClientErrorHandler(executeTCensecQualidadeAtoRemoveData);
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
import API from "@/shared/services/api/Api";
|
|
||||||
import { TCensecQualidadeAtoInterface } from "../../_interfaces/TCensecQualidadeAtoInterface";
|
|
||||||
import { Methods } from "@/shared/services/api/enums/ApiMethodEnum";
|
|
||||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Função responsável por salvar ou atualizar registros da tabela T_CENSEC_QUALIDADEATO.
|
|
||||||
* Utiliza a estrutura centralizada de API e tratamento de erros do sistema.
|
|
||||||
*/
|
|
||||||
async function executeTCensecQualidadeAtoSaveData(data: TCensecQualidadeAtoInterface) {
|
|
||||||
// Verifica se é uma operação de atualização ou criação
|
|
||||||
const isUpdate = Boolean(data.censec_qualidadeato_id);
|
|
||||||
|
|
||||||
// Instancia o serviço de API
|
|
||||||
const api = new API();
|
|
||||||
|
|
||||||
// Envia a requisição com método dinâmico e endpoint apropriado
|
|
||||||
return await api.send({
|
|
||||||
method: isUpdate ? Methods.PUT : Methods.POST,
|
|
||||||
endpoint: `administrativo/t_censec_qualidadeato/${data.censec_qualidadeato_id || ""}`,
|
|
||||||
body: data,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exporta a função com o tratador de erros client-side
|
|
||||||
export const TCensecQualidadeAtoSaveData = withClientErrorHandler(executeTCensecQualidadeAtoSaveData);
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
import API from "@/shared/services/api/Api";
|
|
||||||
import { Methods } from "@/shared/services/api/enums/ApiMethodEnum";
|
|
||||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
|
||||||
|
|
||||||
async function executeTCensecTipoAtoIndexData() {
|
|
||||||
const api = new API();
|
|
||||||
return await api.send({
|
|
||||||
method: Methods.GET,
|
|
||||||
endpoint: `administrativo/t_censec_tipoato/`
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export const TCensecTipoAtoIndexData = withClientErrorHandler(executeTCensecTipoAtoIndexData)
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
import API from "@/shared/services/api/Api";
|
|
||||||
import { TCensecTipoAtoInterface } from "../../_interfaces/TCensecTipoAtoInterface";
|
|
||||||
import { Methods } from "@/shared/services/api/enums/ApiMethodEnum";
|
|
||||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
|
||||||
|
|
||||||
async function executeTCensecTipoAtoRemoveData(data: TCensecTipoAtoInterface) {
|
|
||||||
|
|
||||||
const api = new API();
|
|
||||||
|
|
||||||
return await api.send({
|
|
||||||
method: Methods.DELETE,
|
|
||||||
endpoint: `administrativo/t_censec_tipoato/${data.censec_tipoato_id}`
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export const TCensecTipoAtoRemoveData = withClientErrorHandler(executeTCensecTipoAtoRemoveData)
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
import API from "@/shared/services/api/Api";
|
|
||||||
import { TCensecTipoAtoInterface } from "../../_interfaces/TCensecTipoAtoInterface";
|
|
||||||
import { Methods } from "@/shared/services/api/enums/ApiMethodEnum";
|
|
||||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
|
||||||
|
|
||||||
async function executeTCensecTipoAtoSaveData(data: TCensecTipoAtoInterface) {
|
|
||||||
|
|
||||||
const isUpdate = Boolean(data.censec_tipoato_id);
|
|
||||||
|
|
||||||
const api = new API();
|
|
||||||
|
|
||||||
return await api.send({
|
|
||||||
method: isUpdate ? Methods.PUT : Methods.POST,
|
|
||||||
endpoint: `administrativo/t_censec_tipoato/${data.censec_tipoato_id || ''}`,
|
|
||||||
body: data
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export const TCensecTipoAtoSaveData = withClientErrorHandler(executeTCensecTipoAtoSaveData)
|
|
||||||
|
|
@ -1,251 +0,0 @@
|
||||||
export default async function TCensecTipoAtoMockDeDados() {
|
|
||||||
return Promise.resolve({
|
|
||||||
status: 200,
|
|
||||||
message: 'Dados localizados',
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 1,
|
|
||||||
censec_id: 2,
|
|
||||||
codigo: 1,
|
|
||||||
descricao: "Escritura",
|
|
||||||
situacao: "I",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 2,
|
|
||||||
censec_id: 1,
|
|
||||||
codigo: 2,
|
|
||||||
descricao: "Procuração",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 3,
|
|
||||||
censec_id: 1,
|
|
||||||
codigo: 3,
|
|
||||||
descricao: "Procuração para Fins Previdenciários",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 4,
|
|
||||||
censec_id: 1,
|
|
||||||
codigo: 5,
|
|
||||||
descricao: "Renúncia de Procuração",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 5,
|
|
||||||
censec_id: 1,
|
|
||||||
codigo: 6,
|
|
||||||
descricao: "Revogação de Procuração",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 6,
|
|
||||||
censec_id: 1,
|
|
||||||
codigo: 7,
|
|
||||||
descricao: "Substabelecimento",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 7,
|
|
||||||
censec_id: 1,
|
|
||||||
codigo: 8,
|
|
||||||
descricao: "Ata Notarial",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 8,
|
|
||||||
censec_id: 2,
|
|
||||||
codigo: 1,
|
|
||||||
descricao: "Separação",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "S",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 9,
|
|
||||||
censec_id: 2,
|
|
||||||
codigo: 2,
|
|
||||||
descricao: "Reconciliação",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 10,
|
|
||||||
censec_id: 2,
|
|
||||||
codigo: 3,
|
|
||||||
descricao: "Conversão de Separação em Divórcio",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "S",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 11,
|
|
||||||
censec_id: 2,
|
|
||||||
codigo: 4,
|
|
||||||
descricao: "Divórcio Direto",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "S",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 12,
|
|
||||||
censec_id: 2,
|
|
||||||
codigo: 5,
|
|
||||||
descricao: "Inventário",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 13,
|
|
||||||
censec_id: 2,
|
|
||||||
codigo: 6,
|
|
||||||
descricao: "Sobrepartilha",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 14,
|
|
||||||
censec_id: 2,
|
|
||||||
codigo: 7,
|
|
||||||
descricao: "Retificação",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 15,
|
|
||||||
censec_id: 3,
|
|
||||||
codigo: 1,
|
|
||||||
descricao: "Aditamento",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 16,
|
|
||||||
censec_id: 3,
|
|
||||||
codigo: 2,
|
|
||||||
descricao: "Cerrado",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 17,
|
|
||||||
censec_id: 3,
|
|
||||||
codigo: 3,
|
|
||||||
descricao: "Revogação",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "S"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 18,
|
|
||||||
censec_id: 3,
|
|
||||||
codigo: 4,
|
|
||||||
descricao: "Testamento",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 19,
|
|
||||||
censec_id: 3,
|
|
||||||
codigo: 5,
|
|
||||||
descricao: "Testamento com Revogação",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 20,
|
|
||||||
censec_id: 3,
|
|
||||||
codigo: 6,
|
|
||||||
descricao: "Testamento sem Conteúdo Patrimonial",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: "N",
|
|
||||||
tipo_revogacao: "N"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 21,
|
|
||||||
censec_id: 9,
|
|
||||||
codigo: null,
|
|
||||||
descricao: "Atos Diversos",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: null,
|
|
||||||
tipo_revogacao: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 204,
|
|
||||||
censec_id: 1,
|
|
||||||
codigo: 75,
|
|
||||||
descricao: "Conciliação",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: null,
|
|
||||||
tipo_revogacao: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 208,
|
|
||||||
censec_id: 1,
|
|
||||||
codigo: 76,
|
|
||||||
descricao: "Mediação",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: null,
|
|
||||||
tipo_revogacao: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 209,
|
|
||||||
censec_id: 1,
|
|
||||||
codigo: 8,
|
|
||||||
descricao: "Compra e Venda",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: null,
|
|
||||||
tipo_revogacao: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 210,
|
|
||||||
censec_id: 1,
|
|
||||||
codigo: 1,
|
|
||||||
descricao: "Escritura",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: null,
|
|
||||||
tipo_revogacao: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 211,
|
|
||||||
censec_id: 2,
|
|
||||||
codigo: 8,
|
|
||||||
descricao: "Nomeação de Inventariante",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: null,
|
|
||||||
tipo_revogacao: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
censec_tipoato_id: 212,
|
|
||||||
censec_id: 2,
|
|
||||||
codigo: 9,
|
|
||||||
descricao: "Partilha",
|
|
||||||
situacao: "A",
|
|
||||||
tipo_separacao: null,
|
|
||||||
tipo_revogacao: null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
import { useResponse } from "@/shared/components/response/ResponseContext";
|
|
||||||
import { useState } from "react";
|
|
||||||
import { TCensecQualidadeAtoInterface } from "../../_interfaces/TCensecQualidadeAtoInterface";
|
|
||||||
import { TCensecQualidadeAtoIndexService } from "../../_services/TCensecQualidadeAto/TCensecQualidadeAtoIndexService";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hook responsável por gerenciar a listagem (index)
|
|
||||||
* de registros da tabela T_CENSEC_QUALIDADEATO.
|
|
||||||
*
|
|
||||||
* Integra-se com o ResponseContext para tratamento
|
|
||||||
* global de mensagens e respostas da API.
|
|
||||||
*/
|
|
||||||
export const useTCensecQualidadeAtoIndexHook = () => {
|
|
||||||
const { setResponse } = useResponse();
|
|
||||||
const [tCensecQualidadeAto, setTCensecQualidadeAto] = useState<TCensecQualidadeAtoInterface[]>([]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Busca todos os registros da tabela T_CENSEC_QUALIDADEATO.
|
|
||||||
*/
|
|
||||||
const fetchTCensecQualidadeAto = async (censec_tipoato_id: number) => {
|
|
||||||
const response = await TCensecQualidadeAtoIndexService(censec_tipoato_id);
|
|
||||||
|
|
||||||
setTCensecQualidadeAto(response.data);
|
|
||||||
setResponse(response);
|
|
||||||
};
|
|
||||||
|
|
||||||
return { tCensecQualidadeAto, fetchTCensecQualidadeAto };
|
|
||||||
};
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
import { useResponse } from "@/shared/components/response/ResponseContext";
|
|
||||||
import { TCensecQualidadeAtoInterface } from "../../_interfaces/TCensecQualidadeAtoInterface";
|
|
||||||
import { TCensecQualidadeAtoRemoveService } from "../../_services/TCensecQualidadeAto/TCensecQualidadeAtoRemoveService";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hook responsável por gerenciar a exclusão de registros da tabela T_CENSEC_QUALIDADEATO.
|
|
||||||
*
|
|
||||||
* Integra-se com o ResponseContext para exibir feedbacks globais após a operação.
|
|
||||||
*/
|
|
||||||
export const useTCensecQualidadeAtoRemoveHook = () => {
|
|
||||||
const { setResponse } = useResponse();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Executa a remoção de um registro da tabela T_CENSEC_QUALIDADEATO.
|
|
||||||
*
|
|
||||||
* @param data Objeto contendo o ID do registro a ser removido.
|
|
||||||
*/
|
|
||||||
const removeTCensecQualidadeAto = async (data: TCensecQualidadeAtoInterface) => {
|
|
||||||
const response = await TCensecQualidadeAtoRemoveService(data);
|
|
||||||
setResponse(response);
|
|
||||||
};
|
|
||||||
|
|
||||||
return { removeTCensecQualidadeAto };
|
|
||||||
};
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
import { useResponse } from "@/shared/components/response/ResponseContext";
|
|
||||||
import { useState } from "react";
|
|
||||||
import { TCensecQualidadeAtoInterface } from "../../_interfaces/TCensecQualidadeAtoInterface";
|
|
||||||
import { TCensecQualidadeAtoSaveService } from "../../_services/TCensecQualidadeAto/TCensecQualidadeAtoSaveService";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hook responsável por gerenciar o estado e a operação de salvamento
|
|
||||||
* de registros na tabela T_CENSEC_QUALIDADEATO.
|
|
||||||
*
|
|
||||||
* Integra-se com o ResponseContext para feedbacks globais e mantém
|
|
||||||
* estado local do último registro salvo.
|
|
||||||
*/
|
|
||||||
export const useTCensecQualidadeAtoSaveHook = () => {
|
|
||||||
const { setResponse } = useResponse();
|
|
||||||
const [tCensecQualidadeAto, setTCensecQualidadeAto] = useState<TCensecQualidadeAtoInterface | null>(null);
|
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Executa a operação de salvamento (insert/update)
|
|
||||||
* e atualiza o estado local e global de resposta.
|
|
||||||
*/
|
|
||||||
const saveTCensecQualidadeAto = async (data: TCensecQualidadeAtoInterface) => {
|
|
||||||
const response = await TCensecQualidadeAtoSaveService(data);
|
|
||||||
|
|
||||||
setTCensecQualidadeAto(response.data);
|
|
||||||
setResponse(response);
|
|
||||||
setIsOpen(false);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
};
|
|
||||||
|
|
||||||
return { tCensecQualidadeAto, saveTCensecQualidadeAto };
|
|
||||||
};
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
import { useResponse } from "@/shared/components/response/ResponseContext"
|
|
||||||
import { useState } from "react";
|
|
||||||
import { TCensecTipoAtoInterface } from "../../_interfaces/TCensecTipoAtoInterface";
|
|
||||||
import { TCensecTipoAtoIndexService } from "../../_services/t_censec_tipoato/TCensecTipoAtoIndexService";
|
|
||||||
|
|
||||||
export const useTCensecTipoAtoReadHook = () => {
|
|
||||||
|
|
||||||
const { setResponse } = useResponse();
|
|
||||||
const [tCensecTipoAto, setTCensecTipoAto] = useState<TCensecTipoAtoInterface[]>([]);
|
|
||||||
|
|
||||||
const fetchTCensecTipoAto = async () => {
|
|
||||||
|
|
||||||
const response = await TCensecTipoAtoIndexService();
|
|
||||||
|
|
||||||
setTCensecTipoAto(response.data);
|
|
||||||
|
|
||||||
setResponse(response);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return { tCensecTipoAto, fetchTCensecTipoAto }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
import { useResponse } from "@/shared/components/response/ResponseContext"
|
|
||||||
import { TCensecTipoAtoInterface } from "../../_interfaces/TCensecTipoAtoInterface";
|
|
||||||
import { TCensecTipoAtoRemoveService } from "../../_services/t_censec_tipoato/TCensecTipoAtoRemoveService";
|
|
||||||
|
|
||||||
export const useTCensecTipoAtoRemoveHook = () => {
|
|
||||||
|
|
||||||
const { setResponse } = useResponse();
|
|
||||||
|
|
||||||
const removeTCensecTipoAto = async (data: TCensecTipoAtoInterface) => {
|
|
||||||
|
|
||||||
const response = await TCensecTipoAtoRemoveService(data);
|
|
||||||
|
|
||||||
setResponse(response);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return { removeTCensecTipoAto }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
import { useResponse } from "@/shared/components/response/ResponseContext"
|
|
||||||
import { useState } from "react";
|
|
||||||
import { TCensecTipoAtoInterface } from "../../_interfaces/TCensecTipoAtoInterface";
|
|
||||||
import { TCensecTipoAtoSaveService } from "../../_services/t_censec_tipoato/TCensecTipoAtoSaveService";
|
|
||||||
|
|
||||||
export const useTCensecTipoAtoSaveHook = () => {
|
|
||||||
|
|
||||||
const { setResponse } = useResponse();
|
|
||||||
const [tCensecTipoAto, setTCensecTipoAto] = useState<TCensecTipoAtoInterface | null>(null);
|
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
|
||||||
|
|
||||||
const saveTCensecTipoAto = async (data: TCensecTipoAtoInterface) => {
|
|
||||||
|
|
||||||
const response = await TCensecTipoAtoSaveService(data);
|
|
||||||
|
|
||||||
setTCensecTipoAto(response.data);
|
|
||||||
|
|
||||||
setResponse(response);
|
|
||||||
|
|
||||||
setIsOpen(false);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return { tCensecTipoAto, saveTCensecTipoAto }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
'use client';
|
|
||||||
|
|
||||||
import ITTTBReconhecimentoTipo from '../../_interfaces/TTBReconhecimentoTipoInterface';
|
|
||||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
|
||||||
import { useState } from 'react';
|
|
||||||
import TTBReconhecimentoTipoIndexData from '../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData';
|
|
||||||
|
|
||||||
export const useTTBReconhecimentoTipoReadHook = () => {
|
|
||||||
const { setResponse } = useResponse();
|
|
||||||
|
|
||||||
const [tTBReconhecimentosTipos, setReconhecimenntosTipos] = useState<ITTTBReconhecimentoTipo[]>(
|
|
||||||
[],
|
|
||||||
);
|
|
||||||
|
|
||||||
const fetchTTBReconhecimentosTipos = async () => {
|
|
||||||
const response = await TTBReconhecimentoTipoIndexData();
|
|
||||||
|
|
||||||
setReconhecimenntosTipos(response.data);
|
|
||||||
|
|
||||||
setResponse(response);
|
|
||||||
};
|
|
||||||
|
|
||||||
return { tTBReconhecimentosTipos, fetchTTBReconhecimentosTipos };
|
|
||||||
};
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import { z } from "zod";
|
|
||||||
import { SituacoesEnum } from "@/shared/enums/SituacoesEnum";
|
|
||||||
|
|
||||||
export const TCensecTipoAtoSchema = z.object({
|
|
||||||
censec_tipoato_id: z.number().int(),
|
|
||||||
censec_id: z.number("Precisa referir a qual Central do Censec pertence").int(),
|
|
||||||
codigo: z.number().int().nullable(),
|
|
||||||
descricao: z.string().min(1, "Campo descrição deve ser preenchido"),
|
|
||||||
situacao: z.enum(SituacoesEnum, { message: "Tipo inválido" }),
|
|
||||||
tipo_separacao: z.enum(["S", "N"]).nullable(),
|
|
||||||
tipo_revogacao: z.enum(["S", "N"]).nullable(),
|
|
||||||
});
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
import { z } from 'zod';
|
|
||||||
import { situacaoEnum } from '../_interfaces/TTBReconhecimentoTipoInterface';
|
|
||||||
|
|
||||||
export const TTBReconhecimentoTipoSchema = z.object({
|
|
||||||
tb_reconhecimentotipo_id: z.number().optional(),
|
|
||||||
descricao: z.string().min(1, 'Campo descrição deve ser preenchido'),
|
|
||||||
situacao: z.nativeEnum(situacaoEnum, { message: 'Tipo inválido' }),
|
|
||||||
});
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
|
||||||
import { TCensecQualidadeAtoIndexData } from "../../_data/TCensecQualidadeAto/TCensecQualidadeAtoIndexData";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Service responsável por orquestrar a listagem de registros
|
|
||||||
* da tabela T_CENSEC_QUALIDADEATO.
|
|
||||||
*
|
|
||||||
* Utiliza o Data Layer (TCensecQualidadeAtoIndexData) para buscar os dados na API.
|
|
||||||
*/
|
|
||||||
async function executeTCensecQualidadeAtoIndexService(censec_tipoato_id: number) {
|
|
||||||
const response = await TCensecQualidadeAtoIndexData(censec_tipoato_id);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exporta a função decorada com o handler de erros client-side,
|
|
||||||
* garantindo tratamento consistente de falhas.
|
|
||||||
*/
|
|
||||||
export const TCensecQualidadeAtoIndexService = withClientErrorHandler(executeTCensecQualidadeAtoIndexService);
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
|
||||||
import { TCensecQualidadeAtoRemoveData } from "../../_data/TCensecQualidadeAto/TCensecQualidadeAtoRemoveData";
|
|
||||||
import { TCensecQualidadeAtoInterface } from "../../_interfaces/TCensecQualidadeAtoInterface";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Service responsável por orquestrar a exclusão de registros
|
|
||||||
* da tabela T_CENSEC_QUALIDADEATO.
|
|
||||||
*
|
|
||||||
* Utiliza o Data Layer (TCensecQualidadeAtoRemoveData) para comunicação com a API.
|
|
||||||
*/
|
|
||||||
async function executeTCensecQualidadeAtoRemoveService(data: TCensecQualidadeAtoInterface) {
|
|
||||||
const response = await TCensecQualidadeAtoRemoveData(data);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exporta a função decorada com o handler de erros client-side,
|
|
||||||
* garantindo tratamento consistente de falhas.
|
|
||||||
*/
|
|
||||||
export const TCensecQualidadeAtoRemoveService = withClientErrorHandler(executeTCensecQualidadeAtoRemoveService);
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
|
||||||
import { TCensecQualidadeAtoSaveData } from "../../_data/TCensecQualidadeAto/TCensecQualidadeAtoSaveData";
|
|
||||||
import { TCensecQualidadeAtoInterface } from "../../_interfaces/TCensecQualidadeAtoInterface";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Service responsável por orquestrar a operação de criação ou atualização
|
|
||||||
* de registros da tabela T_CENSEC_QUALIDADEATO.
|
|
||||||
*
|
|
||||||
* Utiliza o Data Layer (TCensecQualidadeAtoSaveData) para comunicação com a API.
|
|
||||||
*/
|
|
||||||
async function executeTCensecQualidadeAtoSaveService(data: TCensecQualidadeAtoInterface) {
|
|
||||||
const response = await TCensecQualidadeAtoSaveData(data);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exporta a função decorada com o handler de erros client-side.
|
|
||||||
*/
|
|
||||||
export const TCensecQualidadeAtoSaveService = withClientErrorHandler(executeTCensecQualidadeAtoSaveService);
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
import GTBProfissaoRemoveData from '../../_data/GTBProfissao/GTBProfissaoRemoveData';
|
|
||||||
import GTBProfissaoInterface from '../../_interfaces/GTBProfissaoInterface';
|
|
||||||
|
|
||||||
export default async function GTBProfissaoRemoveService(data: GTBProfissaoInterface) {
|
|
||||||
const response = await GTBProfissaoRemoveData(data);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
import GTBProfissaoSaveData from '../../_data/GTBProfissao/GTBProfissaoSaveData';
|
|
||||||
import GTBProfissaoInterface from '../../_interfaces/GTBProfissaoInterface';
|
|
||||||
|
|
||||||
export default async function GTProfissaoSaveService(data: GTBProfissaoInterface) {
|
|
||||||
const response = await GTBProfissaoSaveData(data);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
import GTBRegimeBensRemoveData from '../../_data/GTBRegimeBens/GTBRegimeBensRemoveData';
|
|
||||||
import GTBRegimeBensInterface from '../../_interfaces/GTBRegimeBensInterface';
|
|
||||||
|
|
||||||
export default async function GTBRegimeBensRemoveService(data: GTBRegimeBensInterface) {
|
|
||||||
const response = await GTBRegimeBensRemoveData(data);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
|
||||||
import { TCensecTipoAtoIndexData } from "../../_data/TCensecTipoAto/GMedidaTipoIndexData";
|
|
||||||
|
|
||||||
async function executeTCensecTipoAtoIndexService() {
|
|
||||||
|
|
||||||
const response = await TCensecTipoAtoIndexData();
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const TCensecTipoAtoIndexService = withClientErrorHandler(executeTCensecTipoAtoIndexService)
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
|
||||||
import { TCensecTipoAtoRemoveData } from "../../_data/TCensecTipoAto/GMedidaTipoRemoveData";
|
|
||||||
import { TCensecTipoAtoInterface } from "../../_interfaces/TCensecTipoAtoInterface";
|
|
||||||
|
|
||||||
async function executeTCensecTipoAtoRemoveService(data: TCensecTipoAtoInterface) {
|
|
||||||
|
|
||||||
const response = await TCensecTipoAtoRemoveData(data);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export const TCensecTipoAtoRemoveService = withClientErrorHandler(executeTCensecTipoAtoRemoveService)
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
|
||||||
import { TCensecTipoAtoSaveData } from "../../_data/TCensecTipoAto/GMedidaTipoSaveData";
|
|
||||||
import { TCensecTipoAtoInterface } from "../../_interfaces/TCensecTipoAtoInterface";
|
|
||||||
|
|
||||||
async function executeTCensecTipoAtoSaveService(data: TCensecTipoAtoInterface) {
|
|
||||||
|
|
||||||
const response = await TCensecTipoAtoSaveData(data);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export const TCensecTipoAtoSaveService = withClientErrorHandler(executeTCensecTipoAtoSaveService)
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
import TMinutaIndexData from '../../_data/TMinuta/TMinutaIndexData';
|
|
||||||
import { TMinutaInterface } from '../../_interfaces/TMinutaInterface';
|
|
||||||
|
|
||||||
export default async function TMinutaIndex() {
|
|
||||||
const response = await TMinutaIndexData();
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
import TMinutaRemoveData from '../../_data/TMinuta/TMinutaRemoveData';
|
|
||||||
import { TMinutaInterface } from '../../_interfaces/TMinutaInterface';
|
|
||||||
|
|
||||||
export default async function TMinutaRemoveService(data: TMinutaInterface) {
|
|
||||||
const response = await TMinutaRemoveData(data);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
import TMinutaSaveData from '../../_data/TMinuta/TMinutaSaveData';
|
|
||||||
import { TMinutaInterface } from '../../_interfaces/TMinutaInterface';
|
|
||||||
|
|
||||||
export default async function TMinutaSaveService(data: TMinutaInterface) {
|
|
||||||
const response = await TMinutaSaveData(data);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
import { FileText, Heart, Briefcase, Scale, Link as LinkIcon, MapPin } from 'lucide-react';
|
|
||||||
import { Card, CardContent } from '@/components/ui/card';
|
|
||||||
import Link from 'next/link';
|
|
||||||
|
|
||||||
export default function CadastrosPage() {
|
|
||||||
const items = [
|
|
||||||
{
|
|
||||||
title: 'Documentos',
|
|
||||||
description: 'Gerencie os tipos de documentos aceitos e suas configurações no sistema.',
|
|
||||||
icon: FileText,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Estado Civil',
|
|
||||||
description: 'Cadastre e mantenha os diferentes estados civis utilizados nos registros.',
|
|
||||||
icon: Heart,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Profissão',
|
|
||||||
description: 'Gerencie a lista de profissões para utilização em cadastros e registros.',
|
|
||||||
icon: Briefcase,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Regime de Comunhão',
|
|
||||||
description: 'Defina os regimes de comunhão aplicáveis em matrimônios e registros civis.',
|
|
||||||
icon: Scale,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Vínculo de Sinal Público',
|
|
||||||
description:
|
|
||||||
'Controle e cadastre vínculos relacionados a sinais públicos para autenticações.',
|
|
||||||
icon: LinkIcon,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Municípios',
|
|
||||||
description: 'Gerencie a base de municípios para utilização em endereços e cadastros.',
|
|
||||||
icon: MapPin,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className="mb-4 flex items-center justify-between">
|
|
||||||
<div>
|
|
||||||
<h1 className="mb-1 text-4xl font-semibold">Complementos de Cadastro pessoal</h1>
|
|
||||||
<p className="text-muted-foreground text-base">
|
|
||||||
Gerencie os cadastros relacionados a regimes, como estado civil, regime de comunhão e
|
|
||||||
outras informações complementares necessárias para o registro de pessoas.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="grid grid-cols-5 gap-3">
|
|
||||||
{items.map((item, key) => (
|
|
||||||
<Link key={key} href={'/'}>
|
|
||||||
<Card className="hover:bg-muted cursor-pointer transition-colors">
|
|
||||||
<CardContent>
|
|
||||||
<span className="mb-2 inline-flex shrink-0 rounded-md border border-blue-300 bg-blue-100 p-2 dark:border-blue-300/10 dark:bg-blue-400/10">
|
|
||||||
<item.icon className="size-6 stroke-blue-700 dark:stroke-blue-500" />
|
|
||||||
</span>
|
|
||||||
<h3 className="mt-3 text-2xl font-medium tracking-tight text-gray-900 dark:text-white">
|
|
||||||
{item.title}
|
|
||||||
</h3>
|
|
||||||
<p className="mt-1 text-sm text-gray-500 dark:text-gray-400">{item.description}</p>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</Link>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
||||||
'use client';
|
|
||||||
|
|
||||||
import { Card, CardAction, CardContent, CardDescription, CardTitle } from '@/components/ui/card';
|
|
||||||
import {
|
|
||||||
BabyIcon,
|
|
||||||
CrossIcon,
|
|
||||||
FileCheckIcon,
|
|
||||||
FileTextIcon,
|
|
||||||
GavelIcon,
|
|
||||||
GlobeIcon,
|
|
||||||
HeartIcon,
|
|
||||||
PenIcon,
|
|
||||||
ScrollIcon,
|
|
||||||
UsersIcon,
|
|
||||||
} from 'lucide-react';
|
|
||||||
|
|
||||||
const services = [
|
|
||||||
{
|
|
||||||
title: 'Registro de Nascimento',
|
|
||||||
description:
|
|
||||||
'Emissão e registro de certidões de nascimento, garantindo a cidadania e identidade legal do recém-nascido.',
|
|
||||||
icon: BabyIcon,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Registro de Casamento',
|
|
||||||
description: 'Processo completo para habilitação, registro e emissão da certidão de casamento.',
|
|
||||||
icon: HeartIcon,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Registro de Óbito',
|
|
||||||
description:
|
|
||||||
'Lavratura do registro de óbito e emissão da certidão correspondente para fins legais.',
|
|
||||||
icon: CrossIcon,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Reconhecimento de Firma',
|
|
||||||
description: 'Autenticação da assinatura de documentos, garantindo sua validade jurídica.',
|
|
||||||
icon: PenIcon,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Autenticação de Documentos',
|
|
||||||
description: 'Confirmação de que cópias estão de acordo com o documento original apresentado.',
|
|
||||||
icon: FileCheckIcon,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Procurações',
|
|
||||||
description:
|
|
||||||
'Elaboração e registro de procurações públicas para representação legal de pessoas físicas ou jurídicas.',
|
|
||||||
icon: ScrollIcon,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Testamentos',
|
|
||||||
description: 'Lavratura e registro de testamentos públicos com segurança jurídica.',
|
|
||||||
icon: GavelIcon,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Divórcio Extrajudicial',
|
|
||||||
description:
|
|
||||||
'Formalização do divórcio por via administrativa, de forma rápida e sem processo judicial.',
|
|
||||||
icon: UsersIcon,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Apostilamento de Documentos',
|
|
||||||
description:
|
|
||||||
'Apostilamento conforme a Convenção da Haia para validade internacional de documentos.',
|
|
||||||
icon: GlobeIcon,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Certidões e Segunda Via',
|
|
||||||
description: 'Emissão de segundas vias e certidões de nascimento, casamento e óbito.',
|
|
||||||
icon: FileTextIcon,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
export default function ServicosPage() {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className="bg-primary/10 border-primary/20 w-full rounded-xl border p-6">
|
|
||||||
<h2 className="text-primary text-2xl font-semibold">Bem-vindo(a)!</h2>
|
|
||||||
<p className="mt-2 text-base text-gray-700">
|
|
||||||
Olá, <span className="text-primary font-bold">Keven</span>! É um prazer ter você conosco.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className="mt-3 grid grid-cols-4 space-y-2 space-x-2">
|
|
||||||
{services.map((item: any, index) => (
|
|
||||||
<Card className="cursor-pointer" key={index}>
|
|
||||||
<CardContent>
|
|
||||||
<div className="bg-primary flex h-12 w-12 items-center justify-center rounded-2xl">
|
|
||||||
<item.icon className="h-6 w-6 text-white" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<CardTitle className="mt-3">{item.title}</CardTitle>
|
|
||||||
<CardDescription className="mt-3">{item.description}</CardDescription>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -2,8 +2,8 @@ import type { Metadata } from 'next';
|
||||||
import { Geist, Geist_Mono } from 'next/font/google';
|
import { Geist, Geist_Mono } from 'next/font/google';
|
||||||
import '../globals.css';
|
import '../globals.css';
|
||||||
|
|
||||||
import { ResponseProvider } from '../../shared/components/response/ResponseContext';
|
|
||||||
import { AppSidebar } from '@/components/app-sidebar';
|
import { AppSidebar } from '@/components/app-sidebar';
|
||||||
|
import { ThemeProvider } from '@/components/theme-provider';
|
||||||
import {
|
import {
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
BreadcrumbItem,
|
BreadcrumbItem,
|
||||||
|
|
@ -15,7 +15,9 @@ import {
|
||||||
import { Separator } from '@/components/ui/separator';
|
import { Separator } from '@/components/ui/separator';
|
||||||
import { SidebarInset, SidebarProvider, SidebarTrigger } from '@/components/ui/sidebar';
|
import { SidebarInset, SidebarProvider, SidebarTrigger } from '@/components/ui/sidebar';
|
||||||
import { Toaster } from '@/components/ui/sonner';
|
import { Toaster } from '@/components/ui/sonner';
|
||||||
|
|
||||||
import Response from '../../shared/components/response/response';
|
import Response from '../../shared/components/response/response';
|
||||||
|
import { ResponseProvider } from '../../shared/components/response/ResponseContext';
|
||||||
|
|
||||||
const geistSans = Geist({
|
const geistSans = Geist({
|
||||||
variable: '--font-geist-sans',
|
variable: '--font-geist-sans',
|
||||||
|
|
@ -35,50 +37,46 @@ export const metadata: Metadata = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function RootLayout({
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||||
children,
|
|
||||||
}: Readonly<{
|
|
||||||
children: React.ReactNode;
|
|
||||||
}>) {
|
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en" suppressHydrationWarning>
|
||||||
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
|
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
|
||||||
<SidebarProvider>
|
<ThemeProvider>
|
||||||
<AppSidebar />
|
<SidebarProvider>
|
||||||
<SidebarInset>
|
<AppSidebar />
|
||||||
<header className="mb-4 flex h-16 shrink-0 items-center gap-2 border-b-1 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12">
|
|
||||||
<div className="flex items-center gap-2 px-4">
|
<SidebarInset>
|
||||||
<SidebarTrigger className="-ml-1" />
|
<header className="mb-4 flex h-16 shrink-0 items-center gap-2 border-b-1 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12">
|
||||||
<Separator
|
<div className="flex items-center gap-2 px-4">
|
||||||
orientation="vertical"
|
<SidebarTrigger className="-ml-1" />
|
||||||
className="mr-2 data-[orientation=vertical]:h-4"
|
<Separator
|
||||||
/>
|
orientation="vertical"
|
||||||
<Breadcrumb>
|
className="mr-2 data-[orientation=vertical]:h-4"
|
||||||
<BreadcrumbList>
|
/>
|
||||||
<BreadcrumbItem className="hidden md:block">
|
<Breadcrumb>
|
||||||
<BreadcrumbLink href="#">
|
<BreadcrumbList>
|
||||||
Building Your Application
|
<BreadcrumbItem className="hidden md:block">
|
||||||
</BreadcrumbLink>
|
<BreadcrumbLink href="#">Building Your Application</BreadcrumbLink>
|
||||||
</BreadcrumbItem>
|
</BreadcrumbItem>
|
||||||
<BreadcrumbSeparator className="hidden md:block" />
|
<BreadcrumbSeparator className="hidden md:block" />
|
||||||
<BreadcrumbItem>
|
<BreadcrumbItem>
|
||||||
<BreadcrumbPage>
|
<BreadcrumbPage>Data Fetching</BreadcrumbPage>
|
||||||
Data Fetching
|
</BreadcrumbItem>
|
||||||
</BreadcrumbPage>
|
</BreadcrumbList>
|
||||||
</BreadcrumbItem>
|
</Breadcrumb>
|
||||||
</BreadcrumbList>
|
</div>
|
||||||
</Breadcrumb>
|
</header>
|
||||||
</div>
|
|
||||||
</header>
|
<ResponseProvider>
|
||||||
<ResponseProvider>
|
<div className="flex flex-1 flex-col gap-4 p-4 pt-0">
|
||||||
<div className="flex flex-1 flex-col gap-4 p-4 pt-0">
|
{children}
|
||||||
{children}
|
<Toaster richColors position="top-center" />
|
||||||
<Toaster richColors position="top-center" />
|
<Response />
|
||||||
<Response />
|
</div>
|
||||||
</div>
|
</ResponseProvider>
|
||||||
</ResponseProvider>
|
</SidebarInset>
|
||||||
</SidebarInset>
|
</SidebarProvider>
|
||||||
</SidebarProvider>
|
</ThemeProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,54 +1,51 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import useGUsuarioGetJWTHook from '@/shared/hooks/auth/useGUsuarioGetJWTHook';
|
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
import useGUsuarioGetJWTHook from '@/shared/hooks/auth/useGUsuarioGetJWTHook';
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
const { userAuthenticated } = useGUsuarioGetJWTHook();
|
const { userAuthenticated } = useGUsuarioGetJWTHook();
|
||||||
|
|
||||||
// Inicializa time como null para renderizar só no cliente
|
// Inicializa time como null para renderizar só no cliente
|
||||||
const [time, setTime] = useState<Date | null>(null);
|
const [time, setTime] = useState<Date | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTime(new Date()); // define data inicial no cliente
|
setTime(new Date()); // define data inicial no cliente
|
||||||
const interval = setInterval(() => setTime(new Date()), 1000);
|
const interval = setInterval(() => setTime(new Date()), 1000);
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Se ainda não temos a hora, renderiza nada para evitar mismatch
|
// Se ainda não temos a hora, renderiza nada para evitar mismatch
|
||||||
if (!time || !userAuthenticated?.data) return null;
|
if (!time || !userAuthenticated?.data) return null;
|
||||||
|
|
||||||
const hours = time.getHours();
|
const hours = time.getHours();
|
||||||
const greeting =
|
const greeting = hours < 12 ? 'Bom dia' : hours < 18 ? 'Boa tarde' : 'Boa noite';
|
||||||
hours < 12 ? 'Bom dia' : hours < 18 ? 'Boa tarde' : 'Boa noite';
|
|
||||||
|
|
||||||
const formattedDate = time.toLocaleDateString('pt-BR', {
|
const formattedDate = time.toLocaleDateString('pt-BR', {
|
||||||
weekday: 'long',
|
weekday: 'long',
|
||||||
day: '2-digit',
|
day: '2-digit',
|
||||||
month: 'long',
|
month: 'long',
|
||||||
});
|
});
|
||||||
const formattedTime = time.toLocaleTimeString('pt-BR');
|
const formattedTime = time.toLocaleTimeString('pt-BR');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="fixed inset-0 flex flex-col items-center justify-center text-gray-800 overflow-hidden select-none">
|
<main className="fixed inset-0 flex flex-col items-center justify-center overflow-hidden text-gray-800 select-none">
|
||||||
<section className="text-center max-w-md px-4">
|
<section className="max-w-md px-4 text-center">
|
||||||
<h1 className="text-4xl font-bold mb-2">
|
<h1 className="mb-2 text-4xl font-bold">
|
||||||
{greeting},{' '}
|
{greeting}, <span className="text-blue-600">{userAuthenticated.data.nome}</span> 👋
|
||||||
<span className="text-blue-600">{userAuthenticated.data.nome}</span>{' '}
|
</h1>
|
||||||
👋
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<p className="text-gray-600 text-sm mb-6">
|
<p className="mb-6 text-sm text-gray-600">
|
||||||
Hoje é <strong>{formattedDate}</strong>, {formattedTime}
|
Hoje é <strong>{formattedDate}</strong>, {formattedTime}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="rounded-2xl p-6">
|
<div className="rounded-2xl p-6">
|
||||||
<p className="text-gray-700 leading-relaxed">
|
<p className="leading-relaxed text-gray-700">
|
||||||
Que bom ter você de volta! 🎉
|
Que bom ter você de volta! 🎉 Aproveite o seu dia e continue alcançando seus objetivos.
|
||||||
Aproveite o seu dia e continue alcançando seus objetivos.
|
</p>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</section>
|
||||||
</section>
|
</main>
|
||||||
</main>
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
5
src/app/(protected)/servicos/atos/ato/page.tsx
Normal file
5
src/app/(protected)/servicos/atos/ato/page.tsx
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
import TAtoForm from '@/packages/servicos/components/TAto/TAtoForm';
|
||||||
|
|
||||||
|
export default function TAtoFormPage() {
|
||||||
|
return <TAtoForm />;
|
||||||
|
}
|
||||||
5
src/app/(protected)/servicos/atos/page.tsx
Normal file
5
src/app/(protected)/servicos/atos/page.tsx
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
import TAtoIndex from '@/packages/servicos/components/TAto/TAtoIndex';
|
||||||
|
|
||||||
|
export default function TServicoAToPag() {
|
||||||
|
return <TAtoIndex />;
|
||||||
|
}
|
||||||
5
src/app/(protected)/servicos/dashboard/page.tsx
Normal file
5
src/app/(protected)/servicos/dashboard/page.tsx
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
import TServicoPedidoDashboard from '@/packages/servicos/components/TServicoPedido/TServicoPedidoDashboard';
|
||||||
|
|
||||||
|
export default function TServicoPedidoPage() {
|
||||||
|
return <TServicoPedidoDashboard />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useParams } from 'next/navigation';
|
||||||
|
|
||||||
|
import TServicoPedidoDetails from '@/packages/servicos/components/TServicoPedido/TServicoPedidoDetails';
|
||||||
|
|
||||||
|
export default function TServicoPedidoDetailsPage() {
|
||||||
|
const params = useParams();
|
||||||
|
|
||||||
|
return <TServicoPedidoDetails servico_pedido_id={Number(params.servicoPedidoId)} />;
|
||||||
|
}
|
||||||
5
src/app/(protected)/servicos/pedidos/page.tsx
Normal file
5
src/app/(protected)/servicos/pedidos/page.tsx
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
import TServicoPedidoIndex from '@/packages/servicos/components/TServicoPedido/TServicoPedidoIndex';
|
||||||
|
|
||||||
|
export default function TServicoPedidoPage() {
|
||||||
|
return <TServicoPedidoIndex />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useParams } from 'next/navigation';
|
||||||
|
|
||||||
|
import TServicoPedidoForm from '@/packages/servicos/components/TServicoPedido/TServicoPedidoForm';
|
||||||
|
|
||||||
|
export default function TServicoPedidoPage() {
|
||||||
|
const params = useParams();
|
||||||
|
|
||||||
|
return <TServicoPedidoForm servico_pedido_id={Number(params.servicoPedidoId)} />;
|
||||||
|
}
|
||||||
5
src/app/(protected)/servicos/pedidos/pedido/page.tsx
Normal file
5
src/app/(protected)/servicos/pedidos/pedido/page.tsx
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
import TServicoPedidoForm from '@/packages/servicos/components/TServicoPedido/TServicoPedidoForm';
|
||||||
|
|
||||||
|
export default function TServicoPedidoPage() {
|
||||||
|
return <TServicoPedidoForm />;
|
||||||
|
}
|
||||||
|
|
@ -1,124 +1,111 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import {
|
|
||||||
AlertDialog,
|
|
||||||
AlertDialogCancel,
|
|
||||||
AlertDialogContent,
|
|
||||||
AlertDialogDescription,
|
|
||||||
AlertDialogFooter,
|
|
||||||
AlertDialogHeader,
|
|
||||||
AlertDialogTitle,
|
|
||||||
AlertDialogAction,
|
|
||||||
} from '@/components/ui/alert-dialog';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
InputOTP,
|
AlertDialog,
|
||||||
InputOTPGroup,
|
AlertDialogCancel,
|
||||||
InputOTPSlot,
|
AlertDialogContent,
|
||||||
} from '@/components/ui/input-otp';
|
AlertDialogDescription,
|
||||||
|
AlertDialogFooter,
|
||||||
|
AlertDialogHeader,
|
||||||
|
AlertDialogTitle,
|
||||||
|
AlertDialogAction,
|
||||||
|
} from '@/components/ui/alert-dialog';
|
||||||
|
import { InputOTP, InputOTPGroup, InputOTPSlot } from '@/components/ui/input-otp';
|
||||||
|
|
||||||
interface ConfirmExclusionProps {
|
interface ConfirmExclusionProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
title: string;
|
title: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
expectedCode: string;
|
expectedCode: string;
|
||||||
confirmText?: string;
|
confirmText?: string;
|
||||||
cancelText?: string;
|
cancelText?: string;
|
||||||
onConfirm: () => void;
|
onConfirm: () => void;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
onResendCode: () => void; // Função para reenviar o código
|
onResendCode: () => void; // Função para reenviar o código
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ConfirmExclusion({
|
export default function ConfirmExclusion({
|
||||||
isOpen,
|
isOpen,
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
expectedCode,
|
expectedCode,
|
||||||
confirmText = 'Continuar',
|
confirmText = 'Continuar',
|
||||||
cancelText = 'Cancelar',
|
cancelText = 'Cancelar',
|
||||||
onConfirm,
|
onConfirm,
|
||||||
onCancel,
|
onCancel,
|
||||||
onResendCode, // A função para reenvio do código
|
onResendCode, // A função para reenvio do código
|
||||||
}: ConfirmExclusionProps) {
|
}: ConfirmExclusionProps) {
|
||||||
const [code, setCode] = useState('');
|
const [code, setCode] = useState('');
|
||||||
const [isValid, setIsValid] = useState(false);
|
const [isValid, setIsValid] = useState(false);
|
||||||
const [isResending, setIsResending] = useState(false); // Novo estado para controle de envio do código
|
const [isResending, setIsResending] = useState(false); // Novo estado para controle de envio do código
|
||||||
|
|
||||||
const handleChange = (value: string) => {
|
const handleChange = (value: string) => {
|
||||||
setCode(value);
|
setCode(value);
|
||||||
setIsValid(value === expectedCode);
|
setIsValid(value === expectedCode);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleResendCode = async () => {
|
const handleResendCode = async () => {
|
||||||
setIsResending(true);
|
setIsResending(true);
|
||||||
try {
|
try {
|
||||||
await onResendCode(); // Chamando a função de reenvio
|
await onResendCode(); // Chamando a função de reenvio
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Erro ao reenviar código", error);
|
console.error('Erro ao reenviar código', error);
|
||||||
} finally {
|
} finally {
|
||||||
setIsResending(false); // Resetando o estado de envio
|
setIsResending(false); // Resetando o estado de envio
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AlertDialog open={isOpen} onOpenChange={(open) => !open && onCancel()}>
|
<AlertDialog open={isOpen} onOpenChange={(open) => !open && onCancel()}>
|
||||||
<AlertDialogContent className="max-w-lg mx-auto p-6">
|
<AlertDialogContent className="mx-auto max-w-lg p-6">
|
||||||
<AlertDialogHeader className="text-center">
|
<AlertDialogHeader className="text-center">
|
||||||
<AlertDialogTitle className="text-xl font-semibold text-center">{title}</AlertDialogTitle>
|
<AlertDialogTitle className="text-center text-xl font-semibold">{title}</AlertDialogTitle>
|
||||||
{description && (
|
{description && (
|
||||||
<AlertDialogDescription className="mt-2 text-sm text-muted-foreground text-center">
|
<AlertDialogDescription className="text-muted-foreground mt-2 text-center text-sm">
|
||||||
{description}
|
{description}
|
||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
)}
|
)}
|
||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
|
|
||||||
<div className="py-4 text-sm text-muted-foreground space-y-4">
|
<div className="text-muted-foreground space-y-4 py-4 text-sm">
|
||||||
<div className="flex justify-center">
|
<div className="flex justify-center">
|
||||||
<InputOTP
|
<InputOTP maxLength={expectedCode.length} value={code} onChange={handleChange}>
|
||||||
maxLength={expectedCode.length}
|
<InputOTPGroup className="flex gap-4">
|
||||||
value={code}
|
{expectedCode.split('').map((_, index) => (
|
||||||
onChange={handleChange}
|
<InputOTPSlot
|
||||||
>
|
key={index}
|
||||||
<InputOTPGroup className="flex gap-4">
|
index={index}
|
||||||
{expectedCode.split('').map((_, index) => (
|
className="h-12 w-12 rounded-lg border-2 border-gray-300 text-center text-lg focus:ring-2 focus:ring-blue-500"
|
||||||
<InputOTPSlot
|
/>
|
||||||
key={index}
|
))}
|
||||||
index={index}
|
</InputOTPGroup>
|
||||||
className="w-12 h-12 text-center text-lg border-2 border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500"
|
</InputOTP>
|
||||||
/>
|
</div>
|
||||||
))}
|
|
||||||
</InputOTPGroup>
|
|
||||||
</InputOTP>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Botão "Reenviar Código" */}
|
{/* Botão "Reenviar Código" */}
|
||||||
<div className="flex justify-center items-center text-center gap-2 mt-4">
|
<div className="mt-4 flex items-center justify-center gap-2 text-center">
|
||||||
<AlertDialogDescription>
|
<AlertDialogDescription>Não recebeu o código?</AlertDialogDescription>
|
||||||
Não recebeu o código?
|
<button
|
||||||
</AlertDialogDescription>
|
onClick={handleResendCode}
|
||||||
<button
|
className={`cursor-pointer font-semibold text-blue-500 ${isResending ? 'cursor-not-allowed text-gray-400' : 'hover:text-blue-600'}`}
|
||||||
onClick={handleResendCode}
|
disabled={isResending} // Desabilita o botão enquanto o código está sendo reenviado
|
||||||
className={`text-blue-500 font-semibold cursor-pointer ${isResending ? 'cursor-not-allowed text-gray-400' : 'hover:text-blue-600'}`}
|
>
|
||||||
disabled={isResending} // Desabilita o botão enquanto o código está sendo reenviado
|
{isResending ? 'Enviando...' : 'Reenviar Código'}
|
||||||
>
|
</button>
|
||||||
{isResending ? 'Enviando...' : 'Reenviar Código'}
|
</div>
|
||||||
</button>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<AlertDialogFooter>
|
<AlertDialogFooter>
|
||||||
<AlertDialogCancel onClick={onCancel} className="text-gray-600 hover:text-gray-800">
|
<AlertDialogCancel onClick={onCancel} className="text-gray-600 hover:text-gray-800">
|
||||||
{cancelText}
|
{cancelText}
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
<AlertDialogAction
|
<AlertDialogAction onClick={onConfirm} disabled={!isValid}>
|
||||||
onClick={onConfirm}
|
{confirmText}
|
||||||
disabled={!isValid}
|
</AlertDialogAction>
|
||||||
>
|
</AlertDialogFooter>
|
||||||
{confirmText}
|
</AlertDialogContent>
|
||||||
</AlertDialogAction>
|
</AlertDialog>
|
||||||
</AlertDialogFooter>
|
);
|
||||||
</AlertDialogContent>
|
|
||||||
</AlertDialog>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
interface UseConfirmExclusionOptions {
|
interface UseConfirmExclusionOptions {
|
||||||
onConfirm?: () => void;
|
onConfirm?: () => void;
|
||||||
|
|
@ -6,15 +6,19 @@ interface UseConfirmExclusionOptions {
|
||||||
expectedCode: string; // código que o usuário precisa digitar
|
expectedCode: string; // código que o usuário precisa digitar
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useConfirmExclusion({ onConfirm, onCancel, expectedCode }: UseConfirmExclusionOptions) {
|
export function useConfirmExclusion({
|
||||||
|
onConfirm,
|
||||||
|
onCancel,
|
||||||
|
expectedCode,
|
||||||
|
}: UseConfirmExclusionOptions) {
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const [code, setCode] = useState("");
|
const [code, setCode] = useState('');
|
||||||
const [isValid, setIsValid] = useState(false);
|
const [isValid, setIsValid] = useState(false);
|
||||||
|
|
||||||
const openDialog = useCallback(() => setIsOpen(true), []);
|
const openDialog = useCallback(() => setIsOpen(true), []);
|
||||||
const closeDialog = useCallback(() => {
|
const closeDialog = useCallback(() => {
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
setCode(""); // limpa o código quando fecha
|
setCode(''); // limpa o código quando fecha
|
||||||
setIsValid(false);
|
setIsValid(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
@ -35,7 +39,7 @@ export function useConfirmExclusion({ onConfirm, onCancel, expectedCode }: UseCo
|
||||||
setCode(value);
|
setCode(value);
|
||||||
setIsValid(value === expectedCode);
|
setIsValid(value === expectedCode);
|
||||||
},
|
},
|
||||||
[expectedCode]
|
[expectedCode],
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue