# CRMfic - Project Features, Forms, and Templates List

**CRMfic** is a multi-tenant CRM and Email Marketing Automation platform built using **Laravel** (Jetstream, Fortify, Inertia.js) and **Vue 3** (Vite, TailwindCSS, custom SCSS layouts). It enables businesses to manage contacts, create advanced filters, build block-based email campaigns, schedule recurring emails, sequence autoresponders, design visual automation funnels, and manage SMTP routing servers (including Google/Outlook OAuth2).

---

## 1. Core Modules & Feature List

### 🖥️ Dashboard & Global Search
* **Main Dashboard Analytics:** Visual tracking of contact growth over time, campaign sending performance, open rates, click rates, bounces, and unsubscribe metrics.
* **Interactive Growth Charts:** Visualizes contact acquisition trends by custom intervals.
* **Global Workspace Search Palette:** Command-palette style topbar search to immediately search and jump to Contacts, Lists, Tags, Campaigns, and Automations.

### 👥 Audience & Contacts Management
* **Contact Directory:** List view with search, status filters (Subscribed, Unsubscribed, Cleaned, Pending), list/tag filters, and creation dates.
* **Detailed Contact Profiles:** 
  * Contact timeline/activity log (tracks enrollment, sends, opens, clicks, unsubscribes, updates).
  * Profile attributes and standard/custom fields.
  * Inline tags and list enrollment management.
  * Direct note addition/deletion for customer relationships.
* **Lists & Segments:** Logical grouping of subscribers into list buckets.
* **Tags Management:** Granular labels applied to contacts for workflow triggers or segmenting.
* **Bulk Import (CSV):** Allows importing large contacts files with an interactive mapping UI and automatic tag/list enrollment.
* **Bulk Export:** Exports segmented lists of contacts to CSV file format.

### ✉️ Campaign Management (Broadcasts)
* **Visual Email Builder:** High-quality modular block-based email editor.
* **Subject A/B Testing:** Multi-subject variants with weight percentages for testing response rates.
* **Advanced Recipient Segmenting:** Segment by List/Tag inclusions/exclusions, or via nested AND/OR group filters.
* **Flexible Dispatch Scheduling:** 
  * Send immediately.
  * Schedule for a specific date and time in the account timezone.
  * **Range Scheduling (Drip sending):** Spreads out email sending evenly across a start/end date-time range (optimizes deliverability and warms up IPs).

### 🕒 Recurring Campaigns
* **Automated Intervals:** Send campaign emails automatically at scheduled intervals (Daily, Weekly, Monthly, or using custom Cron expressions).
* **Historical Run Tracking:** Displays logs, performance status, and specific recipient stats for every recurring run.

### ⛓️ Email Sequences (Autoresponders)
* **Autoresponder Sequences:** Drip email chains triggered by list subscription or tag events (e.g. Day 1, Day 3, Day 7).
* **Delay Configurations:** Custom wait intervals (in hours, days, or weeks) between steps.
* **Sequence Control:** Pause/resume individual steps, trigger test emails for a step, or reset/reenroll all contacts in the sequence.

### 🎛️ Visual Automation Funnel Builder
* **Dynamic Interactive Canvas:** Double canvas mode supporting both a **Draw.io-style 2D Drag & Drop board** and a **Vertical Tree Flow diagram**.
* **Multi-Trigger Enrollment:** Connect multiple conditions using AND/OR logical operators to enroll contacts.
* **Logic/Conditional Branching:** Path routing based on custom conditions (contact properties, list/tag presence, email interaction) and A/B Split Paths (custom percentage split).
* **Rich Node Steps:** Delays, CRM field updates, external webhook pings, automated lists & tags addition/removal, and email sends.

### 🌐 SMTP Configuration & Authentication
* **SMTP Routing Profiles:** Add multiple email dispatching servers.
* **Standard SMTP credentials:** Setup Host, Port, Encryption, Username, Password.
* **OAuth2 Authentication Flow:** Securely connect and send via **Gmail / Google Workspace** and **Outlook / Office365** through popup window login flows (with automated backend token refresh).
* **Connection Tester:** Run real-time connection verification and test-email sends.

