TorbatYar/frontend/modules/crm/features/sales/pipelines.tsx
Mortezakoohjani e140908034 Ship enterprise CRM frontend with real API wiring and thin app routes.
Connect all CRM pages to the BFF and CRM service, add module docs, and mark CRM available in the SuperApp catalog.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 20:58:17 +03:30

41 lines
1.4 KiB
TypeScript

import { z } from "zod";
import { crmApi } from "@/modules/crm/services/crm-api";
import { createCrmListPage } from "@/modules/crm/components/CrmListCrudPage";
import type { Pipeline } from "@/modules/crm/types";
const schema = z.object({
name: z.string().min(1),
code: z.string().min(1),
description: z.string().optional(),
is_default: z.boolean().optional(),
});
export default createCrmListPage<Pipeline>({
title: "قیف‌های فروش",
description: "تعریف pipeline و مراحل فروش.",
breadcrumb: "قیف‌ها",
resourceKey: "pipelines",
createSchema: schema,
editSchema: schema.partial(),
createDefaults: { name: "", code: "", description: "", is_default: false },
fields: [
{ name: "name", label: "نام" },
{ name: "code", label: "کد", createOnly: true },
{ name: "description", label: "توضیحات", type: "textarea" },
],
columns: [
{ key: "code", header: "کد" },
{ key: "name", header: "نام" },
{ key: "status", header: "وضعیت" },
{
key: "is_default",
header: "پیش‌فرض",
render: (r) => (r.is_default ? "بله" : "خیر"),
},
],
list: (tid) => crmApi.pipelines.list(tid, { page: 1, page_size: 500 }),
create: (tid, d) => crmApi.pipelines.create(tid, d),
update: (tid, id, d) => crmApi.pipelines.update(tid, id, d),
exportColumns: ["code", "name", "status"],
});