feat(14-02): add LeadsSearch, rewire leads pages, surface tags in LeadDetail (CRM-08/09)
- New LeadsSearch.tsx: client-side instant filter across name/email/ company/status/tags (mirrors CatalogSearch.tsx) - page.tsx: fetch via getLeadsWithTags()/getLeadFieldOptions(), render LeadsSearch + CreateLeadModal, revalidate=0 - [id]/page.tsx: fetch getLeadsWithTags()/getLeadFieldOptions(), find lead by id, pass tags/tagOptions to LeadDetail - LeadDetail.tsx: add OptionMultiSelect for lead tags in the "Profilo" card, wired to addLeadTag/removeLeadTag/renameLeadTag with error display
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import { getLeadById, getActivityLog, getUpcomingReminders } from "@/lib/lead-service";
|
||||
import { getActivityLog, getUpcomingReminders } from "@/lib/lead-service";
|
||||
import { getLeadsWithTags, getLeadFieldOptions } from "@/lib/admin-queries";
|
||||
import { LeadDetail } from "@/components/admin/leads/LeadDetail";
|
||||
|
||||
export default async function LeadDetailPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
const lead = await getLeadById(id);
|
||||
|
||||
const [leads, options] = await Promise.all([
|
||||
getLeadsWithTags(),
|
||||
getLeadFieldOptions(),
|
||||
]);
|
||||
|
||||
const lead = leads.find((l) => l.id === id);
|
||||
|
||||
if (!lead) {
|
||||
notFound();
|
||||
@@ -13,5 +20,13 @@ export default async function LeadDetailPage({ params }: { params: Promise<{ id:
|
||||
const activities = await getActivityLog(id);
|
||||
const reminders = await getUpcomingReminders(id);
|
||||
|
||||
return <LeadDetail lead={lead} activities={activities} reminders={reminders} />;
|
||||
return (
|
||||
<LeadDetail
|
||||
lead={lead}
|
||||
activities={activities}
|
||||
reminders={reminders}
|
||||
tags={lead.tags}
|
||||
tagOptions={options.tags}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user