### 🔌 Inbound Webhooks (Integrations)
* **Inbound Endpoints:** Dynamic webhook URLs to receive external lead payloads (e.g., from landing pages, Opt-in forms, external CRMs).
* **Field Mapping Mapper:** Maps incoming JSON or Form URL-encoded keys to internal contact fields.
* **Inbound Logs:** Logs payloads, timestamps, IP sources, and processing outcomes.

### 📂 Media Library
* **Storage Dashboard:** Allows uploading, previewing, and selecting images/videos to reuse across campaigns, automations, and sequences.

---

## 2. Complete Form Catalog

### User Authentication & Security Forms
1. **Registration Form:** `Register.vue`
   * *Fields:* Name, Email, Password, Password Confirmation, Terms Acceptance.
2. **Login Form:** `Login.vue`
   * *Fields:* Email, Password, Remember Me checkbox.
3. **Forgot/Reset Password Form:** `ForgotPassword.vue` & `ResetPassword.vue`
   * *Fields:* Email, Password, Password Confirmation.
4. **Two-Factor Challenge Form:** `TwoFactorChallenge.vue`
   * *Fields:* 2FA Authenticator Code or Backup Recovery Code.
5. **OTP Verification Form:** `VerifyEmail.vue` (Custom Code verification)
   * *Fields:* 6-Digit One-Time Password (OTP) Verification Code.

### Audience & Contact Forms
6. **Contact Creation / Edit Form:** `ContactModal.vue`
   * *Fields:* First Name, Last Name, Email, Phone Number, Date of Birth, Company, Job Title, Lifetime Value (LTV), Subscription Status (Subscribed, Unsubscribed, Cleaned, Pending), List Association select, Tag Association select.
7. **CSV Import Configuration Form:** `ContactsImport.vue`
   * *Fields:* CSV File Upload, Target Lists Selector, Target Tags Selector, Interactive Column Mapping Inputs (maps CSV headers to CRM fields).
8. **Contact Notes Form:** `ContactDetail.vue`
   * *Fields:* Rich-text notes editor for logging custom interactions.
9. **Contacts Export Form:** `ExportModal.vue`
   * *Fields:* List/Tag filters, Selection of fields to export (e.g., Email, First Name, Phone, Company, LTV).

### List & Tag Forms
10. **List Form:** `ListModal.vue`
    * *Fields:* List Title, Description.
11. **Tag Form:** `TagModal.vue`
    * *Fields:* Tag Title, Description.

### Webhook Forms
12. **Inbound Webhook Config Form:** `WebhookModal.vue`
    * *Fields:* Webhook Name, Auto-subscribe List Select, Auto-apply Tag Select, Field mapping rows (Incoming Key -> CRM Field).
13. **External Action Webhook Node Form:** `Automation/Create.vue` (Side panel)
    * *Fields:* Webhook Target URL, HTTP Method (GET, POST, PUT), Authentication Type (None, Bearer Token, Basic Auth, Custom Header), Headers key-value rows, Parameters payload key-value rows, Payload Type (JSON, Form URL-encoded), Payload mode (Full Contact raw JSON vs. Custom params only).

### Campaign, Schedule & Settings Forms
14. **Campaign Composer Form:** `Campaigns/Create.vue`
    * *Step 1: Compose:* Visual Email block editor.
    * *Step 2: Subject & Settings:*
      * Email Subject input.
      * A/B Subject options & Traffic Priority Percent Stepper.
      * Email Pre-header input.
      * SMTP Routing profile selection, Reply-To email override.
      * UTM parameters checklist (Source, Medium, Campaign, Term, Content).
    * *Step 3: Audience Selector:* Inclusion lists & tags, Exclusion lists & tags, or Advanced Rules builder.
    * *Step 4: Dispatch Scheduler:* Dispatch Mode (Send Now, Schedule Single Time, Schedule Time Range), Date-time pickers, Timezone display.
15. **Recurring Campaign Configuration Form:** `Recurring/Edit.vue`
    * *Fields:* Title, email builder canvas, subject lines, list selector, SMTP profile, scheduling intervals (Daily, Weekly, Monthly, Cron, start/end dates).
