Files
mrp/client/src/modules/crm/config.ts
2026-03-14 16:08:29 -05:00

64 lines
1.8 KiB
TypeScript

import { crmRecordStatuses, type CrmRecordInput, type CrmRecordStatus } from "@mrp/shared/dist/crm/types.js";
export type CrmEntity = "customer" | "vendor";
interface CrmModuleConfig {
entity: CrmEntity;
collectionLabel: string;
singularLabel: string;
routeBase: string;
emptyMessage: string;
}
export const crmConfigs: Record<CrmEntity, CrmModuleConfig> = {
customer: {
entity: "customer",
collectionLabel: "Customers",
singularLabel: "Customer",
routeBase: "/crm/customers",
emptyMessage: "No customer accounts have been added yet.",
},
vendor: {
entity: "vendor",
collectionLabel: "Vendors",
singularLabel: "Vendor",
routeBase: "/crm/vendors",
emptyMessage: "No vendor records have been added yet.",
},
};
export const emptyCrmRecordInput: CrmRecordInput = {
name: "",
email: "",
phone: "",
addressLine1: "",
addressLine2: "",
city: "",
state: "",
postalCode: "",
country: "USA",
status: "ACTIVE",
notes: "",
};
export const crmStatusOptions: Array<{ value: CrmRecordStatus; label: string }> = [
{ value: "LEAD", label: "Lead" },
{ value: "ACTIVE", label: "Active" },
{ value: "ON_HOLD", label: "On Hold" },
{ value: "INACTIVE", label: "Inactive" },
];
export const crmStatusFilters: Array<{ value: "ALL" | CrmRecordStatus; label: string }> = [
{ value: "ALL", label: "All statuses" },
...crmStatusOptions,
];
export const crmStatusPalette: Record<CrmRecordStatus, string> = {
LEAD: "border border-sky-400/30 bg-sky-500/12 text-sky-700 dark:text-sky-300",
ACTIVE: "border border-emerald-400/30 bg-emerald-500/12 text-emerald-700 dark:text-emerald-300",
ON_HOLD: "border border-amber-400/30 bg-amber-500/12 text-amber-700 dark:text-amber-300",
INACTIVE: "border border-slate-400/30 bg-slate-500/12 text-slate-700 dark:text-slate-300",
};
export { crmRecordStatuses };