# PhoenixKitCRM v0.2.4 - Table of Contents

> CRM module for PhoenixKit — organization accounts, role-scoped user views, and per-user column configuration.

## Modules

- [PhoenixKitCRM](PhoenixKitCRM.md): CRM module for PhoenixKit.
- [PhoenixKitCRM.Activity](PhoenixKitCRM.Activity.md): Thin wrapper around `PhoenixKit.Activity.log/1` so callers don't need to
duplicate the `Code.ensure_loaded?/1` guard and rescue clause everywhere.
Safe to call from any LiveView — never crashes the caller.
- [PhoenixKitCRM.ActivityLabels](PhoenixKitCRM.ActivityLabels.md): Maps CRM activity action strings (e.g. `"crm.interaction_logged"`) to a
`{heroicon, human_label}` pair plus an optional secondary `detail/2` line, for
the contact/company **Events** tab. Domain labels go through
`PhoenixKitCRM.Gettext`. Unknown actions fall back to a humanized form of the
action string, so a newly-added action still renders without a change here.
- [PhoenixKitCRM.Attachments](PhoenixKitCRM.Attachments.md): Folder-scoped media attachments for a CRM contact, backed by core
`PhoenixKit.Modules.Storage` (the same per-resource-folder convention
`phoenix_kit_staff`/`phoenix_kit_catalogue` use — no module-owned table, no
migration).
- [PhoenixKitCRM.ColumnConfig](PhoenixKitCRM.ColumnConfig.md): Per-scope column configuration for CRM tables and card views.
- [PhoenixKitCRM.Companies](PhoenixKitCRM.Companies.md): Context for CRM companies — CRUD, soft-delete, and search (for the contact
form's company picker).

- [PhoenixKitCRM.Contacts](PhoenixKitCRM.Contacts.md): Context for CRM contacts — CRUD, soft-delete, the (v1 single) company
membership, and the **optional** login-user connection.
- [PhoenixKitCRM.Gettext](PhoenixKitCRM.Gettext.md): Gettext backend for `phoenix_kit_crm`.
- [PhoenixKitCRM.Interactions](PhoenixKitCRM.Interactions.md): Context for CRM interactions — the History/Interactions tab.
- [PhoenixKitCRM.Paths](PhoenixKitCRM.Paths.md): Centralized path helpers for the CRM module. All paths go through
`PhoenixKit.Utils.Routes.path/1` for prefix/locale handling.

- [PhoenixKitCRM.PubSub](PhoenixKitCRM.PubSub.md): Real-time updates for CRM interactions, backed by `PhoenixKit.PubSub.Manager`.
- [PhoenixKitCRM.RoleSetting](PhoenixKitCRM.RoleSetting.md): Schema for CRM role settings.
- [PhoenixKitCRM.RoleSettings](PhoenixKitCRM.RoleSettings.md): Context for managing which roles have CRM access enabled.

- [PhoenixKitCRM.Routes](PhoenixKitCRM.Routes.md): Route definitions for the CRM module.
- [PhoenixKitCRM.Schemas.Company](PhoenixKitCRM.Schemas.Company.md): A CRM company / organization record. A first-class record (its own data),
NOT a login user. Contacts link to it via `CompanyMembership`.

- [PhoenixKitCRM.Schemas.CompanyMembership](PhoenixKitCRM.Schemas.CompanyMembership.md): The contact ↔ company link (many-to-many), carrying free-form
`role_in_company` and `department` on the edge, plus an `is_primary` flag.
- [PhoenixKitCRM.Schemas.Contact](PhoenixKitCRM.Schemas.Contact.md): A CRM contact (client / customer / prospect).
- [PhoenixKitCRM.Schemas.Interaction](PhoenixKitCRM.Schemas.Interaction.md): A logged interaction ("client called, we discussed X") — the core of the
CRM v1 interaction tracker. A structured log entry (type + when + body),
anchored to a subject `Contact`, with N resolvable involved parties.

- [PhoenixKitCRM.Schemas.InteractionParty](PhoenixKitCRM.Schemas.InteractionParty.md): An "involved party" on an interaction — a flat, resolvable mention.
- [PhoenixKitCRM.SidebarBootstrap](PhoenixKitCRM.SidebarBootstrap.md): Registers CRM role subtabs into `PhoenixKit.Dashboard.Registry` under the
namespace `:phoenix_kit_crm_roles`.
- [PhoenixKitCRM.SoftDelete](PhoenixKitCRM.SoftDelete.md): Status-column soft-delete shared by `Contacts` and `Companies`.
- [PhoenixKitCRM.StaffLink](PhoenixKitCRM.StaffLink.md): Optional, soft integration with `phoenix_kit_staff`. Everything here is
guarded — the CRM module works whether or not the staff module is present
or enabled. Used by the interaction "involved parties" picker (a staff
person can be selected) and by the party snapshot.

- [PhoenixKitCRM.UserRoleView](PhoenixKitCRM.UserRoleView.md): Context for managing per-user CRM view configuration.
- [PhoenixKitCRM.UserRoleViewConfig](PhoenixKitCRM.UserRoleViewConfig.md): Schema for per-user, per-scope CRM view configuration.
- [PhoenixKitCRM.Web.CRMLive](PhoenixKitCRM.Web.CRMLive.md): Main admin LiveView for the CRM module — empty placeholder page.
- [PhoenixKitCRM.Web.CellFormat](PhoenixKitCRM.Web.CellFormat.md): Shared formatters for CRM table/card cells.
- [PhoenixKitCRM.Web.ColumnManagement](PhoenixKitCRM.Web.ColumnManagement.md): `use` macro that injects column-management `handle_event/3` callbacks into
a CRM LiveView. The host LV must
- [PhoenixKitCRM.Web.ColumnModal](PhoenixKitCRM.Web.ColumnModal.md): Function component that renders the "Customize columns" modal used by both
`RoleView` and `OrganizationsView`. UX mirrors `PhoenixKit.Users` table column
picker: drag-to-reorder selected columns on the left, click-to-add available
columns on the right.
- [PhoenixKitCRM.Web.CompaniesLive](PhoenixKitCRM.Web.CompaniesLive.md): Admin list of CRM companies.
- [PhoenixKitCRM.Web.CompanyFormLive](PhoenixKitCRM.Web.CompanyFormLive.md): New / edit form for a CRM company.
- [PhoenixKitCRM.Web.CompanyInteractionsComponent](PhoenixKitCRM.Web.CompanyInteractionsComponent.md): The **Interactions** tab of a CRM company — a read-only, aggregated feed of
every interaction logged on the company's member contacts. Each entry links to
the contact it's about (and shows the interaction's parties + attachments), so
you can jump to that person. Interactions are still *logged* on a contact's
page; this is a company-wide rollup.

