CPG-CRM FSD Setting Email
FSD — Admin CRM
A. Document controlA. Kiểm soát tài liệu
| Doc ID | CPG-FSD-CPG-CRM_FSD_Setting_Email |
|---|---|
| VersionPhiên bản | 1.0 |
| StatusTrạng thái | Draft |
| Owner | CPG BA / Architecture |
| AudienceĐối tượng | Frontend, Backend, FlyPay Support, QA, Product |
| ClassificationPhân loại | Internal |
| Effective dateNgày hiệu lực | 01/12/2026 |
| Related docs | Admin CRM Index · BR/NFR Catalog |
B. Version historyB. Lịch sử phiên bản
| Version | Date | Author | ChangesThay đổi |
|---|---|---|---|
| 1.0 | 01/12/2026 | Khoa Trinh | Version 1.0 |
C. Table of contentsC. Mục lục
- 1. Module Scope
- 2. User Roles
- 3. Functional Requirements
- 3.1 Features
- 3.1.1 View Email Template List
- 3.1.2 Email Template Categories
- 3.1.3 Preview Email Template
- 3.1.4 Edit Email Template
- 3.1.5 Template Variables Management
- 3.1.6 Save & Cancel Actions
- 3.1.7 Permission Enforcement
- 3.2 USE Cases
- 4. User Interface
- 4.1 Email Template List Screen
- 4.2 Edit Email Template Modal
- 4.3 Preview Modal
- 5. Data Requirements
- 5.1 Data Dictionary
- 5.2 Data Models
- 6. API Routes
- 6.1 Template Retrieval
- 6.2 Template Management
- 6.3 Preview
- 6.4 Variables
D. ContentD. Nội dung
1. Module Scope
The Email Template Management module allows system administrators to manage, customize, preview, and maintain system email templates used for platform notifications, onboarding, security alerts, financial events, and compliance communications.
This module supports:
- Viewing predefined email templates
- Editing email subjects and HTML content
- Managing template variables (dynamic placeholders)
- Previewing rendered emails before saving
- Ensuring consistent system-wide email communication
2. User Roles
Role Name | Description | Access Level |
|---|---|---|
System Administrator | Full control over email templates | View, Edit, Preview |
Operations Manager | Review operational notifications | View, Preview |
3. Functional Requirements
3.1 Features
3.1.1 View Email Template List
Description: Display all available email templates in a card-based layout.
Functional Behavior
- Templates displayed as cards
- Each card shows:
- Template name
- Category (Onboarding, Security, Financial, Support, Customer, Compliance)
- Email subject
- Available variables
- Search bar filters templates by name
- Pagination applied when template count exceeds page limit
3.1.2 Email Template Categories
Description: Categorize templates for better organization.
Supported Categories
- Onboarding
- Security
- Financial
- Support
- Customer
- Compliance
Behavior
- Category displayed as label/tag on template card
- Category is system-defined (not editable)
3.1.3 Preview Email Template
Description: Allow users to preview the rendered email before editing or saving.
Functional Behavior
- Preview opens in modal
- HTML content rendered as email layout
- Dynamic variables shown as placeholders
- Scrollable content area
- Preview does not modify data
3.1.4 Edit Email Template
Description: Allow administrators to customize email content.
Editable Fields
- Email Subject (text)
- Email Content (HTML)
Functional Rules
- Subject is mandatory
- HTML editor supports inline CSS
- System variables cannot be renamed or deleted
- Save persists changes immediately
3.1.5 Template Variables Management
Description: Display and support usage of dynamic placeholders.
Behavior
- Available variables shown as clickable chips
- Clicking copies variable to clipboard
- Variables follow syntax: {{variable_name}}
- Variables are read-only and system-defined
- Validation does not block unknown variables (handled at runtime)
3.1.6 Save & Cancel Actions
Save
- Validates required fields
- Stores updated subject and HTML
- Displays success notification
Cancel
- Discards unsaved changes
- Closes modal
3.1.7 Permission Enforcement
Behavior
- Only System Admin can edit templates
- Other roles have view-only access
- Unauthorized actions are blocked at API level
3.2 USE Cases
Detailed use-case catalog for this module is maintained under 08_UC:Catalog use case chi tiết của module này được quản lý tại 08_UC:
4. User Interface
4.1 Email Template List Screen

- Search bar at top
- Grid/card layout
- Each card:
- Icon
- Template name
- Category label
- Subject
- Variable list (collapsed)
- Actions: Preview, Edit
4.2 Edit Email Template Modal

- Email Subject input (single line)
- Available Variables section (copyable chips)
- HTML Editor (scrollable)
- Buttons:
- Cancel
- Preview
- Save Changes
4.3 Preview Modal

- Rendered email layout
- Scrollable body
- Close action
5. Data Requirements
5.1 Data Dictionary
email_templates
Field | Type | Description |
|---|---|---|
id | UUID | Unique template identifier |
template_code | VARCHAR(100) | System-defined template code |
template_name | VARCHAR(255) | Display name |
category | ENUM | Template category |
subject | VARCHAR(255) | Email subject |
html_content | TEXT | Email HTML body |
is_active | BOOLEAN | Template active status |
created_at | TIMESTAMP | Creation timestamp |
updated_at | TIMESTAMP | Last update timestamp |
updated_by | UUID | User who last modified |
email_template_variables
Field | Type | Description |
|---|---|---|
id | UUID | Variable ID |
template_id | UUID | Related template |
variable_key | VARCHAR(100) | Variable name |
description | VARCHAR(255) | Meaning of variable |
is_required | BOOLEAN | Mandatory variable |
5.2 Data Models
Entity Relationship
- email_templates (1) - (N) email_template_variables
- users (1) - (N) email_templates
Status / Enums
category
- ONBOARDING
- SECURITY
- FINANCIAL
- SUPPORT
- CUSTOMER
- COMPLIANCE
6. API Routes
Base path: /api/v1
6.1 Template Retrieval
Method | Route | Purpose | Notes |
|---|---|---|---|
GET | /settings/email-templates | List templates | Supports search |
GET | /settings/email-templates/{id} | Get template detail | Includes variables |
6.2 Template Management
Method | Route | Purpose | Notes |
|---|---|---|---|
PUT | /settings/email-templates/{id} | Update template | Admin only |
6.3 Preview
Method | Route | Purpose | Notes |
|---|---|---|---|
POST | /settings/email-templates/{id}/preview | Render preview | No persistence |
6.4 Variables
Method | Route | Purpose | Notes |
|---|---|---|---|
GET | /settings/email-templates/{id}/variables | Get variables | Read-only |