feat(10-redo-C): CRM leads module — schema, services, UI (Phase 10 redo)
Stage C of staged Phase 10 redo. Restores dangling phase10-wip work: - schema.ts: leads expansion + activities/reminders tables + relations - lead-service.ts / lead-validators.ts service layer - /admin/leads list + detail + actions, LeadTable/LeadDetail/LeadForm - LogActivityModal, SendQuoteModal, FollowUpWidget on dashboard - migration 0005 (applied to prod DB in Stage B, along with previously-missing 0001/0003/0004 — root cause of all post-deploy 500s: prod DB had no migrations applied since 0000) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { getLeadsNeedingFollowUp } from "@/lib/lead-service";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { AlertCircle } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
export async function FollowUpWidget() {
|
||||
const leadsNeedingFollowUp = await getLeadsNeedingFollowUp(7);
|
||||
|
||||
return (
|
||||
<Card className="border-orange-200 bg-orange-50">
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<AlertCircle className="h-5 w-5 text-orange-600" />
|
||||
Require Follow-up
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
{leadsNeedingFollowUp.length > 0 ? (
|
||||
<>
|
||||
<p className="text-lg font-bold text-orange-900">
|
||||
{leadsNeedingFollowUp.length} lead{leadsNeedingFollowUp.length !== 1 ? "s" : ""}{" "}
|
||||
to contact
|
||||
</p>
|
||||
<ul className="space-y-2 text-sm">
|
||||
{leadsNeedingFollowUp.slice(0, 3).map((lead) => (
|
||||
<li key={lead.id} className="flex justify-between items-center">
|
||||
<span>{lead.name}</span>
|
||||
<Button variant="ghost" size="sm" asChild>
|
||||
<Link href={`/admin/leads/${lead.id}`}>Contact</Link>
|
||||
</Button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{leadsNeedingFollowUp.length > 3 && (
|
||||
<Button variant="outline" className="w-full" asChild>
|
||||
<Link href="/admin/leads">View All ({leadsNeedingFollowUp.length})</Link>
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<p className="text-gray-600 text-sm">All leads are up to date!</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user