feat(orders): nome do cliente na lista de pedidos via LEFT JOIN vw_clientes

- JOIN de vw_pedidos_erp com vw_clientes pelo id_cliente + id_empresa
- Campos nomeCliente e razaoCliente adicionados ao PedidoSummary (contrato)
- Tabela, cards mobile e drawer exibem razão social (fallback para nome)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-29 19:00:22 +00:00
parent fb6df551b7
commit 2d4f342697
3 changed files with 38 additions and 14 deletions

View File

@@ -297,8 +297,15 @@ function OrderDetailDrawer({ id, onClose }: { id: string | null; onClose: () =>
<Text>{fmtDate(data.dtPedido)}</Text>
</Col>
<Col span={12}>
<span style={label}>Cód. Cliente</span>
<Text>{data.idCliente}</Text>
<span style={label}>Cliente</span>
<Text strong>
{data.razaoCliente ?? data.nomeCliente ?? `Cód. ${data.idCliente}`}
</Text>
{data.nomeCliente && data.razaoCliente && (
<Text type="secondary" style={{ fontSize: 12, display: 'block' }}>
{data.nomeCliente}
</Text>
)}
</Col>
<Col span={12}>
<span style={label}>Total</span>
@@ -406,7 +413,8 @@ function MobileOrderCard({
<OrderStatusBadge situa={order.situa} descr={order.statusDescr} />
</div>
<Text type="secondary" style={{ fontSize: 12, display: 'block', marginBottom: 4 }}>
Cód. cliente {order.idCliente} · {fmtDate(order.dtPedido)}
{order.razaoCliente ?? order.nomeCliente ?? `Cód. ${order.idCliente}`} ·{' '}
{fmtDate(order.dtPedido)}
</Text>
<Text strong style={{ fontSize: 16, color: '#003B8E' }}>
{fmt(order.total)}
@@ -517,16 +525,24 @@ export function OrdersPage() {
{
title: 'Cliente',
key: 'cliente',
render: (_: unknown, row: PedidoSummary) => (
<Space direction="vertical" size={0}>
<Text style={{ fontWeight: 500 }}>Cód. {row.idCliente}</Text>
{row.obs && (
<Text type="secondary" style={{ fontSize: 11 }} ellipsis={{ tooltip: row.obs }}>
{row.obs.slice(0, 40)}
</Text>
)}
</Space>
),
ellipsis: true,
render: (_: unknown, row: PedidoSummary) => {
const nome = row.razaoCliente ?? row.nomeCliente;
return (
<Space direction="vertical" size={0}>
{nome ? (
<Text style={{ fontWeight: 500 }}>{nome}</Text>
) : (
<Text type="secondary">Cód. {row.idCliente}</Text>
)}
{row.nomeCliente && row.razaoCliente && (
<Text type="secondary" style={{ fontSize: 11 }}>
{row.nomeCliente}
</Text>
)}
</Space>
);
},
},
{
title: 'Status',