- Backend: FastAPI app with all models, services, schemas, routes - Admin Panel: Next.js dashboard with all modules (CRM, POS, repairs, warranties, billing, notifications, etc.) - Ecommerce: storefront (submodule) + product catalog - AI Agents: .agents/ skill library for Antigravity IDE - Docs: architecture, billing, notification gateway markdown - Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
103 lines
4.2 KiB
TypeScript
103 lines
4.2 KiB
TypeScript
'use client';
|
|
|
|
import { useEffect, useState } from 'react';
|
|
import { crmService, CrmLead } from '@/services/api/crmService';
|
|
import { Phone, Mail, CheckCircle2, Star, Sparkles } from 'lucide-react';
|
|
|
|
export default function ConvertedLeadsPage() {
|
|
const [leads, setLeads] = useState<CrmLead[]>([]);
|
|
const [loading, setLoading] = useState(true);
|
|
|
|
useEffect(() => {
|
|
loadLeads();
|
|
}, []);
|
|
|
|
const loadLeads = async () => {
|
|
try {
|
|
setLoading(true);
|
|
const data = await crmService.getLeads('CONVERTED');
|
|
setLeads(data || []);
|
|
} catch (err) {
|
|
setLeads([]);
|
|
} finally {
|
|
setLoading(false);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<div className="p-6 space-y-6 max-w-7xl mx-auto">
|
|
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-border pb-4">
|
|
<div>
|
|
<div className="flex items-center gap-2">
|
|
<span className="px-2.5 py-1 rounded-full text-xs font-bold bg-emerald-600/10 text-emerald-600 border border-emerald-600/20">
|
|
Stage 5 of 5
|
|
</span>
|
|
<h1 className="text-2xl font-bold text-foreground">5. Converted Leads & Deals</h1>
|
|
</div>
|
|
<p className="text-xs text-muted-foreground mt-1">
|
|
Successfully converted leads saved as E-Commerce & Service Repair Customer Profiles
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
{loading ? (
|
|
<div className="py-20 text-center text-muted-foreground animate-pulse text-sm">
|
|
Loading Converted Leads...
|
|
</div>
|
|
) : leads.length === 0 ? (
|
|
<div className="py-16 text-center bg-card border border-border rounded-xl">
|
|
<Sparkles className="w-10 h-10 text-emerald-600 mx-auto mb-2 opacity-50" />
|
|
<h3 className="text-sm font-semibold text-foreground">No converted leads recorded yet</h3>
|
|
<p className="text-xs text-muted-foreground mt-1">
|
|
Execute lead conversion on the Quote Sent page to move deals here.
|
|
</p>
|
|
</div>
|
|
) : (
|
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
{leads.map((lead) => (
|
|
<div key={lead.lead_id} className="bg-card border border-emerald-500/30 rounded-xl p-4 shadow-xs space-y-3 flex flex-col justify-between">
|
|
<div className="space-y-2">
|
|
<div className="flex items-start justify-between gap-2">
|
|
<h3 className="font-semibold text-sm text-foreground">
|
|
{lead.title || lead.first_name || 'Converted Inquiry'}
|
|
</h3>
|
|
<span className="px-2 py-0.5 rounded-md text-[10px] font-bold bg-emerald-500/10 text-emerald-600 flex items-center gap-1">
|
|
<CheckCircle2 className="w-3 h-3" />
|
|
CONVERTED
|
|
</span>
|
|
</div>
|
|
|
|
<div className="space-y-1 text-xs">
|
|
{lead.phone && (
|
|
<div className="flex items-center gap-1.5 text-foreground font-medium">
|
|
<Phone className="w-3.5 h-3.5 text-muted-foreground" />
|
|
{lead.phone}
|
|
</div>
|
|
)}
|
|
{lead.email && (
|
|
<div className="flex items-center gap-1.5 text-muted-foreground truncate">
|
|
<Mail className="w-3.5 h-3.5 shrink-0" />
|
|
<span className="truncate">{lead.email}</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
<div className="pt-2 flex items-center gap-1.5">
|
|
<span className="inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 border border-amber-500/30 text-[10px] font-bold">
|
|
<Star className="w-3 h-3 fill-amber-500 text-amber-500" />
|
|
⭐ Gold Star VIP Customer
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="pt-3 border-t border-border flex items-center justify-between text-xs text-emerald-600 font-semibold">
|
|
<span>Active Customer & Deal Record</span>
|
|
<CheckCircle2 className="w-4 h-4" />
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|