@orbe-agro/client-core 5.6.102 → 5.6.104
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/@types/base/@types/models/ativos/ativo.d.ts +101 -1
- package/dist/@types/base/@types/models/ativos/ativo.d.ts.map +1 -1
- package/dist/@types/base/@types/models/ativos/documentacao.d.ts +1 -1
- package/dist/@types/base/@types/models/ativos/documentacao.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/ativos/ativos.d.ts +16 -0
- package/dist/@types/base/configs/endpoints.config/ativos/ativos.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/ativos/config/ativo.d.ts +16 -0
- package/dist/@types/base/configs/endpoints.config/ativos/config/ativo.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts +22 -10
- package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/insumos/config/compra.d.ts +4 -0
- package/dist/@types/base/configs/endpoints.config/insumos/config/compra.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/insumos/config/vendas.d.ts +2 -10
- package/dist/@types/base/configs/endpoints.config/insumos/config/vendas.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/insumos/insumos.d.ts +6 -10
- package/dist/@types/base/configs/endpoints.config/insumos/insumos.d.ts.map +1 -1
- package/dist/@types/base/hooks/adm/users/useUsersById.d.ts +9 -0
- package/dist/@types/base/hooks/adm/users/useUsersById.d.ts.map +1 -0
- package/dist/@types/base/hooks/dm/area/useAreaById.d.ts +9 -0
- package/dist/@types/base/hooks/dm/area/useAreaById.d.ts.map +1 -0
- package/dist/@types/base/hooks/dm/businessPartner/useBusinessPartnerByIds.d.ts +15 -0
- package/dist/@types/base/hooks/dm/businessPartner/useBusinessPartnerByIds.d.ts.map +1 -0
- package/dist/@types/base/hooks/dm/centroCusto/useCentroCustoDefaultList.d.ts +15 -0
- package/dist/@types/base/hooks/dm/centroCusto/useCentroCustoDefaultList.d.ts.map +1 -0
- package/dist/@types/base/hooks/index.d.ts +4 -0
- package/dist/@types/base/hooks/index.d.ts.map +1 -1
- package/dist/@types/base/services/modules/ativos/ativo/AtivoService.d.ts +11 -1
- package/dist/@types/base/services/modules/ativos/ativo/AtivoService.d.ts.map +1 -1
- package/dist/@types/base/services/modules/insumos/compra/CompraService.d.ts +7 -2
- package/dist/@types/base/services/modules/insumos/compra/CompraService.d.ts.map +1 -1
- package/dist/@types/base/services/modules/insumos/vendas/VendasService.d.ts +1 -3
- package/dist/@types/base/services/modules/insumos/vendas/VendasService.d.ts.map +1 -1
- package/dist/@types/base/store/dm/centroCusto/centroCustoDefaultListStore.d.ts +4 -0
- package/dist/@types/base/store/dm/centroCusto/centroCustoDefaultListStore.d.ts.map +1 -0
- package/dist/@types/base/store/index.d.ts +2 -0
- package/dist/@types/base/store/index.d.ts.map +1 -1
- package/dist/base/@types/index.js +9 -0
- package/dist/base/@types/index.js.map +1 -1
- package/dist/base/@types/models/ativos/ativo.js +45 -1
- package/dist/base/@types/models/ativos/ativo.js.map +1 -1
- package/dist/base/@types/models/ativos/index.js +9 -1
- package/dist/base/@types/models/index.js +9 -0
- package/dist/base/@types/models/index.js.map +1 -1
- package/dist/base/configs/endpoints.config/ativos/config/ativo.js +5 -1
- package/dist/base/configs/endpoints.config/ativos/config/ativo.js.map +1 -1
- package/dist/base/configs/endpoints.config/insumos/config/compra.js +12 -2
- package/dist/base/configs/endpoints.config/insumos/config/compra.js.map +1 -1
- package/dist/base/configs/endpoints.config/insumos/config/vendas.js +2 -4
- package/dist/base/configs/endpoints.config/insumos/config/vendas.js.map +1 -1
- package/dist/base/hooks/adm/users/useUsersById.js +24 -0
- package/dist/base/hooks/adm/users/useUsersById.js.map +1 -0
- package/dist/base/hooks/dm/area/useAreaById.js +24 -0
- package/dist/base/hooks/dm/area/useAreaById.js.map +1 -0
- package/dist/base/hooks/dm/businessPartner/useBusinessPartnerByIds.js +31 -0
- package/dist/base/hooks/dm/businessPartner/useBusinessPartnerByIds.js.map +1 -0
- package/dist/base/hooks/dm/centroCusto/useCentroCustoDefaultList.js +31 -0
- package/dist/base/hooks/dm/centroCusto/useCentroCustoDefaultList.js.map +1 -0
- package/dist/base/hooks/index.js +152 -144
- package/dist/base/hooks/index.js.map +1 -1
- package/dist/base/index.js +178 -156
- package/dist/base/index.js.map +1 -1
- package/dist/base/services/index.js +9 -6
- package/dist/base/services/modules/ativos/ativo/AtivoService.js +32 -0
- package/dist/base/services/modules/ativos/ativo/AtivoService.js.map +1 -1
- package/dist/base/services/modules/ativos/index.js +5 -1
- package/dist/base/services/modules/index.js +9 -6
- package/dist/base/services/modules/insumos/compra/CompraService.js +8 -0
- package/dist/base/services/modules/insumos/compra/CompraService.js.map +1 -1
- package/dist/base/services/modules/insumos/index.js +4 -5
- package/dist/base/services/modules/insumos/vendas/VendasService.js +7 -21
- package/dist/base/services/modules/insumos/vendas/VendasService.js.map +1 -1
- package/dist/base/store/dm/centroCusto/centroCustoDefaultListStore.js +16 -0
- package/dist/base/store/dm/centroCusto/centroCustoDefaultListStore.js.map +1 -0
- package/dist/base/store/index.js +4 -0
- package/dist/base/store/index.js.map +1 -1
- package/lib/base/@types/models/ativos/ativo.ts +114 -1
- package/lib/base/@types/models/ativos/documentacao.ts +1 -1
- package/lib/base/configs/endpoints.config/ativos/config/ativo.ts +4 -0
- package/lib/base/configs/endpoints.config/insumos/config/compra.ts +13 -3
- package/lib/base/configs/endpoints.config/insumos/config/vendas.ts +2 -4
- package/lib/base/hooks/adm/users/useUsersById.tsx +25 -0
- package/lib/base/hooks/dm/area/useAreaById.tsx +26 -0
- package/lib/base/hooks/dm/businessPartner/useBusinessPartnerByIds.tsx +39 -0
- package/lib/base/hooks/dm/centroCusto/useCentroCustoDefaultList.tsx +39 -0
- package/lib/base/hooks/index.ts +4 -0
- package/lib/base/services/modules/ativos/ativo/AtivoService.ts +33 -1
- package/lib/base/services/modules/insumos/compra/CompraService.ts +25 -6
- package/lib/base/services/modules/insumos/vendas/VendasService.ts +8 -22
- package/lib/base/store/dm/centroCusto/centroCustoDefaultListStore.ts +19 -0
- package/lib/base/store/index.ts +3 -1
- package/package.json +1 -1
|
@@ -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
|
+
}
|
package/lib/base/hooks/index.ts
CHANGED
|
@@ -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
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import ApiService from
|
|
2
|
-
import { IFilterParams, TQueryResponse } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import ApiService from '@/services/ApiService'
|
|
2
|
+
import { IFilterParams, TQueryResponse } from '@base/@types/api'
|
|
3
|
+
import {
|
|
4
|
+
TCompra,
|
|
5
|
+
TCompraFormSchema,
|
|
6
|
+
TCompraColumnDef,
|
|
7
|
+
} from '@base/@types/models/insumos/compra'
|
|
8
|
+
import endpointConfig from '@base/configs/endpoints.config/endpoints.navigation'
|
|
5
9
|
|
|
6
|
-
const COMPRA_ENDPOINT = endpointConfig.insumos.compra
|
|
10
|
+
const COMPRA_ENDPOINT = endpointConfig.insumos.compra
|
|
7
11
|
|
|
8
12
|
export async function apiGetInsumosCompra(id: number) {
|
|
9
13
|
return ApiService.fetchDataWithAxios<TCompra>({
|
|
@@ -36,10 +40,25 @@ export async function apiFindMonitorInsumosCompra(body?: IFilterParams) {
|
|
|
36
40
|
})
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
export async function apiExecuteAcaoInsumosCompra(
|
|
43
|
+
export async function apiExecuteAcaoInsumosCompra(
|
|
44
|
+
id: string,
|
|
45
|
+
tipoAcao: 'CANCELAR' | 'EFETIVAR',
|
|
46
|
+
) {
|
|
40
47
|
return ApiService.fetchDataWithAxios<void>({
|
|
41
48
|
url: COMPRA_ENDPOINT.executeAcao.endpoint.replace('{id}', id),
|
|
42
49
|
method: COMPRA_ENDPOINT.executeAcao.method,
|
|
43
50
|
data: { tipoAcao },
|
|
44
51
|
})
|
|
45
52
|
}
|
|
53
|
+
|
|
54
|
+
export async function apiGetMediaPreco(body: {
|
|
55
|
+
idSafra: number
|
|
56
|
+
idProduto: number
|
|
57
|
+
quantidade: number
|
|
58
|
+
}) {
|
|
59
|
+
return ApiService.fetchDataWithAxios<number>({
|
|
60
|
+
url: COMPRA_ENDPOINT.getMediaPreco.endpoint,
|
|
61
|
+
method: COMPRA_ENDPOINT.getMediaPreco.method,
|
|
62
|
+
data: body,
|
|
63
|
+
})
|
|
64
|
+
}
|
|
@@ -28,20 +28,6 @@ export async function apiUpdateInsumosVendas(body: TVendas) {
|
|
|
28
28
|
})
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export async function apiDeleteInsumosVendas(id: number) {
|
|
32
|
-
return ApiService.fetchDataWithAxios<TQueryResponse<TVendas>>({
|
|
33
|
-
url: VENDAS_ENDPOINT.delete.endpoint + `${id}`,
|
|
34
|
-
method: VENDAS_ENDPOINT.delete.method,
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export async function apiGetAllInsumosVendas() {
|
|
39
|
-
return ApiService.fetchDataWithAxios<TVendas[]>({
|
|
40
|
-
url: VENDAS_ENDPOINT.findAll.endpoint,
|
|
41
|
-
method: VENDAS_ENDPOINT.findAll.method,
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
|
|
45
31
|
export async function apiFindMonitorInsumosVendas(body?: IFilterParams) {
|
|
46
32
|
return ApiService.fetchDataWithAxios<TQueryResponse<TVendas>>({
|
|
47
33
|
url: VENDAS_ENDPOINT.findMonitor.endpoint,
|
|
@@ -50,18 +36,18 @@ export async function apiFindMonitorInsumosVendas(body?: IFilterParams) {
|
|
|
50
36
|
})
|
|
51
37
|
}
|
|
52
38
|
|
|
53
|
-
export async function apiCalculoVendaInsumosVendas(body: any) {
|
|
54
|
-
return ApiService.fetchDataWithAxios<any>({
|
|
55
|
-
url: VENDAS_ENDPOINT.calculoVenda.endpoint,
|
|
56
|
-
method: VENDAS_ENDPOINT.calculoVenda.method,
|
|
57
|
-
data: body,
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
|
|
61
39
|
export async function apiExecuteAcaoVendas(id: number, body?: any) {
|
|
62
40
|
return ApiService.fetchDataWithAxios<TQueryResponse<TVendas>>({
|
|
63
41
|
url: VENDAS_ENDPOINT.executeAcao.endpoint.replace("{id}", id.toString()),
|
|
64
42
|
method: VENDAS_ENDPOINT.executeAcao.method,
|
|
65
43
|
data: body,
|
|
66
44
|
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export async function apiGetValorFrete(body?: any) {
|
|
48
|
+
return ApiService.fetchDataWithAxios<any>({
|
|
49
|
+
url: VENDAS_ENDPOINT.getValorFrete.endpoint,
|
|
50
|
+
method: VENDAS_ENDPOINT.getValorFrete.method,
|
|
51
|
+
data: body,
|
|
52
|
+
})
|
|
67
53
|
}
|
|
@@ -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
|
+
}))
|
package/lib/base/store/index.ts
CHANGED
package/package.json
CHANGED