Adiciona o frontend Next.js em frontend/ (setup, design system, autenticação/tema, layout/navegação, área master, área tenant completa: clientes, produtos, vendas, recebimentos, whatsapp, e-mail, alertas, equipe e perfil). Estende o backend de forma aditiva e autorizada: cookie httpOnly para refresh token (Etapa 13) e CRUD de equipe + edição de perfil do tenant (Etapa 18, módulo src/modules/equipe/ novo e PUT /tenant/perfil). Detalhes completos em Etapas/V2/*. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
67 lines
1.8 KiB
TypeScript
67 lines
1.8 KiB
TypeScript
import type { ReactNode } from 'react';
|
|
|
|
import { Button } from '@/components/ui/button';
|
|
import { ResponsiveDialog } from '@/components/ui/responsive-dialog';
|
|
|
|
interface ConfirmDialogProps {
|
|
open: boolean;
|
|
onOpenChange: (open: boolean) => void;
|
|
title: string;
|
|
description?: string;
|
|
confirmLabel?: string;
|
|
cancelLabel?: string;
|
|
destructive?: boolean;
|
|
loading?: boolean;
|
|
/** Desabilita o botão de confirmar (ex: falta escolher uma opção obrigatória em `children`). */
|
|
confirmDisabled?: boolean;
|
|
onConfirm: () => void;
|
|
/** Conteúdo extra entre a descrição e os botões (ex: um `Select` obrigatório) — opcional. */
|
|
children?: ReactNode;
|
|
}
|
|
|
|
/**
|
|
* Confirmação explícita antes de ações sensíveis (mudar status de tenant,
|
|
* excluir plano, disparar geração de faturas etc) — Etapa 15. `children`
|
|
* é opcional (Etapa 17: usado para pedir a forma de pagamento antes de
|
|
* marcar parcelas selecionadas como pagas em lote).
|
|
*/
|
|
export function ConfirmDialog({
|
|
open,
|
|
onOpenChange,
|
|
title,
|
|
description,
|
|
confirmLabel = 'Confirmar',
|
|
cancelLabel = 'Cancelar',
|
|
destructive = false,
|
|
loading = false,
|
|
confirmDisabled = false,
|
|
onConfirm,
|
|
children,
|
|
}: ConfirmDialogProps) {
|
|
return (
|
|
<ResponsiveDialog
|
|
open={open}
|
|
onOpenChange={onOpenChange}
|
|
title={title}
|
|
description={description}
|
|
footer={
|
|
<>
|
|
<Button variant="outline" onClick={() => onOpenChange(false)} disabled={loading}>
|
|
{cancelLabel}
|
|
</Button>
|
|
<Button
|
|
variant={destructive ? 'destructive' : 'primary'}
|
|
loading={loading}
|
|
disabled={confirmDisabled}
|
|
onClick={onConfirm}
|
|
>
|
|
{confirmLabel}
|
|
</Button>
|
|
</>
|
|
}
|
|
>
|
|
{children ?? <div className="sr-only" />}
|
|
</ResponsiveDialog>
|
|
);
|
|
}
|