@orbe-agro/client-core 5.6.161 → 5.6.162
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/assets/styles/app.css +7 -0
- package/dist/@ecme/assets/styles/tailwind/index.css +7 -0
- package/dist/@ecme/components/template/Footer.js +1 -1
- package/dist/@types/base/@types/api/request/originacao/TLiquidarContratoRequest.d.ts +1 -0
- package/dist/@types/base/@types/api/request/originacao/TLiquidarContratoRequest.d.ts.map +1 -1
- package/dist/@types/base/@types/api/request/originacao/TSimularRoyaltiesRequest.d.ts +1 -0
- package/dist/@types/base/@types/api/request/originacao/TSimularRoyaltiesRequest.d.ts.map +1 -1
- package/dist/@types/base/@types/api/request/originacao/TUpdateProcessoFiscalRequest.d.ts +5 -0
- package/dist/@types/base/@types/api/request/originacao/TUpdateProcessoFiscalRequest.d.ts.map +1 -0
- package/dist/@types/base/@types/api/response/originacao/TProcessoFiscalResponse.d.ts +1 -0
- package/dist/@types/base/@types/api/response/originacao/TProcessoFiscalResponse.d.ts.map +1 -1
- package/dist/@types/base/@types/filters/index.d.ts +2 -0
- package/dist/@types/base/@types/filters/index.d.ts.map +1 -1
- package/dist/@types/base/@types/models/performance/ppr.d.ts +69 -0
- package/dist/@types/base/@types/models/performance/ppr.d.ts.map +1 -1
- package/dist/@types/base/components/filters/DynamicFilterField.d.ts.map +1 -1
- package/dist/@types/base/components/filters/DynamicListTableFilter.d.ts +37 -0
- package/dist/@types/base/components/filters/DynamicListTableFilter.d.ts.map +1 -0
- package/dist/@types/base/components/filters/index.d.ts +1 -0
- package/dist/@types/base/components/filters/index.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts +7 -1
- package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/originacao/config/cockpitFiscal.d.ts +1 -0
- package/dist/@types/base/configs/endpoints.config/originacao/config/cockpitFiscal.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/originacao/config/processoFiscal.d.ts +3 -0
- package/dist/@types/base/configs/endpoints.config/originacao/config/processoFiscal.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/originacao/config/saldoTicket.d.ts +1 -1
- package/dist/@types/base/configs/endpoints.config/originacao/config/saldoTicket.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/originacao/originacao.d.ts +5 -1
- package/dist/@types/base/configs/endpoints.config/originacao/originacao.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/performance/config/ppr.d.ts +2 -0
- package/dist/@types/base/configs/endpoints.config/performance/config/ppr.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/performance/performance.d.ts +2 -0
- package/dist/@types/base/configs/endpoints.config/performance/performance.d.ts.map +1 -1
- package/dist/@types/base/configs/navigation.config/submenu/performance/config/metaSetorialPorCcPpr.submenu.d.ts +4 -0
- package/dist/@types/base/configs/navigation.config/submenu/performance/config/metaSetorialPorCcPpr.submenu.d.ts.map +1 -0
- package/dist/@types/base/configs/navigation.config/submenu/performance/config/ppr.submenu.d.ts.map +1 -1
- package/dist/@types/base/services/index.d.ts +1 -1
- package/dist/@types/base/services/index.d.ts.map +1 -1
- package/dist/@types/base/services/modules/originacao/cockpitFiscal/cockpitFiscalService.d.ts +2 -0
- package/dist/@types/base/services/modules/originacao/cockpitFiscal/cockpitFiscalService.d.ts.map +1 -1
- package/dist/@types/base/services/modules/originacao/processoFiscal/processoFiscalService.d.ts +8 -0
- package/dist/@types/base/services/modules/originacao/processoFiscal/processoFiscalService.d.ts.map +1 -1
- package/dist/@types/base/services/modules/originacao/saldoTicket/saldoTicketService.d.ts +1 -1
- package/dist/@types/base/services/modules/originacao/saldoTicket/saldoTicketService.d.ts.map +1 -1
- package/dist/@types/base/services/modules/performance/PerformanceService.d.ts +6 -1
- package/dist/@types/base/services/modules/performance/PerformanceService.d.ts.map +1 -1
- package/dist/@types/base/services/query.d.ts +15 -0
- package/dist/@types/base/services/query.d.ts.map +1 -1
- package/dist/base/@types/api/request/originacao/TUpdateProcessoFiscalRequest.js +2 -0
- package/dist/base/@types/api/request/originacao/TUpdateProcessoFiscalRequest.js.map +1 -0
- package/dist/base/assets/styles/init.css +7 -0
- package/dist/base/components/filters/DynamicFilterField.js +49 -19
- package/dist/base/components/filters/DynamicFilterField.js.map +1 -1
- package/dist/base/components/filters/DynamicListTableFilter.js +116 -0
- package/dist/base/components/filters/DynamicListTableFilter.js.map +1 -0
- package/dist/base/components/filters/index.js +3 -1
- package/dist/base/components/filters/index.js.map +1 -1
- package/dist/base/components/index.js +8 -6
- package/dist/base/components/index.js.map +1 -1
- package/dist/base/configs/endpoints.config/originacao/config/cockpitFiscal.js +2 -1
- package/dist/base/configs/endpoints.config/originacao/config/cockpitFiscal.js.map +1 -1
- package/dist/base/configs/endpoints.config/originacao/config/processoFiscal.js +4 -1
- package/dist/base/configs/endpoints.config/originacao/config/processoFiscal.js.map +1 -1
- package/dist/base/configs/endpoints.config/originacao/config/saldoTicket.js +1 -1
- package/dist/base/configs/endpoints.config/originacao/config/saldoTicket.js.map +1 -1
- package/dist/base/configs/endpoints.config/performance/config/ppr.js +3 -1
- package/dist/base/configs/endpoints.config/performance/config/ppr.js.map +1 -1
- package/dist/base/configs/navigation.config/submenu/performance/config/metaSetorialPorCcPpr.submenu.js +17 -0
- package/dist/base/configs/navigation.config/submenu/performance/config/metaSetorialPorCcPpr.submenu.js.map +1 -0
- package/dist/base/configs/navigation.config/submenu/performance/config/ppr.submenu.js +3 -1
- package/dist/base/configs/navigation.config/submenu/performance/config/ppr.submenu.js.map +1 -1
- package/dist/base/index.js +234 -226
- package/dist/base/index.js.map +1 -1
- package/dist/base/services/index.js +8 -2
- package/dist/base/services/modules/index.js +6 -1
- package/dist/base/services/modules/originacao/cockpitFiscal/cockpitFiscalService.js +8 -1
- package/dist/base/services/modules/originacao/cockpitFiscal/cockpitFiscalService.js.map +1 -1
- package/dist/base/services/modules/originacao/processoFiscal/processoFiscalService.js +23 -0
- package/dist/base/services/modules/originacao/processoFiscal/processoFiscalService.js.map +1 -1
- package/dist/base/services/modules/originacao/saldoTicket/saldoTicketService.js +2 -2
- package/dist/base/services/modules/originacao/saldoTicket/saldoTicketService.js.map +1 -1
- package/dist/base/services/modules/performance/PerformanceService.js +38 -0
- package/dist/base/services/modules/performance/PerformanceService.js.map +1 -1
- package/dist/base/services/modules/performance/index.js +6 -1
- package/dist/base/services/query.js +26 -0
- package/dist/base/services/query.js.map +1 -1
- package/lib/base/@types/api/request/originacao/TLiquidarContratoRequest.ts +1 -0
- package/lib/base/@types/api/request/originacao/TSimularRoyaltiesRequest.ts +1 -0
- package/lib/base/@types/api/request/originacao/TUpdateProcessoFiscalRequest.ts +5 -0
- package/lib/base/@types/api/response/originacao/TProcessoFiscalResponse.ts +1 -0
- package/lib/base/@types/filters/index.ts +2 -0
- package/lib/base/@types/models/performance/ppr.ts +74 -0
- package/lib/base/components/filters/DynamicFilterField.tsx +51 -20
- package/lib/base/components/filters/DynamicListTableFilter.tsx +180 -0
- package/lib/base/components/filters/index.ts +1 -0
- package/lib/base/configs/endpoints.config/originacao/config/cockpitFiscal.ts +1 -0
- package/lib/base/configs/endpoints.config/originacao/config/processoFiscal.ts +3 -0
- package/lib/base/configs/endpoints.config/originacao/config/saldoTicket.ts +1 -1
- package/lib/base/configs/endpoints.config/performance/config/ppr.ts +2 -0
- package/lib/base/configs/navigation.config/submenu/performance/config/metaSetorialPorCcPpr.submenu.ts +17 -0
- package/lib/base/configs/navigation.config/submenu/performance/config/ppr.submenu.ts +2 -0
- package/lib/base/services/index.ts +1 -0
- package/lib/base/services/modules/originacao/cockpitFiscal/cockpitFiscalService.ts +8 -0
- package/lib/base/services/modules/originacao/processoFiscal/processoFiscalService.ts +25 -0
- package/lib/base/services/modules/originacao/saldoTicket/saldoTicketService.ts +2 -2
- package/lib/base/services/modules/performance/PerformanceService.ts +42 -0
- package/lib/base/services/query.ts +49 -0
- package/package.json +1 -1
|
@@ -95,6 +95,7 @@ const StandaloneField: React.FC<StandaloneFieldProps> = ({ item, lookupRegistry
|
|
|
95
95
|
<LookupComponent
|
|
96
96
|
name={descriptor.field}
|
|
97
97
|
label={descriptor.label}
|
|
98
|
+
multiSelect={descriptor.multiSelect}
|
|
98
99
|
/>
|
|
99
100
|
)
|
|
100
101
|
}
|
|
@@ -117,26 +118,56 @@ const StandaloneField: React.FC<StandaloneFieldProps> = ({ item, lookupRegistry
|
|
|
117
118
|
<Controller
|
|
118
119
|
name={descriptor.field}
|
|
119
120
|
control={control}
|
|
120
|
-
render={({ field, fieldState: { error } }) =>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
121
|
+
render={({ field, fieldState: { error } }) => {
|
|
122
|
+
if (descriptor.multiSelect) {
|
|
123
|
+
// Multi-select: value é string[], onChange recebe opções como array
|
|
124
|
+
const selectedOptions = options.filter(
|
|
125
|
+
(o) => (field.value as string[] | undefined)?.includes(o.value)
|
|
126
|
+
)
|
|
127
|
+
return (
|
|
128
|
+
<FormItem
|
|
129
|
+
className="text-xs"
|
|
130
|
+
label={descriptor.label}
|
|
131
|
+
invalid={!!error}
|
|
132
|
+
errorMessage={error?.message}
|
|
133
|
+
>
|
|
134
|
+
<Select
|
|
135
|
+
isClearable
|
|
136
|
+
isMulti
|
|
137
|
+
size="sm"
|
|
138
|
+
placeholder="Selecione uma ou mais opções"
|
|
139
|
+
options={options}
|
|
140
|
+
value={selectedOptions.length > 0 ? selectedOptions : null}
|
|
141
|
+
onChange={(opts: readonly { value: string; label: string }[] | null) =>
|
|
142
|
+
field.onChange(opts ? [...opts].map((o) => o.value) : null)
|
|
143
|
+
}
|
|
144
|
+
onBlur={field.onBlur}
|
|
145
|
+
/>
|
|
146
|
+
</FormItem>
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<FormItem
|
|
152
|
+
className="text-xs"
|
|
153
|
+
label={descriptor.label}
|
|
154
|
+
invalid={!!error}
|
|
155
|
+
errorMessage={error?.message}
|
|
156
|
+
>
|
|
157
|
+
<Select
|
|
158
|
+
isClearable
|
|
159
|
+
size="sm"
|
|
160
|
+
placeholder="Selecione uma opção"
|
|
161
|
+
options={options}
|
|
162
|
+
value={options.find((o) => o.value === field.value) ?? null}
|
|
163
|
+
onChange={(opt: { value: string; label: string } | null) =>
|
|
164
|
+
field.onChange(opt?.value ?? null)
|
|
165
|
+
}
|
|
166
|
+
onBlur={field.onBlur}
|
|
167
|
+
/>
|
|
168
|
+
</FormItem>
|
|
169
|
+
)
|
|
170
|
+
}}
|
|
140
171
|
/>
|
|
141
172
|
)
|
|
142
173
|
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import Button from '@/components/ui/Button/index'
|
|
3
|
+
import Drawer from '@/components/ui/Drawer/index'
|
|
4
|
+
import { Form } from '@/components/ui/Form/index'
|
|
5
|
+
import { Badge } from '@/components/ui/index'
|
|
6
|
+
import { FormProvider, useForm } from 'react-hook-form'
|
|
7
|
+
import { useTranslation } from 'react-i18next'
|
|
8
|
+
import { TbFilter } from 'react-icons/tb'
|
|
9
|
+
import useFilterMetadata from '@base/hooks/filters/useFilterMetadata'
|
|
10
|
+
import DynamicFilterPanel from './DynamicFilterPanel'
|
|
11
|
+
import type {
|
|
12
|
+
IFilterFieldDescriptor,
|
|
13
|
+
TLookupComponentRegistry,
|
|
14
|
+
} from '@base/@types/filters'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Props para o DynamicListTableFilter — componente genérico de filtros
|
|
18
|
+
* que renderiza um botão com badge + drawer com formulário dinâmico.
|
|
19
|
+
*
|
|
20
|
+
* Cada list-table que quiser filtros dinâmicos cria um wrapper de ~10 linhas
|
|
21
|
+
* que extrai os valores do seu hook específico e passa como props.
|
|
22
|
+
*/
|
|
23
|
+
export interface DynamicListTableFilterProps {
|
|
24
|
+
/** Chave SWR única para cache do filter-metadata (ex: '/originacao/api/saldo-ticket/filter-metadata') */
|
|
25
|
+
swrKey: string
|
|
26
|
+
/** Função que busca os metadados de filtro no backend */
|
|
27
|
+
metadataFetcher: () => Promise<IFilterFieldDescriptor[]>
|
|
28
|
+
/** Estado atual dos filtros (vem da store do módulo) */
|
|
29
|
+
filterParams: Record<string, unknown>
|
|
30
|
+
/** Atualiza o estado dos filtros (recebendo params limpos) */
|
|
31
|
+
setFilterParams: (payload: Record<string, unknown>) => void
|
|
32
|
+
/** Número de filtros ativos (para o badge) */
|
|
33
|
+
activeFiltersCount: number
|
|
34
|
+
/**
|
|
35
|
+
* Mapa de resource → componente de lookup.
|
|
36
|
+
* Mesmo tipo usado pelo DynamicFilterPanel.
|
|
37
|
+
* @example { 'business-partner': BusinessPartnerLookup, 'safra': SafraLookup }
|
|
38
|
+
*/
|
|
39
|
+
lookupRegistry?: TLookupComponentRegistry
|
|
40
|
+
/**
|
|
41
|
+
* Mapa de resource → função de extração de valor primitivo.
|
|
42
|
+
* Usado no onSubmit para transformar objetos completos armazenados no RHF
|
|
43
|
+
* nos valores planos que a API espera.
|
|
44
|
+
* @example { 'business-partner': (obj) => obj?.id, 'safra': (obj) => obj?.id }
|
|
45
|
+
*/
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
extractValueRegistry?: Record<string, (obj: any) => unknown>
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const DynamicListTableFilter: React.FC<DynamicListTableFilterProps> = ({
|
|
51
|
+
swrKey,
|
|
52
|
+
metadataFetcher,
|
|
53
|
+
filterParams,
|
|
54
|
+
setFilterParams,
|
|
55
|
+
activeFiltersCount,
|
|
56
|
+
lookupRegistry,
|
|
57
|
+
extractValueRegistry,
|
|
58
|
+
}) => {
|
|
59
|
+
const [filterIsOpen, setFilterIsOpen] = useState(false)
|
|
60
|
+
|
|
61
|
+
const { fields, isLoading: metadataLoading, error: metadataError } = useFilterMetadata(
|
|
62
|
+
swrKey,
|
|
63
|
+
metadataFetcher,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
// Sem zod schema: o backend define quais campos existem e todos são opcionais.
|
|
67
|
+
// O defaultValues reconstitui o estado atual dos filtros ao reabrir o drawer.
|
|
68
|
+
const methods = useForm<Record<string, unknown>>({
|
|
69
|
+
defaultValues: filterParams,
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
const onSubmit = (data: Record<string, unknown>) => {
|
|
73
|
+
// Constrói um mapa rápido de field → lookup.resource para os campos com lookup
|
|
74
|
+
const lookupResourceByField = new Map<string, string>()
|
|
75
|
+
for (const f of fields) {
|
|
76
|
+
if (f.lookup) {
|
|
77
|
+
lookupResourceByField.set(f.field, f.lookup.resource)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const cleanParams: Record<string, unknown> = {}
|
|
82
|
+
for (const [key, value] of Object.entries(data)) {
|
|
83
|
+
if (value === null || value === undefined || value === '') continue
|
|
84
|
+
|
|
85
|
+
const resource = lookupResourceByField.get(key)
|
|
86
|
+
// Campo de lookup com extractFn registrado → extrai o primitivo (id, codigo)
|
|
87
|
+
// Se o extractFn não existir (lookup não registrado no registry), trata como texto comum
|
|
88
|
+
const extractFn = resource && extractValueRegistry?.[resource]
|
|
89
|
+
if (extractFn) {
|
|
90
|
+
// Multi-select lookup: value é um array de objetos → extrai primitivo de cada um
|
|
91
|
+
if (Array.isArray(value)) {
|
|
92
|
+
const primitives = value.map((v) => extractFn(v)).filter((p) => p !== null && p !== undefined)
|
|
93
|
+
if (primitives.length > 0) {
|
|
94
|
+
cleanParams[key] = primitives
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
const primitive = extractFn(value)
|
|
98
|
+
if (primitive !== null && primitive !== undefined) {
|
|
99
|
+
cleanParams[key] = primitive
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
cleanParams[key] = value
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
setFilterParams(cleanParams)
|
|
107
|
+
setFilterIsOpen(false)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const onClearFilters = () => {
|
|
111
|
+
// Zera explicitamente cada campo registrado pelos metadados.
|
|
112
|
+
// Usar reset({}) sozinho não é suficiente: o react-hook-form mantém o registro
|
|
113
|
+
// dos campos dinâmicos e pode devolver valores antigos em submits subsequentes.
|
|
114
|
+
// Também inclui os campos de range (startField/endField) que ficam registrados
|
|
115
|
+
// separadamente no form pelo DynamicFilterField/RangeField.
|
|
116
|
+
const clearedValues: Record<string, null> = {}
|
|
117
|
+
for (const f of fields) {
|
|
118
|
+
clearedValues[f.field] = null
|
|
119
|
+
}
|
|
120
|
+
methods.reset(clearedValues)
|
|
121
|
+
setFilterParams({})
|
|
122
|
+
setFilterIsOpen(false)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const { t } = useTranslation()
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<>
|
|
129
|
+
<Badge className="ml-auto mr-4" content={activeFiltersCount}>
|
|
130
|
+
<Button icon={<TbFilter />} className='text-xs' onClick={() => setFilterIsOpen(true)}>
|
|
131
|
+
{t('common.actions.filter')}
|
|
132
|
+
</Button>
|
|
133
|
+
</Badge>
|
|
134
|
+
<Drawer
|
|
135
|
+
title={<span className="font-bold">Filtros</span>}
|
|
136
|
+
isOpen={filterIsOpen}
|
|
137
|
+
className="text-xs"
|
|
138
|
+
onClose={() => setFilterIsOpen(false)}
|
|
139
|
+
onRequestClose={() => setFilterIsOpen(false)}
|
|
140
|
+
>
|
|
141
|
+
<FormProvider {...methods}>
|
|
142
|
+
<Form
|
|
143
|
+
className="h-full"
|
|
144
|
+
containerClassName="flex h-full flex-col"
|
|
145
|
+
onSubmit={methods.handleSubmit(onSubmit)}
|
|
146
|
+
>
|
|
147
|
+
<div className="flex-1 overflow-y-auto overflow-hidden pr-3">
|
|
148
|
+
{metadataLoading && (
|
|
149
|
+
<div className="flex justify-center py-6 text-sm text-gray-500">
|
|
150
|
+
Carregando filtros...
|
|
151
|
+
</div>
|
|
152
|
+
)}
|
|
153
|
+
{metadataError && !metadataLoading && (
|
|
154
|
+
<div className="flex justify-center py-6 text-sm text-red-500">
|
|
155
|
+
Falha ao carregar filtros. Tente novamente.
|
|
156
|
+
</div>
|
|
157
|
+
)}
|
|
158
|
+
{!metadataLoading && !metadataError && (
|
|
159
|
+
<DynamicFilterPanel
|
|
160
|
+
fields={fields}
|
|
161
|
+
lookupRegistry={lookupRegistry}
|
|
162
|
+
/>
|
|
163
|
+
)}
|
|
164
|
+
</div>
|
|
165
|
+
<div className="flex justify-end flex-col gap-2 mt-auto border-t dark:border-t-zinc-600">
|
|
166
|
+
<Button variant="plain" type="button" onClick={onClearFilters}>
|
|
167
|
+
Limpar filtros
|
|
168
|
+
</Button>
|
|
169
|
+
<Button variant="solid" type="submit">
|
|
170
|
+
Filtrar
|
|
171
|
+
</Button>
|
|
172
|
+
</div>
|
|
173
|
+
</Form>
|
|
174
|
+
</FormProvider>
|
|
175
|
+
</Drawer>
|
|
176
|
+
</>
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export default DynamicListTableFilter
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const processoFiscal = {
|
|
2
|
+
create: '/originacao/api/processo-fiscal',
|
|
3
|
+
update: (id: string) => `/originacao/api/processo-fiscal/${id}`,
|
|
2
4
|
uploadNotaFiscal: (id: string) => `/originacao/api/processo-fiscal/${id}/upload-nota-fiscal`,
|
|
3
5
|
downloadNotaFiscal: (url: string) => `/originacao/api/processo-fiscal/nota-fiscal/${url}`,
|
|
6
|
+
listByContrato: (contratoId: string | number) => `/originacao/api/processo-fiscal?contratoId=${contratoId}`,
|
|
4
7
|
};
|
|
5
8
|
|
|
6
9
|
export default processoFiscal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const saldoTicket = {
|
|
2
|
-
buscarSaldoContrato: (id: string) => `/originacao/api/saldo-ticket/contrato/${id}`,
|
|
2
|
+
buscarSaldoContrato: (id: string, processoFiscalId: string | number) => `/originacao/api/saldo-ticket/contrato/${id}?processoFiscalId=${processoFiscalId}`,
|
|
3
3
|
findAll: (params?: string) => `/originacao/api/saldo-ticket?${params ?? ""}`,
|
|
4
4
|
historicoById: (id: string, params?: string) => `/originacao/api/saldo-ticket/${id}/historicos?${params ?? ""}`,
|
|
5
5
|
buscarSaldoDisponivel: '/originacao/api/saldo-ticket/saldo-disponivel',
|
|
@@ -7,6 +7,8 @@ const ppr = {
|
|
|
7
7
|
indicadoresMetaGlobalFindMonitor: '/performance/api/ppr/indicadores/meta-global/find-monitor',
|
|
8
8
|
indicadoresMetaSetorialGeral: '/performance/api/ppr/indicadores/meta-setorial-geral',
|
|
9
9
|
indicadoresMetaSetorialGeralFindMonitor: '/performance/api/ppr/indicadores/meta-setorial-geral/find-monitor',
|
|
10
|
+
indicadoresMetaSetorialPorCc: '/performance/api/ppr/indicadores/meta-setorial-por-cc',
|
|
11
|
+
indicadoresMetaSetorialPorCcFindMonitor: '/performance/api/ppr/indicadores/meta-setorial-por-cc/find-monitor',
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
export default ppr;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NavigationTree } from '@/@types/navigation'
|
|
2
|
+
import { NAV_ITEM_TYPE_ITEM } from '@/constants/navigation.constant'
|
|
3
|
+
import { ADMIN } from '@/constants/roles.constant'
|
|
4
|
+
|
|
5
|
+
const metaSetorialPorCcPprSubmenu: NavigationTree = {
|
|
6
|
+
key: 'modules.performance.ppr.metaSetorialPorCc',
|
|
7
|
+
path: '/performance/ppr/meta-setorial-por-cc',
|
|
8
|
+
title: 'Meta Setorial por CC',
|
|
9
|
+
translateKey: 'nav.modules.performance.ppr.metaSetorialPorCc.title',
|
|
10
|
+
icon: '',
|
|
11
|
+
type: NAV_ITEM_TYPE_ITEM,
|
|
12
|
+
forceShowTitle: true,
|
|
13
|
+
authority: [ADMIN],
|
|
14
|
+
subMenu: [],
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default metaSetorialPorCcPprSubmenu
|
|
@@ -4,6 +4,7 @@ import { ADMIN } from '@/constants/roles.constant'
|
|
|
4
4
|
import aberturaAnoPprSubmenu from './aberturaAnoPpr.submenu'
|
|
5
5
|
import metaGlobalPprSubmenu from './metaGlobalPpr.submenu'
|
|
6
6
|
import metaSetorialGeralPprSubmenu from './metaSetorialGeralPpr.submenu'
|
|
7
|
+
import metaSetorialPorCcPprSubmenu from './metaSetorialPorCcPpr.submenu'
|
|
7
8
|
|
|
8
9
|
const pprSubmenu: NavigationTree = {
|
|
9
10
|
key: 'modules.performance.ppr',
|
|
@@ -17,6 +18,7 @@ const pprSubmenu: NavigationTree = {
|
|
|
17
18
|
aberturaAnoPprSubmenu,
|
|
18
19
|
metaGlobalPprSubmenu,
|
|
19
20
|
metaSetorialGeralPprSubmenu,
|
|
21
|
+
metaSetorialPorCcPprSubmenu,
|
|
20
22
|
],
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -2,6 +2,7 @@ import ApiService from "@/services/ApiService";
|
|
|
2
2
|
import { TQueryResponse } from "@base/@types/api";
|
|
3
3
|
import { TCockpitFiscalResponse } from "@base/@types/api/response/originacao/TCockpitFiscalResponse";
|
|
4
4
|
import endpointNavigationConfig from "@base/configs/endpoints.config/endpoints.navigation";
|
|
5
|
+
import { IFilterFieldDescriptor } from "@base/@types/filters";
|
|
5
6
|
|
|
6
7
|
const COCKPIT_FISCAL_ORIGINACAO_ENDPOINT = endpointNavigationConfig.originacao.cockpitFiscal;
|
|
7
8
|
|
|
@@ -10,4 +11,11 @@ export async function apiFindAllCockpitFiscal(params?: string) {
|
|
|
10
11
|
url: COCKPIT_FISCAL_ORIGINACAO_ENDPOINT.findAll(params),
|
|
11
12
|
method: "get",
|
|
12
13
|
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function apiFindCockpitFiscalFilterMetadata() {
|
|
17
|
+
return ApiService.fetchDataWithAxios<IFilterFieldDescriptor[]>({
|
|
18
|
+
url: COCKPIT_FISCAL_ORIGINACAO_ENDPOINT.filterMetadata,
|
|
19
|
+
method: "get",
|
|
20
|
+
});
|
|
13
21
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import ApiService from "@/services/ApiService";
|
|
2
|
+
import { TProcessoFiscalResponse } from "@base/@types/api/response/originacao/TProcessoFiscalResponse";
|
|
3
|
+
import { TUpdateProcessoFiscalRequest } from "@base/@types/api/request/originacao/TUpdateProcessoFiscalRequest";
|
|
2
4
|
import endpointNavigationConfig from "@base/configs/endpoints.config/endpoints.navigation";
|
|
3
5
|
|
|
4
6
|
const PROCESSO_FISCAL_ORIGINACAO_ENDPOINT = endpointNavigationConfig.originacao.processoFiscal;
|
|
@@ -17,4 +19,27 @@ export async function apiGetNotaFiscal(url: string) {
|
|
|
17
19
|
method: "get",
|
|
18
20
|
responseType: "blob"
|
|
19
21
|
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function apiCreateProcessoFiscal(data: { contratoId: number; quantidade: number }) {
|
|
25
|
+
return ApiService.fetchDataWithAxios<void>({
|
|
26
|
+
url: PROCESSO_FISCAL_ORIGINACAO_ENDPOINT.create,
|
|
27
|
+
method: "post",
|
|
28
|
+
data,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function apiUpdateProcessoFiscal(id: string | number, data: TUpdateProcessoFiscalRequest) {
|
|
33
|
+
return ApiService.fetchDataWithAxios<void>({
|
|
34
|
+
url: PROCESSO_FISCAL_ORIGINACAO_ENDPOINT.update(String(id)),
|
|
35
|
+
method: "put",
|
|
36
|
+
data,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function apiListarProcessosFiscais(contratoId: string | number): Promise<TProcessoFiscalResponse[]> {
|
|
41
|
+
return ApiService.fetchDataWithAxios<TProcessoFiscalResponse[]>({
|
|
42
|
+
url: PROCESSO_FISCAL_ORIGINACAO_ENDPOINT.listByContrato(contratoId),
|
|
43
|
+
method: "get",
|
|
44
|
+
});
|
|
20
45
|
}
|
|
@@ -11,9 +11,9 @@ import { IFilterFieldDescriptor } from "@base/@types/filters";
|
|
|
11
11
|
|
|
12
12
|
const SALDO_TICKET_ORIGINACAO_ENDPOINT = endpointNavigationConfig.originacao.saldoTicket;
|
|
13
13
|
|
|
14
|
-
export async function apiBuscarSaldoContrato(id: number | string) {
|
|
14
|
+
export async function apiBuscarSaldoContrato(id: number | string, processoFiscalId: number | string) {
|
|
15
15
|
return ApiService.fetchDataWithAxios<TSaldoContratoResponse>({
|
|
16
|
-
url: SALDO_TICKET_ORIGINACAO_ENDPOINT.buscarSaldoContrato(String(id)),
|
|
16
|
+
url: SALDO_TICKET_ORIGINACAO_ENDPOINT.buscarSaldoContrato(String(id), processoFiscalId),
|
|
17
17
|
method: "get",
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -9,11 +9,15 @@ import {
|
|
|
9
9
|
TAnoPpr,
|
|
10
10
|
TCreateIndicadorMetaGlobal,
|
|
11
11
|
TCreateIndicadorMetaSetorialGeral,
|
|
12
|
+
TCreateIndicadorMetaSetorialPorCc,
|
|
12
13
|
TFindMonitorIndicadorMetaGlobal,
|
|
13
14
|
TFindMonitorIndicadorMetaSetorialGeral,
|
|
15
|
+
TFindMonitorIndicadorMetaSetorialPorCc,
|
|
14
16
|
TIndicadorMetaGlobal,
|
|
15
17
|
TIndicadorMetaSetorialGeral,
|
|
18
|
+
TIndicadorMetaSetorialPorCc,
|
|
16
19
|
TParametroCcPpr,
|
|
20
|
+
TUpdateIndicadorMetaSetorialPorCc,
|
|
17
21
|
TUpdateParametroCcStatusPpr,
|
|
18
22
|
} from '@base/@types/models/performance/ppr'
|
|
19
23
|
import { endpointsConfig } from '@base/configs'
|
|
@@ -324,3 +328,41 @@ export async function apiDeleteIndicadorMetaSetorialGeral(id: number) {
|
|
|
324
328
|
})
|
|
325
329
|
}
|
|
326
330
|
|
|
331
|
+
export async function apiGetIndicadoresMetaSetorialPorCc(body?: IFilterParams) {
|
|
332
|
+
return ApiService.fetchDataWithAxios<TQueryResponse<TFindMonitorIndicadorMetaSetorialPorCc>>({
|
|
333
|
+
url: endpointsConfig.performance.ppr.indicadoresMetaSetorialPorCcFindMonitor,
|
|
334
|
+
method: 'post',
|
|
335
|
+
data: body,
|
|
336
|
+
})
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export async function apiGetIndicadorMetaSetorialPorCcById(id: number) {
|
|
340
|
+
return ApiService.fetchDataWithAxios<TIndicadorMetaSetorialPorCc>({
|
|
341
|
+
url: `${endpointsConfig.performance.ppr.indicadoresMetaSetorialPorCc}/${id}`,
|
|
342
|
+
method: 'get',
|
|
343
|
+
})
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export async function apiCreateIndicadorMetaSetorialPorCc(data: TCreateIndicadorMetaSetorialPorCc) {
|
|
347
|
+
return ApiService.fetchDataWithAxios<TIndicadorMetaSetorialPorCc>({
|
|
348
|
+
url: endpointsConfig.performance.ppr.indicadoresMetaSetorialPorCc,
|
|
349
|
+
method: 'post',
|
|
350
|
+
data,
|
|
351
|
+
})
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export async function apiUpdateIndicadorMetaSetorialPorCc(data: TUpdateIndicadorMetaSetorialPorCc) {
|
|
355
|
+
return ApiService.fetchDataWithAxios<TIndicadorMetaSetorialPorCc>({
|
|
356
|
+
url: endpointsConfig.performance.ppr.indicadoresMetaSetorialPorCc,
|
|
357
|
+
method: 'put',
|
|
358
|
+
data,
|
|
359
|
+
})
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export async function apiDeleteIndicadorMetaSetorialPorCc(id: number) {
|
|
363
|
+
return ApiService.fetchDataWithAxios<void>({
|
|
364
|
+
url: `${endpointsConfig.performance.ppr.indicadoresMetaSetorialPorCc}/${id}`,
|
|
365
|
+
method: 'delete',
|
|
366
|
+
})
|
|
367
|
+
}
|
|
368
|
+
|
|
@@ -62,3 +62,52 @@ export function buildQueryString(filterParams: IFilterParams, tableParams?: ITab
|
|
|
62
62
|
|
|
63
63
|
return searchParams.toString()
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Versão alternativa do buildQueryString que serializa arrays como parâmetros
|
|
68
|
+
* repetidos na query string ao invés de JSON string.
|
|
69
|
+
*
|
|
70
|
+
* Útil para backends Spring que esperam listas via params repetidos
|
|
71
|
+
* (ex: ?status=APROVADO&status=REPROVADO ao invés de ?status=["APROVADO","REPROVADO"]).
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* buildQueryStringRepeated({ status: ['APROVADO', 'REPROVADO'] })
|
|
75
|
+
* // → "status=APROVADO&status=REPROVADO"
|
|
76
|
+
*
|
|
77
|
+
* Objetos aninhados continuam sendo serializados como JSON string
|
|
78
|
+
* (ex: { filter: { nome: "foo" } }).
|
|
79
|
+
*/
|
|
80
|
+
export function buildQueryStringRepeated(filterParams: IFilterParams, tableParams?: ITableParams): string {
|
|
81
|
+
|
|
82
|
+
const searchParams = new URLSearchParams()
|
|
83
|
+
|
|
84
|
+
// Adiciona os parâmetros da tabela (apenas se fornecidos)
|
|
85
|
+
if(tableParams) {
|
|
86
|
+
Object.entries(tableParams).forEach(([key, value]) => {
|
|
87
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
88
|
+
searchParams.append(key, String(value))
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Adiciona os parâmetros de filtro
|
|
94
|
+
Object.entries(filterParams).forEach(([key, value]) => {
|
|
95
|
+
if (value === undefined || value === null || value === '') return
|
|
96
|
+
|
|
97
|
+
if (Array.isArray(value)) {
|
|
98
|
+
// Array vira params repetidos: ?status=APROVADO&status=REPROVADO
|
|
99
|
+
for (const item of value) {
|
|
100
|
+
if (item !== null && item !== undefined && item !== '') {
|
|
101
|
+
searchParams.append(key, String(item))
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
} else if (typeof value === 'object') {
|
|
105
|
+
// Objetos aninhados continuam como JSON string
|
|
106
|
+
searchParams.append(key, JSON.stringify(value))
|
|
107
|
+
} else {
|
|
108
|
+
searchParams.append(key, String(value))
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
return searchParams.toString()
|
|
113
|
+
}
|
package/package.json
CHANGED