Compare commits

..
Author SHA1 Message Date
ngqileandClaude Opus 5.5 cd0a0458a4 fix(portal): label the lead's own company on the Leads list
Super admins saw two "Company" columns: the tenant code and the lead's
company. The second now reads "Lead's company"; lead forms keep "Company".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-02 11:03:42 +08:00
ngqile bee1da9a7e Merge pull request 'docs: archive polish-e2e-followups' (#46) from archive-polish-e2e-followups into main
CI / build-and-publish (push) Failing after 0s
2026-12-02 02:34:34 +00:00
3 changed files with 25 additions and 1 deletions

No files matched your search

@@ -0,0 +1,23 @@
import { render, screen } from "@testing-library/react";
import { describe, it, expect, vi } from "vitest";
vi.mock("@/app/lib/services/adminLeads", async (importActual) => ({
...(await importActual<typeof import("@/app/lib/services/adminLeads")>()),
listLeads: vi.fn().mockResolvedValue({ items: [], total: 0 }),
}));
vi.mock("@/app/lib/AdminAuthContext", () => ({ useAdminAuth: () => ({ loading: false, hasModule: () => true }) }));
vi.mock("@/app/lib/CompanyScope", () => ({
useCompanyScope: () => ({ companyId: null, showCompanyColumn: true, codeOf: () => "INS" }),
}));
vi.mock("next/navigation", async () => (await import("@/test/memoryRouter")).navigationMock);
import LeadsPage from "./page";
describe("LeadsPage columns", () => {
it("tells the tenant company from the lead's own company", async () => {
render(<LeadsPage />);
const headers = (await screen.findAllByRole("columnheader")).map((h) => h.textContent);
expect(headers).toContain("Company");
expect(headers).toContain("Lead's company");
});
});
+1 -1
View File
@@ -79,7 +79,7 @@ function LeadsPageContent() {
...(showCompanyColumn ? [{ id: "company", cell: ({ row }) => codeOf(row.original.companyId ?? 0), header: t("Company"), enableSorting: false } as ColumnDef<LeadRow, unknown>] : []),
{ accessorKey: "mobile", header: t("LeadMobile"), enableSorting: false },
{ accessorKey: "email", header: t("Email"), enableSorting: false },
{ accessorKey: "companyName", header: t("LeadCompany"), enableSorting: false },
{ accessorKey: "companyName", header: t("LeadsLeadCompany"), enableSorting: false },
{ accessorKey: "eventCount", header: t("LeadsEvents"), enableSorting: false },
{ id: "lastEvent", header: t("LeadsLastEvent"), enableSorting: false, cell: ({ row }) => row.original.lastEvent?.name ?? "" },
{ id: "latestSalesperson", header: t("LeadsLatestSalesperson"), enableSorting: false, cell: ({ row }) => row.original.latestSalesperson?.name ?? "" },
@@ -366,6 +366,7 @@ export const DEFAULT_MESSAGES: Record<string, string> = {
LeadNew: "New",
LeadExisting: "Existing",
LeadCompany: "Company",
LeadsLeadCompany: "Lead's company",
LeadJobTitle: "Job title",
LeadStatus: "Status",
LeadNotes: "Notes",