feat(infra): triggers ERP + reset migrations Prisma para schema correto
Triggers SAR→ERP (scripts/sar-triggers.sql): - trg_pedido_aprovado: ao aprovar (situa 1→2) em sar.pedidos, replica automaticamente em sig.pedidos + sig.peditens e grava erp_id_pedido - trg_cliente_novo: INSERT em sar.clientes_novos replica em sig.corrent com todos os campos obrigatórios; grava id_corrent_erp e flag sincronizado - Corrige trigger tsvectorupdate do ERP para PG 18 (bpchar→text cast) - Adiciona coluna erp_id_pedido em sar.pedidos e tabela sar.clientes_novos Migrations Prisma: - Remove 5 migrations obsoletas com nomes PascalCase (Order, Client, etc.) que não batiam com os @@map snake_case do schema atual - Cria baseline 20260624000000_init_baseline apontando para estado correto Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,17 +1,13 @@
|
||||
import { Avatar, Badge, Button, Dropdown, Flex, Input, Typography } from 'antd';
|
||||
import { Avatar, Badge, Button, Dropdown, Flex, Typography } from 'antd';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import {
|
||||
faBell,
|
||||
faMagnifyingGlass,
|
||||
faBars,
|
||||
faRightFromBracket,
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
import { faBell, faBars, faBuilding, faRightFromBracket } from '@fortawesome/free-solid-svg-icons';
|
||||
import { useNavigate } from '@tanstack/react-router';
|
||||
import { brandTokens } from '../../lib/theme';
|
||||
import { FoundationStatus } from './FoundationStatus';
|
||||
import { usePendingCount } from '../../lib/queries/notifications';
|
||||
import { useCurrentUser } from '../../lib/queries/auth';
|
||||
import { useCompany } from '../../lib/queries/company';
|
||||
import { authStore } from '../../lib/auth-store';
|
||||
|
||||
interface TopbarProps {
|
||||
@@ -33,6 +29,11 @@ export function Topbar({ onToggleSidebar }: TopbarProps) {
|
||||
const { data: pendingData } = usePendingCount();
|
||||
const pendingCount = pendingData?.count ?? 0;
|
||||
const { data: user } = useCurrentUser();
|
||||
const { data: company } = useCompany();
|
||||
const nomeFantasia = company?.nomeFantasia?.trim() ?? null;
|
||||
const razaoSocial = company?.razaoSocial?.trim() ?? null;
|
||||
const nomeEmpresa = nomeFantasia ?? razaoSocial ?? '—';
|
||||
const mostrarRazao = nomeFantasia && razaoSocial && nomeFantasia !== razaoSocial;
|
||||
const initials = user?.nome
|
||||
? user.nome
|
||||
.split(' ')
|
||||
@@ -121,17 +122,39 @@ export function Topbar({ onToggleSidebar }: TopbarProps) {
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
{/* Centro: search (Supervisor/Admin) */}
|
||||
<Flex flex={1} justify="center" style={{ maxWidth: 480, margin: '0 var(--space-2xl)' }}>
|
||||
<Input
|
||||
size="large"
|
||||
placeholder="Buscar cliente, pedido, produto..."
|
||||
prefix={
|
||||
<FontAwesomeIcon icon={faMagnifyingGlass} style={{ color: 'var(--text-muted)' }} />
|
||||
}
|
||||
style={{ borderRadius: 12 }}
|
||||
aria-label="Buscar"
|
||||
/>
|
||||
{/* Centro: empresa ativa */}
|
||||
<Flex flex={1} justify="center" style={{ margin: '0 var(--space-2xl)' }}>
|
||||
<Flex align="center" gap={10}>
|
||||
<FontAwesomeIcon
|
||||
icon={faBuilding}
|
||||
style={{ color: 'var(--text-muted)', fontSize: 16, flexShrink: 0 }}
|
||||
/>
|
||||
<Flex vertical gap={0}>
|
||||
<Typography.Text
|
||||
style={{
|
||||
fontSize: 'var(--text-xl)',
|
||||
fontWeight: 'var(--font-weight-semibold)',
|
||||
color: 'var(--text-main)',
|
||||
lineHeight: 1.2,
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
{nomeEmpresa}
|
||||
</Typography.Text>
|
||||
{mostrarRazao && (
|
||||
<Typography.Text
|
||||
style={{
|
||||
fontSize: 'var(--text-2xs)',
|
||||
color: 'var(--text-muted)',
|
||||
lineHeight: 1.3,
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
{razaoSocial}
|
||||
</Typography.Text>
|
||||
)}
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
{/* Lado direito: novo pedido + status fundação + notificações + perfil */}
|
||||
|
||||
Reference in New Issue
Block a user