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 reactPlugin from "eslint-plugin-react";
|
||||
import reactHooks from "eslint-plugin-react-hooks";
|
||||
import jsxA11y from "eslint-plugin-jsx-a11y";
|
||||
import importPlugin from "eslint-plugin-import";
|
||||
import tseslint from "typescript-eslint";
|
||||
import js from '@eslint/js';
|
||||
import reactPlugin from 'eslint-plugin-react';
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
||||
import importPlugin from 'eslint-plugin-import';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
export default [
|
||||
js.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
{
|
||||
files: ["**/*.ts", "**/*.tsx"],
|
||||
ignores: ["node_modules/**", ".next/**", "out/**", "dist/**"],
|
||||
languageOptions: {
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module",
|
||||
parser: tseslint.parser,
|
||||
parserOptions: {
|
||||
project: "./tsconfig.json",
|
||||
},
|
||||
globals: {
|
||||
React: true,
|
||||
JSX: true,
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
react: reactPlugin,
|
||||
"react-hooks": reactHooks,
|
||||
"jsx-a11y": jsxA11y,
|
||||
import: importPlugin,
|
||||
},
|
||||
settings: {
|
||||
react: { version: "detect" },
|
||||
"import/resolver": {
|
||||
typescript: {
|
||||
alwaysTryTypes: true,
|
||||
project: "./tsconfig.json",
|
||||
},
|
||||
node: {
|
||||
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
||||
},
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
"react/react-in-jsx-scope": "off",
|
||||
"react/jsx-uses-react": "off",
|
||||
"react/jsx-uses-vars": "warn",
|
||||
"react-hooks/rules-of-hooks": "error",
|
||||
"react-hooks/exhaustive-deps": "warn",
|
||||
"import/order": [
|
||||
"error",
|
||||
{
|
||||
groups: [
|
||||
["builtin", "external"],
|
||||
["internal"],
|
||||
["parent", "sibling", "index"],
|
||||
],
|
||||
pathGroups: [
|
||||
{
|
||||
pattern: "@/**",
|
||||
group: "internal",
|
||||
position: "after",
|
||||
},
|
||||
],
|
||||
alphabetize: { order: "asc", caseInsensitive: true },
|
||||
"newlines-between": "always",
|
||||
},
|
||||
],
|
||||
"import/no-duplicates": "error",
|
||||
"import/newline-after-import": ["error", { count: 1 }],
|
||||
"no-unused-vars": "warn",
|
||||
},
|
||||
js.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
ignores: ['node_modules/**', '.next/**', 'out/**', 'dist/**'],
|
||||
languageOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
parser: tseslint.parser,
|
||||
parserOptions: {
|
||||
project: './tsconfig.json',
|
||||
},
|
||||
globals: {
|
||||
React: true,
|
||||
JSX: true,
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
react: reactPlugin,
|
||||
'react-hooks': reactHooks,
|
||||
'jsx-a11y': jsxA11y,
|
||||
import: importPlugin,
|
||||
},
|
||||
settings: {
|
||||
react: { version: 'detect' },
|
||||
'import/resolver': {
|
||||
typescript: {
|
||||
alwaysTryTypes: true,
|
||||
project: './tsconfig.json',
|
||||
},
|
||||
node: {
|
||||
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
||||
},
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'react/jsx-uses-react': 'off',
|
||||
'react/jsx-uses-vars': 'warn',
|
||||
'react-hooks/rules-of-hooks': 'error',
|
||||
'react-hooks/exhaustive-deps': 'warn',
|
||||
'import/order': [
|
||||
'error',
|
||||
{
|
||||
groups: [['builtin', 'external'], ['internal'], ['parent', 'sibling', 'index']],
|
||||
pathGroups: [
|
||||
{
|
||||
pattern: '@/**',
|
||||
group: 'internal',
|
||||
position: 'after',
|
||||
},
|
||||
],
|
||||
alphabetize: { order: 'asc', caseInsensitive: true },
|
||||
'newlines-between': 'always',
|
||||
},
|
||||
],
|
||||
'import/no-duplicates': 'error',
|
||||
'import/newline-after-import': ['error', { count: 1 }],
|
||||
'no-unused-vars': 'warn',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
import TTBAndamentoServicoIndex from "@/packages/administrativo/components/TTBAndamentoServico/TTBAndamentoServicoIndex";
|
||||
import TTBAndamentoServicoIndex from '@/packages/administrativo/components/TTBAndamentoServico/TTBAndamentoServicoIndex';
|
||||
|
||||
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() {
|
||||
|
||||
return (
|
||||
< TAtoParteTipoIndex />
|
||||
);
|
||||
|
||||
}
|
||||
return <TAtoParteTipoIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import GTBBairroIndex from "@/packages/administrativo/components/GTBBairro/GTBBairroIndex";
|
||||
import GTBBairroIndex from '@/packages/administrativo/components/GTBBairro/GTBBairroIndex';
|
||||
|
||||
export default function GCidadePage() {
|
||||
return (
|
||||
< GTBBairroIndex />
|
||||
);
|
||||
return <GTBBairroIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import TCensecTipoNaturezaIndex from "@/packages/administrativo/components/TCensecTipoNatureza/TCensecTipoNaturezaIndex";
|
||||
import TCensecTipoNaturezaIndex from '@/packages/administrativo/components/TCensecTipoNatureza/TCensecTipoNaturezaIndex';
|
||||
|
||||
export default function TCensecTipoNaturezaPage() {
|
||||
return (
|
||||
< TCensecTipoNaturezaIndex />
|
||||
);
|
||||
return <TCensecTipoNaturezaIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import TCensecQualidadeIndex from "@/packages/administrativo/components/TCensecQualidade/TCensecQualidadeIndex";
|
||||
import TCensecQualidadeIndex from '@/packages/administrativo/components/TCensecQualidade/TCensecQualidadeIndex';
|
||||
|
||||
export default function TCensecQualidadePage() {
|
||||
return (
|
||||
< TCensecQualidadeIndex />
|
||||
);
|
||||
return <TCensecQualidadeIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import TCensecIndex from "@/packages/administrativo/components/TCensec/TCensecIndex";
|
||||
import TCensecIndex from '@/packages/administrativo/components/TCensec/TCensecIndex';
|
||||
|
||||
export default function GTBEstadoCivilPage() {
|
||||
return (
|
||||
< TCensecIndex />
|
||||
);
|
||||
return <TCensecIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import TCensecNaturezaLitigioIndex from "@/packages/administrativo/components/TCensecNaturezaLitigio/TCensecNaturezaLitigioIndex";
|
||||
import TCensecNaturezaLitigioIndex from '@/packages/administrativo/components/TCensecNaturezaLitigio/TCensecNaturezaLitigioIndex';
|
||||
|
||||
export default function GCidadePage() {
|
||||
return (
|
||||
< TCensecNaturezaLitigioIndex />
|
||||
);
|
||||
return <TCensecNaturezaLitigioIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import TCensecQualidadeIndex from "@/packages/administrativo/components/TCensecQualidade/TCensecQualidadeIndex";
|
||||
import TCensecQualidadeIndex from '@/packages/administrativo/components/TCensecQualidade/TCensecQualidadeIndex';
|
||||
|
||||
export default function GTBEstadoCivilPage() {
|
||||
return (
|
||||
< TCensecQualidadeIndex />
|
||||
);
|
||||
return <TCensecQualidadeIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import TCensecTipoAtoIndex from "@/packages/administrativo/components/TCensecTipoAto/TCensecTipoAtoIndex";
|
||||
import TCensecTipoAtoIndex from '@/packages/administrativo/components/TCensecTipoAto/TCensecTipoAtoIndex';
|
||||
|
||||
export default function GTBEstadoCivilPage() {
|
||||
return (
|
||||
< TCensecTipoAtoIndex />
|
||||
);
|
||||
return <TCensecTipoAtoIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import GCidadeIndex from "@/packages/administrativo/components/GCidade/GCidadeIndex";
|
||||
import GCidadeIndex from '@/packages/administrativo/components/GCidade/GCidadeIndex';
|
||||
|
||||
export default function GCidadePage() {
|
||||
return (
|
||||
< GCidadeIndex />
|
||||
);
|
||||
return <GCidadeIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import TImovelIndex from "@/packages/administrativo/components/TImovel/TImovelIndex";
|
||||
import TImovelIndex from '@/packages/administrativo/components/TImovel/TImovelIndex';
|
||||
|
||||
export default function TImovelRuralPage() {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import GTBTipoLogradouroIndex from "@/packages/administrativo/components/GTBTipoLogradouro/GTBTipoLogradouroIndex";
|
||||
import GTBTipoLogradouroIndex from '@/packages/administrativo/components/GTBTipoLogradouro/GTBTipoLogradouroIndex';
|
||||
|
||||
export default function GMedidaTipoPage() {
|
||||
return (
|
||||
< GTBTipoLogradouroIndex />
|
||||
);
|
||||
return <GTBTipoLogradouroIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import TImovelIndex from "@/packages/administrativo/components/TImovel/TImovelIndex";
|
||||
import TImovelIndex from '@/packages/administrativo/components/TImovel/TImovelIndex';
|
||||
|
||||
export default function TImovelUrbanoPage() {
|
||||
return (
|
||||
|
|
@ -10,4 +10,4 @@ export default function TImovelUrbanoPage() {
|
|||
tipoClasse={1}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import GMedidaTipoIndex from "@/packages/administrativo/components/GMedidaTipo/GMedidaTipoIndex";
|
||||
import GMedidaTipoIndex from '@/packages/administrativo/components/GMedidaTipo/GMedidaTipoIndex';
|
||||
|
||||
export default function GMedidaTipoPage() {
|
||||
return (
|
||||
< GMedidaTipoIndex />
|
||||
);
|
||||
return <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() {
|
||||
|
||||
return (
|
||||
<GNaturezaIndex
|
||||
sistema_id={2}
|
||||
/>
|
||||
);
|
||||
|
||||
}
|
||||
return <GNaturezaIndex sistema_id={2} />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import GTBEstadoCivilIndex from "@/packages/administrativo/components/GTBEstadoCivil/GTBEstadoCivilIndex";
|
||||
import GTBEstadoCivilIndex from '@/packages/administrativo/components/GTBEstadoCivil/GTBEstadoCivilIndex';
|
||||
|
||||
export default function GTBEstadoCivilPage() {
|
||||
return (
|
||||
< GTBEstadoCivilIndex />
|
||||
);
|
||||
return <GTBEstadoCivilIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,5 @@
|
|||
import TPessoaFisicaIndex from '@/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaIndex';
|
||||
|
||||
export default function TPessoaFisica() {
|
||||
return (
|
||||
<TPessoaFisicaIndex />
|
||||
);
|
||||
return <TPessoaFisicaIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,5 @@
|
|||
import TPessoaJuridicaIndex from '@/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaIndex';
|
||||
|
||||
export default function TPessoaFisica() {
|
||||
|
||||
return (
|
||||
<TPessoaJuridicaIndex />
|
||||
);
|
||||
return <TPessoaJuridicaIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import GTBProfissaoIndex from "@/packages/administrativo/components/GTBProfissao/GTBProfissaoIndex";
|
||||
import GTBProfissaoIndex from '@/packages/administrativo/components/GTBProfissao/GTBProfissaoIndex';
|
||||
|
||||
export default function GTBEstadoCivilPage() {
|
||||
return (
|
||||
< GTBProfissaoIndex />
|
||||
);
|
||||
return <GTBProfissaoIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import GTBRegimeBensIndex from "@/packages/administrativo/components/GTBRegimeBens/GTBRegimeBensIndex";
|
||||
import GTBRegimeBensIndex from '@/packages/administrativo/components/GTBRegimeBens/GTBRegimeBensIndex';
|
||||
|
||||
export default function GTBRegimeBensPage() {
|
||||
return (
|
||||
< GTBRegimeBensIndex />
|
||||
);
|
||||
return <GTBRegimeBensIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import GTBRegimeComunhaoIndex from "@/packages/administrativo/components/GTBRegimeComunhao/GTBRegimeComunhaoIndex";
|
||||
import GTBRegimeComunhaoIndex from '@/packages/administrativo/components/GTBRegimeComunhao/GTBRegimeComunhaoIndex';
|
||||
|
||||
export default function GTBRegimeBensPage() {
|
||||
return (
|
||||
< GTBRegimeComunhaoIndex />
|
||||
);
|
||||
return <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() {
|
||||
|
||||
return (
|
||||
< TTBReconhecimentoTipoIndex />
|
||||
);
|
||||
|
||||
}
|
||||
return <TTBReconhecimentoTipoIndex />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@ export default function TServicoTipoPage() {
|
|||
const { editTServicoTipo } = useTServicoTipoEditHook();
|
||||
|
||||
// Estados
|
||||
const [selectedServicoTipo, setSelectedServicoTipo] = useState<TServicoTipoInterface | null>(null);
|
||||
const [selectedServicoTipo, setSelectedServicoTipo] = useState<TServicoTipoInterface | null>(
|
||||
null,
|
||||
);
|
||||
const [isFormOpen, setIsFormOpen] = useState(false);
|
||||
|
||||
// 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
|
||||
*/
|
||||
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)
|
||||
setIsFormOpen(false);
|
||||
|
||||
// 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) => {
|
||||
// Se nenhum dado for passado, abre o formulário em modo de criação
|
||||
if (!data) {
|
||||
setSelectedServicoTipo(null);
|
||||
setIsFormOpen(false);
|
||||
}, []);
|
||||
setIsFormOpen(true);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Salva os dados do formulário
|
||||
*/
|
||||
const handleSave = useCallback(async (formData: TServicoTipoInterface) => {
|
||||
|
||||
// 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);
|
||||
setIsFormOpen(false);
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* Salva os dados do formulário
|
||||
*/
|
||||
const handleSave = useCallback(
|
||||
async (formData: TServicoTipoInterface) => {
|
||||
// Aguarda salvar o registro
|
||||
await saveTServicoTipo(formData);
|
||||
|
||||
|
|
@ -95,13 +97,8 @@ export default function TServicoTipoPage() {
|
|||
fetchTServicoTipo();
|
||||
},
|
||||
[saveTServicoTipo, fetchTServicoTipo],
|
||||
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Quando o usuário clica em "remover" na tabela
|
||||
*/
|
||||
|
|
@ -116,7 +113,6 @@ export default function TServicoTipoPage() {
|
|||
[openConfirmDialog],
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Executa a exclusão de fato quando o usuário confirma
|
||||
*/
|
||||
|
|
@ -137,8 +133,6 @@ export default function TServicoTipoPage() {
|
|||
handleCancel();
|
||||
}, [itemToDelete, removeTServicoTipo, fetchTServicoTipo, handleCancel]);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Busca inicial dos dados
|
||||
*/
|
||||
|
|
@ -168,7 +162,11 @@ export default function TServicoTipoPage() {
|
|||
{/* Tabela de Tipos de Serviço */}
|
||||
<Card>
|
||||
<CardContent>
|
||||
<TServicoTipoTable data={tServicoTipo} onEdit={handleOpenForm} onDelete={handleConfirmDelete} />
|
||||
<TServicoTipoTable
|
||||
data={tServicoTipo}
|
||||
onEdit={handleOpenForm}
|
||||
onDelete={handleConfirmDelete}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
|
|
@ -194,4 +192,4 @@ export default function TServicoTipoPage() {
|
|||
/>
|
||||
</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
|
||||
|
||||
// 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
|
||||
onEdit: (item: TServicoTipoInterface, isEditingFormStatus: boolean) => void; // callback para edição
|
||||
onDelete: (item: TServicoTipoInterface, isEditingFormStatus: boolean) => void; // callback para exclusão
|
||||
|
|
@ -48,12 +49,12 @@ export default function TServicoTipoTable({ data, onEdit, onDelete }: TServicoTi
|
|||
<TableBody>
|
||||
{data.map((item) => (
|
||||
// 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 */}
|
||||
<TableCell>{item.servico_tipo_id}</TableCell>
|
||||
|
||||
{/* 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 */}
|
||||
|
||||
{/* Ações (menu dropdown) */}
|
||||
|
|
@ -97,4 +98,4 @@ export default function TServicoTipoTable({ data, onEdit, onDelete }: TServicoTi
|
|||
</TableBody>
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,22 +5,22 @@ import API from '@/shared/services/api/Api'; //
|
|||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum'; //
|
||||
|
||||
// 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
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; //
|
||||
|
||||
// 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
|
||||
const api = new API(); //
|
||||
|
||||
// Executa a requisição para a API com o método apropriado e envia o ID no endpoint
|
||||
return await api.send({
|
||||
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
|
||||
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'; //
|
||||
|
||||
// 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
|
||||
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
|
||||
return await api.send({
|
||||
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
|
||||
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'; //
|
||||
|
||||
// Função assíncrona que implementa a lógica de salvar (criar/atualizar) um tipo de serviço
|
||||
async function executeTServicoEtiquetaSaveData(data: TServicoEtiquetaFormValues) {
|
||||
|
||||
try{
|
||||
|
||||
async function executeTServicoEtiquetaSaveData(data: TServicoEtiquetaFormValues) {
|
||||
try {
|
||||
// Instancia o cliente da API para enviar a requisição
|
||||
const api = new API(); //
|
||||
|
||||
|
|
@ -27,13 +25,11 @@ async function executeTServicoEtiquetaSaveData(data: TServicoEtiquetaFormValues)
|
|||
endpoint: `administrativo/t_servico_etiqueta`, // Endpoint e ID alterados
|
||||
body: data, // payload enviado para a API
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
|
||||
console.error('Erro no TServicoEtiquetaSaveData:', error);
|
||||
throw error; // propaga erro para o form
|
||||
}
|
||||
}
|
||||
|
||||
// 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'; //
|
||||
|
||||
// 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
|
||||
const api = new API(); //
|
||||
|
||||
// Executa a requisição para a API com o método apropriado e envia o ID no endpoint
|
||||
return await api.send({
|
||||
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
|
||||
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)
|
||||
async function executeTServicoTipoIndexData() {
|
||||
|
||||
// Instancia o cliente da API para enviar a requisição
|
||||
const api = new API(); //
|
||||
|
||||
// Executa a requisição para a API com o método apropriado e o endpoint da tabela t_servico_tipo
|
||||
return await api.send({
|
||||
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
|
||||
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'; //
|
||||
|
||||
// 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
|
||||
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
|
||||
return await api.send({
|
||||
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
|
||||
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'; //
|
||||
|
||||
// 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)
|
||||
const isEditing = !!data.servico_tipo_id && Number(data.servico_tipo_id) > 0;
|
||||
|
||||
// Define método: prioridade para valor passado manualmente (metodo)
|
||||
const method = data.metodo ?? (isEditing ? 'PUT' : 'POST');
|
||||
const method = data.metodo ?? (isEditing ? 'PUT' : 'POST');
|
||||
|
||||
try{
|
||||
|
||||
console.log(data)
|
||||
try {
|
||||
console.log(data);
|
||||
|
||||
// Instancia o cliente da API para enviar a requisição
|
||||
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
|
||||
body: data, // payload enviado para a API
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
|
||||
console.error('Erro no TServicoTipoSaveData:', error);
|
||||
throw error; // propaga erro para o form
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
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 { CCaixaServicoInterface } from '../../_interfaces/CCaixaServicoInterface';
|
||||
|
||||
|
||||
// Hook personalizado para leitura (consulta) dos tipos de marcação
|
||||
export const useCCaixaServicoReadHook = () => {
|
||||
// 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
|
||||
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 { GEmolumentoInterface } from '../../_interfaces/GEmolumentoInterface';
|
||||
|
||||
|
||||
// Hook personalizado para leitura (consulta) dos emolumentos
|
||||
export const useGEmolumentoReadHook = () => {
|
||||
// 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 { GEmolumentoItemInterface } from '../../_interfaces/GEmolumentoItemInterface';
|
||||
|
||||
|
||||
// Hook personalizado para leitura (consulta) dos emolumentos
|
||||
export const useGEmolumentoItemReadHook = () => {
|
||||
const { setResponse } = useResponse();
|
||||
|
|
@ -27,11 +26,10 @@ export const useGEmolumentoItemReadHook = () => {
|
|||
|
||||
// Retorna a resposta completa (para uso externo)
|
||||
return response;
|
||||
|
||||
} catch (error) {
|
||||
console.error("Erro ao buscar item de emolumento:", error);
|
||||
console.error('Erro ao buscar item de emolumento:', error);
|
||||
setResponse({
|
||||
message: "Erro ao buscar item de emolumento",
|
||||
message: 'Erro ao buscar item de emolumento',
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
});
|
||||
return null; // Retorna nulo para segurança
|
||||
|
|
@ -39,8 +37,5 @@ export const useGEmolumentoItemReadHook = () => {
|
|||
};
|
||||
|
||||
// Retorna função e dados memorizados
|
||||
return useMemo(
|
||||
() => ({ gGEmolumentoItem, fetchGEmolumentoItem }),
|
||||
[gGEmolumentoItem]
|
||||
);
|
||||
return useMemo(() => ({ 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
|
||||
import { GMarcacaoTipoIndexService } from '../../_services/g_marcacao_tipo/GMarcacaoTipoIndexService';
|
||||
|
||||
|
||||
// Hook personalizado para leitura (consulta) dos tipos de marcação
|
||||
export const useGMarcacaoTipoReadHook = () => {
|
||||
|
||||
// Obtém a função que atualiza a resposta global do sistema
|
||||
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
|
||||
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
|
||||
export const useTServicoEtiquetaReadHook = () => {
|
||||
|
||||
// Obtém a função que atualiza a resposta global do sistema
|
||||
const { setResponse } = useResponse();
|
||||
|
||||
|
|
@ -20,24 +19,24 @@ export const useTServicoEtiquetaReadHook = () => {
|
|||
const [tServicoEtiqueta, setTServicoEtiqueta] = useState<TServicoEtiquetaInterface[]>([]);
|
||||
|
||||
// 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
|
||||
const response = await TServicoEtiquetaServicoIdService(data);
|
||||
|
||||
// Atualiza o estado local com os dados retornados
|
||||
setTServicoEtiqueta(response.data);
|
||||
|
||||
// Atualiza o contexto global de resposta (ex: para exibir alertas ou mensagens)
|
||||
setResponse(response);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Erro ao buscar etiquetas:', error);
|
||||
return { data: [] };
|
||||
}
|
||||
}, [setResponse]);
|
||||
// Atualiza o contexto global de resposta (ex: para exibir alertas ou mensagens)
|
||||
setResponse(response);
|
||||
} 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
|
||||
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
|
||||
import { TServicoEtiquetaInterface } from "../../_interfaces/TServicoEtiquetaInterface";
|
||||
import { TServicoEtiquetaInterface } from '../../_interfaces/TServicoEtiquetaInterface';
|
||||
|
||||
// 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
|
||||
export const useTServicoEtiquetaRemoveHook = () => {
|
||||
|
|
@ -22,4 +22,4 @@ export const useTServicoEtiquetaRemoveHook = () => {
|
|||
|
||||
// Retorna a função de remoção para ser usada no componente
|
||||
return { fetchTServicoEtiquetaRemove };
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,23 +2,23 @@ import { useState } from 'react';
|
|||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
// 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
|
||||
import { TServicoEtiquetaSaveService } from '../../_services/t_servico_etiqueta/TServicoEtiquetaSaveService';
|
||||
|
||||
export const useTServicoEtiquetaSaveHook = () => {
|
||||
const { setResponse } = useResponse();
|
||||
|
||||
|
||||
// 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.
|
||||
* @param data Os dados do serviço etiqueta a serem salvos.
|
||||
*/
|
||||
const fetchTServicoEtiquetaSave = async (data: TServicoEtiquetaInterface) => {
|
||||
|
||||
// Chama o serviço de salvamento
|
||||
const response = await TServicoEtiquetaSaveService(data);
|
||||
|
||||
|
|
@ -26,12 +26,12 @@ export const useTServicoEtiquetaSaveHook = () => {
|
|||
setTServicoEtiquetaSave(response.data);
|
||||
|
||||
// Manda a resposta para o verificador de resposta global
|
||||
///setResponse(response);
|
||||
///setResponse(response);
|
||||
|
||||
// Manda a resposta para o verificador de resposta global
|
||||
return response.data;
|
||||
}
|
||||
};
|
||||
|
||||
// Retorna o estado e a função de salvamento para uso no componente
|
||||
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
|
||||
import TServicoTipoInterface from "../../_interfaces/TServicoTipoInterface";
|
||||
import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface';
|
||||
|
||||
// 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
|
||||
export const useTServicoTipoEditHook = () => {
|
||||
|
|
@ -13,7 +13,6 @@ export const useTServicoTipoEditHook = () => {
|
|||
|
||||
// Função assíncrona que Edit um tipo de serviço
|
||||
const editTServicoTipo = async (data: TServicoTipoInterface) => {
|
||||
|
||||
// Chama a função de remoção passando os dados do tipo de serviço
|
||||
const response = await TServicoTipoEditData(data);
|
||||
|
||||
|
|
@ -23,4 +22,4 @@ export const useTServicoTipoEditHook = () => {
|
|||
|
||||
// Retorna a função de remoção para ser usada no componente
|
||||
return { editTServicoTipo };
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ import { useResponse } from '@/shared/components/response/ResponseContext'; // C
|
|||
import { useState } from 'react';
|
||||
|
||||
// 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
|
||||
import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface';
|
||||
import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface';
|
||||
|
||||
// Hook customizado para leitura de dados de tipos de serviço
|
||||
export const useTServicoTipoReadHook = () => {
|
||||
|
|
@ -32,4 +32,4 @@ export const useTServicoTipoReadHook = () => {
|
|||
|
||||
// Retorna os dados e a função de busca para serem usados no componente
|
||||
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
|
||||
import TServicoTipoInterface from "../../_interfaces/TServicoTipoInterface";
|
||||
import TServicoTipoInterface from '../../_interfaces/TServicoTipoInterface';
|
||||
|
||||
// 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
|
||||
export const useTServicoTipoRemoveHook = () => {
|
||||
|
|
@ -22,4 +22,4 @@ export const useTServicoTipoRemoveHook = () => {
|
|||
|
||||
// Retorna a função de remoção para ser usada no componente
|
||||
return { removeTServicoTipo };
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ import { useState } from 'react';
|
|||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
// 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
|
||||
import { TServicoTipoSaveService } from '../../_services/t_servico_tipo/TServicoTipoSaveService';
|
||||
|
||||
export const useTServicoTipoSaveHook = () => {
|
||||
const { setResponse } = useResponse();
|
||||
|
||||
|
||||
// Estado local para armazenar os dados do tipo de serviço salvos
|
||||
const [tServicoTipo, setTServicoTipo] = useState<TServicoTipoInterface | null>(null);
|
||||
|
||||
|
|
@ -26,8 +26,8 @@ export const useTServicoTipoSaveHook = () => {
|
|||
|
||||
// Manda a resposta para o verificador de resposta global
|
||||
setResponse(response);
|
||||
}
|
||||
};
|
||||
|
||||
// Retorna o estado e a função de salvamento para uso no componente
|
||||
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
|
||||
import { TTBReconhecimentoTipoIndexService } from '../../_services/t_tb_reconhecimentotipo/TTBReconhecimentoTipoIndexService';
|
||||
|
||||
|
||||
// Hook personalizado para leitura (consulta) dos tipos de marcação
|
||||
export const useTTBReconhecimentoTipoReadHook = () => {
|
||||
// Obtém a função que atualiza a resposta global do sistema
|
||||
const { setResponse } = useResponse();
|
||||
|
||||
// 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
|
||||
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
|
||||
return useMemo(() => ({ tTBReconhecimentoTipo, fetchTTBReconhecimentoTipo }), [tTBReconhecimentoTipo, fetchTTBReconhecimentoTipo]);
|
||||
return useMemo(
|
||||
() => ({ tTBReconhecimentoTipo, fetchTTBReconhecimentoTipo }),
|
||||
[tTBReconhecimentoTipo, fetchTTBReconhecimentoTipo],
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
// Interface que representa a tabela C_CAIXA_SERVICO
|
||||
export interface CCaixaServicoInterface {
|
||||
interno_sistema?: string; // VARCHAR(1)
|
||||
caixa_servico_id: number; // NUMERIC(10,2) NOT NULL - Chave primária
|
||||
descricao?: string; // VARCHAR(60)
|
||||
situacao?: string; // VARCHAR(1)
|
||||
tipo_transacao?: string; // VARCHAR(1)
|
||||
sistema_id?: number; // NUMERIC(14,3)
|
||||
selo_grupo_id?: number; // NUMERIC(10,2)
|
||||
emitir_relatorio?: string; // VARCHAR(1)
|
||||
repasse?: string; // VARCHAR(1)
|
||||
repetir_descricao?: string; // VARCHAR(1)
|
||||
codigo_conta?: number; // NUMERIC(10,2)
|
||||
tipo_conta_carneleao?: string; // VARCHAR(60)
|
||||
centro_de_custa_id?: number; // NUMERIC(10,2) - Chave estrangeira
|
||||
devolucao_juizo?: string; // VARCHAR(1)
|
||||
}
|
||||
interno_sistema?: string; // VARCHAR(1)
|
||||
caixa_servico_id: number; // NUMERIC(10,2) NOT NULL - Chave primária
|
||||
descricao?: string; // VARCHAR(60)
|
||||
situacao?: string; // VARCHAR(1)
|
||||
tipo_transacao?: string; // VARCHAR(1)
|
||||
sistema_id?: number; // NUMERIC(14,3)
|
||||
selo_grupo_id?: number; // NUMERIC(10,2)
|
||||
emitir_relatorio?: string; // VARCHAR(1)
|
||||
repasse?: string; // VARCHAR(1)
|
||||
repetir_descricao?: string; // VARCHAR(1)
|
||||
codigo_conta?: number; // NUMERIC(10,2)
|
||||
tipo_conta_carneleao?: string; // VARCHAR(60)
|
||||
centro_de_custa_id?: number; // NUMERIC(10,2) - Chave estrangeira
|
||||
devolucao_juizo?: string; // VARCHAR(1)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
export interface CCaixaServicoReadInterface {
|
||||
sistema_id?: number;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
// Interface que representa a tabela G_EMOLUMENTO
|
||||
export interface GEmolumentoInterface {
|
||||
emolumento_id?: number; // NUMERIC(10,2) - Chave primária
|
||||
descricao?: string; // VARCHAR(260)
|
||||
tipo?: string; // VARCHAR(1)
|
||||
sistema_id?: number; // NUMERIC(10,2)
|
||||
selo_grupo_id?: number; // NUMERIC(10,2)
|
||||
reg_averb?: string; // VARCHAR(1)
|
||||
pre_definido?: string; // VARCHAR(1)
|
||||
situacao?: string; // VARCHAR(1)
|
||||
situacao_ri?: string; // VARCHAR(1)
|
||||
com_reducao?: string; // VARCHAR(1)
|
||||
motivo_reducao?: string; // VARCHAR(120)
|
||||
valor_maximo_certidao?: number; // NUMERIC(14,3)
|
||||
tipo_objetivo?: string; // VARCHAR(3)
|
||||
modelo_tag?: string; // VARCHAR(3)
|
||||
codigo_nota_id?: number; // NUMERIC(10,2)
|
||||
convenio_codhab?: string; // VARCHAR(1)
|
||||
item_df?: string; // VARCHAR(10)
|
||||
emolumento_id?: number; // NUMERIC(10,2) - Chave primária
|
||||
descricao?: string; // VARCHAR(260)
|
||||
tipo?: string; // VARCHAR(1)
|
||||
sistema_id?: number; // NUMERIC(10,2)
|
||||
selo_grupo_id?: number; // NUMERIC(10,2)
|
||||
reg_averb?: string; // VARCHAR(1)
|
||||
pre_definido?: string; // VARCHAR(1)
|
||||
situacao?: string; // VARCHAR(1)
|
||||
situacao_ri?: string; // VARCHAR(1)
|
||||
com_reducao?: string; // VARCHAR(1)
|
||||
motivo_reducao?: string; // VARCHAR(120)
|
||||
valor_maximo_certidao?: number; // NUMERIC(14,3)
|
||||
tipo_objetivo?: string; // VARCHAR(3)
|
||||
modelo_tag?: string; // VARCHAR(3)
|
||||
codigo_nota_id?: number; // NUMERIC(10,2)
|
||||
convenio_codhab?: string; // VARCHAR(1)
|
||||
item_df?: string; // VARCHAR(10)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
// Interface que representa a tabela G_EMOLUMENTO_ITEM (inferido)
|
||||
export interface GEmolumentoItemInterface {
|
||||
valor_emolumento?: number; // NUMERIC(14,3)
|
||||
emolumento_item_id: number; // NUMERIC(10,2) NOT NULL - Chave primária (assumida)
|
||||
emolumento_id?: number; // NUMERIC(10,2)
|
||||
valor_inicio?: number; // NUMERIC(14,3)
|
||||
valor_fim?: number; // NUMERIC(14,3)
|
||||
valor_taxa_judiciaria?: number; // NUMERIC(14,3)
|
||||
emolumento_periodo_id?: number; // NUMERIC(10,2)
|
||||
codigo?: number; // NUMERIC(10,2)
|
||||
pagina_extra?: number; // NUMERIC(10,2)
|
||||
valor_pagina_extra?: number; // NUMERIC(14,3)
|
||||
valor_outra_taxa1?: number; // NUMERIC(14,3)
|
||||
codigo_selo?: string; // VARCHAR(30)
|
||||
valor_fundo_ri?: number; // NUMERIC(14,3)
|
||||
codigo_tabela?: string; // VARCHAR(30)
|
||||
selo_grupo_id?: number; // NUMERIC(10,2)
|
||||
codigo_km?: string; // VARCHAR(30)
|
||||
emolumento_acresce?: number; // NUMERIC(14,3)
|
||||
taxa_acresce?: number; // NUMERIC(14,3)
|
||||
funcivil_acresce?: number; // NUMERIC(14,3)
|
||||
valor_fracao?: number; // NUMERIC(14,3)
|
||||
valor_por_excedente_emol?: number; // NUMERIC(14,3)
|
||||
valor_por_excedente_tj?: number; // NUMERIC(14,3)
|
||||
valor_por_excedente_fundo?: number; // NUMERIC(14,3)
|
||||
valor_limite_excedente_emol?: number; // NUMERIC(14,3)
|
||||
valor_limite_excedente_tj?: number; // NUMERIC(14,3)
|
||||
valor_emolumento?: number; // NUMERIC(14,3)
|
||||
emolumento_item_id: number; // NUMERIC(10,2) NOT NULL - Chave primária (assumida)
|
||||
emolumento_id?: number; // NUMERIC(10,2)
|
||||
valor_inicio?: number; // NUMERIC(14,3)
|
||||
valor_fim?: number; // NUMERIC(14,3)
|
||||
valor_taxa_judiciaria?: number; // NUMERIC(14,3)
|
||||
emolumento_periodo_id?: number; // NUMERIC(10,2)
|
||||
codigo?: number; // NUMERIC(10,2)
|
||||
pagina_extra?: number; // NUMERIC(10,2)
|
||||
valor_pagina_extra?: number; // NUMERIC(14,3)
|
||||
valor_outra_taxa1?: number; // NUMERIC(14,3)
|
||||
codigo_selo?: string; // VARCHAR(30)
|
||||
valor_fundo_ri?: number; // NUMERIC(14,3)
|
||||
codigo_tabela?: string; // VARCHAR(30)
|
||||
selo_grupo_id?: number; // NUMERIC(10,2)
|
||||
codigo_km?: string; // VARCHAR(30)
|
||||
emolumento_acresce?: number; // NUMERIC(14,3)
|
||||
taxa_acresce?: number; // NUMERIC(14,3)
|
||||
funcivil_acresce?: number; // NUMERIC(14,3)
|
||||
valor_fracao?: number; // NUMERIC(14,3)
|
||||
valor_por_excedente_emol?: number; // NUMERIC(14,3)
|
||||
valor_por_excedente_tj?: number; // NUMERIC(14,3)
|
||||
valor_por_excedente_fundo?: number; // NUMERIC(14,3)
|
||||
valor_limite_excedente_emol?: number; // NUMERIC(14,3)
|
||||
valor_limite_excedente_tj?: number; // NUMERIC(14,3)
|
||||
valor_limite_excedente_fundo?: number; // NUMERIC(14,3)
|
||||
fundo_selo?: number; // NUMERIC(14,3)
|
||||
distribuicao?: number; // NUMERIC(14,3)
|
||||
vrc_ext?: number; // NUMERIC(10,2) - Renomeado de VRCEXT para vrc_ext (convenção)
|
||||
}
|
||||
fundo_selo?: number; // NUMERIC(14,3)
|
||||
distribuicao?: number; // NUMERIC(14,3)
|
||||
vrc_ext?: number; // NUMERIC(10,2) - Renomeado de VRCEXT para vrc_ext (convenção)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export interface GEmolumentoItemReadInterface {
|
||||
emolumento_id?: number,
|
||||
valor?: number
|
||||
}
|
||||
emolumento_id?: number;
|
||||
valor?: number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
export interface GEmolumentoReadInterface {
|
||||
sistema_id?: number
|
||||
}
|
||||
sistema_id?: number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,4 +17,4 @@ export interface GMarcacaoTipoInterface {
|
|||
protegida?: string;
|
||||
ativar_separador?: string;
|
||||
sql_completo?: string;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@ export interface GMarcacaoTipoReadInterface {
|
|||
grupo?: string;
|
||||
sistema_id?: number;
|
||||
situacao?: string;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Interface que representa a tabela T_TB_RECONHECIMENTOTIPO
|
||||
export interface TServicoEtiquetaInterface {
|
||||
servico_etiqueta_id?: number; // NUMERIC(10,2) NOT NULL - Chave primária
|
||||
etiqueta_modelo_id?: number; // NUMERIC(10,2)
|
||||
servico_tipo_id?: number; // NUMERIC(10,2)
|
||||
descricao?: string
|
||||
servico_etiqueta_id?: number; // NUMERIC(10,2) NOT NULL - Chave primária
|
||||
etiqueta_modelo_id?: number; // NUMERIC(10,2)
|
||||
servico_tipo_id?: number; // NUMERIC(10,2)
|
||||
descricao?: string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
export interface TServicoEtiquetaServicoIdReadInterface {
|
||||
servico_tipo_id?: number
|
||||
}
|
||||
servico_tipo_id?: number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +1,27 @@
|
|||
export default interface TServicoTipoInterface {
|
||||
servico_tipo_id?: number; // SERVICO_TIPO_ID NUMERIC(10,2) NOT NULL (PK)
|
||||
descricao: string; // DESCRICAO VARCHAR(60)
|
||||
valor?: number; // VALOR NUMERIC(14,3)
|
||||
requer_autorizacao?: string; // REQUER_AUTORIZACAO VARCHAR(1)
|
||||
requer_biometria?: string; // REQUER_BIOMETRIA VARCHAR(1)
|
||||
tipo_pessoa?: string; // TIPO_PESSOA VARCHAR(1)
|
||||
tb_reconhecimentotipo_id?: number; // TB_RECONHECIMENTOTIPO_ID NUMERIC(10,2) (FK)
|
||||
requer_abonador?: string; // REQUER_ABONADOR VARCHAR(1)
|
||||
situacao?: string; // SITUACAO VARCHAR(1)
|
||||
requer_cpf?: string; // REQUER_CPF VARCHAR(1)
|
||||
servico_padrao?: string; // SERVICO_PADRAO VARCHAR(1)
|
||||
maximo_pessoa?: number; // MAXIMO_PESSOA NUMERIC(10,2)
|
||||
alterar_valor?: string; // ALTERAR_VALOR VARCHAR(1)
|
||||
servico_caixa_id?: number; // SERVICO_CAIXA_ID NUMERIC(10,2)
|
||||
caixa_servico_id?: number; // LIBERAR_DESCONTO VARCHAR(1)
|
||||
valor_fixo?: string; // VALOR_FIXO VARCHAR(1)
|
||||
emolumento_id?: number; // EMOLUMENTO_ID NUMERIC(10,2) (FK)
|
||||
emolumento_obrigatorio?: number; // EMOLUMENTO_OBRIGATORIO NUMERIC(10,2) (FK)
|
||||
ato_praticado?: string; // ATO_PRATICADO VARCHAR(1)
|
||||
selar?: string; // SELAR VARCHAR(1)
|
||||
frenteverso?: string; // FRENTEVERSO VARCHAR(1)
|
||||
etiqueta_unica?: string; // ETIQUETA_UNICA VARCHAR(1)
|
||||
transferencia_veiculo?: string; // TRANSFERENCIA_VEICULO VARCHAR(1)
|
||||
usar_a4?: string; // USAR_A4 VARCHAR(1)
|
||||
averbacao?: string; // AVERBACAO VARCHAR(1)
|
||||
servico_tipo_id?: number; // SERVICO_TIPO_ID NUMERIC(10,2) NOT NULL (PK)
|
||||
descricao: string; // DESCRICAO VARCHAR(60)
|
||||
valor?: number; // VALOR NUMERIC(14,3)
|
||||
requer_autorizacao?: string; // REQUER_AUTORIZACAO VARCHAR(1)
|
||||
requer_biometria?: string; // REQUER_BIOMETRIA VARCHAR(1)
|
||||
tipo_pessoa?: string; // TIPO_PESSOA VARCHAR(1)
|
||||
tb_reconhecimentotipo_id?: number; // TB_RECONHECIMENTOTIPO_ID NUMERIC(10,2) (FK)
|
||||
requer_abonador?: string; // REQUER_ABONADOR VARCHAR(1)
|
||||
situacao?: string; // SITUACAO VARCHAR(1)
|
||||
requer_cpf?: string; // REQUER_CPF VARCHAR(1)
|
||||
servico_padrao?: string; // SERVICO_PADRAO VARCHAR(1)
|
||||
maximo_pessoa?: number; // MAXIMO_PESSOA NUMERIC(10,2)
|
||||
alterar_valor?: string; // ALTERAR_VALOR VARCHAR(1)
|
||||
servico_caixa_id?: number; // SERVICO_CAIXA_ID NUMERIC(10,2)
|
||||
caixa_servico_id?: number; // LIBERAR_DESCONTO VARCHAR(1)
|
||||
valor_fixo?: string; // VALOR_FIXO VARCHAR(1)
|
||||
emolumento_id?: number; // EMOLUMENTO_ID NUMERIC(10,2) (FK)
|
||||
emolumento_obrigatorio?: number; // EMOLUMENTO_OBRIGATORIO NUMERIC(10,2) (FK)
|
||||
ato_praticado?: string; // ATO_PRATICADO VARCHAR(1)
|
||||
selar?: string; // SELAR VARCHAR(1)
|
||||
frenteverso?: string; // FRENTEVERSO VARCHAR(1)
|
||||
etiqueta_unica?: string; // ETIQUETA_UNICA VARCHAR(1)
|
||||
transferencia_veiculo?: string; // TRANSFERENCIA_VEICULO VARCHAR(1)
|
||||
usar_a4?: string; // USAR_A4 VARCHAR(1)
|
||||
averbacao?: string; // AVERBACAO VARCHAR(1)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Interface que representa a tabela T_TB_RECONHECIMENTOTIPO
|
||||
export interface TTbReconhecimentoTipoInterface {
|
||||
tb_reconhecimentotipo_id: number; // NUMERIC(10,2) NOT NULL - Chave primária
|
||||
descricao?: string; // VARCHAR(30)
|
||||
situacao?: string; // VARCHAR(1)
|
||||
tb_reconhecimentotipo_id: number; // NUMERIC(10,2) NOT NULL - Chave primária
|
||||
descricao?: string; // VARCHAR(30)
|
||||
situacao?: string; // VARCHAR(1)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export interface TTBReconhecimentoTipoReadInterface {
|
||||
tb_reconhecimentotipo_id?: number,
|
||||
descricao?: string
|
||||
}
|
||||
tb_reconhecimentotipo_id?: number;
|
||||
descricao?: string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,5 +11,4 @@ export interface TServicoEtiquetaFormValues {
|
|||
|
||||
/** Relacionamento com o tipo de serviço (FK) */
|
||||
servico_tipo_id?: number;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import z from "zod";
|
||||
import z from 'zod';
|
||||
|
||||
/**
|
||||
* Tipos utilitários para campos simples
|
||||
*/
|
||||
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 OneCharString = z.string().max(1, "Deve ter no máximo 1 caractere").optional();
|
||||
const RequiredString = z.string().min(1, "O campo é obrigatório");
|
||||
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 OneCharString = z.string().max(1, 'Deve ter no máximo 1 caractere').optional();
|
||||
const RequiredString = z.string().min(1, 'O campo é obrigatório');
|
||||
const OptionalNumber = z.number().optional();
|
||||
const RequiredNumber = z.number();
|
||||
|
||||
|
|
@ -15,10 +15,10 @@ const RequiredNumber = z.number();
|
|||
*/
|
||||
export const TServicoTipoSchema = z.object({
|
||||
// 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
|
||||
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(),
|
||||
|
||||
// Controle de flags (S/N)
|
||||
|
|
@ -46,7 +46,7 @@ export const TServicoTipoSchema = z.object({
|
|||
valor: OptionalNumber,
|
||||
maximo_pessoa: OptionalNumber,
|
||||
servico_caixa_id: OptionalNumber,
|
||||
emolumento_id: z.number().nullable(),
|
||||
emolumento_id: z.number().nullable(),
|
||||
emolumento_obrigatorio: z.number().nullable(),
|
||||
|
||||
// Relacionamentos e permissões
|
||||
|
|
|
|||
|
|
@ -9,12 +9,10 @@ import { CCaixaServicoReadInterface } from '../../_interfaces/CCaixaServicoReadI
|
|||
async function executeCCaixaServicoIndexService(data: CCaixaServicoReadInterface) {
|
||||
// Chama a função que realiza a requisição à API e aguarda a resposta
|
||||
const response = await CCaixaServicoIndexData(data);
|
||||
|
||||
|
||||
// Retorna a resposta obtida da requisição
|
||||
return response;
|
||||
}
|
||||
|
||||
// Exporta o serviço encapsulado pelo handler de erro, garantindo tratamento uniforme em caso de falhas
|
||||
export const CCaixaServicoIndexService = withClientErrorHandler(
|
||||
executeCCaixaServicoIndexService,
|
||||
);
|
||||
export const CCaixaServicoIndexService = withClientErrorHandler(executeCCaixaServicoIndexService);
|
||||
|
|
|
|||
|
|
@ -9,12 +9,10 @@ import { GEmolumentoReadInterface } from '../../_interfaces/GEmolumentoReadInter
|
|||
async function executeGEmolumentoIndexService(data: GEmolumentoReadInterface) {
|
||||
// Chama a função que realiza a requisição à API e aguarda a resposta
|
||||
const response = await GEmolumentoIndexData(data);
|
||||
|
||||
|
||||
// Retorna a resposta obtida da requisição
|
||||
return response;
|
||||
}
|
||||
|
||||
// Exporta o serviço encapsulado pelo handler de erro, garantindo tratamento uniforme em caso de falhas
|
||||
export const GEmolumentoIndexService = withClientErrorHandler(
|
||||
executeGEmolumentoIndexService,
|
||||
);
|
||||
export const GEmolumentoIndexService = withClientErrorHandler(executeGEmolumentoIndexService);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { GEmolumentoItemReadInterface } from '../../_interfaces/GEmolumentoItemR
|
|||
async function executeGEmolumentoItemValorService(data: GEmolumentoItemReadInterface) {
|
||||
// Chama a função que realiza a requisição à API e aguarda a resposta
|
||||
const response = await GEmolumentoItemValorData(data);
|
||||
|
||||
|
||||
// Retorna a resposta obtida da requisição
|
||||
return response;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,10 @@ import { GMarcacaoTipoReadInterface } from '../../_interfaces/GMarcacaoTipoReadI
|
|||
async function executeGMarcacaoTipoIndexService(data: GMarcacaoTipoReadInterface) {
|
||||
// Chama a função que realiza a requisição à API e aguarda a resposta
|
||||
const response = await GMarcacaoTipoIndexData(data);
|
||||
|
||||
|
||||
// Retorna a resposta obtida da requisição
|
||||
return response;
|
||||
}
|
||||
|
||||
// Exporta o serviço encapsulado pelo handler de erro, garantindo tratamento uniforme em caso de falhas
|
||||
export const GMarcacaoTipoIndexService = withClientErrorHandler(
|
||||
executeGMarcacaoTipoIndexService,
|
||||
);
|
||||
export const GMarcacaoTipoIndexService = withClientErrorHandler(executeGMarcacaoTipoIndexService);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import { TServicoEtiquetaInterface } from '../../_interfaces/TServicoEtiquetaInt
|
|||
|
||||
// Função assíncrona que executa o salvamento de um serviço etiqueta
|
||||
async function executeTServicoEtiquetaSaveService(data: TServicoEtiquetaInterface) {
|
||||
|
||||
// Chama a função que salva os dados do serviço etiqueta
|
||||
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
|
||||
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
|
||||
async function executeTServicoEtiquetaServicoIdService(data: TServicoEtiquetaInterface) {
|
||||
|
||||
// Chama a função que consulta os dados do tipo de serviço etiqueta
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
export const TServicoTipoSaveService = withClientErrorHandler(executeTServicoTipoSaveService);
|
||||
export const TServicoTipoSaveService = withClientErrorHandler(executeTServicoTipoSaveService);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { TTBReconhecimentoTipoReadInterface } from '../../_interfaces/TTBReconhe
|
|||
async function executeTTBReconhecimentoTipoIndexService(data: TTBReconhecimentoTipoReadInterface) {
|
||||
// Chama a função que realiza a requisição à API e aguarda a resposta
|
||||
const response = await TTBReconhecimentoTipoIndexData(data);
|
||||
|
||||
|
||||
// Retorna a resposta obtida da requisição
|
||||
return response;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,15 +56,11 @@ export default function RootLayout({
|
|||
<Breadcrumb>
|
||||
<BreadcrumbList>
|
||||
<BreadcrumbItem className="hidden md:block">
|
||||
<BreadcrumbLink href="#">
|
||||
Building Your Application
|
||||
</BreadcrumbLink>
|
||||
<BreadcrumbLink href="#">Building Your Application</BreadcrumbLink>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbSeparator className="hidden md:block" />
|
||||
<BreadcrumbItem>
|
||||
<BreadcrumbPage>
|
||||
Data Fetching
|
||||
</BreadcrumbPage>
|
||||
<BreadcrumbPage>Data Fetching</BreadcrumbPage>
|
||||
</BreadcrumbItem>
|
||||
</BreadcrumbList>
|
||||
</Breadcrumb>
|
||||
|
|
|
|||
|
|
@ -4,51 +4,47 @@ import useGUsuarioGetJWTHook from '@/shared/hooks/auth/useGUsuarioGetJWTHook';
|
|||
import { useEffect, useState } from 'react';
|
||||
|
||||
export default function Page() {
|
||||
const { userAuthenticated } = useGUsuarioGetJWTHook();
|
||||
const { userAuthenticated } = useGUsuarioGetJWTHook();
|
||||
|
||||
// Inicializa time como null para renderizar só no cliente
|
||||
const [time, setTime] = useState<Date | null>(null);
|
||||
// Inicializa time como null para renderizar só no cliente
|
||||
const [time, setTime] = useState<Date | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
setTime(new Date()); // define data inicial no cliente
|
||||
const interval = setInterval(() => setTime(new Date()), 1000);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
setTime(new Date()); // define data inicial no cliente
|
||||
const interval = setInterval(() => setTime(new Date()), 1000);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
|
||||
// Se ainda não temos a hora, renderiza nada para evitar mismatch
|
||||
if (!time || !userAuthenticated?.data) return null;
|
||||
// Se ainda não temos a hora, renderiza nada para evitar mismatch
|
||||
if (!time || !userAuthenticated?.data) return null;
|
||||
|
||||
const hours = time.getHours();
|
||||
const greeting =
|
||||
hours < 12 ? 'Bom dia' : hours < 18 ? 'Boa tarde' : 'Boa noite';
|
||||
const hours = time.getHours();
|
||||
const greeting = hours < 12 ? 'Bom dia' : hours < 18 ? 'Boa tarde' : 'Boa noite';
|
||||
|
||||
const formattedDate = time.toLocaleDateString('pt-BR', {
|
||||
weekday: 'long',
|
||||
day: '2-digit',
|
||||
month: 'long',
|
||||
});
|
||||
const formattedTime = time.toLocaleTimeString('pt-BR');
|
||||
const formattedDate = time.toLocaleDateString('pt-BR', {
|
||||
weekday: 'long',
|
||||
day: '2-digit',
|
||||
month: 'long',
|
||||
});
|
||||
const formattedTime = time.toLocaleTimeString('pt-BR');
|
||||
|
||||
return (
|
||||
<main className="fixed inset-0 flex flex-col items-center justify-center text-gray-800 overflow-hidden select-none">
|
||||
<section className="text-center max-w-md px-4">
|
||||
<h1 className="text-4xl font-bold mb-2">
|
||||
{greeting},{' '}
|
||||
<span className="text-blue-600">{userAuthenticated.data.nome}</span>{' '}
|
||||
👋
|
||||
</h1>
|
||||
return (
|
||||
<main className="fixed inset-0 flex flex-col items-center justify-center overflow-hidden text-gray-800 select-none">
|
||||
<section className="max-w-md px-4 text-center">
|
||||
<h1 className="mb-2 text-4xl font-bold">
|
||||
{greeting}, <span className="text-blue-600">{userAuthenticated.data.nome}</span> 👋
|
||||
</h1>
|
||||
|
||||
<p className="text-gray-600 text-sm mb-6">
|
||||
Hoje é <strong>{formattedDate}</strong>, {formattedTime}
|
||||
</p>
|
||||
<p className="mb-6 text-sm text-gray-600">
|
||||
Hoje é <strong>{formattedDate}</strong>, {formattedTime}
|
||||
</p>
|
||||
|
||||
<div className="rounded-2xl p-6">
|
||||
<p className="text-gray-700 leading-relaxed">
|
||||
Que bom ter você de volta! 🎉
|
||||
Aproveite o seu dia e continue alcançando seus objetivos.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
<div className="rounded-2xl p-6">
|
||||
<p className="leading-relaxed text-gray-700">
|
||||
Que bom ter você de volta! 🎉 Aproveite o seu dia e continue alcançando seus objetivos.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,123 +2,110 @@
|
|||
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogAction,
|
||||
AlertDialog,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogAction,
|
||||
} from '@/components/ui/alert-dialog';
|
||||
|
||||
import {
|
||||
InputOTP,
|
||||
InputOTPGroup,
|
||||
InputOTPSlot,
|
||||
} from '@/components/ui/input-otp';
|
||||
import { InputOTP, InputOTPGroup, InputOTPSlot } from '@/components/ui/input-otp';
|
||||
|
||||
interface ConfirmExclusionProps {
|
||||
isOpen: boolean;
|
||||
title: string;
|
||||
description?: string;
|
||||
expectedCode: string;
|
||||
confirmText?: string;
|
||||
cancelText?: string;
|
||||
onConfirm: () => void;
|
||||
onCancel: () => void;
|
||||
onResendCode: () => void; // Função para reenviar o código
|
||||
isOpen: boolean;
|
||||
title: string;
|
||||
description?: string;
|
||||
expectedCode: string;
|
||||
confirmText?: string;
|
||||
cancelText?: string;
|
||||
onConfirm: () => void;
|
||||
onCancel: () => void;
|
||||
onResendCode: () => void; // Função para reenviar o código
|
||||
}
|
||||
|
||||
export default function ConfirmExclusion({
|
||||
isOpen,
|
||||
title,
|
||||
description,
|
||||
expectedCode,
|
||||
confirmText = 'Continuar',
|
||||
cancelText = 'Cancelar',
|
||||
onConfirm,
|
||||
onCancel,
|
||||
onResendCode, // A função para reenvio do código
|
||||
isOpen,
|
||||
title,
|
||||
description,
|
||||
expectedCode,
|
||||
confirmText = 'Continuar',
|
||||
cancelText = 'Cancelar',
|
||||
onConfirm,
|
||||
onCancel,
|
||||
onResendCode, // A função para reenvio do código
|
||||
}: ConfirmExclusionProps) {
|
||||
const [code, setCode] = useState('');
|
||||
const [isValid, setIsValid] = useState(false);
|
||||
const [isResending, setIsResending] = useState(false); // Novo estado para controle de envio do código
|
||||
const [code, setCode] = useState('');
|
||||
const [isValid, setIsValid] = useState(false);
|
||||
const [isResending, setIsResending] = useState(false); // Novo estado para controle de envio do código
|
||||
|
||||
const handleChange = (value: string) => {
|
||||
setCode(value);
|
||||
setIsValid(value === expectedCode);
|
||||
};
|
||||
const handleChange = (value: string) => {
|
||||
setCode(value);
|
||||
setIsValid(value === expectedCode);
|
||||
};
|
||||
|
||||
const handleResendCode = async () => {
|
||||
setIsResending(true);
|
||||
try {
|
||||
await onResendCode(); // Chamando a função de reenvio
|
||||
} catch (error) {
|
||||
console.error("Erro ao reenviar código", error);
|
||||
} finally {
|
||||
setIsResending(false); // Resetando o estado de envio
|
||||
}
|
||||
};
|
||||
const handleResendCode = async () => {
|
||||
setIsResending(true);
|
||||
try {
|
||||
await onResendCode(); // Chamando a função de reenvio
|
||||
} catch (error) {
|
||||
console.error('Erro ao reenviar código', error);
|
||||
} finally {
|
||||
setIsResending(false); // Resetando o estado de envio
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<AlertDialog open={isOpen} onOpenChange={(open) => !open && onCancel()}>
|
||||
<AlertDialogContent className="max-w-lg mx-auto p-6">
|
||||
<AlertDialogHeader className="text-center">
|
||||
<AlertDialogTitle className="text-xl font-semibold text-center">{title}</AlertDialogTitle>
|
||||
{description && (
|
||||
<AlertDialogDescription className="mt-2 text-sm text-muted-foreground text-center">
|
||||
{description}
|
||||
</AlertDialogDescription>
|
||||
)}
|
||||
</AlertDialogHeader>
|
||||
return (
|
||||
<AlertDialog open={isOpen} onOpenChange={(open) => !open && onCancel()}>
|
||||
<AlertDialogContent className="mx-auto max-w-lg p-6">
|
||||
<AlertDialogHeader className="text-center">
|
||||
<AlertDialogTitle className="text-center text-xl font-semibold">{title}</AlertDialogTitle>
|
||||
{description && (
|
||||
<AlertDialogDescription className="text-muted-foreground mt-2 text-center text-sm">
|
||||
{description}
|
||||
</AlertDialogDescription>
|
||||
)}
|
||||
</AlertDialogHeader>
|
||||
|
||||
<div className="py-4 text-sm text-muted-foreground space-y-4">
|
||||
<div className="flex justify-center">
|
||||
<InputOTP
|
||||
maxLength={expectedCode.length}
|
||||
value={code}
|
||||
onChange={handleChange}
|
||||
>
|
||||
<InputOTPGroup className="flex gap-4">
|
||||
{expectedCode.split('').map((_, index) => (
|
||||
<InputOTPSlot
|
||||
key={index}
|
||||
index={index}
|
||||
className="w-12 h-12 text-center text-lg border-2 border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
))}
|
||||
</InputOTPGroup>
|
||||
</InputOTP>
|
||||
</div>
|
||||
<div className="text-muted-foreground space-y-4 py-4 text-sm">
|
||||
<div className="flex justify-center">
|
||||
<InputOTP maxLength={expectedCode.length} value={code} onChange={handleChange}>
|
||||
<InputOTPGroup className="flex gap-4">
|
||||
{expectedCode.split('').map((_, index) => (
|
||||
<InputOTPSlot
|
||||
key={index}
|
||||
index={index}
|
||||
className="h-12 w-12 rounded-lg border-2 border-gray-300 text-center text-lg focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
))}
|
||||
</InputOTPGroup>
|
||||
</InputOTP>
|
||||
</div>
|
||||
|
||||
{/* Botão "Reenviar Código" */}
|
||||
<div className="flex justify-center items-center text-center gap-2 mt-4">
|
||||
<AlertDialogDescription>
|
||||
Não recebeu o código?
|
||||
</AlertDialogDescription>
|
||||
<button
|
||||
onClick={handleResendCode}
|
||||
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>
|
||||
</div>
|
||||
</div>
|
||||
{/* Botão "Reenviar Código" */}
|
||||
<div className="mt-4 flex items-center justify-center gap-2 text-center">
|
||||
<AlertDialogDescription>Não recebeu o código?</AlertDialogDescription>
|
||||
<button
|
||||
onClick={handleResendCode}
|
||||
className={`cursor-pointer font-semibold text-blue-500 ${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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel onClick={onCancel} className="text-gray-600 hover:text-gray-800">
|
||||
{cancelText}
|
||||
</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
onClick={onConfirm}
|
||||
disabled={!isValid}
|
||||
>
|
||||
{confirmText}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
);
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel onClick={onCancel} className="text-gray-600 hover:text-gray-800">
|
||||
{cancelText}
|
||||
</AlertDialogCancel>
|
||||
<AlertDialogAction onClick={onConfirm} disabled={!isValid}>
|
||||
{confirmText}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useCallback, useState } from "react";
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
interface UseConfirmExclusionOptions {
|
||||
onConfirm?: () => void;
|
||||
|
|
@ -6,15 +6,19 @@ interface UseConfirmExclusionOptions {
|
|||
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 [code, setCode] = useState("");
|
||||
const [code, setCode] = useState('');
|
||||
const [isValid, setIsValid] = useState(false);
|
||||
|
||||
const openDialog = useCallback(() => setIsOpen(true), []);
|
||||
const closeDialog = useCallback(() => {
|
||||
setIsOpen(false);
|
||||
setCode(""); // limpa o código quando fecha
|
||||
setCode(''); // limpa o código quando fecha
|
||||
setIsValid(false);
|
||||
}, []);
|
||||
|
||||
|
|
@ -35,7 +39,7 @@ export function useConfirmExclusion({ onConfirm, onCancel, expectedCode }: UseCo
|
|||
setCode(value);
|
||||
setIsValid(value === expectedCode);
|
||||
},
|
||||
[expectedCode]
|
||||
[expectedCode],
|
||||
);
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -106,8 +106,8 @@ const data = {
|
|||
url: '/administrativo/pessoas/estados-civis',
|
||||
},
|
||||
{
|
||||
title: "Regimes/Comunhão",
|
||||
url: "/administrativo/pessoas/regimes-comunhao/",
|
||||
title: 'Regimes/Comunhão',
|
||||
url: '/administrativo/pessoas/regimes-comunhao/',
|
||||
},
|
||||
{
|
||||
title: 'Tipo de Medida',
|
||||
|
|
@ -130,12 +130,12 @@ const data = {
|
|||
url: '/administrativo/minutas/naturezas',
|
||||
},
|
||||
{
|
||||
title: "Censec/Tipo do Ato",
|
||||
url: "/administrativo/centrais/censec/tipos-atos"
|
||||
title: 'Censec/Tipo do Ato',
|
||||
url: '/administrativo/centrais/censec/tipos-atos',
|
||||
},
|
||||
{
|
||||
title: "Censec/Qualidades",
|
||||
url: "/administrativo/centrais/censec/qualidades"
|
||||
title: 'Censec/Qualidades',
|
||||
url: '/administrativo/centrais/censec/qualidades',
|
||||
},
|
||||
{
|
||||
title: 'Censec/Centrais',
|
||||
|
|
@ -146,14 +146,13 @@ const data = {
|
|||
url: '/administrativo/centrais/censec/naturezas-litigios',
|
||||
},
|
||||
{
|
||||
title: "Serviços/Tipos",
|
||||
url: "/cadastros/servicos-tipo/",
|
||||
title: 'Serviços/Tipos',
|
||||
url: '/cadastros/servicos-tipo/',
|
||||
},
|
||||
{
|
||||
title: "Atos/Partes Tipos",
|
||||
url: "/administrativo/atos/partes-tipos",
|
||||
title: 'Atos/Partes Tipos',
|
||||
url: '/administrativo/atos/partes-tipos',
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
@ -182,16 +181,12 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
|||
alt="Logo do site"
|
||||
width={100}
|
||||
height={100}
|
||||
className='rounded-lg'
|
||||
className="rounded-lg"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col gap-0.5 leading-none">
|
||||
<span className="font-semibold">
|
||||
Orius Tecnologia
|
||||
</span>
|
||||
<span className="">
|
||||
25.9.1
|
||||
</span>
|
||||
<span className="font-semibold">Orius Tecnologia</span>
|
||||
<span className="">25.9.1</span>
|
||||
</div>
|
||||
</a>
|
||||
</SidebarMenuButton>
|
||||
|
|
|
|||
|
|
@ -31,9 +31,7 @@ export function NavMain({
|
|||
}) {
|
||||
return (
|
||||
<SidebarGroup>
|
||||
<SidebarGroupLabel>
|
||||
SAAS
|
||||
</SidebarGroupLabel>
|
||||
<SidebarGroupLabel>SAAS</SidebarGroupLabel>
|
||||
<SidebarMenu>
|
||||
{items.map((item) => (
|
||||
<Collapsible
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@ export function NavProjects({
|
|||
|
||||
return (
|
||||
<SidebarGroup className="group-data-[collapsible=icon]:hidden">
|
||||
<SidebarGroupLabel>
|
||||
Escrituras
|
||||
</SidebarGroupLabel>
|
||||
<SidebarGroupLabel>Escrituras</SidebarGroupLabel>
|
||||
<SidebarMenu>
|
||||
{projects.map((item) => (
|
||||
<SidebarMenuItem key={item.name}>
|
||||
|
|
|
|||
|
|
@ -1,58 +1,51 @@
|
|||
"use client"
|
||||
'use client';
|
||||
|
||||
import * as React from "react"
|
||||
import { OTPInput, OTPInputContext } from "input-otp"
|
||||
import { MinusIcon } from "lucide-react"
|
||||
import * as React from 'react';
|
||||
import { OTPInput, OTPInputContext } from 'input-otp';
|
||||
import { MinusIcon } from 'lucide-react';
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
function InputOTP({
|
||||
className,
|
||||
containerClassName,
|
||||
...props
|
||||
}: React.ComponentProps<typeof OTPInput> & {
|
||||
containerClassName?: string
|
||||
containerClassName?: string;
|
||||
}) {
|
||||
return (
|
||||
<OTPInput
|
||||
data-slot="input-otp"
|
||||
containerClassName={cn(
|
||||
"flex items-center gap-2 has-disabled:opacity-50",
|
||||
containerClassName
|
||||
)}
|
||||
className={cn("disabled:cursor-not-allowed", className)}
|
||||
containerClassName={cn('flex items-center gap-2 has-disabled:opacity-50', containerClassName)}
|
||||
className={cn('disabled:cursor-not-allowed', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function InputOTPGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="input-otp-group"
|
||||
className={cn("flex items-center", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
<div data-slot="input-otp-group" className={cn('flex items-center', className)} {...props} />
|
||||
);
|
||||
}
|
||||
|
||||
function InputOTPSlot({
|
||||
index,
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<"div"> & {
|
||||
index: number
|
||||
}: React.ComponentProps<'div'> & {
|
||||
index: number;
|
||||
}) {
|
||||
const inputOTPContext = React.useContext(OTPInputContext)
|
||||
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}
|
||||
const inputOTPContext = React.useContext(OTPInputContext);
|
||||
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
|
||||
|
||||
return (
|
||||
<div
|
||||
data-slot="input-otp-slot"
|
||||
data-active={isActive}
|
||||
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]",
|
||||
className
|
||||
'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,
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
|
|
@ -63,15 +56,15 @@ function InputOTPSlot({
|
|||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
|
||||
function InputOTPSeparator({ ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div data-slot="input-otp-separator" role="separator" {...props}>
|
||||
<MinusIcon />
|
||||
</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',
|
||||
'group-data-[collapsible=icon]:hidden',
|
||||
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,
|
||||
)}
|
||||
{...props}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,28 @@
|
|||
"use client"
|
||||
'use client';
|
||||
|
||||
import * as React from "react"
|
||||
import * as SwitchPrimitive from "@radix-ui/react-switch"
|
||||
import * as React from 'react';
|
||||
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
function Switch({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SwitchPrimitive.Root>) {
|
||||
function Switch({ className, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root>) {
|
||||
return (
|
||||
<SwitchPrimitive.Root
|
||||
data-slot="switch"
|
||||
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",
|
||||
className
|
||||
'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,
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<SwitchPrimitive.Thumb
|
||||
data-slot="switch-thumb"
|
||||
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>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
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 (
|
||||
<div
|
||||
data-slot="table-container"
|
||||
className="relative w-full overflow-x-auto"
|
||||
>
|
||||
<div data-slot="table-container" className="relative w-full overflow-x-auto">
|
||||
<table
|
||||
data-slot="table"
|
||||
className={cn("w-full caption-bottom text-sm", className)}
|
||||
className={cn('w-full caption-bottom text-sm', className)}
|
||||
{...props}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
|
||||
return (
|
||||
<thead
|
||||
data-slot="table-header"
|
||||
className={cn("[&_tr]:border-b", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
|
||||
return <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 (
|
||||
<tbody
|
||||
data-slot="table-body"
|
||||
className={cn("[&_tr:last-child]:border-0", className)}
|
||||
className={cn('[&_tr:last-child]:border-0', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
|
||||
function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {
|
||||
return (
|
||||
<tfoot
|
||||
data-slot="table-footer"
|
||||
className={cn(
|
||||
"bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
|
||||
className
|
||||
)}
|
||||
className={cn('bg-muted/50 border-t font-medium [&>tr]:last:border-b-0', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
|
||||
function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
|
||||
return (
|
||||
<tr
|
||||
data-slot="table-row"
|
||||
className={cn(
|
||||
"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
|
||||
className
|
||||
'hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
|
||||
function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
|
||||
return (
|
||||
<th
|
||||
data-slot="table-head"
|
||||
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]",
|
||||
className
|
||||
'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,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
|
||||
function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
|
||||
return (
|
||||
<td
|
||||
data-slot="table-cell"
|
||||
className={cn(
|
||||
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
||||
className
|
||||
'p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function TableCaption({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<"caption">) {
|
||||
function TableCaption({ className, ...props }: React.ComponentProps<'caption'>) {
|
||||
return (
|
||||
<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}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
Table,
|
||||
TableHeader,
|
||||
TableBody,
|
||||
TableFooter,
|
||||
TableHead,
|
||||
TableRow,
|
||||
TableCell,
|
||||
TableCaption,
|
||||
}
|
||||
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
|
||||
|
|
|
|||
|
|
@ -1,97 +1,96 @@
|
|||
'use client';
|
||||
|
||||
import React from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import React from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
Command,
|
||||
CommandEmpty,
|
||||
CommandGroup,
|
||||
CommandInput,
|
||||
CommandItem,
|
||||
CommandList,
|
||||
} from "@/components/ui/command";
|
||||
import { FormControl } from "@/components/ui/form";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { CheckIcon, ChevronsUpDownIcon } from "lucide-react";
|
||||
import GetCapitalize from "@/shared/actions/text/GetCapitalize";
|
||||
import { useCCaixaServicoReadHook } from "@/app/(protected)/(cadastros)/cadastros/_hooks/c_caixa_servico/useCCaixaServicoReadHook";
|
||||
import { CCaixaServicoReadInterface } from "@/app/(protected)/(cadastros)/cadastros/_interfaces/CCaixaServicoReadInterface";
|
||||
Command,
|
||||
CommandEmpty,
|
||||
CommandGroup,
|
||||
CommandInput,
|
||||
CommandItem,
|
||||
CommandList,
|
||||
} from '@/components/ui/command';
|
||||
import { FormControl } from '@/components/ui/form';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { CheckIcon, ChevronsUpDownIcon } from 'lucide-react';
|
||||
import GetCapitalize from '@/shared/actions/text/GetCapitalize';
|
||||
import { useCCaixaServicoReadHook } from '@/app/(protected)/(cadastros)/cadastros/_hooks/c_caixa_servico/useCCaixaServicoReadHook';
|
||||
import { CCaixaServicoReadInterface } from '@/app/(protected)/(cadastros)/cadastros/_interfaces/CCaixaServicoReadInterface';
|
||||
|
||||
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 { cCaixaServico, fetchCCaixaServico } = useCCaixaServicoReadHook();
|
||||
// Busca os dados uma única vez ao montar
|
||||
React.useEffect(() => {
|
||||
const loadData = async () => {
|
||||
if (!cCaixaServico.length) {
|
||||
setIsLoading(true);
|
||||
await fetchCCaixaServico(cCaixaServicoReadParams);
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
const selected = cCaixaServico?.find(
|
||||
(item) => String(item.caixa_servico_id) === String(field.value)
|
||||
);
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
<PopoverTrigger asChild>
|
||||
<FormControl className="w-full">
|
||||
<Button
|
||||
variant="outline"
|
||||
role="combobox"
|
||||
aria-expanded={open}
|
||||
disabled={isLoading}
|
||||
className="justify-between cursor-pointer"
|
||||
>
|
||||
{isLoading
|
||||
? "Carregando..."
|
||||
: selected
|
||||
? GetCapitalize(selected.descricao)
|
||||
: "Selecione o serviço"}
|
||||
<ChevronsUpDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||
</Button>
|
||||
</FormControl>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-full p-0">
|
||||
<Command>
|
||||
<CommandInput placeholder="Buscar etiquetas/carimbos..." />
|
||||
<CommandList>
|
||||
<CommandEmpty>
|
||||
{isLoading ? "Carregando..." : "Nenhum resultado encontrado."}
|
||||
</CommandEmpty>
|
||||
<CommandGroup>
|
||||
{cCaixaServico?.map((item) => (
|
||||
<CommandItem
|
||||
className="cursor-pointer"
|
||||
key={item.caixa_servico_id}
|
||||
value={item.descricao?.toLowerCase() ?? ""}
|
||||
onSelect={() => {
|
||||
field.onChange(Number(item.caixa_servico_id)); // envia apenas o número
|
||||
setOpen(false);
|
||||
}}
|
||||
>
|
||||
<CheckIcon
|
||||
className={cn(
|
||||
"mr-2 h-4 w-4",
|
||||
String(field.value) === String(item.caixa_servico_id)
|
||||
? "opacity-100"
|
||||
: "opacity-0"
|
||||
)}
|
||||
/>
|
||||
{GetCapitalize(item.descricao)}
|
||||
</CommandItem>
|
||||
))}
|
||||
</CommandGroup>
|
||||
</CommandList>
|
||||
</Command>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
);
|
||||
const [open, setOpen] = React.useState(false);
|
||||
const [isLoading, setIsLoading] = React.useState(false);
|
||||
const { cCaixaServico, fetchCCaixaServico } = useCCaixaServicoReadHook();
|
||||
// Busca os dados uma única vez ao montar
|
||||
React.useEffect(() => {
|
||||
const loadData = async () => {
|
||||
if (!cCaixaServico.length) {
|
||||
setIsLoading(true);
|
||||
await fetchCCaixaServico(cCaixaServicoReadParams);
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
const selected = cCaixaServico?.find(
|
||||
(item) => String(item.caixa_servico_id) === String(field.value),
|
||||
);
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
<PopoverTrigger asChild>
|
||||
<FormControl className="w-full">
|
||||
<Button
|
||||
variant="outline"
|
||||
role="combobox"
|
||||
aria-expanded={open}
|
||||
disabled={isLoading}
|
||||
className="cursor-pointer justify-between"
|
||||
>
|
||||
{isLoading
|
||||
? 'Carregando...'
|
||||
: selected
|
||||
? GetCapitalize(selected.descricao)
|
||||
: 'Selecione o serviço'}
|
||||
<ChevronsUpDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||
</Button>
|
||||
</FormControl>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-full p-0">
|
||||
<Command>
|
||||
<CommandInput placeholder="Buscar etiquetas/carimbos..." />
|
||||
<CommandList>
|
||||
<CommandEmpty>
|
||||
{isLoading ? 'Carregando...' : 'Nenhum resultado encontrado.'}
|
||||
</CommandEmpty>
|
||||
<CommandGroup>
|
||||
{cCaixaServico?.map((item) => (
|
||||
<CommandItem
|
||||
className="cursor-pointer"
|
||||
key={item.caixa_servico_id}
|
||||
value={item.descricao?.toLowerCase() ?? ''}
|
||||
onSelect={() => {
|
||||
field.onChange(Number(item.caixa_servico_id)); // envia apenas o número
|
||||
setOpen(false);
|
||||
}}
|
||||
>
|
||||
<CheckIcon
|
||||
className={cn(
|
||||
'mr-2 h-4 w-4',
|
||||
String(field.value) === String(item.caixa_servico_id)
|
||||
? 'opacity-100'
|
||||
: 'opacity-0',
|
||||
)}
|
||||
/>
|
||||
{GetCapitalize(item.descricao)}
|
||||
</CommandItem>
|
||||
))}
|
||||
</CommandGroup>
|
||||
</CommandList>
|
||||
</Command>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import { useGUfReadHook } from '@/packages/administrativo/hooks/GUF/useGUfReadHo
|
|||
|
||||
import { GCidadeSchema } from '../../schemas/GCidade/GCidadeSchema';
|
||||
|
||||
|
||||
// Hook responsável em trazer todos os estados brasileiros
|
||||
|
||||
// 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)
|
||||
|
||||
import React from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import React from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
Command,
|
||||
CommandEmpty,
|
||||
CommandGroup,
|
||||
CommandInput,
|
||||
CommandItem,
|
||||
CommandList,
|
||||
} from "@/components/ui/command";
|
||||
import { FormControl } from "@/components/ui/form";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { CheckIcon, ChevronsUpDownIcon } from "lucide-react";
|
||||
import GetCapitalize from "@/shared/actions/text/GetCapitalize";
|
||||
import { useGEmolumentoReadHook } from "@/app/(protected)/(cadastros)/cadastros/_hooks/g_emolumento/useGEmolumentoReadHook";
|
||||
import { GEmolumentoReadInterface } from "@/app/(protected)/(cadastros)/cadastros/_interfaces/GEmolumentoReadInterface";
|
||||
|
||||
Command,
|
||||
CommandEmpty,
|
||||
CommandGroup,
|
||||
CommandInput,
|
||||
CommandItem,
|
||||
CommandList,
|
||||
} from '@/components/ui/command';
|
||||
import { FormControl } from '@/components/ui/form';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { CheckIcon, ChevronsUpDownIcon } from 'lucide-react';
|
||||
import GetCapitalize from '@/shared/actions/text/GetCapitalize';
|
||||
import { useGEmolumentoReadHook } from '@/app/(protected)/(cadastros)/cadastros/_hooks/g_emolumento/useGEmolumentoReadHook';
|
||||
import { GEmolumentoReadInterface } from '@/app/(protected)/(cadastros)/cadastros/_interfaces/GEmolumentoReadInterface';
|
||||
|
||||
// Tipagem das props do componente
|
||||
interface GEmolumentoSelectProps {
|
||||
sistema_id: number; // ID do sistema usado para buscar os emolumentos
|
||||
field: any; // Objeto de controle do react-hook-form
|
||||
onSelectChange?: (emolumento: { key: number; value: string }) => void; // Função callback opcional para disparar eventos externos
|
||||
className?: string; // Classe CSS opcional para customização
|
||||
sistema_id: number; // ID do sistema usado para buscar os emolumentos
|
||||
field: any; // Objeto de controle do react-hook-form
|
||||
onSelectChange?: (emolumento: { key: number; value: string }) => void; // Função callback opcional para disparar eventos externos
|
||||
className?: string; // Classe CSS opcional para customização
|
||||
}
|
||||
|
||||
|
||||
// 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
|
||||
const gEmolumentoReadParams: GEmolumentoReadInterface = { sistema_id };
|
||||
// Estados locais do componente
|
||||
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
|
||||
const [open, setOpen] = React.useState(false); // Controla abertura do popover
|
||||
const [isLoading, setIsLoading] = React.useState(false); // Exibe “Carregando...” enquanto busca dados
|
||||
// Hook responsável por buscar emolumentos no backend
|
||||
const { gEmolumento, fetchGEmolumento } = useGEmolumentoReadHook();
|
||||
|
||||
// Hook responsável por buscar emolumentos no backend
|
||||
const { gEmolumento, fetchGEmolumento } = useGEmolumentoReadHook();
|
||||
// Carrega os dados de emolumentos apenas uma vez ao montar o componente
|
||||
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
|
||||
React.useEffect(() => {
|
||||
const loadData = async () => {
|
||||
if (!gEmolumento.length) {
|
||||
setIsLoading(true);
|
||||
await fetchGEmolumento(gEmolumentoReadParams);
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
loadData();
|
||||
}, []); // ← executa apenas uma vez
|
||||
// Obtém o item selecionado com base no valor atual do campo
|
||||
const selected = gEmolumento?.find(
|
||||
(item) => Number(item.emolumento_id) === Number(field.value ?? 0),
|
||||
);
|
||||
|
||||
// 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
|
||||
const selected = gEmolumento?.find(
|
||||
(item) => Number(item.emolumento_id) === Number(field.value ?? 0)
|
||||
);
|
||||
{/* Í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) === */}
|
||||
<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
|
||||
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(
|
||||
"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>
|
||||
<CommandList>
|
||||
{/* Estado vazio ou carregando */}
|
||||
<CommandEmpty>
|
||||
{isLoading ? 'Carregando...' : 'Nenhum resultado encontrado.'}
|
||||
</CommandEmpty>
|
||||
|
||||
{/* === 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..." />
|
||||
{/* Grupo de opções */}
|
||||
<CommandGroup>
|
||||
{gEmolumento?.map((item) => (
|
||||
<CommandItem
|
||||
className="w-full cursor-pointer"
|
||||
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,
|
||||
};
|
||||
|
||||
<CommandList>
|
||||
{/* Estado vazio ou carregando */}
|
||||
<CommandEmpty>
|
||||
{isLoading ? "Carregando..." : "Nenhum resultado encontrado."}
|
||||
</CommandEmpty>
|
||||
// Atualiza o valor no react-hook-form com o ID numérico
|
||||
field.onChange(Number(item.emolumento_id ?? 0));
|
||||
|
||||
{/* Grupo de opções */}
|
||||
<CommandGroup>
|
||||
{gEmolumento?.map((item) => (
|
||||
<CommandItem
|
||||
className="cursor-pointer w-full"
|
||||
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,
|
||||
};
|
||||
// Dispara callback externo, se existir (mantém o objeto completo)
|
||||
if (onSelectChange)
|
||||
onSelectChange({
|
||||
key: Number(item.emolumento_id),
|
||||
value: item.descricao,
|
||||
});
|
||||
|
||||
// Atualiza o valor no react-hook-form com o ID numérico
|
||||
field.onChange(Number(item.emolumento_id ?? 0));
|
||||
|
||||
// Dispara callback externo, se existir (mantém o objeto completo)
|
||||
if (onSelectChange)
|
||||
onSelectChange({
|
||||
key: Number(item.emolumento_id),
|
||||
value: item.descricao,
|
||||
});
|
||||
|
||||
// Fecha o popover
|
||||
setOpen(false);
|
||||
}}
|
||||
|
||||
>
|
||||
{/* Ícone de seleção (check) */}
|
||||
<CheckIcon
|
||||
className={cn(
|
||||
"mr-2 h-4 w-4",
|
||||
String(field.value?.key ?? field.value) === String(item.emolumento_id)
|
||||
? "opacity-100"
|
||||
: "opacity-0"
|
||||
)}
|
||||
/>
|
||||
{/* Nome formatado do emolumento */}
|
||||
{GetCapitalize(item.descricao)}
|
||||
</CommandItem>
|
||||
))}
|
||||
</CommandGroup>
|
||||
</CommandList>
|
||||
</Command>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
);
|
||||
// Fecha o popover
|
||||
setOpen(false);
|
||||
}}
|
||||
>
|
||||
{/* Ícone de seleção (check) */}
|
||||
<CheckIcon
|
||||
className={cn(
|
||||
'mr-2 h-4 w-4',
|
||||
String(field.value?.key ?? field.value) === String(item.emolumento_id)
|
||||
? 'opacity-100'
|
||||
: 'opacity-0',
|
||||
)}
|
||||
/>
|
||||
{/* Nome formatado do emolumento */}
|
||||
{GetCapitalize(item.descricao)}
|
||||
</CommandItem>
|
||||
))}
|
||||
</CommandGroup>
|
||||
</CommandList>
|
||||
</Command>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,102 +1,101 @@
|
|||
'use client';
|
||||
|
||||
import React from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import React from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
Command,
|
||||
CommandEmpty,
|
||||
CommandGroup,
|
||||
CommandInput,
|
||||
CommandItem,
|
||||
CommandList,
|
||||
} from "@/components/ui/command";
|
||||
import { FormControl } from "@/components/ui/form";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { CheckIcon, ChevronsUpDownIcon } from "lucide-react";
|
||||
import GetCapitalize from "@/shared/actions/text/GetCapitalize";
|
||||
import { useGMarcacaoTipoReadHook } from "@/app/(protected)/(cadastros)/cadastros/_hooks/g_marcacao_tipo/useGMarcacaoTipoReadHook";
|
||||
import { GMarcacaoTipoReadInterface } from "@/app/(protected)/(cadastros)/cadastros/_interfaces/GMarcacaoTipoReadInterface";
|
||||
Command,
|
||||
CommandEmpty,
|
||||
CommandGroup,
|
||||
CommandInput,
|
||||
CommandItem,
|
||||
CommandList,
|
||||
} from '@/components/ui/command';
|
||||
import { FormControl } from '@/components/ui/form';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { CheckIcon, ChevronsUpDownIcon } from 'lucide-react';
|
||||
import GetCapitalize from '@/shared/actions/text/GetCapitalize';
|
||||
import { useGMarcacaoTipoReadHook } from '@/app/(protected)/(cadastros)/cadastros/_hooks/g_marcacao_tipo/useGMarcacaoTipoReadHook';
|
||||
import { GMarcacaoTipoReadInterface } from '@/app/(protected)/(cadastros)/cadastros/_interfaces/GMarcacaoTipoReadInterface';
|
||||
|
||||
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 { gMarcacaoTipo, fetchGMarcacaoTipo } = useGMarcacaoTipoReadHook();
|
||||
// Busca os dados uma única vez ao montar
|
||||
React.useEffect(() => {
|
||||
const loadData = async () => {
|
||||
if (!gMarcacaoTipo.length) {
|
||||
setIsLoading(true);
|
||||
await fetchGMarcacaoTipo(gMarcacaoTipoReadParams);
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
const selected = gMarcacaoTipo?.find(
|
||||
(item) => String(item.marcacao_tipo_id) === String(field.value)
|
||||
);
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
<PopoverTrigger asChild>
|
||||
<FormControl className="w-full">
|
||||
<Button
|
||||
variant="outline"
|
||||
role="combobox"
|
||||
aria-expanded={open}
|
||||
disabled={isLoading}
|
||||
className="justify-between cursor-pointer"
|
||||
>
|
||||
{isLoading
|
||||
? "Carregando..."
|
||||
: field.value && typeof field.value === 'object' && field.value.value
|
||||
? GetCapitalize(field.value.value) // Exibe a descrição do objeto
|
||||
: field.value && typeof field.value !== 'object'
|
||||
? field.value // Se for um ID (valor antigo), exibe ele
|
||||
: "Selecione a etiqueta/carimbo"}
|
||||
<ChevronsUpDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||
</Button>
|
||||
</FormControl>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-full p-0">
|
||||
<Command>
|
||||
<CommandInput placeholder="Buscar etiquetas/carimbos..." />
|
||||
<CommandList>
|
||||
<CommandEmpty>
|
||||
{isLoading ? "Carregando..." : "Nenhum resultado encontrado."}
|
||||
</CommandEmpty>
|
||||
<CommandGroup>
|
||||
{gMarcacaoTipo?.map((item) => (
|
||||
<CommandItem
|
||||
className="cursor-pointer"
|
||||
key={item.marcacao_tipo_id}
|
||||
value={item.descricao?.toLowerCase() ?? ""}
|
||||
onSelect={() => {
|
||||
field.onChange({
|
||||
key: Number(item.marcacao_tipo_id),
|
||||
value: item.descricao,
|
||||
});
|
||||
setOpen(false);
|
||||
}}
|
||||
>
|
||||
<CheckIcon
|
||||
className={cn(
|
||||
"mr-2 h-4 w-4",
|
||||
String(field.value) === String(item.marcacao_tipo_id)
|
||||
? "opacity-100"
|
||||
: "opacity-0"
|
||||
)}
|
||||
/>
|
||||
{GetCapitalize(item.descricao)}
|
||||
</CommandItem>
|
||||
))}
|
||||
</CommandGroup>
|
||||
</CommandList>
|
||||
</Command>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
);
|
||||
const [open, setOpen] = React.useState(false);
|
||||
const [isLoading, setIsLoading] = React.useState(false);
|
||||
const { gMarcacaoTipo, fetchGMarcacaoTipo } = useGMarcacaoTipoReadHook();
|
||||
// Busca os dados uma única vez ao montar
|
||||
React.useEffect(() => {
|
||||
const loadData = async () => {
|
||||
if (!gMarcacaoTipo.length) {
|
||||
setIsLoading(true);
|
||||
await fetchGMarcacaoTipo(gMarcacaoTipoReadParams);
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
const selected = gMarcacaoTipo?.find(
|
||||
(item) => String(item.marcacao_tipo_id) === String(field.value),
|
||||
);
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
<PopoverTrigger asChild>
|
||||
<FormControl className="w-full">
|
||||
<Button
|
||||
variant="outline"
|
||||
role="combobox"
|
||||
aria-expanded={open}
|
||||
disabled={isLoading}
|
||||
className="cursor-pointer justify-between"
|
||||
>
|
||||
{isLoading
|
||||
? 'Carregando...'
|
||||
: field.value && typeof field.value === 'object' && field.value.value
|
||||
? GetCapitalize(field.value.value) // Exibe a descrição do objeto
|
||||
: field.value && typeof field.value !== 'object'
|
||||
? field.value // Se for um ID (valor antigo), exibe ele
|
||||
: 'Selecione a etiqueta/carimbo'}
|
||||
<ChevronsUpDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||
</Button>
|
||||
</FormControl>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-full p-0">
|
||||
<Command>
|
||||
<CommandInput placeholder="Buscar etiquetas/carimbos..." />
|
||||
<CommandList>
|
||||
<CommandEmpty>
|
||||
{isLoading ? 'Carregando...' : 'Nenhum resultado encontrado.'}
|
||||
</CommandEmpty>
|
||||
<CommandGroup>
|
||||
{gMarcacaoTipo?.map((item) => (
|
||||
<CommandItem
|
||||
className="cursor-pointer"
|
||||
key={item.marcacao_tipo_id}
|
||||
value={item.descricao?.toLowerCase() ?? ''}
|
||||
onSelect={() => {
|
||||
field.onChange({
|
||||
key: Number(item.marcacao_tipo_id),
|
||||
value: item.descricao,
|
||||
});
|
||||
setOpen(false);
|
||||
}}
|
||||
>
|
||||
<CheckIcon
|
||||
className={cn(
|
||||
'mr-2 h-4 w-4',
|
||||
String(field.value) === String(item.marcacao_tipo_id)
|
||||
? 'opacity-100'
|
||||
: 'opacity-0',
|
||||
)}
|
||||
/>
|
||||
{GetCapitalize(item.descricao)}
|
||||
</CommandItem>
|
||||
))}
|
||||
</CommandGroup>
|
||||
</CommandList>
|
||||
</Command>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import { useGMedidaTipoRemoveHook } from '../../hooks/GMedidaTipo/useGMedidaTipo
|
|||
import { useGMedidaTipoSaveHook } from '../../hooks/GMedidaTipo/useGMedidaTipoSaveHook';
|
||||
import { GMedidaTipoInterface } from '../../interfaces/GMedidaTipo/GMedidaTipoInterface';
|
||||
|
||||
|
||||
const initialMedidaTipo: GMedidaTipoInterface = {
|
||||
medida_tipo_id: 0,
|
||||
sigla: '',
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
|
||||
|
||||
import { useGNaturezaDeleteHook } from '@/packages/administrativo/hooks/GNatureza/useGNaturezaDeleteHook';
|
||||
import { useGNaturezaIndexHook } from '@/packages/administrativo/hooks/GNatureza/useGNaturezaIndexHook';
|
||||
import { useGNaturezaSaveHook } from '@/packages/administrativo/hooks/GNatureza/useGNaturezaSaveHook';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import GTBBairroForm from './GTBBairroForm';
|
|||
import GTBBairroTable from './GTBBairroTable';
|
||||
import { GTBBairroInterface } from '../../interfaces/GTBBairro/GTBBairroInterface';
|
||||
|
||||
|
||||
const initialBairro: GTBBairroInterface = {
|
||||
sistema_id: null,
|
||||
tb_bairro_id: 0,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
|||
|
||||
import { GTBBairroInterface } from '../../interfaces/GTBBairro/GTBBairroInterface';
|
||||
|
||||
|
||||
interface GTBBairroTableProps {
|
||||
data: GTBBairroInterface[];
|
||||
onEdit: (item: GTBBairroInterface, isEditingFormStatus: boolean) => void;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import { useGTBEstadoCivilRemoveHook } from '../../hooks/GTBEstadoCivil/useGTBEs
|
|||
import { useGTBEstadoCivilSaveHook } from '../../hooks/GTBEstadoCivil/useGTBEstadoCivilSaveHook';
|
||||
import { GTBEstadoCivilInterface } from '../../interfaces/GTBEstadoCivil/GTBEstadoCivilInterface';
|
||||
|
||||
|
||||
const initalEstadoCivil: GTBEstadoCivilInterface = {
|
||||
tb_estadocivil_id: 0,
|
||||
sistema_id: 0,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import { Input } from '@/components/ui/input';
|
|||
import { Label } from '@/components/ui/label';
|
||||
import { GTBRegimeBensSchema } from '@/packages/administrativo/schemas/GTBRegimeBens/GTBRegimeBensSchema';
|
||||
|
||||
|
||||
type FormValues = z.infer<typeof GTBRegimeBensSchema>;
|
||||
|
||||
interface Props {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import { useGTBRegimeComunhaoRemoveHook } from '../../hooks/GTBRegimeComunhao/us
|
|||
import { useGTBRegimeComunhaoSaveHook } from '../../hooks/GTBRegimeComunhao/useGTBRegimeComunhaoSaveHook';
|
||||
import GTBRegimeComunhaoInterface from '../../interfaces/GTBRegimeComunhao/GTBRegimeComunhaoInterface';
|
||||
|
||||
|
||||
export default function GTBRegimeComunhaoIndex() {
|
||||
// Hooks para leitura e salvamento
|
||||
const { gTBRegimeComunhao, fetchGTBRegimeComunhao } = useGTBRegimeComunhaoReadHook();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import { useGTBTipoLogradouroRemoveHook } from '../../hooks/GTBTipoLogradouro/us
|
|||
import { useGTBTipoLogradouroSaveHook } from '../../hooks/GTBTipoLogradouro/useGTBTipoLogradouroSaveHook';
|
||||
import { GTBTipoLogradouroInterface } from '../../interfaces/GTBTipoLogradouro/GTBTipoLogradouroInterface';
|
||||
|
||||
|
||||
export default function GTBTipoLogradouroIndex() {
|
||||
// Controle de exibição de respostas
|
||||
const { setResponse } = useResponse();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
|
||||
|
||||
import { useTAtoParteTipoDeleteHook } from '@/packages/administrativo/hooks/TAtoParteTipo/useTAtoParteTipoDeleteHook';
|
||||
import { useTAtoParteTipoIndexHook } from '@/packages/administrativo/hooks/TAtoParteTipo/useTAtoParteTipoIndexHook';
|
||||
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 TCensecInterface from '../../interfaces/TCensec/TCensecInterface';
|
||||
|
||||
|
||||
export default function TCensecIndex() {
|
||||
// Controle de estado do botão
|
||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import TCensecNaturezaLitigioForm from './TCensecNaturezaLitigioForm';
|
|||
import TCensecNaturezaLitigioTable from './TCensecNaturezaLitigioTable';
|
||||
import { TCensecNaturezaLitigioInterface } from '../../interfaces/TCensecNaturezaLitigio/TCensecNaturezaLitigioInterface';
|
||||
|
||||
|
||||
const initialCensecNaturezaLitigio: TCensecNaturezaLitigioInterface = {
|
||||
censec_naturezalitigio_id: 0,
|
||||
descricao: '',
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import SituacoesSelect from '@/shared/components/situacoes/SituacoesSelect';
|
|||
import { useTCensecQualidadeFormHook } from '../../hooks/TCensecQualidade/useTCensecQualidadeHook';
|
||||
import { TCensecQualidadeFormInterface } from '../../interfaces/TCensecQualidade/TCensecQualidadeFormInterface';
|
||||
|
||||
|
||||
export default function TCensecQualidadeForm({
|
||||
isOpen,
|
||||
data,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
|
||||
|
||||
import { useTCensecQualidadeDeleteHook } from '@/packages/administrativo/hooks/TCensecQualidade/useTCensecQualidadeDeleteHook';
|
||||
import { useTCensecQualidadeIndexHook } from '@/packages/administrativo/hooks/TCensecQualidade/useTCensecQualidadeIndexHook';
|
||||
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