⎇ e187ab4cd359ee0789a2b9c658962c19c362ee3d
examples/nakui-modules/crm/module.json
Ñawpa willay
ch'uya
feat(nakui-ui): CRM como ERP — UiModule con listas y formularios
1{
2 "id": "crm",
3 "label": "CRM",
4 "description": "CRM conectado al módulo nakui-core 'crm': clientes, oportunidades que recorren un pipeline de ventas e interacciones. Los formularios «Abrir», «Mover» y «Registrar» disparan morfismos reales con validación del kernel.",
5 "nakui_module_dir": "../../../crates/modules/nakui/modules/crm",
6 "entities": [
7 {
8 "name": "Cliente",
9 "label": "Cliente",
10 "fields": [
11 { "name": "id", "label": "ID", "kind": "text" },
12 { "name": "nombre", "label": "Nombre", "kind": "text", "required": true },
13 { "name": "email", "label": "Email", "kind": "text", "required": true },
14 { "name": "empresa", "label": "Empresa", "kind": "text" }
15 ]
16 },
17 {
18 "name": "Oportunidad",
19 "label": "Oportunidad",
20 "fields": [
21 { "name": "id", "label": "ID", "kind": "text" },
22 { "name": "cliente_id", "label": "Cliente ref", "kind": "text" },
23 { "name": "titulo", "label": "Título", "kind": "text" },
24 { "name": "monto", "label": "Monto", "kind": "number" },
25 { "name": "currency", "label": "Moneda", "kind": "text" },
26 { "name": "etapa", "label": "Etapa", "kind": "text" },
27 { "name": "timestamp", "label": "Fecha", "kind": "text" }
28 ]
29 },
30 {
31 "name": "Interaccion",
32 "label": "Interacción",
33 "fields": [
34 { "name": "id", "label": "ID", "kind": "text" },
35 { "name": "cliente_id", "label": "Cliente ref", "kind": "text" },
36 { "name": "canal", "label": "Canal", "kind": "text" },
37 { "name": "nota", "label": "Nota", "kind": "multiline" },
38 { "name": "timestamp", "label": "Fecha", "kind": "text" }
39 ]
40 }
41 ],
42 "menu": [
43 { "label": "Clientes", "view": "cliente_list", "icon": "👤" },
44 { "label": "+ Cliente", "view": "cliente_form", "icon": "✚" },
45 { "label": "Oportunidades", "view": "oportunidad_list", "icon": "🎯" },
46 { "label": "Abrir oportunidad", "view": "abrir_form", "icon": "✚" },
47 { "label": "Mover oportunidad", "view": "mover_form", "icon": "⏩" },
48 { "label": "Interacciones", "view": "interaccion_list", "icon": "💬" },
49 { "label": "Registrar interacción", "view": "interaccion_form", "icon": "✚" }
50 ],
51 "views": {
52 "cliente_list": {
53 "kind": "list",
54 "title": "Clientes",
55 "entity": "Cliente",
56 "columns": [
57 { "field": "nombre", "label": "Nombre", "weight": 2.0 },
58 { "field": "email", "label": "Email", "weight": 2.5 },
59 { "field": "empresa", "label": "Empresa", "weight": 2.0 }
60 ],
61 "actions": [
62 { "kind": "open_view", "view": "cliente_form", "label": "✚ Nuevo cliente" }
63 ],
64 "search_in": ["nombre", "email", "empresa"]
65 },
66 "cliente_form": {
67 "kind": "form",
68 "title": "Nuevo cliente",
69 "entity": "Cliente",
70 "fields": [
71 { "name": "id", "label": "ID interno", "kind": "text", "help": "Opcional; el runtime genera el UUID de la entity. Dejar vacío está bien." },
72 { "name": "nombre", "label": "Nombre", "kind": "text", "required": true },
73 { "name": "email", "label": "Email", "kind": "text", "required": true },
74 { "name": "empresa", "label": "Empresa", "kind": "text" }
75 ],
76 "on_submit": {
77 "kind": "seed_entity",
78 "entity": "Cliente",
79 "next_view": "cliente_list"
80 }
81 },
82 "oportunidad_list": {
83 "kind": "list",
84 "title": "Oportunidades",
85 "entity": "Oportunidad",
86 "columns": [
87 { "field": "titulo", "label": "Título", "weight": 2.5 },
88 { "field": "etapa", "label": "Etapa", "weight": 1.2 },
89 { "field": "monto", "label": "Monto", "weight": 1.0 },
90 { "field": "currency", "label": "Moneda", "weight": 0.6 },
91 { "field": "cliente_id", "label": "Cliente ref", "weight": 1.5 }
92 ],
93 "actions": [
94 { "kind": "open_view", "view": "abrir_form", "label": "✚ Abrir oportunidad" },
95 { "kind": "open_view", "view": "mover_form", "label": "⏩ Mover etapa" }
96 ],
97 "search_in": ["titulo", "etapa"]
98 },
99 "abrir_form": {
100 "kind": "form",
101 "title": "Abrir oportunidad (morphism)",
102 "entity": "Oportunidad",
103 "fields": [
104 { "name": "cliente_ref", "label": "Cliente", "kind": "entity_ref", "ref_entity": "Cliente", "required": true, "help": "Click en un cliente de la lista para seleccionarlo." },
105 { "name": "oportunidad_id", "label": "Oportunidad UUID", "kind": "text", "required": true, "help": "UUID nuevo por cada intento (idempotencia)." },
106 { "name": "titulo", "label": "Título", "kind": "text", "required": true },
107 { "name": "monto", "label": "Monto", "kind": "number", "required": true, "default": "0" },
108 { "name": "currency", "label": "Moneda", "kind": "text", "default": "USD" },
109 { "name": "timestamp", "label": "Fecha ISO", "kind": "text", "required": true, "default": "2026-05-21T12:00:00Z" }
110 ],
111 "on_submit": {
112 "kind": "morphism",
113 "name": "abrir_oportunidad",
114 "inputs": { "cliente": "cliente_ref" },
115 "params": ["oportunidad_id", "titulo", "monto", "currency", "timestamp"],
116 "next_view": "oportunidad_list"
117 }
118 },
119 "mover_form": {
120 "kind": "form",
121 "title": "Mover oportunidad (morphism)",
122 "entity": "Oportunidad",
123 "fields": [
124 { "name": "oportunidad_ref", "label": "Oportunidad", "kind": "entity_ref", "ref_entity": "Oportunidad", "required": true, "help": "Click en una oportunidad de la lista." },
125 { "name": "etapa", "label": "Etapa destino", "kind": "text", "required": true, "help": "prospecto | calificado | propuesta | negociacion | ganada | perdida" },
126 { "name": "timestamp", "label": "Fecha ISO", "kind": "text", "required": true, "default": "2026-05-21T12:00:00Z" }
127 ],
128 "on_submit": {
129 "kind": "morphism",
130 "name": "mover_oportunidad",
131 "inputs": { "oportunidad": "oportunidad_ref" },
132 "params": ["etapa", "timestamp"],
133 "next_view": "oportunidad_list"
134 }
135 },
136 "interaccion_list": {
137 "kind": "list",
138 "title": "Interacciones",
139 "entity": "Interaccion",
140 "columns": [
141 { "field": "canal", "label": "Canal", "weight": 1.0 },
142 { "field": "nota", "label": "Nota", "weight": 3.0 },
143 { "field": "cliente_id", "label": "Cliente ref", "weight": 1.5 },
144 { "field": "timestamp", "label": "Fecha", "weight": 1.2 }
145 ],
146 "actions": [
147 { "kind": "open_view", "view": "interaccion_form", "label": "✚ Registrar interacción" }
148 ],
149 "search_in": ["canal", "nota"]
150 },
151 "interaccion_form": {
152 "kind": "form",
153 "title": "Registrar interacción (morphism)",
154 "entity": "Interaccion",
155 "fields": [
156 { "name": "cliente_ref", "label": "Cliente", "kind": "entity_ref", "ref_entity": "Cliente", "required": true, "help": "Click en un cliente de la lista." },
157 { "name": "interaccion_id", "label": "Interacción UUID", "kind": "text", "required": true, "help": "UUID nuevo por cada intento (idempotencia)." },
158 { "name": "canal", "label": "Canal", "kind": "text", "required": true, "help": "llamada | email | reunion" },
159 { "name": "nota", "label": "Nota", "kind": "multiline" },
160 { "name": "timestamp", "label": "Fecha ISO", "kind": "text", "required": true, "default": "2026-05-21T12:00:00Z" }
161 ],
162 "on_submit": {
163 "kind": "morphism",
164 "name": "registrar_interaccion",
165 "inputs": { "cliente": "cliente_ref" },
166 "params": ["interaccion_id", "canal", "nota", "timestamp"],
167 "next_view": "interaccion_list"
168 }
169 }
170 }
171}