@orbe-agro/client-core 5.6.103 → 5.6.105

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.
Files changed (71) hide show
  1. package/dist/@types/base/@types/models/ativos/ativo.d.ts +101 -1
  2. package/dist/@types/base/@types/models/ativos/ativo.d.ts.map +1 -1
  3. package/dist/@types/base/@types/models/ativos/documentacao.d.ts +1 -1
  4. package/dist/@types/base/@types/models/ativos/documentacao.d.ts.map +1 -1
  5. package/dist/@types/base/@types/models/transportadora/veiculo.d.ts +1 -0
  6. package/dist/@types/base/@types/models/transportadora/veiculo.d.ts.map +1 -1
  7. package/dist/@types/base/configs/endpoints.config/ativos/ativos.d.ts +16 -0
  8. package/dist/@types/base/configs/endpoints.config/ativos/ativos.d.ts.map +1 -1
  9. package/dist/@types/base/configs/endpoints.config/ativos/config/ativo.d.ts +16 -0
  10. package/dist/@types/base/configs/endpoints.config/ativos/config/ativo.d.ts.map +1 -1
  11. package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts +16 -0
  12. package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts.map +1 -1
  13. package/dist/@types/base/hooks/adm/users/useUsersById.d.ts +9 -0
  14. package/dist/@types/base/hooks/adm/users/useUsersById.d.ts.map +1 -0
  15. package/dist/@types/base/hooks/dm/area/useAreaById.d.ts +9 -0
  16. package/dist/@types/base/hooks/dm/area/useAreaById.d.ts.map +1 -0
  17. package/dist/@types/base/hooks/dm/businessPartner/useBusinessPartnerByIds.d.ts +15 -0
  18. package/dist/@types/base/hooks/dm/businessPartner/useBusinessPartnerByIds.d.ts.map +1 -0
  19. package/dist/@types/base/hooks/dm/centroCusto/useCentroCustoDefaultList.d.ts +15 -0
  20. package/dist/@types/base/hooks/dm/centroCusto/useCentroCustoDefaultList.d.ts.map +1 -0
  21. package/dist/@types/base/hooks/index.d.ts +4 -0
  22. package/dist/@types/base/hooks/index.d.ts.map +1 -1
  23. package/dist/@types/base/services/modules/ativos/ativo/AtivoService.d.ts +11 -1
  24. package/dist/@types/base/services/modules/ativos/ativo/AtivoService.d.ts.map +1 -1
  25. package/dist/@types/base/store/dm/centroCusto/centroCustoDefaultListStore.d.ts +4 -0
  26. package/dist/@types/base/store/dm/centroCusto/centroCustoDefaultListStore.d.ts.map +1 -0
  27. package/dist/@types/base/store/index.d.ts +2 -0
  28. package/dist/@types/base/store/index.d.ts.map +1 -1
  29. package/dist/base/@types/index.js +9 -0
  30. package/dist/base/@types/index.js.map +1 -1
  31. package/dist/base/@types/models/ativos/ativo.js +45 -1
  32. package/dist/base/@types/models/ativos/ativo.js.map +1 -1
  33. package/dist/base/@types/models/ativos/index.js +9 -1
  34. package/dist/base/@types/models/index.js +9 -0
  35. package/dist/base/@types/models/index.js.map +1 -1
  36. package/dist/base/configs/endpoints.config/ativos/config/ativo.js +5 -1
  37. package/dist/base/configs/endpoints.config/ativos/config/ativo.js.map +1 -1
  38. package/dist/base/hooks/adm/users/useUsersById.js +24 -0
  39. package/dist/base/hooks/adm/users/useUsersById.js.map +1 -0
  40. package/dist/base/hooks/dm/area/useAreaById.js +24 -0
  41. package/dist/base/hooks/dm/area/useAreaById.js.map +1 -0
  42. package/dist/base/hooks/dm/businessPartner/useBusinessPartnerByIds.js +31 -0
  43. package/dist/base/hooks/dm/businessPartner/useBusinessPartnerByIds.js.map +1 -0
  44. package/dist/base/hooks/dm/centroCusto/useCentroCustoDefaultList.js +31 -0
  45. package/dist/base/hooks/dm/centroCusto/useCentroCustoDefaultList.js.map +1 -0
  46. package/dist/base/hooks/index.js +152 -144
  47. package/dist/base/hooks/index.js.map +1 -1
  48. package/dist/base/index.js +174 -151
  49. package/dist/base/index.js.map +1 -1
  50. package/dist/base/services/index.js +5 -1
  51. package/dist/base/services/modules/ativos/ativo/AtivoService.js +32 -0
  52. package/dist/base/services/modules/ativos/ativo/AtivoService.js.map +1 -1
  53. package/dist/base/services/modules/ativos/index.js +5 -1
  54. package/dist/base/services/modules/index.js +5 -1
  55. package/dist/base/store/dm/centroCusto/centroCustoDefaultListStore.js +16 -0
  56. package/dist/base/store/dm/centroCusto/centroCustoDefaultListStore.js.map +1 -0
  57. package/dist/base/store/index.js +4 -0
  58. package/dist/base/store/index.js.map +1 -1
  59. package/lib/base/@types/models/ativos/ativo.ts +114 -1
  60. package/lib/base/@types/models/ativos/documentacao.ts +1 -1
  61. package/lib/base/@types/models/transportadora/veiculo.ts +1 -0
  62. package/lib/base/configs/endpoints.config/ativos/config/ativo.ts +4 -0
  63. package/lib/base/hooks/adm/users/useUsersById.tsx +25 -0
  64. package/lib/base/hooks/dm/area/useAreaById.tsx +26 -0
  65. package/lib/base/hooks/dm/businessPartner/useBusinessPartnerByIds.tsx +39 -0
  66. package/lib/base/hooks/dm/centroCusto/useCentroCustoDefaultList.tsx +39 -0
  67. package/lib/base/hooks/index.ts +4 -0
  68. package/lib/base/services/modules/ativos/ativo/AtivoService.ts +33 -1
  69. package/lib/base/store/dm/centroCusto/centroCustoDefaultListStore.ts +19 -0
  70. package/lib/base/store/index.ts +3 -1
  71. package/package.json +1 -1