- [PhoenixKitCRM.Web.CompanyShowLive](PhoenixKitCRM.Web.CompanyShowLive.md): Show page for a CRM company. Tabs: Overview (details + contacts), Interactions
(a read-only rollup of interactions logged on the company's contacts), and
Events always; Files + Images when core Storage is enabled; Comments when the
comments module is enabled. The header shows a circular logo (icon fallback).

- [PhoenixKitCRM.Web.ContactFormLive](PhoenixKitCRM.Web.ContactFormLive.md): New / edit form for a CRM contact: the profile fields, a single company
block (company + free-form role + department), and the optional
"allow login" checkbox (staff-style find-or-create user link).

- [PhoenixKitCRM.Web.ContactShowLive](PhoenixKitCRM.Web.ContactShowLive.md): Show page for a CRM contact. Tabs: Overview, Interactions, Events always;
Files + Images when core Storage is enabled; Comments when the comments
module is enabled. The header shows a circular avatar (initials fallback).

- [PhoenixKitCRM.Web.ContactsLive](PhoenixKitCRM.Web.ContactsLive.md): Admin list of CRM contacts.
- [PhoenixKitCRM.Web.EventsComponent](PhoenixKitCRM.Web.EventsComponent.md): The **Events** tab for a CRM record — a read-only, paginated feed of the
`PhoenixKit.Activity` entries scoped to it (`resource_type` + `resource_uuid`).
Parameterized by `:resource_type` (`"crm_contact"` / `"crm_company"`) and
`:resource_uuid`, so it serves both the contact and company profiles.
- [PhoenixKitCRM.Web.InteractionHelpers](PhoenixKitCRM.Web.InteractionHelpers.md): Shared render helpers for interaction timelines (contact + company feeds): the
involved-party badge and its frozen-snapshot detail/title. A party that
resolved to a CRM contact or a staff person links to that page; free-text
parties render as a plain badge.

- [PhoenixKitCRM.Web.InteractionsComponent](PhoenixKitCRM.Web.InteractionsComponent.md): The Interactions / History tab for a contact: a reverse-chronological feed
of interactions involving the contact, plus a composer to log a new one with
a free-form-but-resolvable "involved parties" picker (CRM contacts + staff).

- [PhoenixKitCRM.Web.MediaComponent](PhoenixKitCRM.Web.MediaComponent.md): The **Files** and **Images** tabs for a CRM record (a contact or a company),
parameterized by `:resource_type` (`:contact | :company`), the `:resource`
struct, and `:kind` (`:files | :images`). Media is folder-scoped via core
`PhoenixKit.Modules.Storage` (see `PhoenixKitCRM.Attachments`): a
`crm-<resource>-<uuid>` root folder for `:files`, a nested `Images` subfolder
for `:images`.
- [PhoenixKitCRM.Web.OrganizationsView](PhoenixKitCRM.Web.OrganizationsView.md): Admin LiveView for the CRM Organizations subtab — lists users whose
`account_type = "organization"` with per-user persisted column
configuration. Supports a card/table view toggle (provided by
`PhoenixKitWeb.Components.Core.TableDefault`).
- [PhoenixKitCRM.Web.RoleView](PhoenixKitCRM.Web.RoleView.md): Admin LiveView for a single CRM role page — lists users assigned to the role
with per-user persisted column configuration. Supports a card/table view
toggle (provided by `PhoenixKitWeb.Components.Core.TableDefault`).

- [PhoenixKitCRM.Web.SettingsLive](PhoenixKitCRM.Web.SettingsLive.md): CRM settings page — exposes the enable/disable toggle and role opt-in.

