статусы на русском языке
All checks were successful
Auto Deploy / deploy (push) Successful in 22s

This commit is contained in:
deonisii
2026-04-17 23:49:12 +03:00
parent 4f67bca4be
commit 9b86175929
3 changed files with 103 additions and 51 deletions

View File

@@ -8,6 +8,15 @@ type SearchParams = Promise<{
status?: string;
}>;
function formatLeadNumber(id: string, createdAt: Date) {
const date = new Date(createdAt);
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, "0");
const d = String(date.getDate()).padStart(2, "0");
return `WP-${y}${m}${d}-${id.slice(-6).toUpperCase()}`;
}
export default async function AdminLeadsPage({
searchParams,
}: {
@@ -64,11 +73,11 @@ export default async function AdminLeadsPage({
className="rounded-2xl border border-white/10 bg-neutral-900 px-4 py-3 outline-none"
>
<option value="">Все статусы</option>
<option value="NEW">NEW</option>
<option value="IN_PROGRESS">IN_PROGRESS</option>
<option value="CALL_SCHEDULED">CALL_SCHEDULED</option>
<option value="WON">WON</option>
<option value="LOST">LOST</option>
<option value="NEW">Новая</option>
<option value="IN_PROGRESS">В работе</option>
<option value="CALL_SCHEDULED">Назначен звонок</option>
<option value="WON">Успешно</option>
<option value="LOST">Закрыта</option>
</select>
<button className="rounded-2xl bg-emerald-600 px-5 py-3 font-semibold hover:bg-emerald-500">
@@ -81,6 +90,7 @@ export default async function AdminLeadsPage({
<thead className="border-b border-white/10 text-neutral-400">
<tr>
<th className="text-left px-4 py-3">Дата</th>
<th className="text-left px-4 py-3">Заявка</th>
<th className="text-left px-4 py-3">Компания</th>
<th className="text-left px-4 py-3">Телефон</th>
<th className="text-left px-4 py-3">Email</th>
@@ -95,6 +105,9 @@ export default async function AdminLeadsPage({
<td className="px-4 py-3 whitespace-nowrap">
{new Date(lead.createdAt).toLocaleString("ru-RU")}
</td>
<td className="px-4 py-3 whitespace-nowrap">
{formatLeadNumber(lead.id, lead.createdAt)}
</td>
<td className="px-4 py-3">{lead.company}</td>
<td className="px-4 py-3">{lead.phone}</td>
<td className="px-4 py-3">{lead.email || "—"}</td>
@@ -108,7 +121,7 @@ export default async function AdminLeadsPage({
{leads.length === 0 && (
<tr>
<td colSpan={7} className="px-4 py-8 text-center text-neutral-400">
<td colSpan={8} className="px-4 py-8 text-center text-neutral-400">
Пока заявок нет
</td>
</tr>
@@ -119,4 +132,4 @@ export default async function AdminLeadsPage({
</div>
</main>
);
}
}