feat(erp): pedidos e dashboard leem histórico do ERP (vw_pedidos_erp)
- OrdersService.list: substitui sar.pedidos por vw_pedidos_erp — 44k pedidos
históricos do rep 29 visíveis; sar.pedidos continua sendo a tabela de escrita
para novos pedidos SAR que serão integrados ao ERP
- DashboardService: atingido/pedidosMes/recentes/inativos todos via vw_pedidos_erp;
supervisor usa vw_pedidos_erp para pedidosDia
- PedidoSummarySchema: id relaxado de uuid() para string(); adiciona numero,
statusDescr e fonte ('sar'|'erp')
- orders.ts: corrige bug — apiFetch retorna JSON diretamente, não Response;
remove res.ok/res.json() incorretos
- OrdersPage: coluna Nº mostra numero do ERP; statusDescr no badge
- DevLogin: atualiza para PAVEI COMERCIO cod 29
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -24,8 +24,7 @@ export function useOrderList(params: Partial<PedidoListQuery> = {}) {
|
||||
queryKey: ['orders', params],
|
||||
queryFn: async () => {
|
||||
const res = await apiFetch(`/orders${qs ? `?${qs}` : ''}`);
|
||||
if (!res.ok) throw new Error(`orders list error ${res.status}`);
|
||||
return PedidoListResponseSchema.parse(await res.json());
|
||||
return PedidoListResponseSchema.parse(res);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -36,8 +35,7 @@ export function useOrderDetail(id: string | undefined) {
|
||||
enabled: !!id,
|
||||
queryFn: async () => {
|
||||
const res = await apiFetch(`/orders/${id}`);
|
||||
if (!res.ok) throw new Error(`order detail error ${res.status}`);
|
||||
return PedidoDetailSchema.parse(await res.json());
|
||||
return PedidoDetailSchema.parse(res);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -48,8 +46,7 @@ export function useClientOrders(idCliente: number | undefined) {
|
||||
enabled: idCliente != null,
|
||||
queryFn: async () => {
|
||||
const res = await apiFetch(`/orders?idCliente=${idCliente}&limit=10`);
|
||||
if (!res.ok) throw new Error(`client orders error ${res.status}`);
|
||||
const data = PedidoListResponseSchema.parse(await res.json());
|
||||
const data = PedidoListResponseSchema.parse(res);
|
||||
return data.data;
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user