Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 5 additions & 75 deletions examples/crm/src/domains/crm/account.object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export const Account = ObjectSchema.create({
pluralLabel: 'Accounts',
icon: 'building',
description: 'Companies and organizations doing business with us',
nameField: 'name',
titleFormat: '{account_number} - {name}',
compactLayout: ['account_number', 'name', 'type', 'owner'],

fields: {
// AutoNumber field - Unique account identifier
Expand Down Expand Up @@ -131,81 +132,10 @@ export const Account = ObjectSchema.create({
apiEnabled: true, // Expose via REST/GraphQL
apiMethods: ['get', 'list', 'create', 'update', 'delete', 'search', 'export'], // Whitelist allowed API operations
files: true, // Allow file attachments
feedEnabled: true, // Enable activity feed/chatter
feeds: true, // Enable activity feed/chatter (Chatter-like)
activities: true, // Enable tasks and events tracking
trash: true, // Recycle bin support
},

// List Views - Different visualization types
list_views: {
all: {
label: 'All Accounts',
type: 'grid',
columns: ['account_number', 'name', 'type', 'industry', 'annual_revenue', 'owner'],
sort: [{ field: 'name', order: 'asc' }],
searchableFields: ['name', 'account_number', 'phone', 'website'],
},
my_accounts: {
label: 'My Accounts',
type: 'grid',
columns: ['name', 'type', 'industry', 'annual_revenue', 'last_activity_date'],
filter: [['owner', '=', '{current_user}']],
sort: [{ field: 'last_activity_date', order: 'desc' }],
},
active_customers: {
label: 'Active Customers',
type: 'grid',
columns: ['name', 'industry', 'annual_revenue', 'number_of_employees'],
filter: [
['type', '=', 'customer'],
['is_active', '=', true]
],
},
by_type: {
label: 'Accounts by Type',
type: 'kanban',
columns: ['name', 'industry', 'annual_revenue'],
kanban: {
groupByField: 'type',
summarizeField: 'annual_revenue',
columns: ['name', 'industry', 'owner'],
}
}
},

// Form Views
form_views: {
default: {
type: 'tabbed',
sections: [
{
label: 'Account Information',
columns: 2,
fields: ['account_number', 'name', 'type', 'industry', 'owner', 'parent_account', 'is_active']
},
{
label: 'Financial Information',
columns: 2,
fields: ['annual_revenue', 'number_of_employees']
},
{
label: 'Contact Details',
columns: 2,
fields: ['phone', 'website', 'brand_color']
},
{
label: 'Location & Address',
columns: 2,
fields: ['billing_address', 'office_location']
},
{
label: 'Additional Information',
columns: 1,
collapsible: true,
collapsed: true,
fields: ['description', 'last_activity_date']
}
]
}
mru: true, // Track Most Recently Used
},

// Validation Rules
Expand Down
109 changes: 6 additions & 103 deletions examples/crm/src/domains/crm/case.object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,113 +174,16 @@ export const Case = ObjectSchema.create({
searchable: true,
apiEnabled: true,
files: true,
feedEnabled: true,
feeds: true, // Enable social feed, comments, and mentions
activities: true, // Enable tasks and events tracking
trash: true,
mru: true, // Track Most Recently Used
},

nameField: 'subject',
titleFormat: '{case_number} - {subject}',
compactLayout: ['case_number', 'subject', 'account', 'status', 'priority'],

list_views: {
all: {
label: 'All Cases',
type: 'grid',
columns: ['case_number', 'subject', 'account', 'contact', 'status', 'priority', 'owner'],
sort: [{ field: 'created_date', order: 'desc' }],
searchableFields: ['case_number', 'subject', 'description'],
},
my_cases: {
label: 'My Cases',
type: 'grid',
columns: ['case_number', 'subject', 'account', 'status', 'priority'],
filter: [['owner', '=', '{current_user}']],
sort: [{ field: 'priority', order: 'desc' }],
},
open_cases: {
label: 'Open Cases',
type: 'grid',
columns: ['case_number', 'subject', 'account', 'status', 'priority', 'owner'],
filter: [['is_closed', '=', false]],
sort: [{ field: 'priority', order: 'desc' }],
},
critical_cases: {
label: 'Critical Cases',
type: 'grid',
columns: ['case_number', 'subject', 'account', 'contact', 'status', 'owner'],
filter: [
['priority', '=', 'critical'],
['is_closed', '=', false],
],
sort: [{ field: 'created_date', order: 'asc' }],
},
escalated_cases: {
label: 'Escalated Cases',
type: 'grid',
columns: ['case_number', 'subject', 'account', 'priority', 'escalation_reason', 'owner'],
filter: [['is_escalated', '=', true]],
},
by_status: {
label: 'Cases by Status',
type: 'kanban',
columns: ['case_number', 'subject', 'account', 'priority'],
filter: [['is_closed', '=', false]],
kanban: {
groupByField: 'status',
columns: ['case_number', 'subject', 'contact', 'priority'],
}
},
sla_violations: {
label: 'SLA Violations',
type: 'grid',
columns: ['case_number', 'subject', 'account', 'sla_due_date', 'owner'],
filter: [['is_sla_violated', '=', true]],
sort: [{ field: 'sla_due_date', order: 'asc' }],
}
},

form_views: {
default: {
type: 'tabbed',
sections: [
{
label: 'Case Information',
columns: 2,
fields: ['case_number', 'subject', 'type', 'origin', 'priority', 'status', 'owner'],
},
{
label: 'Customer Information',
columns: 2,
fields: ['account', 'contact'],
},
{
label: 'Description',
columns: 1,
fields: ['description'],
},
{
label: 'Resolution',
columns: 1,
fields: ['resolution', 'customer_rating', 'customer_feedback', 'customer_signature'],
},
{
label: 'SLA & Metrics',
columns: 2,
fields: ['created_date', 'first_response_date', 'closed_date', 'resolution_time_hours', 'sla_due_date', 'is_sla_violated'],
},
{
label: 'Escalation',
columns: 2,
collapsible: true,
fields: ['is_escalated', 'escalation_reason', 'parent_case'],
},
{
label: 'Internal Information',
columns: 1,
collapsible: true,
fields: ['internal_notes'],
}
]
}
},
// Removed: list_views and form_views belong in UI configuration, not object definition

validations: [
{
Expand Down
81 changes: 6 additions & 75 deletions examples/crm/src/domains/crm/contact.object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,84 +123,15 @@ export const Contact = ObjectSchema.create({
searchable: true,
apiEnabled: true,
files: true,
feedEnabled: true,
feeds: true, // Enable social feed, comments, and mentions
activities: true, // Enable tasks and events tracking
trash: true,
mru: true, // Track Most Recently Used
},

// Name field configuration
nameField: 'full_name',

// List Views
list_views: {
all: {
label: 'All Contacts',
type: 'grid',
columns: ['full_name', 'account', 'title', 'email', 'phone', 'owner'],
sort: [{ field: 'last_name', order: 'asc' }],
searchableFields: ['first_name', 'last_name', 'email', 'phone'],
},
my_contacts: {
label: 'My Contacts',
type: 'grid',
columns: ['full_name', 'account', 'title', 'email', 'phone'],
filter: [['owner', '=', '{current_user}']],
},
primary_contacts: {
label: 'Primary Contacts',
type: 'grid',
columns: ['full_name', 'account', 'title', 'email', 'phone'],
filter: [['is_primary', '=', true]],
},
by_department: {
label: 'By Department',
type: 'kanban',
columns: ['full_name', 'account', 'title', 'email'],
kanban: {
groupByField: 'department',
columns: ['full_name', 'title', 'email', 'phone'],
}
},
birthdays: {
label: 'Birthdays',
type: 'calendar',
columns: ['full_name', 'account', 'phone'],
calendar: {
startDateField: 'birthdate',
titleField: 'full_name',
colorField: 'department',
}
}
},

// Form Views
form_views: {
default: {
type: 'simple',
sections: [
{
label: 'Contact Information',
columns: 2,
fields: ['salutation', 'first_name', 'last_name', 'full_name', 'account', 'title', 'department'],
},
{
label: 'Contact Details',
columns: 2,
fields: ['email', 'phone', 'mobile', 'reports_to', 'owner'],
},
{
label: 'Mailing Address',
columns: 2,
fields: ['mailing_street', 'mailing_city', 'mailing_state', 'mailing_postal_code', 'mailing_country'],
},
{
label: 'Additional Information',
columns: 2,
collapsible: true,
fields: ['birthdate', 'lead_source', 'is_primary', 'do_not_call', 'email_opt_out', 'description'],
}
]
}
},
// Display configuration
titleFormat: '{full_name}',
compactLayout: ['full_name', 'email', 'account', 'phone'],

// Validation Rules
validations: [
Expand Down
Loading
Loading