import React from 'react'; import { Invoice, InvoiceStatus } from '../../types'; import { FileText, FileSearch, AlertCircle, FileCheck, Check, X, MessageSquareQuote, CalendarPlus } from 'lucide-react'; const StatusBadge: React.FC<{ status: InvoiceStatus }> = ({ status }) => { const config: Record = { draft: { label: 'Черновик', color: 'text-slate-500', bg: 'bg-slate-100' }, pending_approval: { label: 'На согл.', color: 'text-amber-600', bg: 'bg-amber-50' }, clarification: { label: 'Уточнение', color: 'text-purple-600', bg: 'bg-purple-50' }, approved: { label: 'Согласован', color: 'text-blue-600', bg: 'bg-blue-50' }, scheduled: { label: 'В графике', color: 'text-indigo-600', bg: 'bg-indigo-50' }, paid: { label: 'Оплачен', color: 'text-emerald-600', bg: 'bg-emerald-50' }, rejected: { label: 'Отказ', color: 'text-red-600', bg: 'bg-red-50' }, overdue: { label: 'Просрочен', color: 'text-white', bg: 'bg-red-500' }, }; const s = config[status] || config.draft; return ( {s.label} ); }; export const InvoiceRegistry: React.FC<{ invoices: Invoice[], onUpdateStatus: (id: string, s: InvoiceStatus, extra?: any) => void }> = ({ invoices, onUpdateStatus }) => { // Show only "inbox" invoices: draft, pending, clarification, approved const registryInvoices = invoices.filter(i => ['draft', 'pending_approval', 'clarification', 'approved', 'rejected'].includes(i.status)); return (

Реестр согласования счетов

{registryInvoices.length === 0 &&
Новых счетов нет
} {registryInvoices.map(inv => (
{inv.priority === 'high' && Срочно}

{inv.contractorName}

{inv.address} • {inv.serviceName}

{inv.amount.toLocaleString()} ₽

{inv.date}

{inv.status === 'pending_approval' || inv.status === 'clarification' ? ( <> ) : inv.status === 'approved' ? ( ) : null}
))}
); };