Улучшить мобильное меню и форму заявки, добавить номер лида и заменить middleware на proxy
All checks were successful
Auto Deploy / deploy (push) Successful in 22s
All checks were successful
Auto Deploy / deploy (push) Successful in 22s
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import LeadStatusSelect from "@/components/lead-status-select";
|
||||
import { LeadStatus } from "@prisma/client";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -8,6 +9,8 @@ type SearchParams = Promise<{
|
||||
status?: string;
|
||||
}>;
|
||||
|
||||
const leadStatuses = Object.values(LeadStatus);
|
||||
|
||||
function formatLeadNumber(id: string, createdAt: Date) {
|
||||
const date = new Date(createdAt);
|
||||
const y = date.getFullYear();
|
||||
@@ -24,7 +27,10 @@ export default async function AdminLeadsPage({
|
||||
}) {
|
||||
const params = await searchParams;
|
||||
const q = params.q?.trim() || "";
|
||||
const status = params.status?.trim() || "";
|
||||
const statusParam = params.status?.trim() || "";
|
||||
const status = leadStatuses.includes(statusParam as LeadStatus)
|
||||
? (statusParam as LeadStatus)
|
||||
: undefined;
|
||||
|
||||
const leads = await prisma.lead.findMany({
|
||||
where: {
|
||||
@@ -39,7 +45,7 @@ export default async function AdminLeadsPage({
|
||||
],
|
||||
}
|
||||
: {},
|
||||
status ? { status: status as any } : {},
|
||||
status ? { status } : {},
|
||||
],
|
||||
},
|
||||
orderBy: { createdAt: "desc" },
|
||||
|
||||
Reference in New Issue
Block a user