16. **SMTP Routing Setup Form:** `SmtpConfig.vue`
    * *Fields:* Config Name, Provider type (SMTP, Google OAuth, Microsoft OAuth), Host, Port, Encryption (None, SSL, TLS), SMTP Username, SMTP Password, From Name, From Email, Reply-to Email.
17. **Global CRM settings:** `Settings/Index.vue`
    * *Fields:* Company Name, Address, City, Country, Account Timezone, Base Currency, Default Sender Name, Default Sender Email, Default Double Opt-in toggle, Email Footer address, Logo image uploader.

---

## 3. Templates Inventory

### 🖥️ Page Layout Templates
* **Inertia App Layout:** [app.blade.php](file:///c:/laragon/www/crmfic/resources/views/app.blade.php) - Root template parsing scripts, stylesheets, and Inertia pages.
* **Email Blade Templates:** 
  * [campaign-test.blade.php](file:///c:/laragon/www/crmfic/resources/views/emails/campaign-test.blade.php) - Format structure for testing email deliverability.
  * [team-invitation.blade.php](file:///c:/laragon/www/crmfic/resources/views/emails/team-invitation.blade.php) - Invites sub-users to join the workspace.
* **OAuth Callback Result Templates:**
  * [google-oauth-result.blade.php](file:///c:/laragon/www/crmfic/resources/views/google-oauth-result.blade.php)
  * [microsoft-oauth-result.blade.php](file:///c:/laragon/www/crmfic/resources/views/microsoft-oauth-result.blade.php)

### 🧱 Visual Email Builder Blocks
The visual editor (`EmailEditor.vue`) uses the following structural block templates to render drag-and-drop HTML components:
1. **Heading Block:** Configurable heading level (H1-H6), sizes, font-weight, color, and padding.
2. **Text Block:** Paragraph editor with margins, alignment, line heights, and typography.
3. **Button Block:** URL redirect, block alignment, button color, text color, padding, and border-radius.
4. **Image Block:** Image URL, upload target, dimensions, alignment, and alt text.
5. **Spacer Block:** Configurable gap height.
6. **Divider Block:** Line style (solid, dashed), thickness, color, and spacing.
7. **Social Links Block:** Link inputs for Facebook, Twitter, Instagram, LinkedIn, YouTube, and Pinterest.
8. **Logo Block:** Header logo upload with alignment controls.
9. **Footer Block:** System-wide tag replacement templates (e.g. physical address, unsubscribe link, preferences link).
10. **Raw HTML Block:** Custom HTML snippet rendering.

### ⚙️ Visual Automation Funnel Templates
The system supports predefined automation funnel configurations (automatically built out in `AutomationController.php` inside the visual builder) to quickly launch common marketing campaigns:
* **Welcome New:** `Welcome Email` -> Wait 1 Day -> `Getting Started Guide` -> Wait 2 Days -> `Social Proof Email`.
* **Onboarding:** `Welcome & Account Setup` -> Wait 1 Day -> `Feature Highlight Email` -> Wait 2 Days -> `Tips & Tricks Email`.
* **Cart Abandonment:** `Cart Abandonment Reminder` -> Wait 4 Hours -> `Reminder + Offer` -> Wait 24 Hours -> `Final Warning (FOMO)`.
* **Re-engagement:** `We Miss You Email` -> Wait 5 Days -> `Final Reminder`.
* **Inactivity:** `Inactivity Alert` -> Wait 3 Days -> `Reminder + 10% Discount Offer` -> Wait 3 Days -> `FOMO (Discount Expiry)`.
* **Email Click Follow-up:** Wait 1 hour -> `Follow-up Content` -> Wait 1 Day -> `Special Conversion Offer`.
* **Upsell:** `Order Confirmation` -> Wait 2 Days -> `Related Recommendations` -> Wait 3 Days -> `Next Order Discount`.
* **Winback:** Reactivates cold/lost customers.
* **Lead Nurture:** Automates contact nurturing.
* **Tag Nurture:** Delivers emails targeted to contacts who acquire specific tag labels.
* **Birthday Campaign:** Sends birthday offers on the contact's birth date.
* **Anniversary Campaign:** Triggers emails on customer registration anniversaries.
* **Feedback / Review:** Gathers post-purchase reviews from customers.
