A full-featured CRM built with React, shadcn/ui, and Supabase.
update import + doc
erwanMarmelabe7a3ac86b7c9
diff --git a/doc/src/content/docs/users/import-data.mdx b/doc/src/content/docs/users/import-data.mdxindex 7ab68d41..d5a21bb6 100644--- a/doc/src/content/docs/users/import-data.mdx+++ b/doc/src/content/docs/users/import-data.mdx@@ -41,12 +41,13 @@ The `name` column is required. `sector` is matched against the company sectors c### Deals```csv-name,company,category,stage,amount,expected_closing_date,description-New website,Acme,Website design,Opportunity,12000,2026-09-30,Redesign of the public website-Print campaign,Globex,Print project,Proposal Sent,4500,2026-10-15,+name,company,category,stage,amount,expected_closing_date,description,lost_reason+New website,Acme,Website design,Opportunity,12000,2026-09-30,Redesign of the public website,+Print campaign,Globex,Print project,Proposal Sent,4500,2026-10-15,,+Logo refresh,Initech,UI Design,Lost,3000,2026-08-31,,Chose a cheaper agency```-The `name` column is required. The `company` column holds a company name: an existing company is reused, an unknown one is created. `category` and `stage` are matched against the deal categories and stages configured in your CRM, by stored value or displayed label. Since a deal always belongs to a stage, an empty or unrecognized `stage` falls back to the first stage of your pipeline.+The `name` column is required. The `company` column holds a company name: an existing company is reused, an unknown one is created. `category` and `stage` are matched against the deal categories and stages configured in your CRM, by stored value or displayed label. Since a deal always belongs to a stage, an empty or unrecognized `stage` falls back to the first stage of your pipeline. `lost_reason` records why a lost deal was lost. It is optional on import, so deals coming from another CRM without a reason are still imported, but the reason becomes mandatory as soon as the deal is edited in Atomic CRM.## Export Contacts To CSVdiff --git a/doc/src/content/docs/users/settings.mdx b/doc/src/content/docs/users/settings.mdxindex c95a0dfc..b0ecdddc 100644--- a/doc/src/content/docs/users/settings.mdx+++ b/doc/src/content/docs/users/settings.mdx@@ -26,4 +26,6 @@ The Settings page lets you customize:Once you save your changes, they will be immediately reflected across the application. For example, if you update the deal stages, the new stages will be available for users to drag and drop deals in the Kanban view, and they will also be available when creating or editing a deal.-When updating the name of an existing category (e.g., a deal stage), the new name will be applied to all existing records that belong to that category. For instance, if you rename the "Prospecting" deal stage to "Lead", all deals that were previously in the "Prospecting" stage will now be in the "Lead" stage.\ No newline at end of file+When updating the name of an existing category (e.g., a deal stage), the new name will be applied to all existing records that belong to that category. For instance, if you rename the "Prospecting" deal stage to "Lead", all deals that were previously in the "Prospecting" stage will now be in the "Lead" stage.++The deal stage with the value `lost` has a special behavior: moving a deal to it, either by dragging the card in the Kanban view or by picking it in the deal form, requires a reason explaining why the deal was lost. You can rename its label freely, but if you delete this stage, deals can no longer be marked as lost with a reason.\ No newline at end of filediff --git a/src/components/atomic-crm/dataImport/DataImportButton.test.tsx b/src/components/atomic-crm/dataImport/DataImportButton.test.tsxindex fd6c967c..f4c6d927 100644--- a/src/components/atomic-crm/dataImport/DataImportButton.test.tsx+++ b/src/components/atomic-crm/dataImport/DataImportButton.test.tsx@@ -204,6 +204,11 @@ describe("DataImportButton", () => {expected_closing_date: "2026-09-30",},{ name: "Print campaign", company: "Acme", stage: null },+ {+ name: "Logo refresh",+ stage: "Lost",+ lost_reason: "Chose a cheaper agency",+ },]);await screen.getByRole("button", { name: "run import" }).click();@@ -214,7 +219,7 @@ describe("DataImportButton", () => {expect(companies[0].name).toBe("Acme");const { data: deals } = await listAll(dataProvider, "deals");- expect(deals).toHaveLength(2);+ expect(deals).toHaveLength(3);expect(deals[0]).toMatchObject({amount: 12000,category: "website-design",@@ -227,6 +232,10 @@ describe("DataImportButton", () => {expect(deals[1].company_id).toBe(companies[0].id);// stage is required, so an empty cell falls back to the first stageexpect(deals[1].stage).toBe("opportunity");+ expect(deals[2]).toMatchObject({+ stage: "lost",+ lost_reason: "Chose a cheaper agency",+ });});it("appends imported deals below the deals already in their stage", async () => {diff --git a/src/components/atomic-crm/dataImport/deals_sample.csv b/src/components/atomic-crm/dataImport/deals_sample.csvindex a62dd7d7..569cb33b 100644--- a/src/components/atomic-crm/dataImport/deals_sample.csv+++ b/src/components/atomic-crm/dataImport/deals_sample.csv@@ -1,3 +1,4 @@-name,company,category,stage,amount,expected_closing_date,description-New website,Acme,Website design,Opportunity,12000,2026-09-30,Redesign of the public website-Print campaign,Globex,Print project,Proposal Sent,4500,2026-10-15,+name,company,category,stage,amount,expected_closing_date,description,lost_reason+New website,Acme,Website design,Opportunity,12000,2026-09-30,Redesign of the public website,+Print campaign,Globex,Print project,Proposal Sent,4500,2026-10-15,,+Logo refresh,Initech,UI Design,Lost,3000,2026-08-31,,Chose a cheaper agencydiff --git a/src/components/atomic-crm/dataImport/useDealImport.ts b/src/components/atomic-crm/dataImport/useDealImport.tsindex 3bfe7a22..196f8259 100644--- a/src/components/atomic-crm/dataImport/useDealImport.ts+++ b/src/components/atomic-crm/dataImport/useDealImport.ts@@ -58,7 +58,7 @@ export function useDealImport(): ProcessImportBatch {category: toConfiguredValue(row.category, dealCategories),stage,description: toText(row.description),- // amount lands in a bigint column, which rejects "4500.50"+ lost_reason: toText(row.lost_reason),amount: toInteger(row.amount),expected_closing_date: toIsoDate(row.expected_closing_date),sales_id: identity?.id,