fix(eslint): Correção automática de código
This commit is contained in:
parent
4b7afd6a8f
commit
23604033fe
132 changed files with 1454 additions and 1703 deletions
|
|
@ -1,74 +1,70 @@
|
||||||
import js from "@eslint/js";
|
import js from '@eslint/js';
|
||||||
import reactPlugin from "eslint-plugin-react";
|
import reactPlugin from 'eslint-plugin-react';
|
||||||
import reactHooks from "eslint-plugin-react-hooks";
|
import reactHooks from 'eslint-plugin-react-hooks';
|
||||||
import jsxA11y from "eslint-plugin-jsx-a11y";
|
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
||||||
import importPlugin from "eslint-plugin-import";
|
import importPlugin from 'eslint-plugin-import';
|
||||||
import tseslint from "typescript-eslint";
|
import tseslint from 'typescript-eslint';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
js.configs.recommended,
|
js.configs.recommended,
|
||||||
...tseslint.configs.recommended,
|
...tseslint.configs.recommended,
|
||||||
{
|
{
|
||||||
files: ["**/*.ts", "**/*.tsx"],
|
files: ['**/*.ts', '**/*.tsx'],
|
||||||
ignores: ["node_modules/**", ".next/**", "out/**", "dist/**"],
|
ignores: ['node_modules/**', '.next/**', 'out/**', 'dist/**'],
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
ecmaVersion: "latest",
|
ecmaVersion: 'latest',
|
||||||
sourceType: "module",
|
sourceType: 'module',
|
||||||
parser: tseslint.parser,
|
parser: tseslint.parser,
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: "./tsconfig.json",
|
project: './tsconfig.json',
|
||||||
},
|
},
|
||||||
globals: {
|
globals: {
|
||||||
React: true,
|
React: true,
|
||||||
JSX: 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",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
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,9 +1,5 @@
|
||||||
import TTBAndamentoServicoIndex from "@/packages/administrativo/components/TTBAndamentoServico/TTBAndamentoServicoIndex";
|
import TTBAndamentoServicoIndex from '@/packages/administrativo/components/TTBAndamentoServico/TTBAndamentoServicoIndex';
|
||||||
|
|
||||||
export default function TAtoParteTipo() {
|
export default function TAtoParteTipo() {
|
||||||
|
return <TTBAndamentoServicoIndex />;
|
||||||
return (
|
}
|
||||||
< TTBAndamentoServicoIndex />
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
import TAtoParteTipoIndex from "@/packages/administrativo/components/TAtoParteTipo/TAtoParteTipoIndex";
|
import TAtoParteTipoIndex from '@/packages/administrativo/components/TAtoParteTipo/TAtoParteTipoIndex';
|
||||||
|
|
||||||
export default function TAtoParteTipo() {
|
export default function TAtoParteTipo() {
|
||||||
|
return <TAtoParteTipoIndex />;
|
||||||
return (
|
}
|
||||||
< TAtoParteTipoIndex />
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import GTBBairroIndex from "@/packages/administrativo/components/GTBBairro/GTBBairroIndex";
|
import GTBBairroIndex from '@/packages/administrativo/components/GTBBairro/GTBBairroIndex';
|
||||||
|
|
||||||
export default function GCidadePage() {
|
export default function GCidadePage() {
|
||||||
return (
|
return <GTBBairroIndex />;
|
||||||
< GTBBairroIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import TCensecTipoNaturezaIndex from "@/packages/administrativo/components/TCensecTipoNatureza/TCensecTipoNaturezaIndex";
|
import TCensecTipoNaturezaIndex from '@/packages/administrativo/components/TCensecTipoNatureza/TCensecTipoNaturezaIndex';
|
||||||
|
|
||||||
export default function TCensecTipoNaturezaPage() {
|
export default function TCensecTipoNaturezaPage() {
|
||||||
return (
|
return <TCensecTipoNaturezaIndex />;
|
||||||
< TCensecTipoNaturezaIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import TCensecQualidadeIndex from "@/packages/administrativo/components/TCensecQualidade/TCensecQualidadeIndex";
|
import TCensecQualidadeIndex from '@/packages/administrativo/components/TCensecQualidade/TCensecQualidadeIndex';
|
||||||
|
|
||||||
export default function TCensecQualidadePage() {
|
export default function TCensecQualidadePage() {
|
||||||
return (
|
return <TCensecQualidadeIndex />;
|
||||||
< TCensecQualidadeIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import TCensecIndex from "@/packages/administrativo/components/TCensec/TCensecIndex";
|
import TCensecIndex from '@/packages/administrativo/components/TCensec/TCensecIndex';
|
||||||
|
|
||||||
export default function GTBEstadoCivilPage() {
|
export default function GTBEstadoCivilPage() {
|
||||||
return (
|
return <TCensecIndex />;
|
||||||
< TCensecIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import TCensecNaturezaLitigioIndex from "@/packages/administrativo/components/TCensecNaturezaLitigio/TCensecNaturezaLitigioIndex";
|
import TCensecNaturezaLitigioIndex from '@/packages/administrativo/components/TCensecNaturezaLitigio/TCensecNaturezaLitigioIndex';
|
||||||
|
|
||||||
export default function GCidadePage() {
|
export default function GCidadePage() {
|
||||||
return (
|
return <TCensecNaturezaLitigioIndex />;
|
||||||
< TCensecNaturezaLitigioIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import TCensecQualidadeIndex from "@/packages/administrativo/components/TCensecQualidade/TCensecQualidadeIndex";
|
import TCensecQualidadeIndex from '@/packages/administrativo/components/TCensecQualidade/TCensecQualidadeIndex';
|
||||||
|
|
||||||
export default function GTBEstadoCivilPage() {
|
export default function GTBEstadoCivilPage() {
|
||||||
return (
|
return <TCensecQualidadeIndex />;
|
||||||
< TCensecQualidadeIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import TCensecTipoAtoIndex from "@/packages/administrativo/components/TCensecTipoAto/TCensecTipoAtoIndex";
|
import TCensecTipoAtoIndex from '@/packages/administrativo/components/TCensecTipoAto/TCensecTipoAtoIndex';
|
||||||
|
|
||||||
export default function GTBEstadoCivilPage() {
|
export default function GTBEstadoCivilPage() {
|
||||||
return (
|
return <TCensecTipoAtoIndex />;
|
||||||
< TCensecTipoAtoIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import GCidadeIndex from "@/packages/administrativo/components/GCidade/GCidadeIndex";
|
import GCidadeIndex from '@/packages/administrativo/components/GCidade/GCidadeIndex';
|
||||||
|
|
||||||
export default function GCidadePage() {
|
export default function GCidadePage() {
|
||||||
return (
|
return <GCidadeIndex />;
|
||||||
< GCidadeIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 (
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import GTBTipoLogradouroIndex from "@/packages/administrativo/components/GTBTipoLogradouro/GTBTipoLogradouroIndex";
|
import GTBTipoLogradouroIndex from '@/packages/administrativo/components/GTBTipoLogradouro/GTBTipoLogradouroIndex';
|
||||||
|
|
||||||
export default function GMedidaTipoPage() {
|
export default function GMedidaTipoPage() {
|
||||||
return (
|
return <GTBTipoLogradouroIndex />;
|
||||||
< 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}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import GMedidaTipoIndex from "@/packages/administrativo/components/GMedidaTipo/GMedidaTipoIndex";
|
import GMedidaTipoIndex from '@/packages/administrativo/components/GMedidaTipo/GMedidaTipoIndex';
|
||||||
|
|
||||||
export default function GMedidaTipoPage() {
|
export default function GMedidaTipoPage() {
|
||||||
return (
|
return <GMedidaTipoIndex />;
|
||||||
< GMedidaTipoIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,5 @@
|
||||||
import GNaturezaIndex from "@/packages/administrativo/components/GNatureza/GNaturezaIndex";
|
import GNaturezaIndex from '@/packages/administrativo/components/GNatureza/GNaturezaIndex';
|
||||||
|
|
||||||
export default function GNaturezaPage() {
|
export default function GNaturezaPage() {
|
||||||
|
return <GNaturezaIndex sistema_id={2} />;
|
||||||
return (
|
}
|
||||||
<GNaturezaIndex
|
|
||||||
sistema_id={2}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import GTBEstadoCivilIndex from "@/packages/administrativo/components/GTBEstadoCivil/GTBEstadoCivilIndex";
|
import GTBEstadoCivilIndex from '@/packages/administrativo/components/GTBEstadoCivil/GTBEstadoCivilIndex';
|
||||||
|
|
||||||
export default function GTBEstadoCivilPage() {
|
export default function GTBEstadoCivilPage() {
|
||||||
return (
|
return <GTBEstadoCivilIndex />;
|
||||||
< 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 />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import GTBProfissaoIndex from "@/packages/administrativo/components/GTBProfissao/GTBProfissaoIndex";
|
import GTBProfissaoIndex from '@/packages/administrativo/components/GTBProfissao/GTBProfissaoIndex';
|
||||||
|
|
||||||
export default function GTBEstadoCivilPage() {
|
export default function GTBEstadoCivilPage() {
|
||||||
return (
|
return <GTBProfissaoIndex />;
|
||||||
< GTBProfissaoIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import GTBRegimeBensIndex from "@/packages/administrativo/components/GTBRegimeBens/GTBRegimeBensIndex";
|
import GTBRegimeBensIndex from '@/packages/administrativo/components/GTBRegimeBens/GTBRegimeBensIndex';
|
||||||
|
|
||||||
export default function GTBRegimeBensPage() {
|
export default function GTBRegimeBensPage() {
|
||||||
return (
|
return <GTBRegimeBensIndex />;
|
||||||
< GTBRegimeBensIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import GTBRegimeComunhaoIndex from "@/packages/administrativo/components/GTBRegimeComunhao/GTBRegimeComunhaoIndex";
|
import GTBRegimeComunhaoIndex from '@/packages/administrativo/components/GTBRegimeComunhao/GTBRegimeComunhaoIndex';
|
||||||
|
|
||||||
export default function GTBRegimeBensPage() {
|
export default function GTBRegimeBensPage() {
|
||||||
return (
|
return <GTBRegimeComunhaoIndex />;
|
||||||
< GTBRegimeComunhaoIndex />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
import TTBReconhecimentoTipoIndex from "@/packages/administrativo/components/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndex";
|
import TTBReconhecimentoTipoIndex from '@/packages/administrativo/components/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndex';
|
||||||
|
|
||||||
export default function TAtoParteTipo() {
|
export default function TAtoParteTipo() {
|
||||||
|
return <TTBReconhecimentoTipoIndex />;
|
||||||
return (
|
}
|
||||||
< TTBReconhecimentoTipoIndex />
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,9 @@ export default function TServicoTipoPage() {
|
||||||
const { editTServicoTipo } = useTServicoTipoEditHook();
|
const { editTServicoTipo } = useTServicoTipoEditHook();
|
||||||
|
|
||||||
// Estados
|
// Estados
|
||||||
const [selectedServicoTipo, setSelectedServicoTipo] = useState<TServicoTipoInterface | null>(null);
|
const [selectedServicoTipo, setSelectedServicoTipo] = useState<TServicoTipoInterface | null>(
|
||||||
|
null,
|
||||||
|
);
|
||||||
const [isFormOpen, setIsFormOpen] = useState(false);
|
const [isFormOpen, setIsFormOpen] = useState(false);
|
||||||
|
|
||||||
// Estado para saber qual item será deletado
|
// Estado para saber qual item será deletado
|
||||||
|
|
@ -49,45 +51,45 @@ export default function TServicoTipoPage() {
|
||||||
/**
|
/**
|
||||||
* Abre o formulário no modo de edição ou criação
|
* Abre o formulário no modo de edição ou criação
|
||||||
*/
|
*/
|
||||||
const handleOpenForm = useCallback(async (data: TServicoTipoInterface | null) => {
|
const handleOpenForm = useCallback(
|
||||||
|
async (data: TServicoTipoInterface | null) => {
|
||||||
|
// Fecha o formulário antes de reabrir (garante reset limpo)
|
||||||
|
setIsFormOpen(false);
|
||||||
|
|
||||||
// Fecha o formulário antes de reabrir (garante reset limpo)
|
// Se nenhum dado for passado, abre o formulário em modo de criação
|
||||||
setIsFormOpen(false);
|
if (!data) {
|
||||||
|
|
||||||
// Se nenhum dado for passado, abre o formulário em modo de criação
|
|
||||||
if (!data) {
|
|
||||||
setSelectedServicoTipo(null);
|
|
||||||
setIsFormOpen(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define o item selecionado para edição
|
|
||||||
setSelectedServicoTipo(data);
|
|
||||||
|
|
||||||
// Aguarda carregar/editar o registro (o hook espera o objeto TServicoTipoInterface)
|
|
||||||
await editTServicoTipo(data);
|
|
||||||
|
|
||||||
// Atualiza a lista de dados
|
|
||||||
await fetchTServicoTipo();
|
|
||||||
|
|
||||||
setIsFormOpen(true);
|
|
||||||
|
|
||||||
}, [editTServicoTipo, fetchTServicoTipo]);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fecha o formulário e limpa o item selecionado
|
|
||||||
*/
|
|
||||||
const handleCloseForm = useCallback((_: null, __: boolean) => {
|
|
||||||
setSelectedServicoTipo(null);
|
setSelectedServicoTipo(null);
|
||||||
setIsFormOpen(false);
|
setIsFormOpen(true);
|
||||||
}, []);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
// Define o item selecionado para edição
|
||||||
* Salva os dados do formulário
|
setSelectedServicoTipo(data);
|
||||||
*/
|
|
||||||
const handleSave = useCallback(async (formData: TServicoTipoInterface) => {
|
// Aguarda carregar/editar o registro (o hook espera o objeto TServicoTipoInterface)
|
||||||
|
await editTServicoTipo(data);
|
||||||
|
|
||||||
|
// Atualiza a lista de dados
|
||||||
|
await fetchTServicoTipo();
|
||||||
|
|
||||||
|
setIsFormOpen(true);
|
||||||
|
},
|
||||||
|
[editTServicoTipo, fetchTServicoTipo],
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fecha o formulário e limpa o item selecionado
|
||||||
|
*/
|
||||||
|
const handleCloseForm = useCallback((_: null, __: boolean) => {
|
||||||
|
setSelectedServicoTipo(null);
|
||||||
|
setIsFormOpen(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Salva os dados do formulário
|
||||||
|
*/
|
||||||
|
const handleSave = useCallback(
|
||||||
|
async (formData: TServicoTipoInterface) => {
|
||||||
// Aguarda salvar o registro
|
// Aguarda salvar o registro
|
||||||
await saveTServicoTipo(formData);
|
await saveTServicoTipo(formData);
|
||||||
|
|
||||||
|
|
@ -95,13 +97,8 @@ export default function TServicoTipoPage() {
|
||||||
fetchTServicoTipo();
|
fetchTServicoTipo();
|
||||||
},
|
},
|
||||||
[saveTServicoTipo, fetchTServicoTipo],
|
[saveTServicoTipo, fetchTServicoTipo],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quando o usuário clica em "remover" na tabela
|
* Quando o usuário clica em "remover" na tabela
|
||||||
*/
|
*/
|
||||||
|
|
@ -116,7 +113,6 @@ export default function TServicoTipoPage() {
|
||||||
[openConfirmDialog],
|
[openConfirmDialog],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executa a exclusão de fato quando o usuário confirma
|
* Executa a exclusão de fato quando o usuário confirma
|
||||||
*/
|
*/
|
||||||
|
|
@ -137,8 +133,6 @@ export default function TServicoTipoPage() {
|
||||||
handleCancel();
|
handleCancel();
|
||||||
}, [itemToDelete, removeTServicoTipo, fetchTServicoTipo, handleCancel]);
|
}, [itemToDelete, removeTServicoTipo, fetchTServicoTipo, handleCancel]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Busca inicial dos dados
|
* Busca inicial dos dados
|
||||||
*/
|
*/
|
||||||
|
|
@ -168,7 +162,11 @@ export default function TServicoTipoPage() {
|
||||||
{/* Tabela de Tipos de Serviço */}
|
{/* Tabela de Tipos de Serviço */}
|
||||||
<Card>
|
<Card>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<TServicoTipoTable data={tServicoTipo} onEdit={handleOpenForm} onDelete={handleConfirmDelete} />
|
<TServicoTipoTable
|
||||||
|
data={tServicoTipo}
|
||||||
|
onEdit={handleOpenForm}
|
||||||
|
onDelete={handleConfirmDelete}
|
||||||
|
/>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
|
@ -194,4 +192,4 @@ export default function TServicoTipoPage() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -22,7 +22,8 @@ import { EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react';
|
||||||
import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface'; // Import alterado
|
import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface'; // Import alterado
|
||||||
|
|
||||||
// Tipagem das props do componente da tabela
|
// Tipagem das props do componente da tabela
|
||||||
interface TServicoTipoTableProps { // Nome da interface alterado
|
interface TServicoTipoTableProps {
|
||||||
|
// Nome da interface alterado
|
||||||
data: TServicoTipoInterface[]; // lista de tipos de serviço
|
data: TServicoTipoInterface[]; // lista de tipos de serviço
|
||||||
onEdit: (item: TServicoTipoInterface, isEditingFormStatus: boolean) => void; // callback para edição
|
onEdit: (item: TServicoTipoInterface, isEditingFormStatus: boolean) => void; // callback para edição
|
||||||
onDelete: (item: TServicoTipoInterface, isEditingFormStatus: boolean) => void; // callback para exclusão
|
onDelete: (item: TServicoTipoInterface, isEditingFormStatus: boolean) => void; // callback para exclusão
|
||||||
|
|
@ -48,12 +49,12 @@ export default function TServicoTipoTable({ data, onEdit, onDelete }: TServicoTi
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{data.map((item) => (
|
{data.map((item) => (
|
||||||
// Assumindo que o ID do Tipo de Serviço é 'servico_tipo_id'
|
// Assumindo que o ID do Tipo de Serviço é 'servico_tipo_id'
|
||||||
<TableRow key={item.servico_tipo_id} className="cursor-pointer">
|
<TableRow key={item.servico_tipo_id} className="cursor-pointer">
|
||||||
{/* ID do Tipo de Serviço */}
|
{/* ID do Tipo de Serviço */}
|
||||||
<TableCell>{item.servico_tipo_id}</TableCell>
|
<TableCell>{item.servico_tipo_id}</TableCell>
|
||||||
|
|
||||||
{/* Nome/descrição do Tipo de Serviço (descricao) */}
|
{/* Nome/descrição do Tipo de Serviço (descricao) */}
|
||||||
<TableCell>{item.descricao}</TableCell>
|
<TableCell>{item.descricao}</TableCell>
|
||||||
{/* As células de IBGE e UF foram removidas */}
|
{/* As células de IBGE e UF foram removidas */}
|
||||||
|
|
||||||
{/* Ações (menu dropdown) */}
|
{/* Ações (menu dropdown) */}
|
||||||
|
|
@ -97,4 +98,4 @@ export default function TServicoTipoTable({ data, onEdit, onDelete }: TServicoTi
|
||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,22 +5,22 @@ import API from '@/shared/services/api/Api'; //
|
||||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum'; //
|
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum'; //
|
||||||
|
|
||||||
// Importa a interface tipada que define a estrutura dos dados do tipo de serviço
|
// Importa a interface tipada que define a estrutura dos dados do tipo de serviço
|
||||||
import { TServicoEtiquetaInterface } from '../../_interfaces/TServicoEtiquetaInterface';
|
import { TServicoEtiquetaInterface } from '../../_interfaces/TServicoEtiquetaInterface';
|
||||||
|
|
||||||
// Importa função que encapsula chamadas assíncronas e trata erros automaticamente
|
// Importa função que encapsula chamadas assíncronas e trata erros automaticamente
|
||||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; //
|
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; //
|
||||||
|
|
||||||
// Função assíncrona que implementa a lógica de localizar um tipo de serviço
|
// Função assíncrona que implementa a lógica de localizar um tipo de serviço
|
||||||
async function executeTServicoEtiquetaService(data: TServicoEtiquetaInterface) {
|
async function executeTServicoEtiquetaService(data: TServicoEtiquetaInterface) {
|
||||||
// Instancia o cliente da API para enviar a requisição
|
// Instancia o cliente da API para enviar a requisição
|
||||||
const api = new API(); //
|
const api = new API(); //
|
||||||
|
|
||||||
// Executa a requisição para a API com o método apropriado e envia o ID no endpoint
|
// Executa a requisição para a API com o método apropriado e envia o ID no endpoint
|
||||||
return await api.send({
|
return await api.send({
|
||||||
method: Methods.GET, // Verbo GET para consulta
|
method: Methods.GET, // Verbo GET para consulta
|
||||||
endpoint: `administrativo/t_servico_etiqueta/servico_tipo/${data.servico_tipo_id}`, // Endpoint e ID alterados
|
endpoint: `administrativo/t_servico_etiqueta/servico_tipo/${data.servico_tipo_id}`, // Endpoint e ID alterados
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta a função de Readr tipo de serviço já encapsulada com tratamento de erros
|
// Exporta a função de Readr tipo de serviço já encapsulada com tratamento de erros
|
||||||
export const TServicoEtiquetaReadData = withClientErrorHandler(executeTServicoEtiquetaService); // Nome da exportação alterado
|
export const TServicoEtiquetaReadData = withClientErrorHandler(executeTServicoEtiquetaService); // Nome da exportação alterado
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ import { TServicoEtiquetaInterface } from '../../_interfaces/TServicoEtiquetaInt
|
||||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; //
|
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; //
|
||||||
|
|
||||||
// Função assíncrona que implementa a lógica de remover um tipo de serviço
|
// Função assíncrona que implementa a lógica de remover um tipo de serviço
|
||||||
async function executeTServicoEtiquetaRemoveData(data: TServicoEtiquetaInterface) { // Nome da função alterado
|
async function executeTServicoEtiquetaRemoveData(data: TServicoEtiquetaInterface) {
|
||||||
|
// Nome da função alterado
|
||||||
|
|
||||||
// Instancia o cliente da API para enviar a requisição
|
// Instancia o cliente da API para enviar a requisição
|
||||||
const api = new API(); //
|
const api = new API(); //
|
||||||
|
|
@ -19,9 +20,9 @@ async function executeTServicoEtiquetaRemoveData(data: TServicoEtiquetaInterface
|
||||||
// Executa a requisição para a API com o método apropriado e envia o ID no endpoint
|
// Executa a requisição para a API com o método apropriado e envia o ID no endpoint
|
||||||
return await api.send({
|
return await api.send({
|
||||||
method: Methods.DELETE, // Verbo DELETE para exclusão
|
method: Methods.DELETE, // Verbo DELETE para exclusão
|
||||||
endpoint: `administrativo/t_servico_etiqueta/${data.servico_etiqueta_id}`, // Endpoint e ID alterados
|
endpoint: `administrativo/t_servico_etiqueta/${data.servico_etiqueta_id}`, // Endpoint e ID alterados
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta a função de remover tipo de serviço já encapsulada com tratamento de erros
|
// Exporta a função de remover tipo de serviço já encapsulada com tratamento de erros
|
||||||
export const TServicoEtiquetaRemoveData = withClientErrorHandler(executeTServicoEtiquetaRemoveData); // Nome da exportação alterado
|
export const TServicoEtiquetaRemoveData = withClientErrorHandler(executeTServicoEtiquetaRemoveData); // Nome da exportação alterado
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,8 @@ import { TServicoEtiquetaInterface } from '../../_interfaces/TServicoEtiquetaInt
|
||||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; //
|
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; //
|
||||||
|
|
||||||
// Função assíncrona que implementa a lógica de salvar (criar/atualizar) um tipo de serviço
|
// Função assíncrona que implementa a lógica de salvar (criar/atualizar) um tipo de serviço
|
||||||
async function executeTServicoEtiquetaSaveData(data: TServicoEtiquetaFormValues) {
|
async function executeTServicoEtiquetaSaveData(data: TServicoEtiquetaFormValues) {
|
||||||
|
try {
|
||||||
try{
|
|
||||||
|
|
||||||
// Instancia o cliente da API para enviar a requisição
|
// Instancia o cliente da API para enviar a requisição
|
||||||
const api = new API(); //
|
const api = new API(); //
|
||||||
|
|
||||||
|
|
@ -27,13 +25,11 @@ async function executeTServicoEtiquetaSaveData(data: TServicoEtiquetaFormValues)
|
||||||
endpoint: `administrativo/t_servico_etiqueta`, // Endpoint e ID alterados
|
endpoint: `administrativo/t_servico_etiqueta`, // Endpoint e ID alterados
|
||||||
body: data, // payload enviado para a API
|
body: data, // payload enviado para a API
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
console.error('Erro no TServicoEtiquetaSaveData:', error);
|
console.error('Erro no TServicoEtiquetaSaveData:', error);
|
||||||
throw error; // propaga erro para o form
|
throw error; // propaga erro para o form
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta a função de salvar tipo de serviço já encapsulada com tratamento de erros
|
// Exporta a função de salvar tipo de serviço já encapsulada com tratamento de erros
|
||||||
export const TServicoEtiquetaSaveData = withClientErrorHandler(executeTServicoEtiquetaSaveData); // Nome da exportação alterado
|
export const TServicoEtiquetaSaveData = withClientErrorHandler(executeTServicoEtiquetaSaveData); // Nome da exportação alterado
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,16 @@ import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface'; //
|
||||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; //
|
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; //
|
||||||
|
|
||||||
// Função assíncrona que implementa a lógica de localizar um tipo de serviço
|
// Função assíncrona que implementa a lógica de localizar um tipo de serviço
|
||||||
async function executeTServicoTipoEditService(data: TServicoTipoInterface) {
|
async function executeTServicoTipoEditService(data: TServicoTipoInterface) {
|
||||||
// Instancia o cliente da API para enviar a requisição
|
// Instancia o cliente da API para enviar a requisição
|
||||||
const api = new API(); //
|
const api = new API(); //
|
||||||
|
|
||||||
// Executa a requisição para a API com o método apropriado e envia o ID no endpoint
|
// Executa a requisição para a API com o método apropriado e envia o ID no endpoint
|
||||||
return await api.send({
|
return await api.send({
|
||||||
method: Methods.GET, // Verbo GET para consulta
|
method: Methods.GET, // Verbo GET para consulta
|
||||||
endpoint: `administrativo/t_servico_tipo/${data.servico_tipo_id}`, // Endpoint e ID alterados
|
endpoint: `administrativo/t_servico_tipo/${data.servico_tipo_id}`, // Endpoint e ID alterados
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta a função de Readr tipo de serviço já encapsulada com tratamento de erros
|
// Exporta a função de Readr tipo de serviço já encapsulada com tratamento de erros
|
||||||
export const TServicoTipoEditData = withClientErrorHandler(executeTServicoTipoEditService); // Nome da exportação alterado
|
export const TServicoTipoEditData = withClientErrorHandler(executeTServicoTipoEditService); // Nome da exportação alterado
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,15 @@ import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/
|
||||||
|
|
||||||
// Função assíncrona que implementa a lógica de buscar todos os tipos de serviço (GET)
|
// Função assíncrona que implementa a lógica de buscar todos os tipos de serviço (GET)
|
||||||
async function executeTServicoTipoIndexData() {
|
async function executeTServicoTipoIndexData() {
|
||||||
|
|
||||||
// Instancia o cliente da API para enviar a requisição
|
// Instancia o cliente da API para enviar a requisição
|
||||||
const api = new API(); //
|
const api = new API(); //
|
||||||
|
|
||||||
// Executa a requisição para a API com o método apropriado e o endpoint da tabela t_servico_tipo
|
// Executa a requisição para a API com o método apropriado e o endpoint da tabela t_servico_tipo
|
||||||
return await api.send({
|
return await api.send({
|
||||||
method: Methods.GET, // GET listar todos os itens
|
method: Methods.GET, // GET listar todos os itens
|
||||||
endpoint: `administrativo/t_servico_tipo/` // Endpoint atualizado
|
endpoint: `administrativo/t_servico_tipo/`, // Endpoint atualizado
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta a função de listar tipos de serviço já encapsulada com tratamento de erros
|
// Exporta a função de listar tipos de serviço já encapsulada com tratamento de erros
|
||||||
export const TServicoTipoIndexData = withClientErrorHandler(executeTServicoTipoIndexData);
|
export const TServicoTipoIndexData = withClientErrorHandler(executeTServicoTipoIndexData);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface'; //
|
||||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; //
|
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; //
|
||||||
|
|
||||||
// Função assíncrona que implementa a lógica de remover um tipo de serviço
|
// Função assíncrona que implementa a lógica de remover um tipo de serviço
|
||||||
async function executeTServicoTipoRemoveData(data: TServicoTipoInterface) { // Nome da função alterado
|
async function executeTServicoTipoRemoveData(data: TServicoTipoInterface) {
|
||||||
|
// Nome da função alterado
|
||||||
|
|
||||||
// Instancia o cliente da API para enviar a requisição
|
// Instancia o cliente da API para enviar a requisição
|
||||||
const api = new API(); //
|
const api = new API(); //
|
||||||
|
|
@ -19,9 +20,9 @@ async function executeTServicoTipoRemoveData(data: TServicoTipoInterface) { // N
|
||||||
// Executa a requisição para a API com o método apropriado e envia o ID no endpoint
|
// Executa a requisição para a API com o método apropriado e envia o ID no endpoint
|
||||||
return await api.send({
|
return await api.send({
|
||||||
method: Methods.DELETE, // Verbo DELETE para exclusão
|
method: Methods.DELETE, // Verbo DELETE para exclusão
|
||||||
endpoint: `administrativo/t_servico_tipo/${data.servico_tipo_id}`, // Endpoint e ID alterados
|
endpoint: `administrativo/t_servico_tipo/${data.servico_tipo_id}`, // Endpoint e ID alterados
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta a função de remover tipo de serviço já encapsulada com tratamento de erros
|
// Exporta a função de remover tipo de serviço já encapsulada com tratamento de erros
|
||||||
export const TServicoTipoRemoveData = withClientErrorHandler(executeTServicoTipoRemoveData); // Nome da exportação alterado
|
export const TServicoTipoRemoveData = withClientErrorHandler(executeTServicoTipoRemoveData); // Nome da exportação alterado
|
||||||
|
|
|
||||||
|
|
@ -14,17 +14,17 @@ import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface'; //
|
||||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; //
|
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; //
|
||||||
|
|
||||||
// Função assíncrona que implementa a lógica de salvar (criar/atualizar) um tipo de serviço
|
// Função assíncrona que implementa a lógica de salvar (criar/atualizar) um tipo de serviço
|
||||||
async function executeTServicoTipoSaveData(data: TServicoTipoFormValues & { metodo?: 'POST' | 'PUT' }) {
|
async function executeTServicoTipoSaveData(
|
||||||
|
data: TServicoTipoFormValues & { metodo?: 'POST' | 'PUT' },
|
||||||
|
) {
|
||||||
// Verifica se existe ID do tipo de serviço para decidir se é atualização (PUT) ou criação (POST)
|
// Verifica se existe ID do tipo de serviço para decidir se é atualização (PUT) ou criação (POST)
|
||||||
const isEditing = !!data.servico_tipo_id && Number(data.servico_tipo_id) > 0;
|
const isEditing = !!data.servico_tipo_id && Number(data.servico_tipo_id) > 0;
|
||||||
|
|
||||||
// Define método: prioridade para valor passado manualmente (metodo)
|
// Define método: prioridade para valor passado manualmente (metodo)
|
||||||
const method = data.metodo ?? (isEditing ? 'PUT' : 'POST');
|
const method = data.metodo ?? (isEditing ? 'PUT' : 'POST');
|
||||||
|
|
||||||
try{
|
try {
|
||||||
|
console.log(data);
|
||||||
console.log(data)
|
|
||||||
|
|
||||||
// Instancia o cliente da API para enviar a requisição
|
// Instancia o cliente da API para enviar a requisição
|
||||||
const api = new API(); //
|
const api = new API(); //
|
||||||
|
|
@ -35,13 +35,11 @@ async function executeTServicoTipoSaveData(data: TServicoTipoFormValues & { meto
|
||||||
endpoint: `administrativo/t_servico_tipo/${data.servico_tipo_id || ''}`, // Endpoint e ID alterados
|
endpoint: `administrativo/t_servico_tipo/${data.servico_tipo_id || ''}`, // Endpoint e ID alterados
|
||||||
body: data, // payload enviado para a API
|
body: data, // payload enviado para a API
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
console.error('Erro no TServicoTipoSaveData:', error);
|
console.error('Erro no TServicoTipoSaveData:', error);
|
||||||
throw error; // propaga erro para o form
|
throw error; // propaga erro para o form
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta a função de salvar tipo de serviço já encapsulada com tratamento de erros
|
// Exporta a função de salvar tipo de serviço já encapsulada com tratamento de erros
|
||||||
export const TServicoTipoSaveData = withClientErrorHandler(executeTServicoTipoSaveData); // Nome da exportação alterado
|
export const TServicoTipoSaveData = withClientErrorHandler(executeTServicoTipoSaveData); // Nome da exportação alterado
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,6 @@ async function executeTTBReconhecimentoTipoIndexData(data: TTBReconhecimentoTipo
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta a função encapsulada pelo handler de erro, garantindo tratamento uniforme em caso de falhas
|
// Exporta a função encapsulada pelo handler de erro, garantindo tratamento uniforme em caso de falhas
|
||||||
export const TTBReconhecimentoTipoIndexData = withClientErrorHandler(executeTTBReconhecimentoTipoIndexData);
|
export const TTBReconhecimentoTipoIndexData = withClientErrorHandler(
|
||||||
|
executeTTBReconhecimentoTipoIndexData,
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import { CCaixaServicoReadInterface } from '../../_interfaces/CCaixaServicoReadI
|
||||||
import { CCaixaServicoIndexService } from '../../_services/c_caixa_servico/CCaixaServicoIndexService';
|
import { CCaixaServicoIndexService } from '../../_services/c_caixa_servico/CCaixaServicoIndexService';
|
||||||
import { CCaixaServicoInterface } from '../../_interfaces/CCaixaServicoInterface';
|
import { CCaixaServicoInterface } from '../../_interfaces/CCaixaServicoInterface';
|
||||||
|
|
||||||
|
|
||||||
// Hook personalizado para leitura (consulta) dos tipos de marcação
|
// Hook personalizado para leitura (consulta) dos tipos de marcação
|
||||||
export const useCCaixaServicoReadHook = () => {
|
export const useCCaixaServicoReadHook = () => {
|
||||||
// Obtém a função que atualiza a resposta global do sistema
|
// Obtém a função que atualiza a resposta global do sistema
|
||||||
|
|
@ -33,5 +32,8 @@ export const useCCaixaServicoReadHook = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Retorna os dados e a função de busca, memorizando o valor para evitar recriações desnecessárias
|
// Retorna os dados e a função de busca, memorizando o valor para evitar recriações desnecessárias
|
||||||
return useMemo(() => ({ cCaixaServico, fetchCCaixaServico }), [cCaixaServico, fetchCCaixaServico]);
|
return useMemo(
|
||||||
|
() => ({ cCaixaServico, fetchCCaixaServico }),
|
||||||
|
[cCaixaServico, fetchCCaixaServico],
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import { GEmolumentoReadInterface } from '../../_interfaces/GEmolumentoReadInter
|
||||||
import { GEmolumentoIndexService } from '../../_services/g_emolumento/GEmolumentoIndexService';
|
import { GEmolumentoIndexService } from '../../_services/g_emolumento/GEmolumentoIndexService';
|
||||||
import { GEmolumentoInterface } from '../../_interfaces/GEmolumentoInterface';
|
import { GEmolumentoInterface } from '../../_interfaces/GEmolumentoInterface';
|
||||||
|
|
||||||
|
|
||||||
// Hook personalizado para leitura (consulta) dos emolumentos
|
// Hook personalizado para leitura (consulta) dos emolumentos
|
||||||
export const useGEmolumentoReadHook = () => {
|
export const useGEmolumentoReadHook = () => {
|
||||||
// Obtém a função que atualiza a resposta global do sistema
|
// Obtém a função que atualiza a resposta global do sistema
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import { GEmolumentoItemReadInterface } from '../../_interfaces/GEmolumentoItemR
|
||||||
import { GEmolumentoItemValorService } from '../../_services/g_emolumento_item/GEmolumentoItemValorService';
|
import { GEmolumentoItemValorService } from '../../_services/g_emolumento_item/GEmolumentoItemValorService';
|
||||||
import { GEmolumentoItemInterface } from '../../_interfaces/GEmolumentoItemInterface';
|
import { GEmolumentoItemInterface } from '../../_interfaces/GEmolumentoItemInterface';
|
||||||
|
|
||||||
|
|
||||||
// Hook personalizado para leitura (consulta) dos emolumentos
|
// Hook personalizado para leitura (consulta) dos emolumentos
|
||||||
export const useGEmolumentoItemReadHook = () => {
|
export const useGEmolumentoItemReadHook = () => {
|
||||||
const { setResponse } = useResponse();
|
const { setResponse } = useResponse();
|
||||||
|
|
@ -27,11 +26,10 @@ export const useGEmolumentoItemReadHook = () => {
|
||||||
|
|
||||||
// Retorna a resposta completa (para uso externo)
|
// Retorna a resposta completa (para uso externo)
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Erro ao buscar item de emolumento:", error);
|
console.error('Erro ao buscar item de emolumento:', error);
|
||||||
setResponse({
|
setResponse({
|
||||||
message: "Erro ao buscar item de emolumento",
|
message: 'Erro ao buscar item de emolumento',
|
||||||
error: error instanceof Error ? error.message : String(error),
|
error: error instanceof Error ? error.message : String(error),
|
||||||
});
|
});
|
||||||
return null; // Retorna nulo para segurança
|
return null; // Retorna nulo para segurança
|
||||||
|
|
@ -39,8 +37,5 @@ export const useGEmolumentoItemReadHook = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Retorna função e dados memorizados
|
// Retorna função e dados memorizados
|
||||||
return useMemo(
|
return useMemo(() => ({ gGEmolumentoItem, fetchGEmolumentoItem }), [gGEmolumentoItem]);
|
||||||
() => ({ gGEmolumentoItem, fetchGEmolumentoItem }),
|
|
||||||
[gGEmolumentoItem]
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,8 @@ import { GMarcacaoTipoInterface } from '../../_interfaces/GMarcacaoTipoInterface
|
||||||
// Importa o serviço responsável por buscar os dados de "GMarcacaoTipo" na API
|
// Importa o serviço responsável por buscar os dados de "GMarcacaoTipo" na API
|
||||||
import { GMarcacaoTipoIndexService } from '../../_services/g_marcacao_tipo/GMarcacaoTipoIndexService';
|
import { GMarcacaoTipoIndexService } from '../../_services/g_marcacao_tipo/GMarcacaoTipoIndexService';
|
||||||
|
|
||||||
|
|
||||||
// Hook personalizado para leitura (consulta) dos tipos de marcação
|
// Hook personalizado para leitura (consulta) dos tipos de marcação
|
||||||
export const useGMarcacaoTipoReadHook = () => {
|
export const useGMarcacaoTipoReadHook = () => {
|
||||||
|
|
||||||
// Obtém a função que atualiza a resposta global do sistema
|
// Obtém a função que atualiza a resposta global do sistema
|
||||||
const { setResponse } = useResponse();
|
const { setResponse } = useResponse();
|
||||||
|
|
||||||
|
|
@ -34,5 +32,8 @@ export const useGMarcacaoTipoReadHook = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Retorna os dados e a função de busca, memorizando o valor para evitar recriações desnecessárias
|
// Retorna os dados e a função de busca, memorizando o valor para evitar recriações desnecessárias
|
||||||
return useMemo(() => ({ gMarcacaoTipo, fetchGMarcacaoTipo }), [gMarcacaoTipo, fetchGMarcacaoTipo]);
|
return useMemo(
|
||||||
|
() => ({ gMarcacaoTipo, fetchGMarcacaoTipo }),
|
||||||
|
[gMarcacaoTipo, fetchGMarcacaoTipo],
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import { TServicoEtiquetaServicoIdService } from '../../_services/t_servico_etiq
|
||||||
|
|
||||||
// Hook personalizado para leitura (consulta) dos tipos de marcação
|
// Hook personalizado para leitura (consulta) dos tipos de marcação
|
||||||
export const useTServicoEtiquetaReadHook = () => {
|
export const useTServicoEtiquetaReadHook = () => {
|
||||||
|
|
||||||
// Obtém a função que atualiza a resposta global do sistema
|
// Obtém a função que atualiza a resposta global do sistema
|
||||||
const { setResponse } = useResponse();
|
const { setResponse } = useResponse();
|
||||||
|
|
||||||
|
|
@ -20,24 +19,24 @@ export const useTServicoEtiquetaReadHook = () => {
|
||||||
const [tServicoEtiqueta, setTServicoEtiqueta] = useState<TServicoEtiquetaInterface[]>([]);
|
const [tServicoEtiqueta, setTServicoEtiqueta] = useState<TServicoEtiquetaInterface[]>([]);
|
||||||
|
|
||||||
// Função responsável por buscar os dados da API e atualizar o estado
|
// Função responsável por buscar os dados da API e atualizar o estado
|
||||||
const fetchTServicoEtiqueta = useCallback(async (data: TServicoEtiquetaInterface) => {
|
const fetchTServicoEtiqueta = useCallback(
|
||||||
|
async (data: TServicoEtiquetaInterface) => {
|
||||||
|
try {
|
||||||
|
// Executa o serviço que faz a requisição à API
|
||||||
|
const response = await TServicoEtiquetaServicoIdService(data);
|
||||||
|
|
||||||
try{
|
// Atualiza o estado local com os dados retornados
|
||||||
|
setTServicoEtiqueta(response.data);
|
||||||
|
|
||||||
// Executa o serviço que faz a requisição à API
|
// Atualiza o contexto global de resposta (ex: para exibir alertas ou mensagens)
|
||||||
const response = await TServicoEtiquetaServicoIdService(data);
|
setResponse(response);
|
||||||
|
} catch (error) {
|
||||||
// Atualiza o estado local com os dados retornados
|
console.error('Erro ao buscar etiquetas:', error);
|
||||||
setTServicoEtiqueta(response.data);
|
return { data: [] };
|
||||||
|
}
|
||||||
// Atualiza o contexto global de resposta (ex: para exibir alertas ou mensagens)
|
},
|
||||||
setResponse(response);
|
[setResponse],
|
||||||
|
);
|
||||||
} catch (error) {
|
|
||||||
console.error('Erro ao buscar etiquetas:', error);
|
|
||||||
return { data: [] };
|
|
||||||
}
|
|
||||||
}, [setResponse]);
|
|
||||||
|
|
||||||
// Retorna os dados e a função de busca, memorizando o valor para evitar recriações desnecessárias
|
// Retorna os dados e a função de busca, memorizando o valor para evitar recriações desnecessárias
|
||||||
return { tServicoEtiqueta, fetchTServicoEtiqueta };
|
return { tServicoEtiqueta, fetchTServicoEtiqueta };
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { useResponse } from "@/shared/components/response/ResponseContext"; // Contexto global para gerenciar respostas da API
|
import { useResponse } from '@/shared/components/response/ResponseContext'; // Contexto global para gerenciar respostas da API
|
||||||
|
|
||||||
// Interface tipada do tipo de serviço
|
// Interface tipada do tipo de serviço
|
||||||
import { TServicoEtiquetaInterface } from "../../_interfaces/TServicoEtiquetaInterface";
|
import { TServicoEtiquetaInterface } from '../../_interfaces/TServicoEtiquetaInterface';
|
||||||
|
|
||||||
// Função que remove o tipo de serviço via API
|
// Função que remove o tipo de serviço via API
|
||||||
import { TServicoEtiquetaRemoveData } from "../../_data/TServicoEtiqueta/TServicoEtiquetaRemoveData";
|
import { TServicoEtiquetaRemoveData } from '../../_data/TServicoEtiqueta/TServicoEtiquetaRemoveData';
|
||||||
|
|
||||||
// Hook customizado para remoção de tipos de serviço
|
// Hook customizado para remoção de tipos de serviço
|
||||||
export const useTServicoEtiquetaRemoveHook = () => {
|
export const useTServicoEtiquetaRemoveHook = () => {
|
||||||
|
|
@ -22,4 +22,4 @@ export const useTServicoEtiquetaRemoveHook = () => {
|
||||||
|
|
||||||
// Retorna a função de remoção para ser usada no componente
|
// Retorna a função de remoção para ser usada no componente
|
||||||
return { fetchTServicoEtiquetaRemove };
|
return { fetchTServicoEtiquetaRemove };
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,23 @@ import { useState } from 'react';
|
||||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||||
|
|
||||||
// Interface tipada do serviço etiqueta
|
// Interface tipada do serviço etiqueta
|
||||||
import { TServicoEtiquetaInterface } from '../../_interfaces/TServicoEtiquetaInterface';
|
import { TServicoEtiquetaInterface } from '../../_interfaces/TServicoEtiquetaInterface';
|
||||||
|
|
||||||
// Serviço que salva os dados do serviço etiqueta
|
// Serviço que salva os dados do serviço etiqueta
|
||||||
import { TServicoEtiquetaSaveService } from '../../_services/t_servico_etiqueta/TServicoEtiquetaSaveService';
|
import { TServicoEtiquetaSaveService } from '../../_services/t_servico_etiqueta/TServicoEtiquetaSaveService';
|
||||||
|
|
||||||
export const useTServicoEtiquetaSaveHook = () => {
|
export const useTServicoEtiquetaSaveHook = () => {
|
||||||
const { setResponse } = useResponse();
|
const { setResponse } = useResponse();
|
||||||
|
|
||||||
// Estado local para armazenar os dados do serviço etiqueta salvos
|
// Estado local para armazenar os dados do serviço etiqueta salvos
|
||||||
const [tServicoEtiquetaSave, setTServicoEtiquetaSave] = useState<TServicoEtiquetaInterface | null>(null);
|
const [tServicoEtiquetaSave, setTServicoEtiquetaSave] =
|
||||||
|
useState<TServicoEtiquetaInterface | null>(null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Função que executa o salvamento de um serviço etiqueta.
|
* Função que executa o salvamento de um serviço etiqueta.
|
||||||
* @param data Os dados do serviço etiqueta a serem salvos.
|
* @param data Os dados do serviço etiqueta a serem salvos.
|
||||||
*/
|
*/
|
||||||
const fetchTServicoEtiquetaSave = async (data: TServicoEtiquetaInterface) => {
|
const fetchTServicoEtiquetaSave = async (data: TServicoEtiquetaInterface) => {
|
||||||
|
|
||||||
// Chama o serviço de salvamento
|
// Chama o serviço de salvamento
|
||||||
const response = await TServicoEtiquetaSaveService(data);
|
const response = await TServicoEtiquetaSaveService(data);
|
||||||
|
|
||||||
|
|
@ -26,12 +26,12 @@ export const useTServicoEtiquetaSaveHook = () => {
|
||||||
setTServicoEtiquetaSave(response.data);
|
setTServicoEtiquetaSave(response.data);
|
||||||
|
|
||||||
// Manda a resposta para o verificador de resposta global
|
// Manda a resposta para o verificador de resposta global
|
||||||
///setResponse(response);
|
///setResponse(response);
|
||||||
|
|
||||||
// Manda a resposta para o verificador de resposta global
|
// Manda a resposta para o verificador de resposta global
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
};
|
||||||
|
|
||||||
// Retorna o estado e a função de salvamento para uso no componente
|
// Retorna o estado e a função de salvamento para uso no componente
|
||||||
return { tServicoEtiquetaSave, fetchTServicoEtiquetaSave };
|
return { tServicoEtiquetaSave, fetchTServicoEtiquetaSave };
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { useResponse } from "@/shared/components/response/ResponseContext"; // Contexto global para gerenciar respostas da API
|
import { useResponse } from '@/shared/components/response/ResponseContext'; // Contexto global para gerenciar respostas da API
|
||||||
|
|
||||||
// Interface tipada do tipo de serviço
|
// Interface tipada do tipo de serviço
|
||||||
import TServicoTipoInterface from "../../_interfaces/TServicoTipoInterface";
|
import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface';
|
||||||
|
|
||||||
// Função que Edit o tipo de serviço via API
|
// Função que Edit o tipo de serviço via API
|
||||||
import { TServicoTipoEditData } from "../../_data/TServicoTipo/TServicoTipoEditData";
|
import { TServicoTipoEditData } from '../../_data/TServicoTipo/TServicoTipoEditData';
|
||||||
|
|
||||||
// Hook customizado para remoção de tipos de serviço
|
// Hook customizado para remoção de tipos de serviço
|
||||||
export const useTServicoTipoEditHook = () => {
|
export const useTServicoTipoEditHook = () => {
|
||||||
|
|
@ -13,7 +13,6 @@ export const useTServicoTipoEditHook = () => {
|
||||||
|
|
||||||
// Função assíncrona que Edit um tipo de serviço
|
// Função assíncrona que Edit um tipo de serviço
|
||||||
const editTServicoTipo = async (data: TServicoTipoInterface) => {
|
const editTServicoTipo = async (data: TServicoTipoInterface) => {
|
||||||
|
|
||||||
// Chama a função de remoção passando os dados do tipo de serviço
|
// Chama a função de remoção passando os dados do tipo de serviço
|
||||||
const response = await TServicoTipoEditData(data);
|
const response = await TServicoTipoEditData(data);
|
||||||
|
|
||||||
|
|
@ -23,4 +22,4 @@ export const useTServicoTipoEditHook = () => {
|
||||||
|
|
||||||
// Retorna a função de remoção para ser usada no componente
|
// Retorna a função de remoção para ser usada no componente
|
||||||
return { editTServicoTipo };
|
return { editTServicoTipo };
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@ import { useResponse } from '@/shared/components/response/ResponseContext'; // C
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
// Serviço que busca a lista de tipos de serviço (TServicoTipoIndexService)
|
// Serviço que busca a lista de tipos de serviço (TServicoTipoIndexService)
|
||||||
import { TServicoTipoIndexService } from '../../_services/t_servico_tipo/TServicoTipoIndexService';
|
import { TServicoTipoIndexService } from '../../_services/t_servico_tipo/TServicoTipoIndexService';
|
||||||
|
|
||||||
// Interface tipada do tipo de serviço
|
// Interface tipada do tipo de serviço
|
||||||
import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface';
|
import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface';
|
||||||
|
|
||||||
// Hook customizado para leitura de dados de tipos de serviço
|
// Hook customizado para leitura de dados de tipos de serviço
|
||||||
export const useTServicoTipoReadHook = () => {
|
export const useTServicoTipoReadHook = () => {
|
||||||
|
|
@ -32,4 +32,4 @@ export const useTServicoTipoReadHook = () => {
|
||||||
|
|
||||||
// Retorna os dados e a função de busca para serem usados no componente
|
// Retorna os dados e a função de busca para serem usados no componente
|
||||||
return { tServicoTipo, fetchTServicoTipo };
|
return { tServicoTipo, fetchTServicoTipo };
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { useResponse } from "@/shared/components/response/ResponseContext"; // Contexto global para gerenciar respostas da API
|
import { useResponse } from '@/shared/components/response/ResponseContext'; // Contexto global para gerenciar respostas da API
|
||||||
|
|
||||||
// Interface tipada do tipo de serviço
|
// Interface tipada do tipo de serviço
|
||||||
import TServicoTipoInterface from "../../_interfaces/TServicoTipoInterface";
|
import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface';
|
||||||
|
|
||||||
// Função que remove o tipo de serviço via API
|
// Função que remove o tipo de serviço via API
|
||||||
import { TServicoTipoRemoveData } from "../../_data/TServicoTipo/TServicoTipoRemoveData";
|
import { TServicoTipoRemoveData } from '../../_data/TServicoTipo/TServicoTipoRemoveData';
|
||||||
|
|
||||||
// Hook customizado para remoção de tipos de serviço
|
// Hook customizado para remoção de tipos de serviço
|
||||||
export const useTServicoTipoRemoveHook = () => {
|
export const useTServicoTipoRemoveHook = () => {
|
||||||
|
|
@ -22,4 +22,4 @@ export const useTServicoTipoRemoveHook = () => {
|
||||||
|
|
||||||
// Retorna a função de remoção para ser usada no componente
|
// Retorna a função de remoção para ser usada no componente
|
||||||
return { removeTServicoTipo };
|
return { removeTServicoTipo };
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,14 @@ import { useState } from 'react';
|
||||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||||
|
|
||||||
// Interface tipada do tipo de serviço
|
// Interface tipada do tipo de serviço
|
||||||
import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface';
|
import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface';
|
||||||
|
|
||||||
// Serviço que salva os dados do tipo de serviço
|
// Serviço que salva os dados do tipo de serviço
|
||||||
import { TServicoTipoSaveService } from '../../_services/t_servico_tipo/TServicoTipoSaveService';
|
import { TServicoTipoSaveService } from '../../_services/t_servico_tipo/TServicoTipoSaveService';
|
||||||
|
|
||||||
export const useTServicoTipoSaveHook = () => {
|
export const useTServicoTipoSaveHook = () => {
|
||||||
const { setResponse } = useResponse();
|
const { setResponse } = useResponse();
|
||||||
|
|
||||||
// Estado local para armazenar os dados do tipo de serviço salvos
|
// Estado local para armazenar os dados do tipo de serviço salvos
|
||||||
const [tServicoTipo, setTServicoTipo] = useState<TServicoTipoInterface | null>(null);
|
const [tServicoTipo, setTServicoTipo] = useState<TServicoTipoInterface | null>(null);
|
||||||
|
|
||||||
|
|
@ -26,8 +26,8 @@ export const useTServicoTipoSaveHook = () => {
|
||||||
|
|
||||||
// Manda a resposta para o verificador de resposta global
|
// Manda a resposta para o verificador de resposta global
|
||||||
setResponse(response);
|
setResponse(response);
|
||||||
}
|
};
|
||||||
|
|
||||||
// Retorna o estado e a função de salvamento para uso no componente
|
// Retorna o estado e a função de salvamento para uso no componente
|
||||||
return { tServicoTipo, saveTServicoTipo };
|
return { tServicoTipo, saveTServicoTipo };
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,15 @@ import { TTBReconhecimentoTipoInterface } from '../../_interfaces/TTBReconhecime
|
||||||
// Importa o serviço responsável por buscar os dados de "TTBReconhecimentoTipo" na API
|
// Importa o serviço responsável por buscar os dados de "TTBReconhecimentoTipo" na API
|
||||||
import { TTBReconhecimentoTipoIndexService } from '../../_services/t_tb_reconhecimentotipo/TTBReconhecimentoTipoIndexService';
|
import { TTBReconhecimentoTipoIndexService } from '../../_services/t_tb_reconhecimentotipo/TTBReconhecimentoTipoIndexService';
|
||||||
|
|
||||||
|
|
||||||
// Hook personalizado para leitura (consulta) dos tipos de marcação
|
// Hook personalizado para leitura (consulta) dos tipos de marcação
|
||||||
export const useTTBReconhecimentoTipoReadHook = () => {
|
export const useTTBReconhecimentoTipoReadHook = () => {
|
||||||
// Obtém a função que atualiza a resposta global do sistema
|
// Obtém a função que atualiza a resposta global do sistema
|
||||||
const { setResponse } = useResponse();
|
const { setResponse } = useResponse();
|
||||||
|
|
||||||
// Define o estado local que armazenará a lista de tipos de marcação
|
// Define o estado local que armazenará a lista de tipos de marcação
|
||||||
const [tTBReconhecimentoTipo, setTTBReconhecimentoTipo] = useState<TTBReconhecimentoTipoInterface[]>([]);
|
const [tTBReconhecimentoTipo, setTTBReconhecimentoTipo] = useState<
|
||||||
|
TTBReconhecimentoTipoInterface[]
|
||||||
|
>([]);
|
||||||
|
|
||||||
// Função responsável por buscar os dados da API e atualizar o estado
|
// Função responsável por buscar os dados da API e atualizar o estado
|
||||||
const fetchTTBReconhecimentoTipo = async (data: TTBReconhecimentoTipoReadInterface) => {
|
const fetchTTBReconhecimentoTipo = async (data: TTBReconhecimentoTipoReadInterface) => {
|
||||||
|
|
@ -33,5 +34,8 @@ export const useTTBReconhecimentoTipoReadHook = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Retorna os dados e a função de busca, memorizando o valor para evitar recriações desnecessárias
|
// Retorna os dados e a função de busca, memorizando o valor para evitar recriações desnecessárias
|
||||||
return useMemo(() => ({ tTBReconhecimentoTipo, fetchTTBReconhecimentoTipo }), [tTBReconhecimentoTipo, fetchTTBReconhecimentoTipo]);
|
return useMemo(
|
||||||
|
() => ({ tTBReconhecimentoTipo, fetchTTBReconhecimentoTipo }),
|
||||||
|
[tTBReconhecimentoTipo, fetchTTBReconhecimentoTipo],
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
// Interface que representa a tabela C_CAIXA_SERVICO
|
// Interface que representa a tabela C_CAIXA_SERVICO
|
||||||
export interface CCaixaServicoInterface {
|
export interface CCaixaServicoInterface {
|
||||||
interno_sistema?: string; // VARCHAR(1)
|
interno_sistema?: string; // VARCHAR(1)
|
||||||
caixa_servico_id: number; // NUMERIC(10,2) NOT NULL - Chave primária
|
caixa_servico_id: number; // NUMERIC(10,2) NOT NULL - Chave primária
|
||||||
descricao?: string; // VARCHAR(60)
|
descricao?: string; // VARCHAR(60)
|
||||||
situacao?: string; // VARCHAR(1)
|
situacao?: string; // VARCHAR(1)
|
||||||
tipo_transacao?: string; // VARCHAR(1)
|
tipo_transacao?: string; // VARCHAR(1)
|
||||||
sistema_id?: number; // NUMERIC(14,3)
|
sistema_id?: number; // NUMERIC(14,3)
|
||||||
selo_grupo_id?: number; // NUMERIC(10,2)
|
selo_grupo_id?: number; // NUMERIC(10,2)
|
||||||
emitir_relatorio?: string; // VARCHAR(1)
|
emitir_relatorio?: string; // VARCHAR(1)
|
||||||
repasse?: string; // VARCHAR(1)
|
repasse?: string; // VARCHAR(1)
|
||||||
repetir_descricao?: string; // VARCHAR(1)
|
repetir_descricao?: string; // VARCHAR(1)
|
||||||
codigo_conta?: number; // NUMERIC(10,2)
|
codigo_conta?: number; // NUMERIC(10,2)
|
||||||
tipo_conta_carneleao?: string; // VARCHAR(60)
|
tipo_conta_carneleao?: string; // VARCHAR(60)
|
||||||
centro_de_custa_id?: number; // NUMERIC(10,2) - Chave estrangeira
|
centro_de_custa_id?: number; // NUMERIC(10,2) - Chave estrangeira
|
||||||
devolucao_juizo?: string; // VARCHAR(1)
|
devolucao_juizo?: string; // VARCHAR(1)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
export interface CCaixaServicoReadInterface {
|
export interface CCaixaServicoReadInterface {
|
||||||
sistema_id?: number;
|
sistema_id?: number;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,20 @@
|
||||||
// Interface que representa a tabela G_EMOLUMENTO
|
// Interface que representa a tabela G_EMOLUMENTO
|
||||||
export interface GEmolumentoInterface {
|
export interface GEmolumentoInterface {
|
||||||
emolumento_id?: number; // NUMERIC(10,2) - Chave primária
|
emolumento_id?: number; // NUMERIC(10,2) - Chave primária
|
||||||
descricao?: string; // VARCHAR(260)
|
descricao?: string; // VARCHAR(260)
|
||||||
tipo?: string; // VARCHAR(1)
|
tipo?: string; // VARCHAR(1)
|
||||||
sistema_id?: number; // NUMERIC(10,2)
|
sistema_id?: number; // NUMERIC(10,2)
|
||||||
selo_grupo_id?: number; // NUMERIC(10,2)
|
selo_grupo_id?: number; // NUMERIC(10,2)
|
||||||
reg_averb?: string; // VARCHAR(1)
|
reg_averb?: string; // VARCHAR(1)
|
||||||
pre_definido?: string; // VARCHAR(1)
|
pre_definido?: string; // VARCHAR(1)
|
||||||
situacao?: string; // VARCHAR(1)
|
situacao?: string; // VARCHAR(1)
|
||||||
situacao_ri?: string; // VARCHAR(1)
|
situacao_ri?: string; // VARCHAR(1)
|
||||||
com_reducao?: string; // VARCHAR(1)
|
com_reducao?: string; // VARCHAR(1)
|
||||||
motivo_reducao?: string; // VARCHAR(120)
|
motivo_reducao?: string; // VARCHAR(120)
|
||||||
valor_maximo_certidao?: number; // NUMERIC(14,3)
|
valor_maximo_certidao?: number; // NUMERIC(14,3)
|
||||||
tipo_objetivo?: string; // VARCHAR(3)
|
tipo_objetivo?: string; // VARCHAR(3)
|
||||||
modelo_tag?: string; // VARCHAR(3)
|
modelo_tag?: string; // VARCHAR(3)
|
||||||
codigo_nota_id?: number; // NUMERIC(10,2)
|
codigo_nota_id?: number; // NUMERIC(10,2)
|
||||||
convenio_codhab?: string; // VARCHAR(1)
|
convenio_codhab?: string; // VARCHAR(1)
|
||||||
item_df?: string; // VARCHAR(10)
|
item_df?: string; // VARCHAR(10)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,32 @@
|
||||||
// Interface que representa a tabela G_EMOLUMENTO_ITEM (inferido)
|
// Interface que representa a tabela G_EMOLUMENTO_ITEM (inferido)
|
||||||
export interface GEmolumentoItemInterface {
|
export interface GEmolumentoItemInterface {
|
||||||
valor_emolumento?: number; // NUMERIC(14,3)
|
valor_emolumento?: number; // NUMERIC(14,3)
|
||||||
emolumento_item_id: number; // NUMERIC(10,2) NOT NULL - Chave primária (assumida)
|
emolumento_item_id: number; // NUMERIC(10,2) NOT NULL - Chave primária (assumida)
|
||||||
emolumento_id?: number; // NUMERIC(10,2)
|
emolumento_id?: number; // NUMERIC(10,2)
|
||||||
valor_inicio?: number; // NUMERIC(14,3)
|
valor_inicio?: number; // NUMERIC(14,3)
|
||||||
valor_fim?: number; // NUMERIC(14,3)
|
valor_fim?: number; // NUMERIC(14,3)
|
||||||
valor_taxa_judiciaria?: number; // NUMERIC(14,3)
|
valor_taxa_judiciaria?: number; // NUMERIC(14,3)
|
||||||
emolumento_periodo_id?: number; // NUMERIC(10,2)
|
emolumento_periodo_id?: number; // NUMERIC(10,2)
|
||||||
codigo?: number; // NUMERIC(10,2)
|
codigo?: number; // NUMERIC(10,2)
|
||||||
pagina_extra?: number; // NUMERIC(10,2)
|
pagina_extra?: number; // NUMERIC(10,2)
|
||||||
valor_pagina_extra?: number; // NUMERIC(14,3)
|
valor_pagina_extra?: number; // NUMERIC(14,3)
|
||||||
valor_outra_taxa1?: number; // NUMERIC(14,3)
|
valor_outra_taxa1?: number; // NUMERIC(14,3)
|
||||||
codigo_selo?: string; // VARCHAR(30)
|
codigo_selo?: string; // VARCHAR(30)
|
||||||
valor_fundo_ri?: number; // NUMERIC(14,3)
|
valor_fundo_ri?: number; // NUMERIC(14,3)
|
||||||
codigo_tabela?: string; // VARCHAR(30)
|
codigo_tabela?: string; // VARCHAR(30)
|
||||||
selo_grupo_id?: number; // NUMERIC(10,2)
|
selo_grupo_id?: number; // NUMERIC(10,2)
|
||||||
codigo_km?: string; // VARCHAR(30)
|
codigo_km?: string; // VARCHAR(30)
|
||||||
emolumento_acresce?: number; // NUMERIC(14,3)
|
emolumento_acresce?: number; // NUMERIC(14,3)
|
||||||
taxa_acresce?: number; // NUMERIC(14,3)
|
taxa_acresce?: number; // NUMERIC(14,3)
|
||||||
funcivil_acresce?: number; // NUMERIC(14,3)
|
funcivil_acresce?: number; // NUMERIC(14,3)
|
||||||
valor_fracao?: number; // NUMERIC(14,3)
|
valor_fracao?: number; // NUMERIC(14,3)
|
||||||
valor_por_excedente_emol?: number; // NUMERIC(14,3)
|
valor_por_excedente_emol?: number; // NUMERIC(14,3)
|
||||||
valor_por_excedente_tj?: number; // NUMERIC(14,3)
|
valor_por_excedente_tj?: number; // NUMERIC(14,3)
|
||||||
valor_por_excedente_fundo?: number; // NUMERIC(14,3)
|
valor_por_excedente_fundo?: number; // NUMERIC(14,3)
|
||||||
valor_limite_excedente_emol?: number; // NUMERIC(14,3)
|
valor_limite_excedente_emol?: number; // NUMERIC(14,3)
|
||||||
valor_limite_excedente_tj?: number; // NUMERIC(14,3)
|
valor_limite_excedente_tj?: number; // NUMERIC(14,3)
|
||||||
valor_limite_excedente_fundo?: number; // NUMERIC(14,3)
|
valor_limite_excedente_fundo?: number; // NUMERIC(14,3)
|
||||||
fundo_selo?: number; // NUMERIC(14,3)
|
fundo_selo?: number; // NUMERIC(14,3)
|
||||||
distribuicao?: number; // NUMERIC(14,3)
|
distribuicao?: number; // NUMERIC(14,3)
|
||||||
vrc_ext?: number; // NUMERIC(10,2) - Renomeado de VRCEXT para vrc_ext (convenção)
|
vrc_ext?: number; // NUMERIC(10,2) - Renomeado de VRCEXT para vrc_ext (convenção)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
export interface GEmolumentoItemReadInterface {
|
export interface GEmolumentoItemReadInterface {
|
||||||
emolumento_id?: number,
|
emolumento_id?: number;
|
||||||
valor?: number
|
valor?: number;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
export interface GEmolumentoReadInterface {
|
export interface GEmolumentoReadInterface {
|
||||||
sistema_id?: number
|
sistema_id?: number;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,4 @@ export interface GMarcacaoTipoInterface {
|
||||||
protegida?: string;
|
protegida?: string;
|
||||||
ativar_separador?: string;
|
ativar_separador?: string;
|
||||||
sql_completo?: string;
|
sql_completo?: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@ export interface GMarcacaoTipoReadInterface {
|
||||||
grupo?: string;
|
grupo?: string;
|
||||||
sistema_id?: number;
|
sistema_id?: number;
|
||||||
situacao?: string;
|
situacao?: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Interface que representa a tabela T_TB_RECONHECIMENTOTIPO
|
// Interface que representa a tabela T_TB_RECONHECIMENTOTIPO
|
||||||
export interface TServicoEtiquetaInterface {
|
export interface TServicoEtiquetaInterface {
|
||||||
servico_etiqueta_id?: number; // NUMERIC(10,2) NOT NULL - Chave primária
|
servico_etiqueta_id?: number; // NUMERIC(10,2) NOT NULL - Chave primária
|
||||||
etiqueta_modelo_id?: number; // NUMERIC(10,2)
|
etiqueta_modelo_id?: number; // NUMERIC(10,2)
|
||||||
servico_tipo_id?: number; // NUMERIC(10,2)
|
servico_tipo_id?: number; // NUMERIC(10,2)
|
||||||
descricao?: string
|
descricao?: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
export interface TServicoEtiquetaServicoIdReadInterface {
|
export interface TServicoEtiquetaServicoIdReadInterface {
|
||||||
servico_tipo_id?: number
|
servico_tipo_id?: number;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,27 @@
|
||||||
export default interface TServicoTipoInterface {
|
export default interface TServicoTipoInterface {
|
||||||
servico_tipo_id?: number; // SERVICO_TIPO_ID NUMERIC(10,2) NOT NULL (PK)
|
servico_tipo_id?: number; // SERVICO_TIPO_ID NUMERIC(10,2) NOT NULL (PK)
|
||||||
descricao: string; // DESCRICAO VARCHAR(60)
|
descricao: string; // DESCRICAO VARCHAR(60)
|
||||||
valor?: number; // VALOR NUMERIC(14,3)
|
valor?: number; // VALOR NUMERIC(14,3)
|
||||||
requer_autorizacao?: string; // REQUER_AUTORIZACAO VARCHAR(1)
|
requer_autorizacao?: string; // REQUER_AUTORIZACAO VARCHAR(1)
|
||||||
requer_biometria?: string; // REQUER_BIOMETRIA VARCHAR(1)
|
requer_biometria?: string; // REQUER_BIOMETRIA VARCHAR(1)
|
||||||
tipo_pessoa?: string; // TIPO_PESSOA VARCHAR(1)
|
tipo_pessoa?: string; // TIPO_PESSOA VARCHAR(1)
|
||||||
tb_reconhecimentotipo_id?: number; // TB_RECONHECIMENTOTIPO_ID NUMERIC(10,2) (FK)
|
tb_reconhecimentotipo_id?: number; // TB_RECONHECIMENTOTIPO_ID NUMERIC(10,2) (FK)
|
||||||
requer_abonador?: string; // REQUER_ABONADOR VARCHAR(1)
|
requer_abonador?: string; // REQUER_ABONADOR VARCHAR(1)
|
||||||
situacao?: string; // SITUACAO VARCHAR(1)
|
situacao?: string; // SITUACAO VARCHAR(1)
|
||||||
requer_cpf?: string; // REQUER_CPF VARCHAR(1)
|
requer_cpf?: string; // REQUER_CPF VARCHAR(1)
|
||||||
servico_padrao?: string; // SERVICO_PADRAO VARCHAR(1)
|
servico_padrao?: string; // SERVICO_PADRAO VARCHAR(1)
|
||||||
maximo_pessoa?: number; // MAXIMO_PESSOA NUMERIC(10,2)
|
maximo_pessoa?: number; // MAXIMO_PESSOA NUMERIC(10,2)
|
||||||
alterar_valor?: string; // ALTERAR_VALOR VARCHAR(1)
|
alterar_valor?: string; // ALTERAR_VALOR VARCHAR(1)
|
||||||
servico_caixa_id?: number; // SERVICO_CAIXA_ID NUMERIC(10,2)
|
servico_caixa_id?: number; // SERVICO_CAIXA_ID NUMERIC(10,2)
|
||||||
caixa_servico_id?: number; // LIBERAR_DESCONTO VARCHAR(1)
|
caixa_servico_id?: number; // LIBERAR_DESCONTO VARCHAR(1)
|
||||||
valor_fixo?: string; // VALOR_FIXO VARCHAR(1)
|
valor_fixo?: string; // VALOR_FIXO VARCHAR(1)
|
||||||
emolumento_id?: number; // EMOLUMENTO_ID NUMERIC(10,2) (FK)
|
emolumento_id?: number; // EMOLUMENTO_ID NUMERIC(10,2) (FK)
|
||||||
emolumento_obrigatorio?: number; // EMOLUMENTO_OBRIGATORIO NUMERIC(10,2) (FK)
|
emolumento_obrigatorio?: number; // EMOLUMENTO_OBRIGATORIO NUMERIC(10,2) (FK)
|
||||||
ato_praticado?: string; // ATO_PRATICADO VARCHAR(1)
|
ato_praticado?: string; // ATO_PRATICADO VARCHAR(1)
|
||||||
selar?: string; // SELAR VARCHAR(1)
|
selar?: string; // SELAR VARCHAR(1)
|
||||||
frenteverso?: string; // FRENTEVERSO VARCHAR(1)
|
frenteverso?: string; // FRENTEVERSO VARCHAR(1)
|
||||||
etiqueta_unica?: string; // ETIQUETA_UNICA VARCHAR(1)
|
etiqueta_unica?: string; // ETIQUETA_UNICA VARCHAR(1)
|
||||||
transferencia_veiculo?: string; // TRANSFERENCIA_VEICULO VARCHAR(1)
|
transferencia_veiculo?: string; // TRANSFERENCIA_VEICULO VARCHAR(1)
|
||||||
usar_a4?: string; // USAR_A4 VARCHAR(1)
|
usar_a4?: string; // USAR_A4 VARCHAR(1)
|
||||||
averbacao?: string; // AVERBACAO VARCHAR(1)
|
averbacao?: string; // AVERBACAO VARCHAR(1)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Interface que representa a tabela T_TB_RECONHECIMENTOTIPO
|
// Interface que representa a tabela T_TB_RECONHECIMENTOTIPO
|
||||||
export interface TTbReconhecimentoTipoInterface {
|
export interface TTbReconhecimentoTipoInterface {
|
||||||
tb_reconhecimentotipo_id: number; // NUMERIC(10,2) NOT NULL - Chave primária
|
tb_reconhecimentotipo_id: number; // NUMERIC(10,2) NOT NULL - Chave primária
|
||||||
descricao?: string; // VARCHAR(30)
|
descricao?: string; // VARCHAR(30)
|
||||||
situacao?: string; // VARCHAR(1)
|
situacao?: string; // VARCHAR(1)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
export interface TTBReconhecimentoTipoReadInterface {
|
export interface TTBReconhecimentoTipoReadInterface {
|
||||||
tb_reconhecimentotipo_id?: number,
|
tb_reconhecimentotipo_id?: number;
|
||||||
descricao?: string
|
descricao?: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,4 @@ export interface TServicoEtiquetaFormValues {
|
||||||
|
|
||||||
/** Relacionamento com o tipo de serviço (FK) */
|
/** Relacionamento com o tipo de serviço (FK) */
|
||||||
servico_tipo_id?: number;
|
servico_tipo_id?: number;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import z from "zod";
|
import z from 'zod';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tipos utilitários para campos simples
|
* Tipos utilitários para campos simples
|
||||||
*/
|
*/
|
||||||
const SN = z.enum(["S", "N"]).default("N"); // Campos do tipo Sim/Não
|
const SN = z.enum(['S', 'N']).default('N'); // Campos do tipo Sim/Não
|
||||||
const AI = z.enum(["A", "I"]).default("A"); // Situação Ativo/Inativo
|
const AI = z.enum(['A', 'I']).default('A'); // Situação Ativo/Inativo
|
||||||
const OneCharString = z.string().max(1, "Deve ter no máximo 1 caractere").optional();
|
const OneCharString = z.string().max(1, 'Deve ter no máximo 1 caractere').optional();
|
||||||
const RequiredString = z.string().min(1, "O campo é obrigatório");
|
const RequiredString = z.string().min(1, 'O campo é obrigatório');
|
||||||
const OptionalNumber = z.number().optional();
|
const OptionalNumber = z.number().optional();
|
||||||
const RequiredNumber = z.number();
|
const RequiredNumber = z.number();
|
||||||
|
|
||||||
|
|
@ -15,10 +15,10 @@ const RequiredNumber = z.number();
|
||||||
*/
|
*/
|
||||||
export const TServicoTipoSchema = z.object({
|
export const TServicoTipoSchema = z.object({
|
||||||
// Identificador
|
// Identificador
|
||||||
servico_tipo_id: RequiredNumber.describe("ID do Tipo de Serviço").optional(),
|
servico_tipo_id: RequiredNumber.describe('ID do Tipo de Serviço').optional(),
|
||||||
|
|
||||||
// Campos principais
|
// Campos principais
|
||||||
descricao: z.string().max(60, "A descrição deve ter no máximo 60 caracteres").optional(),
|
descricao: z.string().max(60, 'A descrição deve ter no máximo 60 caracteres').optional(),
|
||||||
categoria: z.string().optional(),
|
categoria: z.string().optional(),
|
||||||
|
|
||||||
// Controle de flags (S/N)
|
// Controle de flags (S/N)
|
||||||
|
|
@ -46,7 +46,7 @@ export const TServicoTipoSchema = z.object({
|
||||||
valor: OptionalNumber,
|
valor: OptionalNumber,
|
||||||
maximo_pessoa: OptionalNumber,
|
maximo_pessoa: OptionalNumber,
|
||||||
servico_caixa_id: OptionalNumber,
|
servico_caixa_id: OptionalNumber,
|
||||||
emolumento_id: z.number().nullable(),
|
emolumento_id: z.number().nullable(),
|
||||||
emolumento_obrigatorio: z.number().nullable(),
|
emolumento_obrigatorio: z.number().nullable(),
|
||||||
|
|
||||||
// Relacionamentos e permissões
|
// Relacionamentos e permissões
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,10 @@ import { CCaixaServicoReadInterface } from '../../_interfaces/CCaixaServicoReadI
|
||||||
async function executeCCaixaServicoIndexService(data: CCaixaServicoReadInterface) {
|
async function executeCCaixaServicoIndexService(data: CCaixaServicoReadInterface) {
|
||||||
// Chama a função que realiza a requisição à API e aguarda a resposta
|
// Chama a função que realiza a requisição à API e aguarda a resposta
|
||||||
const response = await CCaixaServicoIndexData(data);
|
const response = await CCaixaServicoIndexData(data);
|
||||||
|
|
||||||
// Retorna a resposta obtida da requisição
|
// Retorna a resposta obtida da requisição
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta o serviço encapsulado pelo handler de erro, garantindo tratamento uniforme em caso de falhas
|
// Exporta o serviço encapsulado pelo handler de erro, garantindo tratamento uniforme em caso de falhas
|
||||||
export const CCaixaServicoIndexService = withClientErrorHandler(
|
export const CCaixaServicoIndexService = withClientErrorHandler(executeCCaixaServicoIndexService);
|
||||||
executeCCaixaServicoIndexService,
|
|
||||||
);
|
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,10 @@ import { GEmolumentoReadInterface } from '../../_interfaces/GEmolumentoReadInter
|
||||||
async function executeGEmolumentoIndexService(data: GEmolumentoReadInterface) {
|
async function executeGEmolumentoIndexService(data: GEmolumentoReadInterface) {
|
||||||
// Chama a função que realiza a requisição à API e aguarda a resposta
|
// Chama a função que realiza a requisição à API e aguarda a resposta
|
||||||
const response = await GEmolumentoIndexData(data);
|
const response = await GEmolumentoIndexData(data);
|
||||||
|
|
||||||
// Retorna a resposta obtida da requisição
|
// Retorna a resposta obtida da requisição
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta o serviço encapsulado pelo handler de erro, garantindo tratamento uniforme em caso de falhas
|
// Exporta o serviço encapsulado pelo handler de erro, garantindo tratamento uniforme em caso de falhas
|
||||||
export const GEmolumentoIndexService = withClientErrorHandler(
|
export const GEmolumentoIndexService = withClientErrorHandler(executeGEmolumentoIndexService);
|
||||||
executeGEmolumentoIndexService,
|
|
||||||
);
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import { GEmolumentoItemReadInterface } from '../../_interfaces/GEmolumentoItemR
|
||||||
async function executeGEmolumentoItemValorService(data: GEmolumentoItemReadInterface) {
|
async function executeGEmolumentoItemValorService(data: GEmolumentoItemReadInterface) {
|
||||||
// Chama a função que realiza a requisição à API e aguarda a resposta
|
// Chama a função que realiza a requisição à API e aguarda a resposta
|
||||||
const response = await GEmolumentoItemValorData(data);
|
const response = await GEmolumentoItemValorData(data);
|
||||||
|
|
||||||
// Retorna a resposta obtida da requisição
|
// Retorna a resposta obtida da requisição
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,10 @@ import { GMarcacaoTipoReadInterface } from '../../_interfaces/GMarcacaoTipoReadI
|
||||||
async function executeGMarcacaoTipoIndexService(data: GMarcacaoTipoReadInterface) {
|
async function executeGMarcacaoTipoIndexService(data: GMarcacaoTipoReadInterface) {
|
||||||
// Chama a função que realiza a requisição à API e aguarda a resposta
|
// Chama a função que realiza a requisição à API e aguarda a resposta
|
||||||
const response = await GMarcacaoTipoIndexData(data);
|
const response = await GMarcacaoTipoIndexData(data);
|
||||||
|
|
||||||
// Retorna a resposta obtida da requisição
|
// Retorna a resposta obtida da requisição
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta o serviço encapsulado pelo handler de erro, garantindo tratamento uniforme em caso de falhas
|
// Exporta o serviço encapsulado pelo handler de erro, garantindo tratamento uniforme em caso de falhas
|
||||||
export const GMarcacaoTipoIndexService = withClientErrorHandler(
|
export const GMarcacaoTipoIndexService = withClientErrorHandler(executeGMarcacaoTipoIndexService);
|
||||||
executeGMarcacaoTipoIndexService,
|
|
||||||
);
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import { TServicoEtiquetaInterface } from '../../_interfaces/TServicoEtiquetaInt
|
||||||
|
|
||||||
// Função assíncrona que executa o salvamento de um serviço etiqueta
|
// Função assíncrona que executa o salvamento de um serviço etiqueta
|
||||||
async function executeTServicoEtiquetaSaveService(data: TServicoEtiquetaInterface) {
|
async function executeTServicoEtiquetaSaveService(data: TServicoEtiquetaInterface) {
|
||||||
|
|
||||||
// Chama a função que salva os dados do serviço etiqueta
|
// Chama a função que salva os dados do serviço etiqueta
|
||||||
const response = await TServicoEtiquetaSaveData(data);
|
const response = await TServicoEtiquetaSaveData(data);
|
||||||
|
|
||||||
|
|
@ -18,4 +17,6 @@ async function executeTServicoEtiquetaSaveService(data: TServicoEtiquetaInterfac
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta o serviço de salvamento de serviço etiqueta já encapsulado com tratamento de erros
|
// Exporta o serviço de salvamento de serviço etiqueta já encapsulado com tratamento de erros
|
||||||
export const TServicoEtiquetaSaveService = withClientErrorHandler(executeTServicoEtiquetaSaveService);
|
export const TServicoEtiquetaSaveService = withClientErrorHandler(
|
||||||
|
executeTServicoEtiquetaSaveService,
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import { TServicoEtiquetaInterface } from '../../_interfaces/TServicoEtiquetaInt
|
||||||
|
|
||||||
// Função assíncrona que executa a consulta de um tipo de serviço etiqueta
|
// Função assíncrona que executa a consulta de um tipo de serviço etiqueta
|
||||||
async function executeTServicoEtiquetaServicoIdService(data: TServicoEtiquetaInterface) {
|
async function executeTServicoEtiquetaServicoIdService(data: TServicoEtiquetaInterface) {
|
||||||
|
|
||||||
// Chama a função que consulta os dados do tipo de serviço etiqueta
|
// Chama a função que consulta os dados do tipo de serviço etiqueta
|
||||||
const response = await TServicoEtiquetaReadData(data);
|
const response = await TServicoEtiquetaReadData(data);
|
||||||
|
|
||||||
|
|
@ -17,4 +16,6 @@ async function executeTServicoEtiquetaServicoIdService(data: TServicoEtiquetaInt
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta o serviço de remoção de tipo de serviço já encapsulado com tratamento de erros
|
// Exporta o serviço de remoção de tipo de serviço já encapsulado com tratamento de erros
|
||||||
export const TServicoEtiquetaServicoIdService = withClientErrorHandler(executeTServicoEtiquetaServicoIdService);
|
export const TServicoEtiquetaServicoIdService = withClientErrorHandler(
|
||||||
|
executeTServicoEtiquetaServicoIdService,
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,4 @@ async function executeTServicoTipoEditService(data: TServicoTipoInterface) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta o serviço de remoção de tipo de serviço já encapsulado com tratamento de erros
|
// Exporta o serviço de remoção de tipo de serviço já encapsulado com tratamento de erros
|
||||||
export const TServicoTipoEditService = withClientErrorHandler(executeTServicoTipoEditService);
|
export const TServicoTipoEditService = withClientErrorHandler(executeTServicoTipoEditService);
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,4 @@ async function executeTServicoTipoIndexService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta o serviço de índice de tipos de serviço já encapsulado com tratamento de erros
|
// Exporta o serviço de índice de tipos de serviço já encapsulado com tratamento de erros
|
||||||
export const TServicoTipoIndexService = withClientErrorHandler(executeTServicoTipoIndexService);
|
export const TServicoTipoIndexService = withClientErrorHandler(executeTServicoTipoIndexService);
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,4 @@ async function executeTServicoTipoRemoveService(data: TServicoTipoInterface) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta o serviço de remoção de tipo de serviço já encapsulado com tratamento de erros
|
// Exporta o serviço de remoção de tipo de serviço já encapsulado com tratamento de erros
|
||||||
export const TServicoTipoRemoveService = withClientErrorHandler(executeTServicoTipoRemoveService);
|
export const TServicoTipoRemoveService = withClientErrorHandler(executeTServicoTipoRemoveService);
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,4 @@ async function executeTServicoTipoSaveService(data: TServicoTipoInterface) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exporta o serviço de salvamento de tipo de serviço já encapsulado com tratamento de erros
|
// Exporta o serviço de salvamento de tipo de serviço já encapsulado com tratamento de erros
|
||||||
export const TServicoTipoSaveService = withClientErrorHandler(executeTServicoTipoSaveService);
|
export const TServicoTipoSaveService = withClientErrorHandler(executeTServicoTipoSaveService);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import { TTBReconhecimentoTipoReadInterface } from '../../_interfaces/TTBReconhe
|
||||||
async function executeTTBReconhecimentoTipoIndexService(data: TTBReconhecimentoTipoReadInterface) {
|
async function executeTTBReconhecimentoTipoIndexService(data: TTBReconhecimentoTipoReadInterface) {
|
||||||
// Chama a função que realiza a requisição à API e aguarda a resposta
|
// Chama a função que realiza a requisição à API e aguarda a resposta
|
||||||
const response = await TTBReconhecimentoTipoIndexData(data);
|
const response = await TTBReconhecimentoTipoIndexData(data);
|
||||||
|
|
||||||
// Retorna a resposta obtida da requisição
|
// Retorna a resposta obtida da requisição
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,15 +56,11 @@ export default function RootLayout({
|
||||||
<Breadcrumb>
|
<Breadcrumb>
|
||||||
<BreadcrumbList>
|
<BreadcrumbList>
|
||||||
<BreadcrumbItem className="hidden md:block">
|
<BreadcrumbItem className="hidden md:block">
|
||||||
<BreadcrumbLink href="#">
|
<BreadcrumbLink href="#">Building Your Application</BreadcrumbLink>
|
||||||
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
|
|
||||||
</BreadcrumbPage>
|
|
||||||
</BreadcrumbItem>
|
</BreadcrumbItem>
|
||||||
</BreadcrumbList>
|
</BreadcrumbList>
|
||||||
</Breadcrumb>
|
</Breadcrumb>
|
||||||
|
|
|
||||||
|
|
@ -4,51 +4,47 @@ import useGUsuarioGetJWTHook from '@/shared/hooks/auth/useGUsuarioGetJWTHook';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
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>
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,123 +2,110 @@
|
||||||
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import {
|
import {
|
||||||
AlertDialog,
|
AlertDialog,
|
||||||
AlertDialogCancel,
|
AlertDialogCancel,
|
||||||
AlertDialogContent,
|
AlertDialogContent,
|
||||||
AlertDialogDescription,
|
AlertDialogDescription,
|
||||||
AlertDialogFooter,
|
AlertDialogFooter,
|
||||||
AlertDialogHeader,
|
AlertDialogHeader,
|
||||||
AlertDialogTitle,
|
AlertDialogTitle,
|
||||||
AlertDialogAction,
|
AlertDialogAction,
|
||||||
} from '@/components/ui/alert-dialog';
|
} from '@/components/ui/alert-dialog';
|
||||||
|
|
||||||
import {
|
import { InputOTP, InputOTPGroup, InputOTPSlot } from '@/components/ui/input-otp';
|
||||||
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 {
|
||||||
|
|
|
||||||
|
|
@ -106,8 +106,8 @@ const data = {
|
||||||
url: '/administrativo/pessoas/estados-civis',
|
url: '/administrativo/pessoas/estados-civis',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Regimes/Comunhão",
|
title: 'Regimes/Comunhão',
|
||||||
url: "/administrativo/pessoas/regimes-comunhao/",
|
url: '/administrativo/pessoas/regimes-comunhao/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Tipo de Medida',
|
title: 'Tipo de Medida',
|
||||||
|
|
@ -130,12 +130,12 @@ const data = {
|
||||||
url: '/administrativo/minutas/naturezas',
|
url: '/administrativo/minutas/naturezas',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Censec/Tipo do Ato",
|
title: 'Censec/Tipo do Ato',
|
||||||
url: "/administrativo/centrais/censec/tipos-atos"
|
url: '/administrativo/centrais/censec/tipos-atos',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Censec/Qualidades",
|
title: 'Censec/Qualidades',
|
||||||
url: "/administrativo/centrais/censec/qualidades"
|
url: '/administrativo/centrais/censec/qualidades',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Censec/Centrais',
|
title: 'Censec/Centrais',
|
||||||
|
|
@ -146,14 +146,13 @@ const data = {
|
||||||
url: '/administrativo/centrais/censec/naturezas-litigios',
|
url: '/administrativo/centrais/censec/naturezas-litigios',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Serviços/Tipos",
|
title: 'Serviços/Tipos',
|
||||||
url: "/cadastros/servicos-tipo/",
|
url: '/cadastros/servicos-tipo/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Atos/Partes Tipos",
|
title: 'Atos/Partes Tipos',
|
||||||
url: "/administrativo/atos/partes-tipos",
|
url: '/administrativo/atos/partes-tipos',
|
||||||
},
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -182,16 +181,12 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
||||||
alt="Logo do site"
|
alt="Logo do site"
|
||||||
width={100}
|
width={100}
|
||||||
height={100}
|
height={100}
|
||||||
className='rounded-lg'
|
className="rounded-lg"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-0.5 leading-none">
|
<div className="flex flex-col gap-0.5 leading-none">
|
||||||
<span className="font-semibold">
|
<span className="font-semibold">Orius Tecnologia</span>
|
||||||
Orius Tecnologia
|
<span className="">25.9.1</span>
|
||||||
</span>
|
|
||||||
<span className="">
|
|
||||||
25.9.1
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</SidebarMenuButton>
|
</SidebarMenuButton>
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,7 @@ export function NavMain({
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<SidebarGroup>
|
<SidebarGroup>
|
||||||
<SidebarGroupLabel>
|
<SidebarGroupLabel>SAAS</SidebarGroupLabel>
|
||||||
SAAS
|
|
||||||
</SidebarGroupLabel>
|
|
||||||
<SidebarMenu>
|
<SidebarMenu>
|
||||||
{items.map((item) => (
|
{items.map((item) => (
|
||||||
<Collapsible
|
<Collapsible
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,7 @@ export function NavProjects({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidebarGroup className="group-data-[collapsible=icon]:hidden">
|
<SidebarGroup className="group-data-[collapsible=icon]:hidden">
|
||||||
<SidebarGroupLabel>
|
<SidebarGroupLabel>Escrituras</SidebarGroupLabel>
|
||||||
Escrituras
|
|
||||||
</SidebarGroupLabel>
|
|
||||||
<SidebarMenu>
|
<SidebarMenu>
|
||||||
{projects.map((item) => (
|
{projects.map((item) => (
|
||||||
<SidebarMenuItem key={item.name}>
|
<SidebarMenuItem key={item.name}>
|
||||||
|
|
|
||||||
|
|
@ -1,58 +1,51 @@
|
||||||
"use client"
|
'use client';
|
||||||
|
|
||||||
import * as React from "react"
|
import * as React from 'react';
|
||||||
import { OTPInput, OTPInputContext } from "input-otp"
|
import { OTPInput, OTPInputContext } from 'input-otp';
|
||||||
import { MinusIcon } from "lucide-react"
|
import { MinusIcon } from 'lucide-react';
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
function InputOTP({
|
function InputOTP({
|
||||||
className,
|
className,
|
||||||
containerClassName,
|
containerClassName,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof OTPInput> & {
|
}: React.ComponentProps<typeof OTPInput> & {
|
||||||
containerClassName?: string
|
containerClassName?: string;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<OTPInput
|
<OTPInput
|
||||||
data-slot="input-otp"
|
data-slot="input-otp"
|
||||||
containerClassName={cn(
|
containerClassName={cn('flex items-center gap-2 has-disabled:opacity-50', containerClassName)}
|
||||||
"flex items-center gap-2 has-disabled:opacity-50",
|
className={cn('disabled:cursor-not-allowed', className)}
|
||||||
containerClassName
|
|
||||||
)}
|
|
||||||
className={cn("disabled:cursor-not-allowed", className)}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
|
function InputOTPGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div data-slot="input-otp-group" className={cn('flex items-center', className)} {...props} />
|
||||||
data-slot="input-otp-group"
|
);
|
||||||
className={cn("flex items-center", className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function InputOTPSlot({
|
function InputOTPSlot({
|
||||||
index,
|
index,
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<"div"> & {
|
}: React.ComponentProps<'div'> & {
|
||||||
index: number
|
index: number;
|
||||||
}) {
|
}) {
|
||||||
const inputOTPContext = React.useContext(OTPInputContext)
|
const inputOTPContext = React.useContext(OTPInputContext);
|
||||||
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}
|
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="input-otp-slot"
|
data-slot="input-otp-slot"
|
||||||
data-active={isActive}
|
data-active={isActive}
|
||||||
className={cn(
|
className={cn(
|
||||||
"data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",
|
'data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]',
|
||||||
className
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
|
|
@ -63,15 +56,15 @@ function InputOTPSlot({
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
|
function InputOTPSeparator({ ...props }: React.ComponentProps<'div'>) {
|
||||||
return (
|
return (
|
||||||
<div data-slot="input-otp-separator" role="separator" {...props}>
|
<div data-slot="input-otp-separator" role="separator" {...props}>
|
||||||
<MinusIcon />
|
<MinusIcon />
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
|
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|
||||||
|
|
|
||||||
|
|
@ -548,7 +548,7 @@ function SidebarMenuAction({
|
||||||
'peer-data-[size=lg]/menu-button:top-2.5',
|
'peer-data-[size=lg]/menu-button:top-2.5',
|
||||||
'group-data-[collapsible=icon]:hidden',
|
'group-data-[collapsible=icon]:hidden',
|
||||||
showOnHover &&
|
showOnHover &&
|
||||||
'peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0',
|
'peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0',
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,28 @@
|
||||||
"use client"
|
'use client';
|
||||||
|
|
||||||
import * as React from "react"
|
import * as React from 'react';
|
||||||
import * as SwitchPrimitive from "@radix-ui/react-switch"
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
function Switch({
|
function Switch({ className, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root>) {
|
||||||
className,
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof SwitchPrimitive.Root>) {
|
|
||||||
return (
|
return (
|
||||||
<SwitchPrimitive.Root
|
<SwitchPrimitive.Root
|
||||||
data-slot="switch"
|
data-slot="switch"
|
||||||
className={cn(
|
className={cn(
|
||||||
"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
'peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
|
||||||
className
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<SwitchPrimitive.Thumb
|
<SwitchPrimitive.Thumb
|
||||||
data-slot="switch-thumb"
|
data-slot="switch-thumb"
|
||||||
className={cn(
|
className={cn(
|
||||||
"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
|
'bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0',
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</SwitchPrimitive.Root>
|
</SwitchPrimitive.Root>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Switch }
|
export { Switch };
|
||||||
|
|
|
||||||
|
|
@ -1,116 +1,92 @@
|
||||||
"use client"
|
'use client';
|
||||||
|
|
||||||
import * as React from "react"
|
import * as React from 'react';
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
function Table({ className, ...props }: React.ComponentProps<"table">) {
|
function Table({ className, ...props }: React.ComponentProps<'table'>) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div data-slot="table-container" className="relative w-full overflow-x-auto">
|
||||||
data-slot="table-container"
|
|
||||||
className="relative w-full overflow-x-auto"
|
|
||||||
>
|
|
||||||
<table
|
<table
|
||||||
data-slot="table"
|
data-slot="table"
|
||||||
className={cn("w-full caption-bottom text-sm", className)}
|
className={cn('w-full caption-bottom text-sm', className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
|
function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
|
||||||
return (
|
return <thead data-slot="table-header" className={cn('[&_tr]:border-b', className)} {...props} />;
|
||||||
<thead
|
|
||||||
data-slot="table-header"
|
|
||||||
className={cn("[&_tr]:border-b", className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
|
function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {
|
||||||
return (
|
return (
|
||||||
<tbody
|
<tbody
|
||||||
data-slot="table-body"
|
data-slot="table-body"
|
||||||
className={cn("[&_tr:last-child]:border-0", className)}
|
className={cn('[&_tr:last-child]:border-0', className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
|
function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {
|
||||||
return (
|
return (
|
||||||
<tfoot
|
<tfoot
|
||||||
data-slot="table-footer"
|
data-slot="table-footer"
|
||||||
className={cn(
|
className={cn('bg-muted/50 border-t font-medium [&>tr]:last:border-b-0', className)}
|
||||||
"bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
|
function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
|
||||||
return (
|
return (
|
||||||
<tr
|
<tr
|
||||||
data-slot="table-row"
|
data-slot="table-row"
|
||||||
className={cn(
|
className={cn(
|
||||||
"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
|
'hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors',
|
||||||
className
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
|
function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
|
||||||
return (
|
return (
|
||||||
<th
|
<th
|
||||||
data-slot="table-head"
|
data-slot="table-head"
|
||||||
className={cn(
|
className={cn(
|
||||||
"text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
'text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
|
||||||
className
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
|
function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
|
||||||
return (
|
return (
|
||||||
<td
|
<td
|
||||||
data-slot="table-cell"
|
data-slot="table-cell"
|
||||||
className={cn(
|
className={cn(
|
||||||
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
'p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
|
||||||
className
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableCaption({
|
function TableCaption({ className, ...props }: React.ComponentProps<'caption'>) {
|
||||||
className,
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<"caption">) {
|
|
||||||
return (
|
return (
|
||||||
<caption
|
<caption
|
||||||
data-slot="table-caption"
|
data-slot="table-caption"
|
||||||
className={cn("text-muted-foreground mt-4 text-sm", className)}
|
className={cn('text-muted-foreground mt-4 text-sm', className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
|
||||||
Table,
|
|
||||||
TableHeader,
|
|
||||||
TableBody,
|
|
||||||
TableFooter,
|
|
||||||
TableHead,
|
|
||||||
TableRow,
|
|
||||||
TableCell,
|
|
||||||
TableCaption,
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,97 +1,96 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import React from "react";
|
import React from 'react';
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from '@/components/ui/button';
|
||||||
import {
|
import {
|
||||||
Command,
|
Command,
|
||||||
CommandEmpty,
|
CommandEmpty,
|
||||||
CommandGroup,
|
CommandGroup,
|
||||||
CommandInput,
|
CommandInput,
|
||||||
CommandItem,
|
CommandItem,
|
||||||
CommandList,
|
CommandList,
|
||||||
} from "@/components/ui/command";
|
} from '@/components/ui/command';
|
||||||
import { FormControl } from "@/components/ui/form";
|
import { FormControl } from '@/components/ui/form';
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from '@/lib/utils';
|
||||||
import { CheckIcon, ChevronsUpDownIcon } from "lucide-react";
|
import { CheckIcon, ChevronsUpDownIcon } from 'lucide-react';
|
||||||
import GetCapitalize from "@/shared/actions/text/GetCapitalize";
|
import GetCapitalize from '@/shared/actions/text/GetCapitalize';
|
||||||
import { useCCaixaServicoReadHook } from "@/app/(protected)/(cadastros)/cadastros/_hooks/c_caixa_servico/useCCaixaServicoReadHook";
|
import { useCCaixaServicoReadHook } from '@/app/(protected)/(cadastros)/cadastros/_hooks/c_caixa_servico/useCCaixaServicoReadHook';
|
||||||
import { CCaixaServicoReadInterface } from "@/app/(protected)/(cadastros)/cadastros/_interfaces/CCaixaServicoReadInterface";
|
import { CCaixaServicoReadInterface } from '@/app/(protected)/(cadastros)/cadastros/_interfaces/CCaixaServicoReadInterface';
|
||||||
|
|
||||||
export default function CCaixaServicoSelect({ sistema_id, field }: any) {
|
export default function CCaixaServicoSelect({ sistema_id, field }: any) {
|
||||||
|
const cCaixaServicoReadParams: CCaixaServicoReadInterface = { sistema_id };
|
||||||
|
|
||||||
const cCaixaServicoReadParams: CCaixaServicoReadInterface = { sistema_id };
|
const [open, setOpen] = React.useState(false);
|
||||||
|
const [isLoading, setIsLoading] = React.useState(false);
|
||||||
const [open, setOpen] = React.useState(false);
|
const { cCaixaServico, fetchCCaixaServico } = useCCaixaServicoReadHook();
|
||||||
const [isLoading, setIsLoading] = React.useState(false);
|
// Busca os dados uma única vez ao montar
|
||||||
const { cCaixaServico, fetchCCaixaServico } = useCCaixaServicoReadHook();
|
React.useEffect(() => {
|
||||||
// Busca os dados uma única vez ao montar
|
const loadData = async () => {
|
||||||
React.useEffect(() => {
|
if (!cCaixaServico.length) {
|
||||||
const loadData = async () => {
|
setIsLoading(true);
|
||||||
if (!cCaixaServico.length) {
|
await fetchCCaixaServico(cCaixaServicoReadParams);
|
||||||
setIsLoading(true);
|
setIsLoading(false);
|
||||||
await fetchCCaixaServico(cCaixaServicoReadParams);
|
}
|
||||||
setIsLoading(false);
|
};
|
||||||
}
|
loadData();
|
||||||
};
|
}, []);
|
||||||
loadData();
|
const selected = cCaixaServico?.find(
|
||||||
}, []);
|
(item) => String(item.caixa_servico_id) === String(field.value),
|
||||||
const selected = cCaixaServico?.find(
|
);
|
||||||
(item) => String(item.caixa_servico_id) === String(field.value)
|
return (
|
||||||
);
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
return (
|
<PopoverTrigger asChild>
|
||||||
<Popover open={open} onOpenChange={setOpen}>
|
<FormControl className="w-full">
|
||||||
<PopoverTrigger asChild>
|
<Button
|
||||||
<FormControl className="w-full">
|
variant="outline"
|
||||||
<Button
|
role="combobox"
|
||||||
variant="outline"
|
aria-expanded={open}
|
||||||
role="combobox"
|
disabled={isLoading}
|
||||||
aria-expanded={open}
|
className="cursor-pointer justify-between"
|
||||||
disabled={isLoading}
|
>
|
||||||
className="justify-between cursor-pointer"
|
{isLoading
|
||||||
>
|
? 'Carregando...'
|
||||||
{isLoading
|
: selected
|
||||||
? "Carregando..."
|
? GetCapitalize(selected.descricao)
|
||||||
: selected
|
: 'Selecione o serviço'}
|
||||||
? GetCapitalize(selected.descricao)
|
<ChevronsUpDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
: "Selecione o serviço"}
|
</Button>
|
||||||
<ChevronsUpDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
</FormControl>
|
||||||
</Button>
|
</PopoverTrigger>
|
||||||
</FormControl>
|
<PopoverContent className="w-full p-0">
|
||||||
</PopoverTrigger>
|
<Command>
|
||||||
<PopoverContent className="w-full p-0">
|
<CommandInput placeholder="Buscar etiquetas/carimbos..." />
|
||||||
<Command>
|
<CommandList>
|
||||||
<CommandInput placeholder="Buscar etiquetas/carimbos..." />
|
<CommandEmpty>
|
||||||
<CommandList>
|
{isLoading ? 'Carregando...' : 'Nenhum resultado encontrado.'}
|
||||||
<CommandEmpty>
|
</CommandEmpty>
|
||||||
{isLoading ? "Carregando..." : "Nenhum resultado encontrado."}
|
<CommandGroup>
|
||||||
</CommandEmpty>
|
{cCaixaServico?.map((item) => (
|
||||||
<CommandGroup>
|
<CommandItem
|
||||||
{cCaixaServico?.map((item) => (
|
className="cursor-pointer"
|
||||||
<CommandItem
|
key={item.caixa_servico_id}
|
||||||
className="cursor-pointer"
|
value={item.descricao?.toLowerCase() ?? ''}
|
||||||
key={item.caixa_servico_id}
|
onSelect={() => {
|
||||||
value={item.descricao?.toLowerCase() ?? ""}
|
field.onChange(Number(item.caixa_servico_id)); // envia apenas o número
|
||||||
onSelect={() => {
|
setOpen(false);
|
||||||
field.onChange(Number(item.caixa_servico_id)); // envia apenas o número
|
}}
|
||||||
setOpen(false);
|
>
|
||||||
}}
|
<CheckIcon
|
||||||
>
|
className={cn(
|
||||||
<CheckIcon
|
'mr-2 h-4 w-4',
|
||||||
className={cn(
|
String(field.value) === String(item.caixa_servico_id)
|
||||||
"mr-2 h-4 w-4",
|
? 'opacity-100'
|
||||||
String(field.value) === String(item.caixa_servico_id)
|
: 'opacity-0',
|
||||||
? "opacity-100"
|
)}
|
||||||
: "opacity-0"
|
/>
|
||||||
)}
|
{GetCapitalize(item.descricao)}
|
||||||
/>
|
</CommandItem>
|
||||||
{GetCapitalize(item.descricao)}
|
))}
|
||||||
</CommandItem>
|
</CommandGroup>
|
||||||
))}
|
</CommandList>
|
||||||
</CommandGroup>
|
</Command>
|
||||||
</CommandList>
|
</PopoverContent>
|
||||||
</Command>
|
</Popover>
|
||||||
</PopoverContent>
|
);
|
||||||
</Popover>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ import { useGUfReadHook } from '@/packages/administrativo/hooks/GUF/useGUfReadHo
|
||||||
|
|
||||||
import { GCidadeSchema } from '../../schemas/GCidade/GCidadeSchema';
|
import { GCidadeSchema } from '../../schemas/GCidade/GCidadeSchema';
|
||||||
|
|
||||||
|
|
||||||
// Hook responsável em trazer todos os estados brasileiros
|
// Hook responsável em trazer todos os estados brasileiros
|
||||||
|
|
||||||
// Define o tipo do formulário com base no schema Zod
|
// Define o tipo do formulário com base no schema Zod
|
||||||
|
|
|
||||||
|
|
@ -1,158 +1,156 @@
|
||||||
'use client'; // Garante execução no cliente (Next.js App Router)
|
'use client'; // Garante execução no cliente (Next.js App Router)
|
||||||
|
|
||||||
import React from "react";
|
import React from 'react';
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from '@/components/ui/button';
|
||||||
import {
|
import {
|
||||||
Command,
|
Command,
|
||||||
CommandEmpty,
|
CommandEmpty,
|
||||||
CommandGroup,
|
CommandGroup,
|
||||||
CommandInput,
|
CommandInput,
|
||||||
CommandItem,
|
CommandItem,
|
||||||
CommandList,
|
CommandList,
|
||||||
} from "@/components/ui/command";
|
} from '@/components/ui/command';
|
||||||
import { FormControl } from "@/components/ui/form";
|
import { FormControl } from '@/components/ui/form';
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from '@/lib/utils';
|
||||||
import { CheckIcon, ChevronsUpDownIcon } from "lucide-react";
|
import { CheckIcon, ChevronsUpDownIcon } from 'lucide-react';
|
||||||
import GetCapitalize from "@/shared/actions/text/GetCapitalize";
|
import GetCapitalize from '@/shared/actions/text/GetCapitalize';
|
||||||
import { useGEmolumentoReadHook } from "@/app/(protected)/(cadastros)/cadastros/_hooks/g_emolumento/useGEmolumentoReadHook";
|
import { useGEmolumentoReadHook } from '@/app/(protected)/(cadastros)/cadastros/_hooks/g_emolumento/useGEmolumentoReadHook';
|
||||||
import { GEmolumentoReadInterface } from "@/app/(protected)/(cadastros)/cadastros/_interfaces/GEmolumentoReadInterface";
|
import { GEmolumentoReadInterface } from '@/app/(protected)/(cadastros)/cadastros/_interfaces/GEmolumentoReadInterface';
|
||||||
|
|
||||||
|
|
||||||
// Tipagem das props do componente
|
// Tipagem das props do componente
|
||||||
interface GEmolumentoSelectProps {
|
interface GEmolumentoSelectProps {
|
||||||
sistema_id: number; // ID do sistema usado para buscar os emolumentos
|
sistema_id: number; // ID do sistema usado para buscar os emolumentos
|
||||||
field: any; // Objeto de controle do react-hook-form
|
field: any; // Objeto de controle do react-hook-form
|
||||||
onSelectChange?: (emolumento: { key: number; value: string }) => void; // Função callback opcional para disparar eventos externos
|
onSelectChange?: (emolumento: { key: number; value: string }) => void; // Função callback opcional para disparar eventos externos
|
||||||
className?: string; // Classe CSS opcional para customização
|
className?: string; // Classe CSS opcional para customização
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Componente principal do select de emolumentos
|
// Componente principal do select de emolumentos
|
||||||
export default function GEmolumentoSelect({ sistema_id, field, onSelectChange, className }: GEmolumentoSelectProps) {
|
export default function GEmolumentoSelect({
|
||||||
|
sistema_id,
|
||||||
|
field,
|
||||||
|
onSelectChange,
|
||||||
|
className,
|
||||||
|
}: GEmolumentoSelectProps) {
|
||||||
|
// Define parâmetros de leitura para o hook que busca os emolumentos
|
||||||
|
const gEmolumentoReadParams: GEmolumentoReadInterface = { sistema_id };
|
||||||
|
|
||||||
// Define parâmetros de leitura para o hook que busca os emolumentos
|
// Estados locais do componente
|
||||||
const gEmolumentoReadParams: GEmolumentoReadInterface = { sistema_id };
|
const [open, setOpen] = React.useState(false); // Controla abertura do popover
|
||||||
|
const [isLoading, setIsLoading] = React.useState(false); // Exibe “Carregando...” enquanto busca dados
|
||||||
|
|
||||||
// Estados locais do componente
|
// Hook responsável por buscar emolumentos no backend
|
||||||
const [open, setOpen] = React.useState(false); // Controla abertura do popover
|
const { gEmolumento, fetchGEmolumento } = useGEmolumentoReadHook();
|
||||||
const [isLoading, setIsLoading] = React.useState(false); // Exibe “Carregando...” enquanto busca dados
|
|
||||||
|
|
||||||
// Hook responsável por buscar emolumentos no backend
|
// Carrega os dados de emolumentos apenas uma vez ao montar o componente
|
||||||
const { gEmolumento, fetchGEmolumento } = useGEmolumentoReadHook();
|
React.useEffect(() => {
|
||||||
|
const loadData = async () => {
|
||||||
|
if (!gEmolumento.length) {
|
||||||
|
setIsLoading(true);
|
||||||
|
await fetchGEmolumento(gEmolumentoReadParams);
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
loadData();
|
||||||
|
}, []); // ← executa apenas uma vez
|
||||||
|
|
||||||
// Carrega os dados de emolumentos apenas uma vez ao montar o componente
|
// Obtém o item selecionado com base no valor atual do campo
|
||||||
React.useEffect(() => {
|
const selected = gEmolumento?.find(
|
||||||
const loadData = async () => {
|
(item) => Number(item.emolumento_id) === Number(field.value ?? 0),
|
||||||
if (!gEmolumento.length) {
|
);
|
||||||
setIsLoading(true);
|
|
||||||
await fetchGEmolumento(gEmolumentoReadParams);
|
|
||||||
setIsLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
loadData();
|
|
||||||
}, []); // ← executa apenas uma vez
|
|
||||||
|
|
||||||
|
// Estrutura visual do componente
|
||||||
|
return (
|
||||||
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
|
{/* === Botão principal (exibe valor selecionado) === */}
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<FormControl className="w-full">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
role="combobox"
|
||||||
|
aria-expanded={open}
|
||||||
|
disabled={isLoading}
|
||||||
|
className={cn(
|
||||||
|
'min-h-[2.5rem] w-full cursor-pointer justify-between text-left break-words whitespace-normal',
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{/* Exibe o texto do botão */}
|
||||||
|
{isLoading
|
||||||
|
? 'Carregando...'
|
||||||
|
: selected
|
||||||
|
? GetCapitalize(selected.descricao)
|
||||||
|
: 'Selecione emolumento'}
|
||||||
|
|
||||||
// Obtém o item selecionado com base no valor atual do campo
|
{/* Ícone de seta */}
|
||||||
const selected = gEmolumento?.find(
|
<ChevronsUpDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
(item) => Number(item.emolumento_id) === Number(field.value ?? 0)
|
</Button>
|
||||||
);
|
</FormControl>
|
||||||
|
</PopoverTrigger>
|
||||||
|
|
||||||
|
{/* === Conteúdo do Popover (lista de opções) === */}
|
||||||
|
<PopoverContent
|
||||||
|
align="start"
|
||||||
|
side="bottom"
|
||||||
|
className="w-[var(--radix-popover-trigger-width)] max-w-full p-0"
|
||||||
|
>
|
||||||
|
<Command>
|
||||||
|
{/* Campo de busca dentro do popover */}
|
||||||
|
<CommandInput placeholder="Buscar emolumentos..." />
|
||||||
|
|
||||||
// Estrutura visual do componente
|
<CommandList>
|
||||||
return (
|
{/* Estado vazio ou carregando */}
|
||||||
<Popover open={open} onOpenChange={setOpen}>
|
<CommandEmpty>
|
||||||
{/* === Botão principal (exibe valor selecionado) === */}
|
{isLoading ? 'Carregando...' : 'Nenhum resultado encontrado.'}
|
||||||
<PopoverTrigger asChild>
|
</CommandEmpty>
|
||||||
<FormControl className="w-full">
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
role="combobox"
|
|
||||||
aria-expanded={open}
|
|
||||||
disabled={isLoading}
|
|
||||||
className={cn(
|
|
||||||
"justify-between cursor-pointer w-full whitespace-normal text-left break-words min-h-[2.5rem]",
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{/* Exibe o texto do botão */}
|
|
||||||
{isLoading
|
|
||||||
? "Carregando..."
|
|
||||||
: selected
|
|
||||||
? GetCapitalize(selected.descricao)
|
|
||||||
: "Selecione emolumento"}
|
|
||||||
|
|
||||||
{/* Ícone de seta */}
|
|
||||||
<ChevronsUpDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
|
||||||
</Button>
|
|
||||||
</FormControl>
|
|
||||||
</PopoverTrigger>
|
|
||||||
|
|
||||||
{/* === Conteúdo do Popover (lista de opções) === */}
|
{/* Grupo de opções */}
|
||||||
<PopoverContent
|
<CommandGroup>
|
||||||
align="start"
|
{gEmolumento?.map((item) => (
|
||||||
side="bottom"
|
<CommandItem
|
||||||
className="w-[var(--radix-popover-trigger-width)] max-w-full p-0"
|
className="w-full cursor-pointer"
|
||||||
>
|
key={item.emolumento_id}
|
||||||
<Command>
|
value={item.descricao?.toLowerCase() ?? ''}
|
||||||
{/* Campo de busca dentro do popover */}
|
// Quando o item é selecionado
|
||||||
<CommandInput placeholder="Buscar emolumentos..." />
|
onSelect={() => {
|
||||||
|
// Cria objeto com ID e descrição
|
||||||
|
const selectedValue = {
|
||||||
|
key: Number(item.emolumento_id),
|
||||||
|
value: item.descricao,
|
||||||
|
};
|
||||||
|
|
||||||
<CommandList>
|
// Atualiza o valor no react-hook-form com o ID numérico
|
||||||
{/* Estado vazio ou carregando */}
|
field.onChange(Number(item.emolumento_id ?? 0));
|
||||||
<CommandEmpty>
|
|
||||||
{isLoading ? "Carregando..." : "Nenhum resultado encontrado."}
|
|
||||||
</CommandEmpty>
|
|
||||||
|
|
||||||
{/* Grupo de opções */}
|
// Dispara callback externo, se existir (mantém o objeto completo)
|
||||||
<CommandGroup>
|
if (onSelectChange)
|
||||||
{gEmolumento?.map((item) => (
|
onSelectChange({
|
||||||
<CommandItem
|
key: Number(item.emolumento_id),
|
||||||
className="cursor-pointer w-full"
|
value: item.descricao,
|
||||||
key={item.emolumento_id}
|
});
|
||||||
value={item.descricao?.toLowerCase() ?? ""}
|
|
||||||
|
|
||||||
// Quando o item é selecionado
|
|
||||||
onSelect={() => {
|
|
||||||
// Cria objeto com ID e descrição
|
|
||||||
const selectedValue = {
|
|
||||||
key: Number(item.emolumento_id),
|
|
||||||
value: item.descricao,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Atualiza o valor no react-hook-form com o ID numérico
|
// Fecha o popover
|
||||||
field.onChange(Number(item.emolumento_id ?? 0));
|
setOpen(false);
|
||||||
|
}}
|
||||||
// Dispara callback externo, se existir (mantém o objeto completo)
|
>
|
||||||
if (onSelectChange)
|
{/* Ícone de seleção (check) */}
|
||||||
onSelectChange({
|
<CheckIcon
|
||||||
key: Number(item.emolumento_id),
|
className={cn(
|
||||||
value: item.descricao,
|
'mr-2 h-4 w-4',
|
||||||
});
|
String(field.value?.key ?? field.value) === String(item.emolumento_id)
|
||||||
|
? 'opacity-100'
|
||||||
// Fecha o popover
|
: 'opacity-0',
|
||||||
setOpen(false);
|
)}
|
||||||
}}
|
/>
|
||||||
|
{/* Nome formatado do emolumento */}
|
||||||
>
|
{GetCapitalize(item.descricao)}
|
||||||
{/* Ícone de seleção (check) */}
|
</CommandItem>
|
||||||
<CheckIcon
|
))}
|
||||||
className={cn(
|
</CommandGroup>
|
||||||
"mr-2 h-4 w-4",
|
</CommandList>
|
||||||
String(field.value?.key ?? field.value) === String(item.emolumento_id)
|
</Command>
|
||||||
? "opacity-100"
|
</PopoverContent>
|
||||||
: "opacity-0"
|
</Popover>
|
||||||
)}
|
);
|
||||||
/>
|
|
||||||
{/* Nome formatado do emolumento */}
|
|
||||||
{GetCapitalize(item.descricao)}
|
|
||||||
</CommandItem>
|
|
||||||
))}
|
|
||||||
</CommandGroup>
|
|
||||||
</CommandList>
|
|
||||||
</Command>
|
|
||||||
</PopoverContent>
|
|
||||||
</Popover>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,102 +1,101 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import React from "react";
|
import React from 'react';
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from '@/components/ui/button';
|
||||||
import {
|
import {
|
||||||
Command,
|
Command,
|
||||||
CommandEmpty,
|
CommandEmpty,
|
||||||
CommandGroup,
|
CommandGroup,
|
||||||
CommandInput,
|
CommandInput,
|
||||||
CommandItem,
|
CommandItem,
|
||||||
CommandList,
|
CommandList,
|
||||||
} from "@/components/ui/command";
|
} from '@/components/ui/command';
|
||||||
import { FormControl } from "@/components/ui/form";
|
import { FormControl } from '@/components/ui/form';
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from '@/lib/utils';
|
||||||
import { CheckIcon, ChevronsUpDownIcon } from "lucide-react";
|
import { CheckIcon, ChevronsUpDownIcon } from 'lucide-react';
|
||||||
import GetCapitalize from "@/shared/actions/text/GetCapitalize";
|
import GetCapitalize from '@/shared/actions/text/GetCapitalize';
|
||||||
import { useGMarcacaoTipoReadHook } from "@/app/(protected)/(cadastros)/cadastros/_hooks/g_marcacao_tipo/useGMarcacaoTipoReadHook";
|
import { useGMarcacaoTipoReadHook } from '@/app/(protected)/(cadastros)/cadastros/_hooks/g_marcacao_tipo/useGMarcacaoTipoReadHook';
|
||||||
import { GMarcacaoTipoReadInterface } from "@/app/(protected)/(cadastros)/cadastros/_interfaces/GMarcacaoTipoReadInterface";
|
import { GMarcacaoTipoReadInterface } from '@/app/(protected)/(cadastros)/cadastros/_interfaces/GMarcacaoTipoReadInterface';
|
||||||
|
|
||||||
export default function GMarcacaoTipoSelect({ grupo, sistema_id, situacao, field }: any) {
|
export default function GMarcacaoTipoSelect({ grupo, sistema_id, situacao, field }: any) {
|
||||||
|
const gMarcacaoTipoReadParams: GMarcacaoTipoReadInterface = { grupo, sistema_id, situacao };
|
||||||
|
|
||||||
const gMarcacaoTipoReadParams: GMarcacaoTipoReadInterface = { grupo, sistema_id, situacao };
|
const [open, setOpen] = React.useState(false);
|
||||||
|
const [isLoading, setIsLoading] = React.useState(false);
|
||||||
const [open, setOpen] = React.useState(false);
|
const { gMarcacaoTipo, fetchGMarcacaoTipo } = useGMarcacaoTipoReadHook();
|
||||||
const [isLoading, setIsLoading] = React.useState(false);
|
// Busca os dados uma única vez ao montar
|
||||||
const { gMarcacaoTipo, fetchGMarcacaoTipo } = useGMarcacaoTipoReadHook();
|
React.useEffect(() => {
|
||||||
// Busca os dados uma única vez ao montar
|
const loadData = async () => {
|
||||||
React.useEffect(() => {
|
if (!gMarcacaoTipo.length) {
|
||||||
const loadData = async () => {
|
setIsLoading(true);
|
||||||
if (!gMarcacaoTipo.length) {
|
await fetchGMarcacaoTipo(gMarcacaoTipoReadParams);
|
||||||
setIsLoading(true);
|
setIsLoading(false);
|
||||||
await fetchGMarcacaoTipo(gMarcacaoTipoReadParams);
|
}
|
||||||
setIsLoading(false);
|
};
|
||||||
}
|
loadData();
|
||||||
};
|
}, []);
|
||||||
loadData();
|
const selected = gMarcacaoTipo?.find(
|
||||||
}, []);
|
(item) => String(item.marcacao_tipo_id) === String(field.value),
|
||||||
const selected = gMarcacaoTipo?.find(
|
);
|
||||||
(item) => String(item.marcacao_tipo_id) === String(field.value)
|
return (
|
||||||
);
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
return (
|
<PopoverTrigger asChild>
|
||||||
<Popover open={open} onOpenChange={setOpen}>
|
<FormControl className="w-full">
|
||||||
<PopoverTrigger asChild>
|
<Button
|
||||||
<FormControl className="w-full">
|
variant="outline"
|
||||||
<Button
|
role="combobox"
|
||||||
variant="outline"
|
aria-expanded={open}
|
||||||
role="combobox"
|
disabled={isLoading}
|
||||||
aria-expanded={open}
|
className="cursor-pointer justify-between"
|
||||||
disabled={isLoading}
|
>
|
||||||
className="justify-between cursor-pointer"
|
{isLoading
|
||||||
>
|
? 'Carregando...'
|
||||||
{isLoading
|
: field.value && typeof field.value === 'object' && field.value.value
|
||||||
? "Carregando..."
|
? GetCapitalize(field.value.value) // Exibe a descrição do objeto
|
||||||
: field.value && typeof field.value === 'object' && field.value.value
|
: field.value && typeof field.value !== 'object'
|
||||||
? GetCapitalize(field.value.value) // Exibe a descrição do objeto
|
? field.value // Se for um ID (valor antigo), exibe ele
|
||||||
: field.value && typeof field.value !== 'object'
|
: 'Selecione a etiqueta/carimbo'}
|
||||||
? field.value // Se for um ID (valor antigo), exibe ele
|
<ChevronsUpDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
: "Selecione a etiqueta/carimbo"}
|
</Button>
|
||||||
<ChevronsUpDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
</FormControl>
|
||||||
</Button>
|
</PopoverTrigger>
|
||||||
</FormControl>
|
<PopoverContent className="w-full p-0">
|
||||||
</PopoverTrigger>
|
<Command>
|
||||||
<PopoverContent className="w-full p-0">
|
<CommandInput placeholder="Buscar etiquetas/carimbos..." />
|
||||||
<Command>
|
<CommandList>
|
||||||
<CommandInput placeholder="Buscar etiquetas/carimbos..." />
|
<CommandEmpty>
|
||||||
<CommandList>
|
{isLoading ? 'Carregando...' : 'Nenhum resultado encontrado.'}
|
||||||
<CommandEmpty>
|
</CommandEmpty>
|
||||||
{isLoading ? "Carregando..." : "Nenhum resultado encontrado."}
|
<CommandGroup>
|
||||||
</CommandEmpty>
|
{gMarcacaoTipo?.map((item) => (
|
||||||
<CommandGroup>
|
<CommandItem
|
||||||
{gMarcacaoTipo?.map((item) => (
|
className="cursor-pointer"
|
||||||
<CommandItem
|
key={item.marcacao_tipo_id}
|
||||||
className="cursor-pointer"
|
value={item.descricao?.toLowerCase() ?? ''}
|
||||||
key={item.marcacao_tipo_id}
|
onSelect={() => {
|
||||||
value={item.descricao?.toLowerCase() ?? ""}
|
field.onChange({
|
||||||
onSelect={() => {
|
key: Number(item.marcacao_tipo_id),
|
||||||
field.onChange({
|
value: item.descricao,
|
||||||
key: Number(item.marcacao_tipo_id),
|
});
|
||||||
value: item.descricao,
|
setOpen(false);
|
||||||
});
|
}}
|
||||||
setOpen(false);
|
>
|
||||||
}}
|
<CheckIcon
|
||||||
>
|
className={cn(
|
||||||
<CheckIcon
|
'mr-2 h-4 w-4',
|
||||||
className={cn(
|
String(field.value) === String(item.marcacao_tipo_id)
|
||||||
"mr-2 h-4 w-4",
|
? 'opacity-100'
|
||||||
String(field.value) === String(item.marcacao_tipo_id)
|
: 'opacity-0',
|
||||||
? "opacity-100"
|
)}
|
||||||
: "opacity-0"
|
/>
|
||||||
)}
|
{GetCapitalize(item.descricao)}
|
||||||
/>
|
</CommandItem>
|
||||||
{GetCapitalize(item.descricao)}
|
))}
|
||||||
</CommandItem>
|
</CommandGroup>
|
||||||
))}
|
</CommandList>
|
||||||
</CommandGroup>
|
</Command>
|
||||||
</CommandList>
|
</PopoverContent>
|
||||||
</Command>
|
</Popover>
|
||||||
</PopoverContent>
|
);
|
||||||
</Popover>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import { useGMedidaTipoRemoveHook } from '../../hooks/GMedidaTipo/useGMedidaTipo
|
||||||
import { useGMedidaTipoSaveHook } from '../../hooks/GMedidaTipo/useGMedidaTipoSaveHook';
|
import { useGMedidaTipoSaveHook } from '../../hooks/GMedidaTipo/useGMedidaTipoSaveHook';
|
||||||
import { GMedidaTipoInterface } from '../../interfaces/GMedidaTipo/GMedidaTipoInterface';
|
import { GMedidaTipoInterface } from '../../interfaces/GMedidaTipo/GMedidaTipoInterface';
|
||||||
|
|
||||||
|
|
||||||
const initialMedidaTipo: GMedidaTipoInterface = {
|
const initialMedidaTipo: GMedidaTipoInterface = {
|
||||||
medida_tipo_id: 0,
|
medida_tipo_id: 0,
|
||||||
sigla: '',
|
sigla: '',
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import { useEffect, useState, useCallback } from 'react';
|
import { useEffect, useState, useCallback } from 'react';
|
||||||
|
|
||||||
|
|
||||||
import { useGNaturezaDeleteHook } from '@/packages/administrativo/hooks/GNatureza/useGNaturezaDeleteHook';
|
import { useGNaturezaDeleteHook } from '@/packages/administrativo/hooks/GNatureza/useGNaturezaDeleteHook';
|
||||||
import { useGNaturezaIndexHook } from '@/packages/administrativo/hooks/GNatureza/useGNaturezaIndexHook';
|
import { useGNaturezaIndexHook } from '@/packages/administrativo/hooks/GNatureza/useGNaturezaIndexHook';
|
||||||
import { useGNaturezaSaveHook } from '@/packages/administrativo/hooks/GNatureza/useGNaturezaSaveHook';
|
import { useGNaturezaSaveHook } from '@/packages/administrativo/hooks/GNatureza/useGNaturezaSaveHook';
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import GTBBairroForm from './GTBBairroForm';
|
||||||
import GTBBairroTable from './GTBBairroTable';
|
import GTBBairroTable from './GTBBairroTable';
|
||||||
import { GTBBairroInterface } from '../../interfaces/GTBBairro/GTBBairroInterface';
|
import { GTBBairroInterface } from '../../interfaces/GTBBairro/GTBBairroInterface';
|
||||||
|
|
||||||
|
|
||||||
const initialBairro: GTBBairroInterface = {
|
const initialBairro: GTBBairroInterface = {
|
||||||
sistema_id: null,
|
sistema_id: null,
|
||||||
tb_bairro_id: 0,
|
tb_bairro_id: 0,
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||||
|
|
||||||
import { GTBBairroInterface } from '../../interfaces/GTBBairro/GTBBairroInterface';
|
import { GTBBairroInterface } from '../../interfaces/GTBBairro/GTBBairroInterface';
|
||||||
|
|
||||||
|
|
||||||
interface GTBBairroTableProps {
|
interface GTBBairroTableProps {
|
||||||
data: GTBBairroInterface[];
|
data: GTBBairroInterface[];
|
||||||
onEdit: (item: GTBBairroInterface, isEditingFormStatus: boolean) => void;
|
onEdit: (item: GTBBairroInterface, isEditingFormStatus: boolean) => void;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ import { useGTBEstadoCivilRemoveHook } from '../../hooks/GTBEstadoCivil/useGTBEs
|
||||||
import { useGTBEstadoCivilSaveHook } from '../../hooks/GTBEstadoCivil/useGTBEstadoCivilSaveHook';
|
import { useGTBEstadoCivilSaveHook } from '../../hooks/GTBEstadoCivil/useGTBEstadoCivilSaveHook';
|
||||||
import { GTBEstadoCivilInterface } from '../../interfaces/GTBEstadoCivil/GTBEstadoCivilInterface';
|
import { GTBEstadoCivilInterface } from '../../interfaces/GTBEstadoCivil/GTBEstadoCivilInterface';
|
||||||
|
|
||||||
|
|
||||||
const initalEstadoCivil: GTBEstadoCivilInterface = {
|
const initalEstadoCivil: GTBEstadoCivilInterface = {
|
||||||
tb_estadocivil_id: 0,
|
tb_estadocivil_id: 0,
|
||||||
sistema_id: 0,
|
sistema_id: 0,
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import { Input } from '@/components/ui/input';
|
||||||
import { Label } from '@/components/ui/label';
|
import { Label } from '@/components/ui/label';
|
||||||
import { GTBRegimeBensSchema } from '@/packages/administrativo/schemas/GTBRegimeBens/GTBRegimeBensSchema';
|
import { GTBRegimeBensSchema } from '@/packages/administrativo/schemas/GTBRegimeBens/GTBRegimeBensSchema';
|
||||||
|
|
||||||
|
|
||||||
type FormValues = z.infer<typeof GTBRegimeBensSchema>;
|
type FormValues = z.infer<typeof GTBRegimeBensSchema>;
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import { useGTBRegimeComunhaoRemoveHook } from '../../hooks/GTBRegimeComunhao/us
|
||||||
import { useGTBRegimeComunhaoSaveHook } from '../../hooks/GTBRegimeComunhao/useGTBRegimeComunhaoSaveHook';
|
import { useGTBRegimeComunhaoSaveHook } from '../../hooks/GTBRegimeComunhao/useGTBRegimeComunhaoSaveHook';
|
||||||
import GTBRegimeComunhaoInterface from '../../interfaces/GTBRegimeComunhao/GTBRegimeComunhaoInterface';
|
import GTBRegimeComunhaoInterface from '../../interfaces/GTBRegimeComunhao/GTBRegimeComunhaoInterface';
|
||||||
|
|
||||||
|
|
||||||
export default function GTBRegimeComunhaoIndex() {
|
export default function GTBRegimeComunhaoIndex() {
|
||||||
// Hooks para leitura e salvamento
|
// Hooks para leitura e salvamento
|
||||||
const { gTBRegimeComunhao, fetchGTBRegimeComunhao } = useGTBRegimeComunhaoReadHook();
|
const { gTBRegimeComunhao, fetchGTBRegimeComunhao } = useGTBRegimeComunhaoReadHook();
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ import { useGTBTipoLogradouroRemoveHook } from '../../hooks/GTBTipoLogradouro/us
|
||||||
import { useGTBTipoLogradouroSaveHook } from '../../hooks/GTBTipoLogradouro/useGTBTipoLogradouroSaveHook';
|
import { useGTBTipoLogradouroSaveHook } from '../../hooks/GTBTipoLogradouro/useGTBTipoLogradouroSaveHook';
|
||||||
import { GTBTipoLogradouroInterface } from '../../interfaces/GTBTipoLogradouro/GTBTipoLogradouroInterface';
|
import { GTBTipoLogradouroInterface } from '../../interfaces/GTBTipoLogradouro/GTBTipoLogradouroInterface';
|
||||||
|
|
||||||
|
|
||||||
export default function GTBTipoLogradouroIndex() {
|
export default function GTBTipoLogradouroIndex() {
|
||||||
// Controle de exibição de respostas
|
// Controle de exibição de respostas
|
||||||
const { setResponse } = useResponse();
|
const { setResponse } = useResponse();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import { useEffect, useState, useCallback } from 'react';
|
import { useEffect, useState, useCallback } from 'react';
|
||||||
|
|
||||||
|
|
||||||
import { useTAtoParteTipoDeleteHook } from '@/packages/administrativo/hooks/TAtoParteTipo/useTAtoParteTipoDeleteHook';
|
import { useTAtoParteTipoDeleteHook } from '@/packages/administrativo/hooks/TAtoParteTipo/useTAtoParteTipoDeleteHook';
|
||||||
import { useTAtoParteTipoIndexHook } from '@/packages/administrativo/hooks/TAtoParteTipo/useTAtoParteTipoIndexHook';
|
import { useTAtoParteTipoIndexHook } from '@/packages/administrativo/hooks/TAtoParteTipo/useTAtoParteTipoIndexHook';
|
||||||
import { useTAtoParteTipoSaveHook } from '@/packages/administrativo/hooks/TAtoParteTipo/useTAtoParteTipoSaveHook';
|
import { useTAtoParteTipoSaveHook } from '@/packages/administrativo/hooks/TAtoParteTipo/useTAtoParteTipoSaveHook';
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import { useTCensecReadHook } from '../../hooks/TCensec/useTCensecReadHook';
|
||||||
import { useTCensecSaveHook } from '../../hooks/TCensec/useTCensecSaveHook';
|
import { useTCensecSaveHook } from '../../hooks/TCensec/useTCensecSaveHook';
|
||||||
import TCensecInterface from '../../interfaces/TCensec/TCensecInterface';
|
import TCensecInterface from '../../interfaces/TCensec/TCensecInterface';
|
||||||
|
|
||||||
|
|
||||||
export default function TCensecIndex() {
|
export default function TCensecIndex() {
|
||||||
// Controle de estado do botão
|
// Controle de estado do botão
|
||||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import TCensecNaturezaLitigioForm from './TCensecNaturezaLitigioForm';
|
||||||
import TCensecNaturezaLitigioTable from './TCensecNaturezaLitigioTable';
|
import TCensecNaturezaLitigioTable from './TCensecNaturezaLitigioTable';
|
||||||
import { TCensecNaturezaLitigioInterface } from '../../interfaces/TCensecNaturezaLitigio/TCensecNaturezaLitigioInterface';
|
import { TCensecNaturezaLitigioInterface } from '../../interfaces/TCensecNaturezaLitigio/TCensecNaturezaLitigioInterface';
|
||||||
|
|
||||||
|
|
||||||
const initialCensecNaturezaLitigio: TCensecNaturezaLitigioInterface = {
|
const initialCensecNaturezaLitigio: TCensecNaturezaLitigioInterface = {
|
||||||
censec_naturezalitigio_id: 0,
|
censec_naturezalitigio_id: 0,
|
||||||
descricao: '',
|
descricao: '',
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import SituacoesSelect from '@/shared/components/situacoes/SituacoesSelect';
|
||||||
import { useTCensecQualidadeFormHook } from '../../hooks/TCensecQualidade/useTCensecQualidadeHook';
|
import { useTCensecQualidadeFormHook } from '../../hooks/TCensecQualidade/useTCensecQualidadeHook';
|
||||||
import { TCensecQualidadeFormInterface } from '../../interfaces/TCensecQualidade/TCensecQualidadeFormInterface';
|
import { TCensecQualidadeFormInterface } from '../../interfaces/TCensecQualidade/TCensecQualidadeFormInterface';
|
||||||
|
|
||||||
|
|
||||||
export default function TCensecQualidadeForm({
|
export default function TCensecQualidadeForm({
|
||||||
isOpen,
|
isOpen,
|
||||||
data,
|
data,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import { useEffect, useState, useCallback } from 'react';
|
import { useEffect, useState, useCallback } from 'react';
|
||||||
|
|
||||||
|
|
||||||
import { useTCensecQualidadeDeleteHook } from '@/packages/administrativo/hooks/TCensecQualidade/useTCensecQualidadeDeleteHook';
|
import { useTCensecQualidadeDeleteHook } from '@/packages/administrativo/hooks/TCensecQualidade/useTCensecQualidadeDeleteHook';
|
||||||
import { useTCensecQualidadeIndexHook } from '@/packages/administrativo/hooks/TCensecQualidade/useTCensecQualidadeIndexHook';
|
import { useTCensecQualidadeIndexHook } from '@/packages/administrativo/hooks/TCensecQualidade/useTCensecQualidadeIndexHook';
|
||||||
import { useTCensecQualidadeSaveHook } from '@/packages/administrativo/hooks/TCensecQualidade/useTCensecQualidadeSaveHook';
|
import { useTCensecQualidadeSaveHook } from '@/packages/administrativo/hooks/TCensecQualidade/useTCensecQualidadeSaveHook';
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue