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:
2026-05-29 14:30:51 +00:00
parent 2abe5e8697
commit 24408ecd83
6 changed files with 204 additions and 146 deletions

View File

@@ -19,31 +19,39 @@ const SITUA_COLOR: Record<number, string> = {
const columns: TableColumnsType<PedidoSummary> = [
{
title: 'Nº',
dataIndex: 'numPedSar',
dataIndex: 'numero',
width: 120,
render: (num: string, row: PedidoSummary) => (
<Link to="/pedidos/$id" params={{ id: row.id }}>
{num}
</Link>
),
render: (_: number, row: PedidoSummary) => {
const label = row.numero ? String(row.numero) : row.numPedSar || row.id;
return row.fonte === 'erp' ? (
<span style={{ fontVariantNumeric: 'tabular-nums' }}>{label}</span>
) : (
<Link to="/pedidos/$id" params={{ id: row.id }}>
{label}
</Link>
);
},
},
{
title: 'Status',
dataIndex: 'situa',
width: 150,
render: (s: number) => (
<Badge
status={
(SITUA_COLOR[s] ?? 'default') as
| 'default'
| 'warning'
| 'processing'
| 'success'
| 'error'
}
text={<Tag color={SITUA_COLOR[s] ?? 'default'}>{SITUA_LABEL[s] ?? String(s)}</Tag>}
/>
),
render: (s: number, row: PedidoSummary) => {
const label = row.statusDescr ?? SITUA_LABEL[s] ?? String(s);
return (
<Badge
status={
(SITUA_COLOR[s] ?? 'default') as
| 'default'
| 'warning'
| 'processing'
| 'success'
| 'error'
}
text={<Tag color={SITUA_COLOR[s] ?? 'default'}>{label}</Tag>}
/>
);
},
},
{
title: 'Total',