Files
hub/docs/crm-overview.md
kelly 5b78f8db0f feat: brand profile page rebuild, dev tooling, and CRM refactor
- Rebuild brand profile page with 3-zone architecture:
  Zone 1: Identity bar (logo, name, tagline, score, actions)
  Zone 2: Dashboard snapshot (8 KPI cards, insight banners, tab bar)
  Zone 3: Tabbed content panels (9 sections)

- Add dev:setup command for local environment setup
  - Runs migrations with optional --fresh flag
  - Prompts to seed dev fixtures
  - Displays test credentials on completion

- Add development seeders (not called from DatabaseSeeder):
  - ProductionSyncSeeder: users, businesses, brands
  - DevSuitesSeeder: suite and plan assignments
  - BrandProfilesSeeder: brand AI profiles

- Refactor CRM from Modules/Crm to app/ structure
  - Move entities to app/Models/Crm/
  - Move controllers to app/Http/Controllers/Crm/
  - Remove old modular structure

- Update CLAUDE.md with dev setup documentation
2025-12-01 19:53:54 -07:00

3.5 KiB

CRM Module Overview

The CRM module provides comprehensive customer relationship management for sellers to manage buyer relationships, sales pipeline, omnichannel communications, and deal tracking.

Module Flag

Enable CRM features by setting has_crm = true on the Business model.

Core Features

Omnichannel Threads

Unified inbox for all customer communications (email, SMS, chat) with:

  • Team assignment and collaboration
  • Internal notes and mentions
  • AI-suggested replies
  • SLA tracking

AI-Powered Deals

Sales pipeline with intelligent deal management:

  • Win probability predictions
  • Stage-based workflow
  • Activity tracking
  • Risk alerts

Quotes & Invoices

Full document workflow:

  • Line item builder
  • Tax calculation
  • E-signature support (quotes)
  • Payment tracking (invoices)
  • PDF generation

Workflow Automations

Trigger-based automation engine:

  • Thread and deal triggers
  • Email/SMS actions
  • Assignment rules
  • Time-based scheduling

Calendar Integration

Two-way sync with external calendars:

  • Google Calendar
  • Outlook/Office 365

Self-service scheduling:

  • Booking pages
  • Availability windows
  • Automatic calendar blocking

Data Model

Primary Tables

Table Purpose
crm_threads Conversation threads
crm_channel_messages Individual messages
crm_channels Communication channels
crm_deals Sales deals
crm_pipelines Deal pipelines
crm_quotes Quotes
crm_invoices Invoices
crm_automations Workflow rules
crm_sla_policies SLA configurations
crm_calendar_connections External calendar links
crm_meeting_links Booking pages
crm_tags Tagging system
crm_message_templates Reusable templates
crm_team_roles Role definitions

Key Relationships

// Business model
$business->crmThreads()           // Conversation threads
$business->crmDeals()             // Sales deals
$business->crmPipelines()         // Deal pipelines
$business->crmAutomations()       // Workflow automations
$business->crmTags()              // Tags

// Contact model
$contact->crmThreads()            // Threads with this contact
$contact->crmDeals()              // Deals for this contact

Routes

All CRM routes under /s/{business}/crm/ with EnsureBusinessHasCrm middleware.

Prefix Purpose
/crm Dashboard
/crm/threads Omnichannel inbox
/crm/deals Deal pipeline
/crm/quotes Quotes
/crm/invoices Invoices
/crm/automations Workflow automation
/crm/calendar Calendar with sync
/crm/meetings Meeting links & bookings
/crm/settings Configuration

Usage

Enable CRM

$business->update(['has_crm' => true]);

Create a Deal

use App\Models\Crm\CrmDeal;

CrmDeal::create([
    'business_id' => $business->id,
    'contact_id' => $contact->id,
    'pipeline_id' => $pipeline->id,
    'title' => 'Enterprise Deal',
    'value' => 50000,
    'stage' => 'qualified',
    'owner_id' => auth()->id(),
]);

Create a Thread

use App\Models\Crm\CrmThread;

$thread = CrmThread::create([
    'business_id' => $business->id,
    'contact_id' => $contact->id,
    'channel_id' => $channel->id,
    'subject' => 'Inquiry',
    'status' => 'open',
]);

Middleware

EnsureBusinessHasCrm protects all CRM routes. If has_crm is false, users see an upgrade prompt.

See Also