@orbe-agro/client-core 5.3.98 → 5.3.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@ecme/auth/AuthProvider.js +41 -40
- package/dist/@ecme/auth/AuthProvider.js.map +1 -1
- package/dist/@ecme/store/authStore.js +22 -20
- package/dist/@ecme/store/authStore.js.map +1 -1
- package/dist/@types/@ecme/@types/auth.d.ts +2 -0
- package/dist/@types/@ecme/@types/auth.d.ts.map +1 -1
- package/dist/@types/@ecme/auth/AuthProvider.d.ts.map +1 -1
- package/dist/@types/@ecme/store/authStore.d.ts.map +1 -1
- package/dist/@types/base/@types/forms/commodities/contratoBiodiesel/index.d.ts +2 -0
- package/dist/@types/base/@types/forms/commodities/contratoBiodiesel/index.d.ts.map +1 -1
- package/dist/@types/base/@types/forms/index.d.ts +2 -0
- package/dist/@types/base/@types/forms/index.d.ts.map +1 -1
- package/dist/@types/base/@types/models/adm/user.d.ts +5 -0
- package/dist/@types/base/@types/models/adm/user.d.ts.map +1 -1
- package/dist/@types/base/@types/models/transportadora/material.d.ts +3 -6
- package/dist/@types/base/@types/models/transportadora/material.d.ts.map +1 -1
- package/dist/@types/base/@types/models/transportadora/municipio.d.ts +1 -1
- package/dist/@types/base/@types/models/transportadora/municipio.d.ts.map +1 -1
- package/dist/@types/base/@types/models/transportadora/ordemCarregamento.d.ts +43 -27
- package/dist/@types/base/@types/models/transportadora/ordemCarregamento.d.ts.map +1 -1
- package/dist/@types/base/@types/models/transportadora/veiculo.d.ts +2 -2
- package/dist/@types/base/@types/models/transportadora/veiculo.d.ts.map +1 -1
- package/dist/@types/base/@types/models/user.d.ts +5 -0
- package/dist/@types/base/@types/models/user.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/adm/adm.d.ts +1 -0
- package/dist/@types/base/configs/endpoints.config/adm/adm.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/adm/config/users.d.ts +1 -0
- package/dist/@types/base/configs/endpoints.config/adm/config/users.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/dm/config/businessPartner.d.ts +12 -0
- package/dist/@types/base/configs/endpoints.config/dm/config/businessPartner.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/dm/dm.d.ts +12 -0
- package/dist/@types/base/configs/endpoints.config/dm/dm.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts +13 -0
- package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts.map +1 -1
- package/dist/@types/base/hooks/dm/businessPartner/useBusinessPartnerFuncoesParceirosClientesList.d.ts +13 -0
- package/dist/@types/base/hooks/dm/businessPartner/useBusinessPartnerFuncoesParceirosClientesList.d.ts.map +1 -0
- package/dist/@types/base/hooks/dm/businessPartner/useBusinessPartnerFuncoesParceirosFornecedoresList.d.ts +13 -0
- package/dist/@types/base/hooks/dm/businessPartner/useBusinessPartnerFuncoesParceirosFornecedoresList.d.ts.map +1 -0
- package/dist/@types/base/hooks/dm/businessPartner/useVendedoresAKARepresentantesVendasList.d.ts +13 -0
- package/dist/@types/base/hooks/dm/businessPartner/useVendedoresAKARepresentantesVendasList.d.ts.map +1 -0
- package/dist/@types/base/hooks/index.d.ts +4 -1
- package/dist/@types/base/hooks/index.d.ts.map +1 -1
- package/dist/@types/base/services/modules/AdmService.d.ts +2 -0
- package/dist/@types/base/services/modules/AdmService.d.ts.map +1 -1
- package/dist/@types/base/services/modules/dm/businessPartner/BusinessPartnerService.d.ts +3 -0
- package/dist/@types/base/services/modules/dm/businessPartner/BusinessPartnerService.d.ts.map +1 -1
- package/dist/base/configs/endpoints.config/adm/config/users.js +4 -3
- package/dist/base/configs/endpoints.config/adm/config/users.js.map +1 -1
- package/dist/base/configs/endpoints.config/dm/config/businessPartner.js +4 -1
- package/dist/base/configs/endpoints.config/dm/config/businessPartner.js.map +1 -1
- package/dist/base/hooks/dm/businessPartner/useBusinessPartnerFuncoesParceirosClientesList.js +26 -0
- package/dist/base/hooks/dm/businessPartner/useBusinessPartnerFuncoesParceirosClientesList.js.map +1 -0
- package/dist/base/hooks/dm/businessPartner/useBusinessPartnerFuncoesParceirosFornecedoresList.js +26 -0
- package/dist/base/hooks/dm/businessPartner/useBusinessPartnerFuncoesParceirosFornecedoresList.js.map +1 -0
- package/dist/base/hooks/dm/businessPartner/useVendedoresAKARepresentantesVendasList.js +26 -0
- package/dist/base/hooks/dm/businessPartner/useVendedoresAKARepresentantesVendasList.js.map +1 -0
- package/dist/base/hooks/index.js +89 -83
- package/dist/base/hooks/index.js.map +1 -1
- package/dist/base/index.js +481 -471
- package/dist/base/index.js.map +1 -1
- package/dist/base/services/index.js +380 -376
- package/dist/base/services/modules/AdmService.js +10 -6
- package/dist/base/services/modules/AdmService.js.map +1 -1
- package/dist/base/services/modules/dm/businessPartner/BusinessPartnerService.js +61 -35
- package/dist/base/services/modules/dm/businessPartner/BusinessPartnerService.js.map +1 -1
- package/dist/base/services/modules/dm/index.js +71 -68
- package/dist/base/services/modules/index.js +379 -375
- package/lib/@ecme/@types/auth.ts +3 -0
- package/lib/@ecme/auth/AuthProvider.tsx +4 -2
- package/lib/@ecme/store/authStore.ts +2 -0
- package/lib/base/@types/forms/commodities/contratoBiodiesel/index.ts +2 -0
- package/lib/base/@types/forms/index.ts +2 -0
- package/lib/base/@types/models/adm/user.ts +6 -0
- package/lib/base/@types/models/transportadora/material.ts +3 -8
- package/lib/base/@types/models/transportadora/municipio.ts +1 -1
- package/lib/base/@types/models/transportadora/ordemCarregamento.ts +48 -26
- package/lib/base/@types/models/transportadora/veiculo.ts +2 -2
- package/lib/base/@types/models/user.ts +6 -0
- package/lib/base/configs/endpoints.config/adm/config/users.ts +1 -0
- package/lib/base/configs/endpoints.config/dm/config/businessPartner.ts +3 -0
- package/lib/base/hooks/dm/businessPartner/useBusinessPartnerFuncoesParceirosClientesList.tsx +33 -0
- package/lib/base/hooks/dm/businessPartner/useBusinessPartnerFuncoesParceirosFornecedoresList.tsx +33 -0
- package/lib/base/hooks/dm/businessPartner/useVendedoresAKARepresentantesVendasList.tsx +34 -0
- package/lib/base/hooks/index.ts +4 -1
- package/lib/base/services/modules/AdmService.ts +8 -0
- package/lib/base/services/modules/dm/businessPartner/BusinessPartnerService.ts +30 -0
- package/package.json +1 -1
package/lib/@ecme/@types/auth.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TVinculosUsuario } from "@base/@types/models/adm/user"
|
|
2
|
+
|
|
1
3
|
export type SignInCredential = {
|
|
2
4
|
username: string
|
|
3
5
|
password: string
|
|
@@ -43,6 +45,7 @@ export type User = {
|
|
|
43
45
|
authority?: string[]
|
|
44
46
|
primeiroAcesso?: boolean
|
|
45
47
|
funcionalidades?: string[]
|
|
48
|
+
vinculosUsuario?: TVinculosUsuario | null
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
export type Token = {
|
|
@@ -12,7 +12,7 @@ import { useSessionUser, useToken } from "@/store/authStore";
|
|
|
12
12
|
import { ReactNode, Ref, useImperativeHandle, useRef } from "react";
|
|
13
13
|
import { NavigateFunction, useNavigate } from "react-router-dom";
|
|
14
14
|
import AuthContext from "./AuthContext";
|
|
15
|
-
import { apiFetchUserFuncionalidades } from "@base/services";
|
|
15
|
+
import { apiFetchUserFuncionalidades, apiFetchUserVinculosUsuario } from "@base/services";
|
|
16
16
|
|
|
17
17
|
type AuthProviderProps = { children: ReactNode };
|
|
18
18
|
|
|
@@ -77,12 +77,14 @@ function AuthProvider({ children }: AuthProviderProps) {
|
|
|
77
77
|
if (resp) {
|
|
78
78
|
handleSignIn({ accessToken: resp.jwtToken });
|
|
79
79
|
const funcionalidades = await apiFetchUserFuncionalidades(resp.id);
|
|
80
|
+
const vinculosUsuario = await apiFetchUserVinculosUsuario(resp.id);
|
|
80
81
|
|
|
81
82
|
const newUser = {
|
|
82
83
|
userId: resp.id.toString(),
|
|
83
84
|
userName: resp.nome,
|
|
84
85
|
primeiroAcesso: resp.primeiroAcesso,
|
|
85
|
-
authority: funcionalidades
|
|
86
|
+
authority: funcionalidades,
|
|
87
|
+
vinculosUsuario: vinculosUsuario
|
|
86
88
|
};
|
|
87
89
|
setUser(newUser);
|
|
88
90
|
redirect(newUser);
|
|
@@ -41,6 +41,7 @@ const initialState: AuthState = {
|
|
|
41
41
|
email: '',
|
|
42
42
|
authority: [],
|
|
43
43
|
funcionalidades: [],
|
|
44
|
+
vinculosUsuario: null
|
|
44
45
|
},
|
|
45
46
|
}
|
|
46
47
|
|
|
@@ -62,6 +63,7 @@ export const useSessionUser = create<AuthState & AuthAction>()(
|
|
|
62
63
|
...payload,
|
|
63
64
|
funcionalidades:
|
|
64
65
|
payload.funcionalidades || state.user.funcionalidades,
|
|
66
|
+
vinculosUsuario: payload.vinculosUsuario || state.user.vinculosUsuario,
|
|
65
67
|
},
|
|
66
68
|
})),
|
|
67
69
|
}),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TUser } from '@base/@types/models/adm/user';
|
|
1
2
|
import { TBusinessPartner } from '@base/@types/models/dm/businessPartner';
|
|
2
3
|
import { TProduto } from '@base/@types/models/dm/produto';
|
|
3
4
|
import type { Control, FieldErrors, FieldValues, UseFormGetValues, UseFormRegister, UseFormSetValue, UseFormWatch } from 'react-hook-form';
|
|
@@ -7,6 +8,7 @@ export interface IFormSectionBaseProps<T extends FieldValues> {
|
|
|
7
8
|
errors: FieldErrors<T>;
|
|
8
9
|
getValues?: UseFormGetValues<T>;
|
|
9
10
|
setValue?: UseFormSetValue<T>;
|
|
11
|
+
user?: TUser | null;
|
|
10
12
|
isView?: boolean;
|
|
11
13
|
index?: number;
|
|
12
14
|
watch?: UseFormWatch<T>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Control, FieldErrors, FieldValues, UseFormGetValues, UseFormRegister, UseFormSetValue, UseFormWatch } from 'react-hook-form';
|
|
2
|
+
import { TUser } from '../models/adm/user';
|
|
2
3
|
|
|
3
4
|
export interface IFormSectionBaseProps<T extends FieldValues> {
|
|
4
5
|
control: Control<T>
|
|
@@ -7,6 +8,7 @@ export interface IFormSectionBaseProps<T extends FieldValues> {
|
|
|
7
8
|
getValues?: UseFormGetValues<T>;
|
|
8
9
|
setValue?: UseFormSetValue<T>
|
|
9
10
|
isView?: boolean
|
|
11
|
+
user?: TUser | null;
|
|
10
12
|
index?: number
|
|
11
13
|
watch?: UseFormWatch<T>
|
|
12
14
|
register?: UseFormRegister<T>
|
|
@@ -9,6 +9,7 @@ export type TUser = {
|
|
|
9
9
|
celular?: string
|
|
10
10
|
empresa?: string
|
|
11
11
|
roles?: TRoles[] | null
|
|
12
|
+
vinculosUsuario?: TVinculosUsuario | null
|
|
12
13
|
ativo?: boolean
|
|
13
14
|
primeiroLogin?: boolean
|
|
14
15
|
selecionaDeposito?: boolean
|
|
@@ -20,3 +21,8 @@ export type TRoles = {
|
|
|
20
21
|
name: string
|
|
21
22
|
descricao: string
|
|
22
23
|
}
|
|
24
|
+
|
|
25
|
+
export type TVinculosUsuario = {
|
|
26
|
+
id?: number
|
|
27
|
+
vendedorId?: number | null
|
|
28
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TCliente } from "../dm/businessPartner";
|
|
1
|
+
import { TCliente, TBusinessPartner } from "../dm/businessPartner";
|
|
2
2
|
import { TCarga } from "./carga";
|
|
3
3
|
import { TMaterial } from "./material";
|
|
4
4
|
import { TMotorista } from "./motorista";
|
|
@@ -16,42 +16,64 @@ export type TDadosComplementaresOrdemCarregamento = {
|
|
|
16
16
|
quantidadeTempoTransportouParaAEmpresa?: string,
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export type
|
|
19
|
+
export type TCargaOrdemCarregamento = {
|
|
20
20
|
peso: number,
|
|
21
21
|
preco: number,
|
|
22
|
+
produtoId: number,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type TContatoOrdemCarregamento = {
|
|
26
|
+
id?: number,
|
|
27
|
+
nome: string,
|
|
28
|
+
tipoContato: number,
|
|
29
|
+
tipoRetorno: number,
|
|
30
|
+
descricao: string
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
export type TOrdemCarregamento = {
|
|
25
34
|
id?: number | undefined,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
formCidadeOrigem: TMunicipio,
|
|
35
|
+
status?: string,
|
|
36
|
+
dtCadastro?: Date,
|
|
37
|
+
veiculoIds: number[],
|
|
38
|
+
motoristaId: number,
|
|
39
|
+
proprietarioId: number,
|
|
40
|
+
// Campos de localização
|
|
33
41
|
cidadeOrigem: string,
|
|
34
42
|
ufOrigem: string,
|
|
35
|
-
formCidadeDestino: TMunicipio,
|
|
36
43
|
cidadeDestino: string,
|
|
37
44
|
ufDestino: string,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
viagemPedagioTagEmissorId: string,
|
|
45
|
-
tipoCarga: string,
|
|
46
|
-
formTipo: string,
|
|
45
|
+
// Campos de consulta
|
|
46
|
+
consultaBuonny?: string,
|
|
47
|
+
consultaVerttice?: string,
|
|
48
|
+
laudoGuep?: string,
|
|
49
|
+
referenciaGuep?: string,
|
|
50
|
+
// Dados complementares
|
|
47
51
|
tipoCargaBuonny: string,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
observacao?: string,
|
|
53
|
+
cargas: TCargaOrdemCarregamento[],
|
|
54
|
+
contatos?: TContatoOrdemCarregamento[],
|
|
51
55
|
dadosComplementares?: TDadosComplementaresOrdemCarregamento,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
ticketId?: number,
|
|
57
|
+
ativo?: boolean,
|
|
58
|
+
// Campos do formulário (mantidos para compatibilidade com o form)
|
|
59
|
+
produto?: TMaterial,
|
|
60
|
+
empresa?: TCliente,
|
|
61
|
+
proprietario?: TBusinessPartner,
|
|
62
|
+
motorista?: TMotorista,
|
|
63
|
+
localCarregamento?: string,
|
|
64
|
+
veiculos?: TVeiculo[] | undefined,
|
|
65
|
+
formCidadeOrigem?: TMunicipio,
|
|
66
|
+
formCidadeDestino?: TMunicipio,
|
|
67
|
+
dtCarregamento?: string,
|
|
68
|
+
moduloTransporte?: string,
|
|
69
|
+
viagemPedagioSolucaoId?: string,
|
|
70
|
+
viagemPedagioTagEmissorId?: string,
|
|
71
|
+
tipoCarga?: string,
|
|
72
|
+
formTipo?: number,
|
|
73
|
+
consultaBuonnyTipo?: string,
|
|
74
|
+
material?: string,
|
|
75
|
+
formNome?: string,
|
|
76
|
+
formDescricao?: string,
|
|
77
|
+
formTipoRetorno?: string,
|
|
56
78
|
}
|
|
57
79
|
|
|
@@ -5,6 +5,7 @@ export type TUser = {
|
|
|
5
5
|
email: string
|
|
6
6
|
password: string
|
|
7
7
|
roles: Set<TRole>
|
|
8
|
+
vinculosUsuario?: TVinculosUsuario | null
|
|
8
9
|
centrosDeCusto: Set<TCentroDeCusto>
|
|
9
10
|
metricas: Set<TMetrica>
|
|
10
11
|
token: string
|
|
@@ -40,6 +41,11 @@ export type TRole = {
|
|
|
40
41
|
name: string
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
export type TVinculosUsuario = {
|
|
45
|
+
id?: number
|
|
46
|
+
vendedorId?: number | null
|
|
47
|
+
}
|
|
48
|
+
|
|
43
49
|
export type TCentroDeCusto = {
|
|
44
50
|
id: number
|
|
45
51
|
name: string
|
|
@@ -6,6 +6,7 @@ const users = {
|
|
|
6
6
|
findForEquipeVendas: `/dados-mestres/api/user/fetch-user-equipe-venda/`,
|
|
7
7
|
findAllRegional: `/dados-mestres/api/user/fetch-regional-venda`,
|
|
8
8
|
findProductsMonitor: `/dados-mestres/api/user/find-monitor`,
|
|
9
|
+
findVinculosUsuarioByUserId: `/dados-mestres/api/user/vinculos-usuario`,
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export default users
|
|
@@ -9,6 +9,9 @@ const businessPartner = {
|
|
|
9
9
|
findMonitorTransportadora: { endpoint: `${BUSINESS_PARTNER_BASE_URL}/find-monitor-transportadora`, httpMethod: 'post' },
|
|
10
10
|
findBusinessPartnerFiliais: { endpoint: `${BUSINESS_PARTNER_BASE_URL}/find-business-partner-filiais`, method: 'post' },
|
|
11
11
|
findBusinessPartnerMatrizes: { endpoint: `${BUSINESS_PARTNER_BASE_URL}/find-business-partner-matrizes`, method: 'post' },
|
|
12
|
+
findBusinessPartnerFuncoesParceirosClientes: { endpoint: `${BUSINESS_PARTNER_BASE_URL}/find-bp-vinculo-funcao-parceiros-clientes`, method: 'post' },
|
|
13
|
+
findBusinessPartnerFuncoesParceirosFornecedores: { endpoint: `${BUSINESS_PARTNER_BASE_URL}/find-bp-vinculo-funcao-parceiros-fornecedores`, method: 'post' },
|
|
14
|
+
findBusinessPartnerByClientOrSupplierFunction: { endpoint: `${BUSINESS_PARTNER_BASE_URL}/find-vendedores-aka-representantes-vendas`, method: 'get' },
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
export default businessPartner
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { apiFindDmBusinessPartnerFuncoesParceirosClientes } from '@base/services/modules/dm/businessPartner/BusinessPartnerService'
|
|
2
|
+
import { useBusinessPartnerListStore } from '@base/store/dm/businesPartner/businessPartnerListStore';
|
|
3
|
+
import useSWR from 'swr'
|
|
4
|
+
|
|
5
|
+
export default function useBusinessPartnerFuncoesParceirosClientesList() {
|
|
6
|
+
const { tableParams, filterParams, setTableParams, setFilterParams } =
|
|
7
|
+
useBusinessPartnerListStore((state) => state);
|
|
8
|
+
|
|
9
|
+
const swrKey = ["/api/dm/business-partner/find-bp-vinculo-funcao-parceiros-clientes", filterParams];
|
|
10
|
+
|
|
11
|
+
const { data, error, isLoading, mutate } = useSWR(
|
|
12
|
+
swrKey,
|
|
13
|
+
() => apiFindDmBusinessPartnerFuncoesParceirosClientes(filterParams),
|
|
14
|
+
{ revalidateOnFocus: false }
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const businessPartnerFuncoesParceirosClientesList = data || [];
|
|
18
|
+
|
|
19
|
+
const businessPartnerFuncoesParceirosClientesListTotal = data?.length || 0;
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
data,
|
|
23
|
+
businessPartnerFuncoesParceirosClientesList,
|
|
24
|
+
businessPartnerFuncoesParceirosClientesListTotal,
|
|
25
|
+
error,
|
|
26
|
+
isLoading,
|
|
27
|
+
tableParams,
|
|
28
|
+
filterParams,
|
|
29
|
+
mutate,
|
|
30
|
+
setTableParams,
|
|
31
|
+
setFilterParams,
|
|
32
|
+
};
|
|
33
|
+
}
|
package/lib/base/hooks/dm/businessPartner/useBusinessPartnerFuncoesParceirosFornecedoresList.tsx
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { apiFindDmBusinessPartnerFuncoesParceirosFornecedores } from '@base/services/modules/dm/businessPartner/BusinessPartnerService'
|
|
2
|
+
import { useBusinessPartnerListStore } from '@base/store/dm/businesPartner/businessPartnerListStore';
|
|
3
|
+
import useSWR from 'swr'
|
|
4
|
+
|
|
5
|
+
export default function useBusinessPartnerFuncoesParceirosFornecedoresList() {
|
|
6
|
+
const { tableParams, filterParams, setTableParams, setFilterParams } =
|
|
7
|
+
useBusinessPartnerListStore((state) => state);
|
|
8
|
+
|
|
9
|
+
const swrKey = ["/api/dm/business-partner/find-bp-vinculo-funcao-parceiros-fornecedores", filterParams];
|
|
10
|
+
|
|
11
|
+
const { data, error, isLoading, mutate } = useSWR(
|
|
12
|
+
swrKey,
|
|
13
|
+
() => apiFindDmBusinessPartnerFuncoesParceirosFornecedores(filterParams),
|
|
14
|
+
{ revalidateOnFocus: false }
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const businessPartnerFuncoesParceirosFornecedoresList = data || [];
|
|
18
|
+
|
|
19
|
+
const businessPartnerFuncoesParceirosFornecedoresListTotal = data?.length || 0;
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
data,
|
|
23
|
+
businessPartnerFuncoesParceirosFornecedoresList,
|
|
24
|
+
businessPartnerFuncoesParceirosFornecedoresListTotal,
|
|
25
|
+
error,
|
|
26
|
+
isLoading,
|
|
27
|
+
tableParams,
|
|
28
|
+
filterParams,
|
|
29
|
+
mutate,
|
|
30
|
+
setTableParams,
|
|
31
|
+
setFilterParams,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
import { apiFindDmVendedoresAKARepresentantesVendas } from '@base/services/modules/dm/businessPartner/BusinessPartnerService'
|
|
3
|
+
import { useBusinessPartnerListStore } from '@base/store/dm/businesPartner/businessPartnerListStore';
|
|
4
|
+
import useSWR from "swr";
|
|
5
|
+
|
|
6
|
+
export default function useVendedoresAKARepresentantesVendasList() {
|
|
7
|
+
const { tableParams, filterParams, setTableParams, setFilterParams } =
|
|
8
|
+
useBusinessPartnerListStore((state) => state);
|
|
9
|
+
|
|
10
|
+
const swrKey = ["/api/dm/business-partner/find-vendedores-aka-representantes-vendas", filterParams];
|
|
11
|
+
|
|
12
|
+
const { data, error, isLoading, mutate } = useSWR(
|
|
13
|
+
swrKey,
|
|
14
|
+
() => apiFindDmVendedoresAKARepresentantesVendas(),
|
|
15
|
+
{ revalidateOnFocus: false }
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const clientOrSupplierFunctionList = data || [];
|
|
19
|
+
|
|
20
|
+
const clientOrSupplierFunctionListTotal = data?.length || 0;
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
data,
|
|
24
|
+
clientOrSupplierFunctionList,
|
|
25
|
+
clientOrSupplierFunctionListTotal,
|
|
26
|
+
error,
|
|
27
|
+
isLoading,
|
|
28
|
+
tableParams,
|
|
29
|
+
filterParams,
|
|
30
|
+
mutate,
|
|
31
|
+
setTableParams,
|
|
32
|
+
setFilterParams,
|
|
33
|
+
};
|
|
34
|
+
}
|
package/lib/base/hooks/index.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
// Hooks exports from base
|
|
2
2
|
export { default as useRolesList } from './adm/roles/useRolesList';
|
|
3
3
|
export { default as useUsersList } from './adm/users/useUsersList';
|
|
4
|
-
export { default as useUserList } from './dm/user/useUserList';
|
|
5
4
|
export { default as useBusinessPartnerById } from './dm/businessPartner/useBusinessPartnerById';
|
|
6
5
|
export { default as useBusinessPartnerClienteList } from './dm/businessPartner/useBusinessPartnerClienteList';
|
|
7
6
|
export { default as useBusinessPartnerFiliaisList } from './dm/businessPartner/useBusinessPartnerFiliaisList';
|
|
8
7
|
export { default as useBusinessPartnerFornecedorList } from './dm/businessPartner/useBusinessPartnerFornecedorList';
|
|
8
|
+
export { default as useBusinessPartnerFuncoesParceirosClientesList } from './dm/businessPartner/useBusinessPartnerFuncoesParceirosClientesList';
|
|
9
|
+
export { default as useBusinessPartnerFuncoesParceirosFornecedoresList } from './dm/businessPartner/useBusinessPartnerFuncoesParceirosFornecedoresList';
|
|
9
10
|
export { default as useBusinessPartnerList } from './dm/businessPartner/useBusinessPartnerList';
|
|
10
11
|
export { default as useBusinessPartnerMatrizesList } from './dm/businessPartner/useBusinessPartnerMatrizesList';
|
|
12
|
+
export { default as useVendedoresAKARepresentantesVendasList } from './dm/businessPartner/useVendedoresAKARepresentantesVendasList';
|
|
11
13
|
export { default as useCanalDistribuicaoByCodigoList } from './dm/canalDistribuicao/useCanalDistribuicaoByCodigoList';
|
|
12
14
|
export { default as useCanalDistribuicaoList } from './dm/canalDistribuicao/useCanalDistribuicaoList';
|
|
13
15
|
export { default as useCentroByCodigoList } from './dm/centro/useCentroByCodigoList';
|
|
@@ -40,5 +42,6 @@ export { default as useTipoOrdemVendaByCodigoList } from './dm/tipoOrdemVenda/us
|
|
|
40
42
|
export { default as useTipoOrdemVendaList } from './dm/tipoOrdemVenda/useTipoOrdemVendaList';
|
|
41
43
|
export { default as useTipoVeiculoByCodigoList } from './dm/tipoVeiculo/useTipoVeiculoByCodigoList';
|
|
42
44
|
export { default as useTipoVeiculoList } from './dm/tipoVeiculo/useTipoVeiculoList';
|
|
45
|
+
export { default as useUserList } from './dm/user/useUserList';
|
|
43
46
|
export { default as useList } from './useList';
|
|
44
47
|
|
|
@@ -2,6 +2,7 @@ import { IFilterParams, TQueryResponse } from '@base/@types/api'
|
|
|
2
2
|
import endpointNavigationConfig from '@base/configs/endpoints.config/endpoints.navigation'
|
|
3
3
|
import ApiService from '@/services/ApiService'
|
|
4
4
|
import { TUser } from '@base/@types/models/user'
|
|
5
|
+
import { TVinculosUsuario } from '@base/@types/models/adm/user'
|
|
5
6
|
|
|
6
7
|
export async function apiGetUsers(body?: IFilterParams) {
|
|
7
8
|
return ApiService.fetchDataWithAxios<TQueryResponse<TUser>>({
|
|
@@ -25,3 +26,10 @@ export const apiFetchUserFuncionalidades = async (userId: number) => {
|
|
|
25
26
|
method: 'get',
|
|
26
27
|
});
|
|
27
28
|
};
|
|
29
|
+
|
|
30
|
+
export const apiFetchUserVinculosUsuario = async (userId: number) => {
|
|
31
|
+
return ApiService.fetchDataWithAxios<TVinculosUsuario>({
|
|
32
|
+
url: endpointNavigationConfig.users.findVinculosUsuarioByUserId + `/${userId}`,
|
|
33
|
+
method: 'get',
|
|
34
|
+
});
|
|
35
|
+
};
|
|
@@ -78,4 +78,34 @@ export async function apiFindDmBusinessPartnerMatrizes(body?: IFilterParams) {
|
|
|
78
78
|
method: BUSINESS_PARTNER_ENDPOINT.findBusinessPartnerMatrizes.method,
|
|
79
79
|
data: body,
|
|
80
80
|
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export async function apiFindDmBusinessPartnerFuncoesParceirosClientes(body?: IFilterParams) {
|
|
84
|
+
if (!body || Object.keys(body).length === 0) {
|
|
85
|
+
return undefined
|
|
86
|
+
}
|
|
87
|
+
return ApiService.fetchDataWithAxios<TBusinessPartner[]>({
|
|
88
|
+
url: BUSINESS_PARTNER_ENDPOINT.findBusinessPartnerFuncoesParceirosClientes.endpoint,
|
|
89
|
+
method: BUSINESS_PARTNER_ENDPOINT.findBusinessPartnerFuncoesParceirosClientes.method,
|
|
90
|
+
data: body,
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export async function apiFindDmBusinessPartnerFuncoesParceirosFornecedores(body?: IFilterParams) {
|
|
95
|
+
if (!body || Object.keys(body).length === 0) {
|
|
96
|
+
return undefined
|
|
97
|
+
}
|
|
98
|
+
return ApiService.fetchDataWithAxios<TBusinessPartner[]>({
|
|
99
|
+
url: BUSINESS_PARTNER_ENDPOINT.findBusinessPartnerFuncoesParceirosFornecedores.endpoint,
|
|
100
|
+
method: BUSINESS_PARTNER_ENDPOINT.findBusinessPartnerFuncoesParceirosFornecedores.method,
|
|
101
|
+
data: body,
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export async function apiFindDmVendedoresAKARepresentantesVendas(data = {}) {
|
|
106
|
+
return ApiService.fetchDataWithAxios<TBusinessPartner[]>({
|
|
107
|
+
url: BUSINESS_PARTNER_ENDPOINT.findBusinessPartnerByClientOrSupplierFunction.endpoint,
|
|
108
|
+
method: BUSINESS_PARTNER_ENDPOINT.findBusinessPartnerByClientOrSupplierFunction.method,
|
|
109
|
+
data,
|
|
110
|
+
});
|
|
81
111
|
}
|
package/package.json
CHANGED