@@ -1,3 +1,40 @@
1
+ export enum TipoAcao {
2
+ INATIVACAO = 'INATIVACAO',
3
+ EDICAO = 'EDICAO',
4
+ DISPONIBILIZACAO = 'DISPONIBILIZACAO',
5
+ DEVOLUCAO = 'DEVOLUCAO',
6
+ TRANSFERENCIA = 'TRANSFERENCIA',
7
+ MANUTENCAO = 'MANUTENCAO'
8
+ }
9
+
10
+ export enum TipoDisponibilizacao {
11
+ INDIVIDUAL = 'INDIVIDUAL',
12
+ COMPARTILHADO = 'COMPARTILHADO'
13
+ }
14
+
15
+ export enum TipoDevolucao {
16
+ CONTRATO_ENCERRADO = 'CONTRATO_ENCERRADO',
17
+ TROCA = 'TROCA',
18
+ DESLIGAMENTO = 'DESLIGAMENTO',
19
+ TRANSFERENCIA = 'TRANSFERENCIA',
20
+ }
21
+
22
+ export enum StatusManutencao {
23
+ CONCLUIDO = 'CONCLUIDO',
24
+ EM_ANDAMENTO = 'EM_ANDAMENTO'
25
+ }
26
+
27
+ export enum ResultadoManutencao {
28
+ DEVOLVIDO = 'DEVOLVIDO',
29
+ SUBSTITUICAO = 'SUBSTITUICAO',
30
+ SEM_RESULTADO = 'SEM_RESULTADO',
31
+ }
32
+
33
+ export enum ResponsavelManutencao {
34
+ INTERNO = 'INTERNO',
35
+ EXTERNO = 'EXTERNO',
36
+ }
37
+
1
38
  export type TAtivoColumnDef = {
2
39
  id: number
3
40
  dataCriacao: string
@@ -15,7 +52,7 @@ export type TAtivo = {
15
52
  camposAtivo: TCamposAtivo[]
16
53
  descricao?: string | null
17
54
  observacao?: string | null
18
- reserva?: boolean
55
+ reserva?: boolean | null
19
56
  }
20
57
 
21
58
  export type TCamposAtivo = {
@@ -34,4 +71,80 @@ export type TValoresCampo = {
34
71
  id?: number
35
72
  valorCampoId: number
36
73
  valorCampo: string
74
+ }
75
+
76
+ export type TMovimentacao = {
77
+ id?: number
78
+ tipoMovimentacao?: string
79
+ disponibilizacao?: TDisponibilizacao
80
+ devolucao?: TDevolucao
81
+ transferencia?: TTransferencia
82
+ }
83
+
84
+ export type THistorico = {
85
+ id?: number
86
+ item?: string
87
+ tipoAcao?: string
88
+ descricao?: string
89
+ historicoValoresCampos?: THistoricoValoresCampo[]
90
+ detalhesHistorico?: string
91
+ responsaveis?: number[]
92
+ }
93
+
94
+ export type THistoricoValoresCampo = {
95
+ id?: number
96
+ nomeCampo?: string
97
+ valorCampo?: string
98
+ }
99
+
100
+ export type TDisponibilizacao = {
101
+ id?: number
102
+ ativoId: number
103
+ dataDisponibilizacao: string
104
+ tipoDisponibilizacao: string
105
+ destino: string
106
+ avarias?: boolean
107
+ descricaoAvarias?: string
108
+ observacao?: string
109
+ }
110
+
111
+ export type TDevolucao = {
112
+ id?: number
113
+ ativoId: number
114
+ dataDevolucao: string
115
+ responsavelRecebimentoId: number
116
+ tipoDevolucao: string
117
+ avarias?: boolean
118
+ descricaoAvarias?: string
119
+ operacional?: boolean
120
+ descricaoOperacional?: string
121
+ }
122
+
123
+ export type TTransferencia = {
124
+ id?: number
125
+ ativoId: number
126
+ dataTransferencia: string
127
+ destino: string
128
+ avarias?: boolean
129
+ descricaoAvarias?: string
130
+ operacional?: boolean
131
+ descricaoOperacional?: string
132
+ }
133
+
134
+ export type TManutencao = {
135
+ id?: number
136
+ ativoId: number
137
+ dataManutencao: string
138
+ descricao: string
139
+ responsavelRecebimentoId: number
140
+ responsavelInternoManutencaoId: number
141
+ responsavelExternoManutencao: string
142
+ numeroChamado: string
143
+ motivoManutencao: string
144
+ avarias?: boolean
145
+ descricaoAvarias?: string
146
+ statusManutencao?: string
147
+ resultadoManutencao?: string
148
+ responsavelManutencao?: string
149
+ finalizarManutencao?: string
37
150
  }
@@ -54,7 +54,7 @@ export type TContratoPorItens = {
54
54
  export type TNotaFiscal = {
55
55
  id?: number
56
56
  notaFiscal: string
57
- garantia?: boolean
57
+ garantia?: boolean | null
58
58
  dataInicioGarantia?: string
59
59
  dataFinalGarantia?: string
60
60
  dataAquisicao: string
@@ -14,5 +14,6 @@ export type TVeiculo = {
14
14
  placa1?: string | undefined,
15
15
  placa2?: string | undefined,
16
16
  eixosNumero?: number,
17
+ altodesempenhoindicador : string,
17
18
  }
18
19
 
@@ -7,6 +7,10 @@ const ativo = {
7
7
  delete: { endpoint: `${ATIVO_BASE_URL}/`, method: 'delete' },
8
8
  findMonitor: { endpoint: `${ATIVO_BASE_URL}/find-monitor`, method: 'post' },
9
9
  countByStatus: { endpoint: `${ATIVO_BASE_URL}/count-ativos`, method: 'post' },
10
+ disponibilizar: { endpoint: `${ATIVO_BASE_URL}/disponibilizar`, method: 'post' },
11
+ devolver: { endpoint: `${ATIVO_BASE_URL}/devolver`, method: 'post' },
12
+ transferir: { endpoint: `${ATIVO_BASE_URL}/transferir`, method: 'post' },
13
+ reparar: { endpoint: `${ATIVO_BASE_URL}/reparar`, method: 'post' },
10
14
  }
11
15
 
12
16
  export default ativo
@@ -0,0 +1,25 @@
1
+
2
+ import { apiFindOneUser } from "@base/services/modules/DadosMestres/auth/authService"
3
+ import useSWR from "swr"
4
+
5
+ export function useUsersById(id: number | null) {
6
+ const { data, error, isLoading, mutate } = useSWR(
7
+ id ? `/api/user/${id}` : null,
8
+ () => id ? apiFindOneUser(String(id)) : null,
9
+ {
10
+ revalidateOnFocus: false,
11
+ },
12
+ )
13
+
14
+ const ativo = data || null
15
+
16
+ return {
17
+ data,
18
+ ativo,
19
+ error,
20
+ isLoading,
21
+ mutate,
22
+ }
23
+ }
24
+
25
+ export default useUsersById
@@ -0,0 +1,26 @@
1
+
2
+
3
+ import { apiGetAreById } from "@base/services/modules/dm/area/AreaService"
4
+ import useSWR from "swr"
5
+
6
+ export function useAreaById(id: number) {
7
+ const { data, error, isLoading, mutate } = useSWR(
8
+ id ? `/api/area/${id}` : null,
9
+ () => id ? apiGetAreById(id) : null,
10
+ {
11
+ revalidateOnFocus: false,
12
+ },
13
+ )
14
+
15
+ const ativo = data || null
16
+
17
+ return {
18
+ data,
19
+ ativo,
20
+ error,
21
+ isLoading,
22
+ mutate,
23
+ }
24
+ }
25
+
26
+ export default useAreaById
@@ -0,0 +1,39 @@
1
+ import { apiFindDmBusinessPartnerByIds } 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 useBusinessPartnerByIds(options?: { enableAutoFetch?: boolean }) {
6
+ const { tableParams, filterParams, setTableParams, setFilterParams } =
7
+ useBusinessPartnerListStore((state) => state);
8
+
9
+ // Se enableAutoFetch for false, só busca quando há filtros válidos
10
+ // Se enableAutoFetch for true ou undefined (padrão), sempre busca
11
+ const shouldFetch = options?.enableAutoFetch === false
12
+ ? (filterParams && Object.keys(filterParams).length > 0)
13
+ : true;
14
+
15
+ const swrKey = shouldFetch ? ["/api/dm/business-partner/find-by-ids", filterParams] : null;
16
+
17
+ const { data, error, isLoading, mutate } = useSWR(
18
+ swrKey,
19
+ () => apiFindDmBusinessPartnerByIds(filterParams),
20
+ { revalidateOnFocus: false }
21
+ );
22
+
23
+ const businessPartnerByIds = data || [];
24
+
25
+ const businessPartnerByIdsTotal = data?.length || 0;
26
+
27
+ return {
28
+ data,
29
+ businessPartnerByIds,
30
+ businessPartnerByIdsTotal,
31
+ error,
32
+ isLoading,
33
+ tableParams,
34
+ filterParams,
35
+ mutate,
36
+ setTableParams,
37
+ setFilterParams,
38
+ };
39
+ }
@@ -0,0 +1,39 @@
1
+ import { apiFindMonitorCentroCusto } from '@base/services/modules/dm/centroCusto/CentroCustoService'
2
+ import { useCentroCustoDefaultListStore } from '@base/store/dm/centroCusto/centroCustoDefaultListStore'
3
+ import useSWR from 'swr'
4
+
5
+ export default function useCentroCustoDefaultList(options?: { enableAutoFetch?: boolean }) {
6
+ const { tableParams, filterParams, setTableParams, setFilterParams } =
7
+ useCentroCustoDefaultListStore((state) => state)
8
+
9
+ // Se enableAutoFetch for false, só busca quando há filtros válidos
10
+ // Se enableAutoFetch for true ou undefined (padrão), sempre busca
11
+ const shouldFetch = options?.enableAutoFetch === false
12
+ ? (filterParams && Object.keys(filterParams).length > 0)
13
+ : true
14
+
15
+ const swrKey = shouldFetch ? ['/api/dm/centro-custo/find-monitor', filterParams] : null
16
+
17
+ const { data, error, isLoading, mutate } = useSWR(
18
+ swrKey,
19
+ () => apiFindMonitorCentroCusto(filterParams),
20
+ { revalidateOnFocus: false },
21
+ )
22
+
23
+ const centrosCustosList = data || []
24
+
25
+ const centrosCustosListTotal = data?.totalElements || 0
26
+
27
+ return {
28
+ data,
29
+ centrosCustosList,
30
+ centrosCustosListTotal,
31
+ error,
32
+ isLoading,
33
+ tableParams,
34
+ filterParams,
35
+ mutate,
36
+ setTableParams,
37
+ setFilterParams,
38
+ }
39
+ }
@@ -2,7 +2,10 @@
2
2
  export { default as useRolesList } from './adm/roles/useRolesList';
3
3
  export { default as useFindRolesByUserIdList } from './adm/roles/useFindRolesByUserIdList';
4
4
  export { default as useUsersList } from './adm/users/useUsersList';
5
+ export { default as useUsersById } from './adm/users/useUsersById';
6
+ export { default as useAreaById } from './dm/area/useAreaById';
5
7
  export { default as useBusinessPartnerById } from './dm/businessPartner/useBusinessPartnerById';
8
+ export { default as useBusinessPartnerByIds } from './dm/businessPartner/useBusinessPartnerByIds';
6
9
  export { default as useBusinessPartnerClienteList } from './dm/businessPartner/useBusinessPartnerClienteList';
7
10
  export { default as useBusinessPartnerFiliaisList } from './dm/businessPartner/useBusinessPartnerFiliaisList';
8
11
  export { default as useBusinessPartnerFindMonitorFornecedorList } from './dm/businessPartner/useBusinessPartnerFindMonitorFornecedorList';
@@ -20,6 +23,7 @@ export { default as useCanalDistribuicaoList } from './dm/canalDistribuicao/useC
20
23
  export { default as useCentroByCodigoList } from './dm/centro/useCentroByCodigoList';
21
24
  export { default as useCentroList } from './dm/centro/useCentroList';
22
25
  export { default as useCentroCustoList } from './dm/centroCusto/useCentroCustoList';
26
+ export { default as useCentroCustoDefaultList } from './dm/centroCusto/useCentroCustoDefaultList';
23
27
  export { default as useCondicaoPagamentoList } from './dm/condicaoPagamento/useCondicaoPagamentoList';
24
28
  export { default as useCondicaoPagamentoFindMonitorList } from './dm/condicaoPagamento/useCondicaoPagamentoFindMonitorList';
25
29
  export { default as useCondicaoPagamentoFindMonitorAuxList } from './dm/condicaoPagamento/useCondicaoPagamentoFindMonitorAuxList';
@@ -1,6 +1,6 @@
1
1
  import ApiService from "@/services/ApiService";
2
2
  import { IFilterParams, TQueryResponse } from "@base/@types/api";
3
- import { TAtivo } from "@base/@types/models/ativos/ativo";
3
+ import { TAtivo, TDevolucao, TDisponibilizacao, TManutencao, TTransferencia } from "@base/@types/models/ativos/ativo";
4
4
  import endpointConfig from "@base/configs/endpoints.config/endpoints.navigation";
5
5
 
6
6
  const ATIVO_ENDPOINT = endpointConfig.ativos.ativo;
@@ -49,4 +49,36 @@ export async function apiCountAtivosAtivo(body?: IFilterParams) {
49
49
  method: ATIVO_ENDPOINT.countByStatus.method,
50
50
  data: body,
51
51
  })
52
+ }
53
+
54
+ export async function apiDisponibilizarAtivosAtivo(body: TDisponibilizacao & { idsResponsaveisAtivo: number[] }) {
55
+ return ApiService.fetchDataWithAxios<TQueryResponse<TDisponibilizacao>>({
56
+ url: ATIVO_ENDPOINT.disponibilizar.endpoint,
57
+ method: ATIVO_ENDPOINT.disponibilizar.method,
58
+ data: body,
59
+ })
60
+ }
61
+
62
+ export async function apiDevolverAtivosAtivo(body: TDevolucao) {
63
+ return ApiService.fetchDataWithAxios<TQueryResponse<TDevolucao>>({
64
+ url: ATIVO_ENDPOINT.devolver.endpoint,
65
+ method: ATIVO_ENDPOINT.devolver.method,
66
+ data: body,
67
+ })
68
+ }
69
+
70
+ export async function apiTransferirAtivosAtivo(body: TTransferencia & { idsSolicitantesTransferencia: number[] }) {
71
+ return ApiService.fetchDataWithAxios<TQueryResponse<TTransferencia>>({
72
+ url: ATIVO_ENDPOINT.transferir.endpoint,
73
+ method: ATIVO_ENDPOINT.transferir.method,
74
+ data: body,
75
+ })
76
+ }
77
+
78
+ export async function apiRepararAtivosAtivo(body: TManutencao & { idsResponsaveisAtivo: number[] }) {
79
+ return ApiService.fetchDataWithAxios<TQueryResponse<TManutencao>>({
80
+ url: ATIVO_ENDPOINT.reparar.endpoint,
81
+ method: ATIVO_ENDPOINT.reparar.method,
82
+ data: body,
83
+ })
52
84
  }
@@ -0,0 +1,19 @@
1
+ import { TCentroDeCusto } from '@base/@types/models/orcamento/CentroDeCusto'
2
+ import { IListStoreAction, IListStoreState } from '@base/@types/store'
3
+ import { getBaseTableParams } from '@base/services/query'
4
+ import { create } from 'zustand'
5
+
6
+ const baseTableParams = getBaseTableParams()
7
+
8
+ const initialState: IListStoreState<TCentroDeCusto> = {
9
+ filterParams: {},
10
+ tableParams: baseTableParams,
11
+ }
12
+
13
+ export const useCentroCustoDefaultListStore = create<
14
+ IListStoreState<TCentroDeCusto> & IListStoreAction<TCentroDeCusto>
15
+ >((set) => ({
16
+ ...initialState,
17
+ setFilterParams: (payload) => set(() => ({ filterParams: payload })),
18
+ setTableParams: (payload) => set(() => ({ tableParams: payload })),
19
+ }))
@@ -1,2 +1,4 @@
1
1
  // Base store exports
2
- export * from './loadingConfigStore';
2
+ export * from './loadingConfigStore';
3
+ export * from './dm/centroCusto/centroCustoListStore';
4
+ export * from './dm/centroCusto/centroCustoDefaultListStore';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbe-agro/client-core",
3
- "version": "5.6.103",
3
+ "version": "5.6.105",
4
4
  "description": "Biblioteca principal de componentes e utilidades para os microfrontends do Orbe Agro.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",