@orbe-agro/client-core 5.3.107 → 5.3.108
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/commodities/pedidoVenda.d.ts +1 -0
- package/dist/@types/base/@types/models/commodities/pedidoVenda.d.ts.map +1 -1
- package/dist/@types/base/@types/models/racao/pedidoVenda.d.ts +1 -0
- package/dist/@types/base/@types/models/racao/pedidoVenda.d.ts.map +1 -1
- package/dist/@types/base/@types/store/dm/produto/index.d.ts +12 -0
- package/dist/@types/base/@types/store/dm/produto/index.d.ts.map +1 -0
- package/dist/@types/base/configs/endpoints.config/dm/config/produto.d.ts +4 -0
- package/dist/@types/base/configs/endpoints.config/dm/config/produto.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/dm/dm.d.ts +4 -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 +4 -0
- package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts.map +1 -1
- package/dist/@types/base/hooks/dm/produto/useValidaProdutoByEmissorPedidoVendaList.d.ts +12 -0
- package/dist/@types/base/hooks/dm/produto/useValidaProdutoByEmissorPedidoVendaList.d.ts.map +1 -0
- package/dist/@types/base/hooks/dm/produto/useValidaProdutoByEmissorPedidoVendaListUseMulti.d.ts +12 -0
- package/dist/@types/base/hooks/dm/produto/useValidaProdutoByEmissorPedidoVendaListUseMulti.d.ts.map +1 -0
- package/dist/@types/base/hooks/index.d.ts +2 -0
- package/dist/@types/base/hooks/index.d.ts.map +1 -1
- package/dist/@types/base/services/modules/dm/produto/ProdutoService.d.ts +6 -0
- package/dist/@types/base/services/modules/dm/produto/ProdutoService.d.ts.map +1 -1
- package/dist/@types/base/store/dm/produto/produtoListStoreUseMulti.d.ts +4 -0
- package/dist/@types/base/store/dm/produto/produtoListStoreUseMulti.d.ts.map +1 -0
- package/dist/base/@types/models/commodities/pedidoVenda.js.map +1 -1
- package/dist/base/@types/models/racao/pedidoVenda.js.map +1 -1
- package/dist/base/@types/store/dm/produto/index.js +2 -0
- package/dist/base/@types/store/dm/produto/index.js.map +1 -0
- package/dist/base/configs/endpoints.config/dm/config/produto.js +2 -1
- package/dist/base/configs/endpoints.config/dm/config/produto.js.map +1 -1
- package/dist/base/hooks/dm/produto/useValidaProdutoByEmissorPedidoVendaList.js +34 -0
- package/dist/base/hooks/dm/produto/useValidaProdutoByEmissorPedidoVendaList.js.map +1 -0
- package/dist/base/hooks/dm/produto/useValidaProdutoByEmissorPedidoVendaListUseMulti.js +34 -0
- package/dist/base/hooks/dm/produto/useValidaProdutoByEmissorPedidoVendaListUseMulti.js.map +1 -0
- package/dist/base/hooks/index.js +46 -42
- package/dist/base/hooks/index.js.map +1 -1
- package/dist/base/index.js +440 -435
- package/dist/base/index.js.map +1 -1
- package/dist/base/services/index.js +312 -311
- package/dist/base/services/modules/dm/index.js +31 -30
- package/dist/base/services/modules/dm/produto/ProdutoService.js +33 -26
- package/dist/base/services/modules/dm/produto/ProdutoService.js.map +1 -1
- package/dist/base/services/modules/index.js +314 -313
- package/dist/base/store/dm/produto/produtoListStoreUseMulti.js +14 -0
- package/dist/base/store/dm/produto/produtoListStoreUseMulti.js.map +1 -0
- package/lib/base/@types/models/commodities/pedidoVenda.ts +1 -0
- package/lib/base/@types/models/racao/pedidoVenda.ts +1 -0
- package/lib/base/@types/store/dm/produto/index.ts +15 -0
- package/lib/base/configs/endpoints.config/dm/config/produto.ts +2 -1
- package/lib/base/hooks/dm/produto/useValidaProdutoByEmissorPedidoVendaList.tsx +45 -0
- package/lib/base/hooks/dm/produto/useValidaProdutoByEmissorPedidoVendaListUseMulti.tsx +45 -0
- package/lib/base/hooks/index.ts +2 -0
- package/lib/base/services/modules/dm/produto/ProdutoService.ts +13 -0
- package/lib/base/store/dm/produto/produtoListStoreUseMulti.ts +19 -0
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getBaseTableParams as r } from "../../../services/query.js";
|
|
2
|
+
import { create as o } from "zustand";
|
|
3
|
+
const e = r(), s = {
|
|
4
|
+
filterParamsProduto: {},
|
|
5
|
+
tableParamsProduto: e
|
|
6
|
+
}, i = o((a) => ({
|
|
7
|
+
...s,
|
|
8
|
+
setFilterParamsProduto: (t) => a(() => ({ filterParamsProduto: t })),
|
|
9
|
+
setTableParamsProduto: (t) => a(() => ({ tableParamsProduto: t }))
|
|
10
|
+
}));
|
|
11
|
+
export {
|
|
12
|
+
i as useProdutoListStoreUseMulti
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=produtoListStoreUseMulti.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"produtoListStoreUseMulti.js","sources":["../../../../../lib/base/store/dm/produto/produtoListStoreUseMulti.ts"],"sourcesContent":["import { TProduto } from '@base/@types/models/dm/produto'\nimport { IListStoreAction, IListStoreState } from '@base/@types/store/dm/produto'\nimport { getBaseTableParams } from '@base/services/query'\nimport { create } from 'zustand'\n\nconst baseTableParams = getBaseTableParams()\n\nconst initialState: IListStoreState<TProduto> = {\n filterParamsProduto: {},\n tableParamsProduto: baseTableParams,\n}\n\nexport const useProdutoListStoreUseMulti = create<\n IListStoreState<TProduto> & IListStoreAction<TProduto>\n>((set) => ({\n ...initialState,\n setFilterParamsProduto: (payload) => set(() => ({ filterParamsProduto: payload })),\n setTableParamsProduto: (payload) => set(() => ({ tableParamsProduto: payload })),\n}))"],"names":["baseTableParams","getBaseTableParams","initialState","useProdutoListStoreUseMulti","create","set","payload"],"mappings":";;AAKA,MAAMA,IAAkBC,EAAA,GAElBC,IAA0C;AAAA,EAC5C,qBAAqB,CAAA;AAAA,EACrB,oBAAoBF;AACxB,GAEaG,IAA8BC,EAEzC,CAACC,OAAS;AAAA,EACR,GAAGH;AAAA,EACH,wBAAwB,CAACI,MAAYD,EAAI,OAAO,EAAE,qBAAqBC,IAAU;AAAA,EACjF,uBAAuB,CAACA,MAAYD,EAAI,OAAO,EAAE,oBAAoBC,IAAU;AACnF,EAAE;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IFilterParams, ITableParams, TQueryState } from '../../../api'
|
|
2
|
+
|
|
3
|
+
export interface IListStoreState<T> {
|
|
4
|
+
tableParamsProduto: ITableParams
|
|
5
|
+
filterParamsProduto: IFilterParams
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface IListStoreAction<T> {
|
|
9
|
+
setFilterParamsProduto: (payload: IFilterParams) => void
|
|
10
|
+
setTableParamsProduto: (payload: ITableParams) => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface IListStore<T>
|
|
14
|
+
extends IListStoreState<T>,
|
|
15
|
+
IListStoreAction<T> {}
|
|
@@ -5,7 +5,8 @@ const produto = {
|
|
|
5
5
|
findProdutoByCodigo: { endpoint: `${PRODUTO_BASE_URL}/find/`, method: 'post' },
|
|
6
6
|
findProdutosIsPrecificadoRacao: { endpoint: `${PRODUTO_BASE_URL}/find-produto-is-precificado-racao`, method: 'post' },
|
|
7
7
|
findProdutosByGrupoProduto: { endpoint: `${PRODUTO_BASE_URL}/find-produtos-by-grupo-produto`, method: 'post' },
|
|
8
|
-
findMonitor: { endpoint: `${PRODUTO_BASE_URL}/find-monitor`, httpMethod: 'post' }
|
|
8
|
+
findMonitor: { endpoint: `${PRODUTO_BASE_URL}/find-monitor`, httpMethod: 'post' },
|
|
9
|
+
validaProdutoByEmissorPedidoVenda: { endpoint: `${PRODUTO_BASE_URL}/valida-produto-by-emissor-pedido-venda/`, method: 'post' },
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export default produto
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { apiFindDmValidaProdutoByEmissorPedidoVenda } from '@base/services/modules/dm/produto/ProdutoService'
|
|
2
|
+
import { useProdutoListStore } from '@base/store/dm/produto/produtoListStore'
|
|
3
|
+
|
|
4
|
+
import useSWR from 'swr'
|
|
5
|
+
|
|
6
|
+
export default function useValidaProdutoByEmissorPedidoVendaList() {
|
|
7
|
+
const { tableParams, filterParams, setTableParams, setFilterParams } =
|
|
8
|
+
useProdutoListStore((state) => state)
|
|
9
|
+
|
|
10
|
+
const organizacaoVenda = filterParams?.organizacaoVenda
|
|
11
|
+
const canalDistribuicao = filterParams?.canalDistribuicao
|
|
12
|
+
const produtoId = filterParams?.produtoId
|
|
13
|
+
|
|
14
|
+
const { data, error, isLoading, mutate } = useSWR(
|
|
15
|
+
organizacaoVenda && canalDistribuicao && produtoId
|
|
16
|
+
? [
|
|
17
|
+
`/api/dm/produto/valida-produto-by-emissor-pedido-venda/${organizacaoVenda}/${canalDistribuicao}/${produtoId}`,
|
|
18
|
+
organizacaoVenda,
|
|
19
|
+
canalDistribuicao,
|
|
20
|
+
produtoId
|
|
21
|
+
]
|
|
22
|
+
: null,
|
|
23
|
+
([, organizacaoVenda, canalDistribuicao, produtoId]: [string, string, string, number]) =>
|
|
24
|
+
apiFindDmValidaProdutoByEmissorPedidoVenda(
|
|
25
|
+
organizacaoVenda,
|
|
26
|
+
canalDistribuicao,
|
|
27
|
+
produtoId
|
|
28
|
+
),
|
|
29
|
+
{ revalidateOnFocus: false },
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
const validaProdutoByEmissorPedidoVendaMessage = data ?? ''
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
data,
|
|
36
|
+
validaProdutoByEmissorPedidoVendaMessage,
|
|
37
|
+
error,
|
|
38
|
+
isLoading,
|
|
39
|
+
tableParams,
|
|
40
|
+
filterParams,
|
|
41
|
+
mutate,
|
|
42
|
+
setTableParams,
|
|
43
|
+
setFilterParams,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { apiFindDmValidaProdutoByEmissorPedidoVenda } from '@base/services/modules/dm/produto/ProdutoService'
|
|
2
|
+
import { useProdutoListStoreUseMulti } from '@base/store/dm/produto/produtoListStoreUseMulti'
|
|
3
|
+
|
|
4
|
+
import useSWR from 'swr'
|
|
5
|
+
|
|
6
|
+
export default function useValidaProdutoByEmissorPedidoVendaListUseMulti() {
|
|
7
|
+
const { tableParamsProduto, filterParamsProduto, setTableParamsProduto, setFilterParamsProduto } =
|
|
8
|
+
useProdutoListStoreUseMulti((state) => state)
|
|
9
|
+
|
|
10
|
+
const organizacaoVenda = filterParamsProduto?.organizacaoVenda
|
|
11
|
+
const canalDistribuicao = filterParamsProduto?.canalDistribuicao
|
|
12
|
+
const produtoId = filterParamsProduto?.produtoId
|
|
13
|
+
|
|
14
|
+
const { data, error, isLoading, mutate } = useSWR(
|
|
15
|
+
organizacaoVenda && canalDistribuicao && produtoId
|
|
16
|
+
? [
|
|
17
|
+
`/api/dm/produto/valida-produto-by-emissor-pedido-venda/${organizacaoVenda}/${canalDistribuicao}/${produtoId}`,
|
|
18
|
+
organizacaoVenda,
|
|
19
|
+
canalDistribuicao,
|
|
20
|
+
produtoId
|
|
21
|
+
]
|
|
22
|
+
: null,
|
|
23
|
+
([, organizacaoVenda, canalDistribuicao, produtoId]: [string, string, string, number]) =>
|
|
24
|
+
apiFindDmValidaProdutoByEmissorPedidoVenda(
|
|
25
|
+
organizacaoVenda,
|
|
26
|
+
canalDistribuicao,
|
|
27
|
+
produtoId
|
|
28
|
+
),
|
|
29
|
+
{ revalidateOnFocus: false },
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
const validaProdutoByEmissorPedidoVendaMessage = data ?? ''
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
data,
|
|
36
|
+
validaProdutoByEmissorPedidoVendaMessage,
|
|
37
|
+
error,
|
|
38
|
+
isLoading,
|
|
39
|
+
tableParamsProduto,
|
|
40
|
+
filterParamsProduto,
|
|
41
|
+
mutate,
|
|
42
|
+
setTableParamsProduto,
|
|
43
|
+
setFilterParamsProduto,
|
|
44
|
+
}
|
|
45
|
+
}
|
package/lib/base/hooks/index.ts
CHANGED
|
@@ -35,6 +35,8 @@ export { default as useProdutoByGrupoProdutoList } from './dm/produto/useProduto
|
|
|
35
35
|
export { default as useProdutoFindList } from './dm/produto/useProdutoFindList';
|
|
36
36
|
export { default as useProdutoFindMonitorList } from './dm/produto/useProdutoFindMonitorList';
|
|
37
37
|
export { default as useProdutoIsPrecificadoRacaoList } from './dm/produto/useProdutoIsPrecificadoRacaoList';
|
|
38
|
+
export { default as useValidaProdutoByEmissorPedidoVendaList } from './dm/produto/useValidaProdutoByEmissorPedidoVendaList';
|
|
39
|
+
export { default as useValidaProdutoByEmissorPedidoVendaListUseMulti } from './dm/produto/useValidaProdutoByEmissorPedidoVendaListUseMulti';
|
|
38
40
|
export { default as useSetorAtividadeList } from './dm/setorAtividade/useSetorAtividadeList';
|
|
39
41
|
export { default as useTipoDocumentoVendaByCodigoList } from './dm/tipoDocumentoVenda/useTipoDocumentoVendaByCodigoList';
|
|
40
42
|
export { default as useTipoDocumentoVendaList } from './dm/tipoDocumentoVenda/useTipoDocumentoVendaList';
|
|
@@ -5,6 +5,12 @@ import { endpointsConfig } from "@base/configs";
|
|
|
5
5
|
|
|
6
6
|
const PRODUTO_ENDPOINT = endpointsConfig.dm.produto;
|
|
7
7
|
|
|
8
|
+
export type TValidaProdutoResponse = {
|
|
9
|
+
status: 'SUCCESS' | 'ERROR'
|
|
10
|
+
code: 'OK' | 'ORG_NOT_FOUND' | 'CANAL_NOT_FOUND' | 'ORG_AND_CANAL_NOT_FOUND' | 'MISMATCH'
|
|
11
|
+
message: string
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
export async function apiFindDmProduto(data = {}) {
|
|
9
15
|
return ApiService.fetchDataWithAxios<TProduto[]>({
|
|
10
16
|
url: PRODUTO_ENDPOINT.find.endpoint,
|
|
@@ -55,4 +61,11 @@ export async function apiFindMonitorProduto(body?: IFilterParams) {
|
|
|
55
61
|
method: PRODUTO_ENDPOINT.findMonitor.httpMethod,
|
|
56
62
|
data: body,
|
|
57
63
|
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export async function apiFindDmValidaProdutoByEmissorPedidoVenda(organizacaoVenda: string, canalDistribuicao: string, produtoId: number) {
|
|
67
|
+
return ApiService.fetchDataWithAxios<TValidaProdutoResponse>({
|
|
68
|
+
url: PRODUTO_ENDPOINT.validaProdutoByEmissorPedidoVenda.endpoint + `${organizacaoVenda}/` + `${canalDistribuicao}/` + `${produtoId}`,
|
|
69
|
+
method: PRODUTO_ENDPOINT.validaProdutoByEmissorPedidoVenda.method,
|
|
70
|
+
})
|
|
58
71
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TProduto } from '@base/@types/models/dm/produto'
|
|
2
|
+
import { IListStoreAction, IListStoreState } from '@base/@types/store/dm/produto'
|
|
3
|
+
import { getBaseTableParams } from '@base/services/query'
|
|
4
|
+
import { create } from 'zustand'
|
|
5
|
+
|
|
6
|
+
const baseTableParams = getBaseTableParams()
|
|
7
|
+
|
|
8
|
+
const initialState: IListStoreState<TProduto> = {
|
|
9
|
+
filterParamsProduto: {},
|
|
10
|
+
tableParamsProduto: baseTableParams,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const useProdutoListStoreUseMulti = create<
|
|
14
|
+
IListStoreState<TProduto> & IListStoreAction<TProduto>
|
|
15
|
+
>((set) => ({
|
|
16
|
+
...initialState,
|
|
17
|
+
setFilterParamsProduto: (payload) => set(() => ({ filterParamsProduto: payload })),
|
|
18
|
+
setTableParamsProduto: (payload) => set(() => ({ tableParamsProduto: payload })),
|
|
19
|
+
}))
|
package/package.json
CHANGED