@nextsparkjs/theme-crm 0.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/CRM_PLAN.md +343 -0
  2. package/about.md +122 -0
  3. package/config/app.config.ts +185 -0
  4. package/config/billing.config.ts +187 -0
  5. package/config/dashboard.config.ts +372 -0
  6. package/config/dev.config.ts +55 -0
  7. package/config/features.config.ts +336 -0
  8. package/config/flows.config.ts +511 -0
  9. package/config/permissions.config.ts +297 -0
  10. package/config/theme.config.ts +111 -0
  11. package/entities/activities/activities.config.ts +61 -0
  12. package/entities/activities/activities.fields.ts +362 -0
  13. package/entities/activities/activities.service.ts +503 -0
  14. package/entities/activities/activities.types.ts +117 -0
  15. package/entities/activities/messages/en.json +123 -0
  16. package/entities/activities/messages/es.json +123 -0
  17. package/entities/activities/migrations/020_activities_table.sql +123 -0
  18. package/entities/activities/migrations/021_activities_metas.sql +114 -0
  19. package/entities/activities/migrations/022_activities_sample_data.sql +420 -0
  20. package/entities/campaigns/campaigns.config.ts +61 -0
  21. package/entities/campaigns/campaigns.fields.ts +413 -0
  22. package/entities/campaigns/campaigns.service.ts +426 -0
  23. package/entities/campaigns/campaigns.types.ts +124 -0
  24. package/entities/campaigns/messages/en.json +145 -0
  25. package/entities/campaigns/messages/es.json +145 -0
  26. package/entities/campaigns/migrations/001_campaigns_table.sql +127 -0
  27. package/entities/campaigns/migrations/002_campaigns_metas.sql +114 -0
  28. package/entities/campaigns/migrations/003_campaigns_sample_data.sql +364 -0
  29. package/entities/companies/companies.config.ts +61 -0
  30. package/entities/companies/companies.fields.ts +429 -0
  31. package/entities/companies/companies.service.ts +566 -0
  32. package/entities/companies/companies.types.ts +125 -0
  33. package/entities/companies/messages/en.json +146 -0
  34. package/entities/companies/messages/es.json +146 -0
  35. package/entities/companies/migrations/001_companies_table.sql +150 -0
  36. package/entities/companies/migrations/002_companies_metas.sql +114 -0
  37. package/entities/companies/migrations/003_companies_sample_data.sql +246 -0
  38. package/entities/contacts/contacts.config.ts +61 -0
  39. package/entities/contacts/contacts.fields.ts +359 -0
  40. package/entities/contacts/contacts.service.ts +509 -0
  41. package/entities/contacts/contacts.types.ts +108 -0
  42. package/entities/contacts/messages/en.json +117 -0
  43. package/entities/contacts/messages/es.json +117 -0
  44. package/entities/contacts/migrations/001_contacts_table.sql +134 -0
  45. package/entities/contacts/migrations/002_contacts_metas.sql +114 -0
  46. package/entities/contacts/migrations/003_contacts_sample_data.sql +421 -0
  47. package/entities/leads/leads.config.ts +61 -0
  48. package/entities/leads/leads.fields.ts +336 -0
  49. package/entities/leads/leads.service.ts +496 -0
  50. package/entities/leads/leads.types.ts +114 -0
  51. package/entities/leads/messages/en.json +132 -0
  52. package/entities/leads/messages/es.json +132 -0
  53. package/entities/leads/migrations/001_leads_table.sql +150 -0
  54. package/entities/leads/migrations/002_leads_metas.sql +120 -0
  55. package/entities/leads/migrations/003_leads_sample_data.sql +242 -0
  56. package/entities/notes/messages/en.json +114 -0
  57. package/entities/notes/messages/es.json +114 -0
  58. package/entities/notes/migrations/020_notes_table.sql +118 -0
  59. package/entities/notes/migrations/021_notes_metas.sql +114 -0
  60. package/entities/notes/migrations/022_notes_sample_data.sql +275 -0
  61. package/entities/notes/notes.config.ts +61 -0
  62. package/entities/notes/notes.fields.ts +283 -0
  63. package/entities/notes/notes.service.ts +320 -0
  64. package/entities/notes/notes.types.ts +102 -0
  65. package/entities/opportunities/messages/en.json +107 -0
  66. package/entities/opportunities/messages/es.json +107 -0
  67. package/entities/opportunities/migrations/010_opportunities_table.sql +145 -0
  68. package/entities/opportunities/migrations/011_opportunities_metas.sql +114 -0
  69. package/entities/opportunities/migrations/012_opportunities_sample_data.sql +438 -0
  70. package/entities/opportunities/opportunities.config.ts +61 -0
  71. package/entities/opportunities/opportunities.fields.ts +416 -0
  72. package/entities/opportunities/opportunities.service.ts +525 -0
  73. package/entities/opportunities/opportunities.types.ts +135 -0
  74. package/entities/pipelines/messages/en.json +115 -0
  75. package/entities/pipelines/messages/es.json +115 -0
  76. package/entities/pipelines/migrations/001_pipelines_table.sql +106 -0
  77. package/entities/pipelines/migrations/002_pipelines_metas.sql +114 -0
  78. package/entities/pipelines/migrations/003_pipelines_sample_data.sql +91 -0
  79. package/entities/pipelines/pipelines.config.ts +62 -0
  80. package/entities/pipelines/pipelines.fields.ts +193 -0
  81. package/entities/pipelines/pipelines.service.ts +383 -0
  82. package/entities/pipelines/pipelines.types.ts +78 -0
  83. package/entities/products/messages/en.json +135 -0
  84. package/entities/products/messages/es.json +135 -0
  85. package/entities/products/migrations/001_products_table.sql +117 -0
  86. package/entities/products/migrations/002_products_metas.sql +114 -0
  87. package/entities/products/migrations/003_products_sample_data.sql +247 -0
  88. package/entities/products/products.config.ts +62 -0
  89. package/entities/products/products.fields.ts +361 -0
  90. package/entities/products/products.service.ts +437 -0
  91. package/entities/products/products.types.ts +125 -0
  92. package/lib/crm-constants.ts +77 -0
  93. package/lib/crm-utils.ts +185 -0
  94. package/lib/selectors.ts +333 -0
  95. package/messages/en.json +131 -0
  96. package/messages/es.json +131 -0
  97. package/migrations/999_theme_sample_data.sql +473 -0
  98. package/package.json +18 -0
  99. package/pendings.md +205 -0
  100. package/permissions-matrix.md +216 -0
  101. package/styles/components.css +414 -0
  102. package/styles/crm-theme.css +358 -0
  103. package/styles/globals.css +576 -0
  104. package/styles/variables.css +111 -0
  105. package/templates/dashboard/(main)/activities/components/ActivityCard.tsx +169 -0
  106. package/templates/dashboard/(main)/activities/components/ActivityTimeline.tsx +165 -0
  107. package/templates/dashboard/(main)/activities/page.tsx +297 -0
  108. package/templates/dashboard/(main)/campaigns/page.tsx +373 -0
  109. package/templates/dashboard/(main)/companies/page.tsx +296 -0
  110. package/templates/dashboard/(main)/contacts/page.tsx +347 -0
  111. package/templates/dashboard/(main)/layout.tsx +98 -0
  112. package/templates/dashboard/(main)/leads/page.tsx +335 -0
  113. package/templates/dashboard/(main)/opportunities/[id]/edit/page.tsx +95 -0
  114. package/templates/dashboard/(main)/opportunities/create/page.tsx +94 -0
  115. package/templates/dashboard/(main)/opportunities/page.tsx +350 -0
  116. package/templates/dashboard/(main)/pipelines/[id]/edit/page.tsx +95 -0
  117. package/templates/dashboard/(main)/pipelines/[id]/page.tsx +143 -0
  118. package/templates/dashboard/(main)/pipelines/create/page.tsx +94 -0
  119. package/templates/dashboard/(main)/pipelines/page.tsx +234 -0
  120. package/templates/dashboard/(main)/products/[id]/edit/page.tsx +97 -0
  121. package/templates/dashboard/(main)/products/[id]/page.tsx +509 -0
  122. package/templates/dashboard/(main)/products/create/page.tsx +96 -0
  123. package/templates/dashboard/(main)/products/page.tsx +308 -0
  124. package/templates/shared/ActionButtons.tsx +41 -0
  125. package/templates/shared/CRMDashboard.tsx +519 -0
  126. package/templates/shared/CRMDataTable.tsx +441 -0
  127. package/templates/shared/CRMMetricCard.tsx +76 -0
  128. package/templates/shared/CRMMobileNav.tsx +172 -0
  129. package/templates/shared/CRMSidebar.tsx +346 -0
  130. package/templates/shared/CRMTopBar.tsx +265 -0
  131. package/templates/shared/DealCard.tsx +123 -0
  132. package/templates/shared/EntityCard.tsx +58 -0
  133. package/templates/shared/OpportunityForm.tsx +649 -0
  134. package/templates/shared/PipelineForm.tsx +367 -0
  135. package/templates/shared/PipelineKanban.tsx +194 -0
  136. package/templates/shared/QuickFilters.tsx +47 -0
  137. package/templates/shared/StageColumn.tsx +175 -0
  138. package/templates/shared/StageSelect.tsx +177 -0
  139. package/templates/shared/StagesRepeater.tsx +317 -0
  140. package/templates/shared/index.ts +9 -0
