// CallbackTab.jsx — Callback Request Management UI // Exported as window.CallbackTab (function () { const { useState, useEffect, useCallback, useRef } = React; const STATUS_LABELS = { pending: 'Bekleyen', calling: 'Arıyor', done: 'Tamamlandı', failed: 'Başarısız', cancelled: 'İptal', }; const STATUS_COLORS = { pending: { bg: '#92400e20', border: '#f59e0b', text: '#fbbf24' }, calling: { bg: '#1e3a8a20', border: '#3b82f6', text: '#60a5fa' }, done: { bg: '#064e3b20', border: '#10b981', text: '#34d399' }, failed: { bg: '#7f1d1d20', border: '#ef4444', text: '#f87171' }, cancelled: { bg: '#1f2937', border: '#6b7280', text: '#9ca3af' }, }; const FILTER_TABS = [ { key: 'all', label: 'Tümü' }, { key: 'pending', label: 'Bekleyen' }, { key: 'calling', label: 'Arıyor' }, { key: 'done', label: 'Tamamlandı' }, { key: 'failed', label: 'Başarısız' }, { key: 'cancelled', label: 'İptal' }, ]; function StatusBadge({ status }) { const s = STATUS_COLORS[status] || STATUS_COLORS.cancelled; return ( {STATUS_LABELS[status] || status} ); } function formatTR(iso) { if (!iso) return '--'; // Backend naive UTC döndürebilir → parseUTC ile yerel saate çevir. return fmtDateTime(iso, { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit', }); } // ── Stat card ─────────────────────────────────────────────────────────────── function StatCard({ label, value, color }) { return (
| Talep Saati | Numara | Müşteri Adı | Kuyruk | Planlanan Saat | Durum | Denemeler | İşlemler |
|---|---|---|---|---|---|---|---|
| {formatTR(cb.requested_at)} | {cb.phone} | {cb.caller_name || Bilinmiyor} | {cb.queue_name ? {cb.queue_name} : — } | {formatTR(cb.scheduled_at)} |
|
0 ? '#7f1d1d20' : 'var(--bg-hover)', border: `1px solid ${cb.attempts > 0 ? '#ef444460' : 'var(--border)'}`, color: cb.attempts > 0 ? '#f87171' : 'var(--text-dim)', borderRadius: 20, padding: '2px 10px', fontSize: 12, fontWeight:600, }}> {cb.attempts ?? 0} |
|