@@ -0,0 +1,362 @@
1
+ /**
2
+ * Activities Entity Fields Configuration
3
+ *
4
+ * Separated from main config according to new refactoring plan.
5
+ * Contains all field definitions for the activities entity.
6
+ */
7
+
8
+ import type { EntityField } from '@nextsparkjs/core/lib/entities/types'
9
+
10
+ export const activitiesFields: EntityField[] = [
11
+ {
12
+ name: 'type',
13
+ type: 'select',
14
+ required: true,
15
+ options: [
16
+ { value: 'call', label: 'Call' },
17
+ { value: 'email', label: 'Email' },
18
+ { value: 'meeting', label: 'Meeting' },
19
+ { value: 'task', label: 'Task' },
20
+ { value: 'note', label: 'Note' },
21
+ { value: 'demo', label: 'Demo' },
22
+ { value: 'presentation', label: 'Presentation' },
23
+ ],
24
+ display: {
25
+ label: 'Activity Type',
26
+ description: 'Type of activity',
27
+ placeholder: 'Select type...',
28
+ showInList: true,
29
+ showInDetail: true,
30
+ showInForm: true,
31
+ order: 1,
32
+ columnWidth: 4,
33
+ },
34
+ api: {
35
+ searchable: false,
36
+ sortable: true,
37
+ readOnly: false,
38
+ },
39
+ },
40
+ {
41
+ name: 'subject',
42
+ type: 'text',
43
+ required: true,
44
+ display: {
45
+ label: 'Subject',
46
+ description: 'Activity subject or title',
47
+ placeholder: 'Enter subject...',
48
+ showInList: true,
49
+ showInDetail: true,
50
+ showInForm: true,
51
+ order: 2,
52
+ columnWidth: 8,
53
+ },
54
+ api: {
55
+ searchable: true,
56
+ sortable: true,
57
+ readOnly: false,
58
+ },
59
+ },
60
+ {
61
+ name: 'description',
62
+ type: 'textarea',
63
+ required: false,
64
+ display: {
65
+ label: 'Description',
66
+ description: 'Detailed description',
67
+ placeholder: 'Enter description...',
68
+ showInList: false,
69
+ showInDetail: true,
70
+ showInForm: true,
71
+ order: 3,
72
+ columnWidth: 12,
73
+ },
74
+ api: {
75
+ searchable: true,
76
+ sortable: false,
77
+ readOnly: false,
78
+ },
79
+ },
80
+ {
81
+ name: 'status',
82
+ type: 'select',
83
+ required: false,
84
+ options: [
85
+ { value: 'scheduled', label: 'Scheduled' },
86
+ { value: 'in_progress', label: 'In Progress' },
87
+ { value: 'completed', label: 'Completed' },
88
+ { value: 'cancelled', label: 'Cancelled' },
89
+ { value: 'overdue', label: 'Overdue' },
90
+ ],
91
+ display: {
92
+ label: 'Status',
93
+ description: 'Current activity status',
94
+ placeholder: 'Select status...',
95
+ showInList: true,
96
+ showInDetail: true,
97
+ showInForm: true,
98
+ order: 4,
99
+ columnWidth: 4,
100
+ },
101
+ api: {
102
+ searchable: false,
103
+ sortable: true,
104
+ readOnly: false,
105
+ },
106
+ },
107
+ {
108
+ name: 'priority',
109
+ type: 'select',
110
+ required: false,
111
+ options: [
112
+ { value: 'low', label: 'Low' },
113
+ { value: 'medium', label: 'Medium' },
114
+ { value: 'high', label: 'High' },
115
+ { value: 'urgent', label: 'Urgent' },
116
+ ],
117
+ display: {
118
+ label: 'Priority',
119
+ description: 'Activity priority level',
120
+ placeholder: 'Select priority...',
121
+ showInList: true,
122
+ showInDetail: true,
123
+ showInForm: true,
124
+ order: 5,
125
+ columnWidth: 4,
126
+ },
127
+ api: {
128
+ searchable: false,
129
+ sortable: true,
130
+ readOnly: false,
131
+ },
132
+ },
133
+ {
134
+ name: 'dueDate',
135
+ type: 'datetime',
136
+ required: false,
137
+ display: {
138
+ label: 'Due Date',
139
+ description: 'When activity is due',
140
+ placeholder: 'Select date and time...',
141
+ showInList: true,
142
+ showInDetail: true,
143
+ showInForm: true,
144
+ order: 6,
145
+ columnWidth: 4,
146
+ },
147
+ api: {
148
+ searchable: false,
149
+ sortable: true,
150
+ readOnly: false,
151
+ },
152
+ },
153
+ {
154
+ name: 'completedAt',
155
+ type: 'datetime',
156
+ required: false,
157
+ display: {
158
+ label: 'Completed At',
159
+ description: 'When activity was completed',
160
+ showInList: false,
161
+ showInDetail: true,
162
+ showInForm: false,
163
+ order: 7,
164
+ columnWidth: 4,
165
+ },
166
+ api: {
167
+ searchable: false,
168
+ sortable: true,
169
+ readOnly: true,
170
+ },
171
+ },
172
+ {
173
+ name: 'duration',
174
+ type: 'number',
175
+ required: false,
176
+ display: {
177
+ label: 'Duration (minutes)',
178
+ description: 'Duration in minutes',
179
+ placeholder: '60',
180
+ showInList: false,
181
+ showInDetail: true,
182
+ showInForm: true,
183
+ order: 8,
184
+ columnWidth: 4,
185
+ },
186
+ api: {
187
+ searchable: false,
188
+ sortable: true,
189
+ readOnly: false,
190
+ },
191
+ },
192
+ {
193
+ name: 'outcome',
194
+ type: 'textarea',
195
+ required: false,
196
+ display: {
197
+ label: 'Outcome',
198
+ description: 'Activity outcome or result',
199
+ placeholder: 'Enter outcome...',
200
+ showInList: false,
201
+ showInDetail: true,
202
+ showInForm: true,
203
+ order: 9,
204
+ columnWidth: 6,
205
+ },
206
+ api: {
207
+ searchable: true,
208
+ sortable: false,
209
+ readOnly: false,
210
+ },
211
+ },
212
+ {
213
+ name: 'location',
214
+ type: 'text',
215
+ required: false,
216
+ display: {
217
+ label: 'Location',
218
+ description: 'Location for meetings',
219
+ placeholder: 'Enter location...',
220
+ showInList: false,
221
+ showInDetail: true,
222
+ showInForm: true,
223
+ order: 10,
224
+ columnWidth: 6,
225
+ },
226
+ api: {
227
+ searchable: true,
228
+ sortable: false,
229
+ readOnly: false,
230
+ },
231
+ },
232
+ {
233
+ name: 'contactId',
234
+ type: 'relation',
235
+ required: false,
236
+ display: {
237
+ label: 'Contact',
238
+ description: 'Related contact',
239
+ placeholder: 'Select contact...',
240
+ showInList: true,
241
+ showInDetail: true,
242
+ showInForm: true,
243
+ order: 11,
244
+ columnWidth: 4,
245
+ },
246
+ api: {
247
+ searchable: false,
248
+ sortable: true,
249
+ readOnly: false,
250
+ },
251
+ relation: {
252
+ entity: 'contacts',
253
+ titleField: 'email',
254
+ },
255
+ },
256
+ {
257
+ name: 'companyId',
258
+ type: 'relation',
259
+ required: false,
260
+ display: {
261
+ label: 'Company',
262
+ description: 'Related company',
263
+ placeholder: 'Select company...',
264
+ showInList: false,
265
+ showInDetail: true,
266
+ showInForm: true,
267
+ order: 12,
268
+ columnWidth: 4,
269
+ },
270
+ api: {
271
+ searchable: false,
272
+ sortable: true,
273
+ readOnly: false,
274
+ },
275
+ relation: {
276
+ entity: 'companies',
277
+ titleField: 'name',
278
+ },
279
+ },
280
+ {
281
+ name: 'opportunityId',
282
+ type: 'relation',
283
+ required: false,
284
+ display: {
285
+ label: 'Opportunity',
286
+ description: 'Related opportunity',
287
+ placeholder: 'Select opportunity...',
288
+ showInList: false,
289
+ showInDetail: true,
290
+ showInForm: true,
291
+ order: 13,
292
+ columnWidth: 4,
293
+ },
294
+ api: {
295
+ searchable: false,
296
+ sortable: true,
297
+ readOnly: false,
298
+ },
299
+ relation: {
300
+ entity: 'opportunities',
301
+ titleField: 'name',
302
+ },
303
+ },
304
+ {
305
+ name: 'assignedTo',
306
+ type: 'user',
307
+ required: false,
308
+ display: {
309
+ label: 'Assigned To',
310
+ description: 'User assigned to this activity',
311
+ placeholder: 'Select user...',
312
+ showInList: true,
313
+ showInDetail: true,
314
+ showInForm: true,
315
+ order: 14,
316
+ columnWidth: 4,
317
+ },
318
+ api: {
319
+ searchable: false,
320
+ sortable: true,
321
+ readOnly: false,
322
+ },
323
+ },
324
+ {
325
+ name: 'createdAt',
326
+ type: 'datetime',
327
+ required: false,
328
+ display: {
329
+ label: 'Created At',
330
+ description: 'When the activity was created',
331
+ showInList: true,
332
+ showInDetail: true,
333
+ showInForm: false,
334
+ order: 98,
335
+ columnWidth: 4,
336
+ },
337
+ api: {
338
+ searchable: false,
339
+ sortable: true,
340
+ readOnly: true,
341
+ },
342
+ },
343
+ {
344
+ name: 'updatedAt',
345
+ type: 'datetime',
346
+ required: false,
347
+ display: {
348
+ label: 'Updated At',
349
+ description: 'When the activity was last updated',
350
+ showInList: false,
351
+ showInDetail: true,
352
+ showInForm: false,
353
+ order: 99,
354
+ columnWidth: 4,
355
+ },
356
+ api: {
357
+ searchable: false,
358
+ sortable: true,
359
+ readOnly: true,
360
+ },
361
+ },
362
+ ]