⎇ eba629a806c7f861dd00a37c20b0f9e9d1ef3a52
examples/nakui-modules/crm/module.json
Ñawpa willay
ch'uya
feat(nakui): Fase 2 del ERP — relaciones legibles + formato
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", "kind": "entity_ref", "ref_entity": "Cliente" },
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", "kind": "entity_ref", "ref_entity": "Cliente" },
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": "nombre", "label": "Nombre", "kind": "text", "required": true },
72 { "name": "email", "label": "Email", "kind": "text", "required": true },
73 { "name": "empresa", "label": "Empresa", "kind": "text" }
74 ],
75 "on_submit": {
76 "kind": "seed_entity",
77 "entity": "Cliente",
78 "next_view": "cliente_list"
79 }
80 },
81 "oportunidad_list": {
82 "kind": "list",
83 "title": "Oportunidades",
84 "entity": "Oportunidad",
85 "columns": [
86 { "field": "titulo", "label": "Título", "weight": 2.5 },
87 { "field": "etapa", "label": "Etapa", "weight": 1.2 },
88 { "field": "monto", "label": "Monto", "weight": 1.2, "format": { "kind": "currency", "symbol": "$" } },
89 { "field": "cliente_id", "label": "Cliente", "weight": 2.0, "ref_entity": "Cliente" }
90 ],
91 "actions": [
92 { "kind": "open_view", "view": "abrir_form", "label": "✚ Abrir oportunidad" },
93 { "kind": "open_view", "view": "mover_form", "label": "⏩ Mover etapa" }
94 ],
95 "search_in": ["titulo", "etapa"]
96 },
97 "abrir_form": {
98 "kind": "form",
99 "title": "Abrir oportunidad (morphism)",
100 "entity": "Oportunidad",
101 "fields": [
102 { "name": "cliente_ref", "label": "Cliente", "kind": "entity_ref", "ref_entity": "Cliente", "required": true, "help": "Click en un cliente de la lista para seleccionarlo." },
103 { "name": "oportunidad_id", "label": "ID de la oportunidad", "kind": "auto_id" },
104 { "name": "titulo", "label": "Título", "kind": "text", "required": true },
105 { "name": "monto", "label": "Monto", "kind": "number", "required": true, "default": "0" },
106 { "name": "currency", "label": "Moneda", "kind": "text", "default": "USD" },
107 { "name": "timestamp", "label": "Fecha ISO", "kind": "text", "required": true, "default": "2026-05-21T12:00:00Z" }
108 ],
109 "on_submit": {
110 "kind": "morphism",
111 "name": "abrir_oportunidad",
112 "inputs": { "cliente": "cliente_ref" },
113 "params": ["oportunidad_id", "titulo", "monto", "currency", "timestamp"],
114 "next_view": "oportunidad_list"
115 }
116 },
117 "mover_form": {
118 "kind": "form",
119 "title": "Mover oportunidad (morphism)",
120 "entity": "Oportunidad",
121 "fields": [
122 { "name": "oportunidad_ref", "label": "Oportunidad", "kind": "entity_ref", "ref_entity": "Oportunidad", "required": true, "help": "Click en una oportunidad de la lista." },
123 {
124 "name": "etapa", "label": "Etapa destino", "kind": "select", "required": true,
125 "options": [
126 { "value": "prospecto", "label": "Prospecto" },
127 { "value": "calificado", "label": "Calificado" },
128 { "value": "propuesta", "label": "Propuesta" },
129 { "value": "negociacion", "label": "Negociación" },
130 { "value": "ganada", "label": "Ganada" },
131 { "value": "perdida", "label": "Perdida" }
132 ]
133 },
134 { "name": "timestamp", "label": "Fecha ISO", "kind": "text", "required": true, "default": "2026-05-21T12:00:00Z" }
135 ],
136 "on_submit": {
137 "kind": "morphism",
138 "name": "mover_oportunidad",
139 "inputs": { "oportunidad": "oportunidad_ref" },
140 "params": ["etapa", "timestamp"],
141 "next_view": "oportunidad_list"
142 }
143 },
144 "interaccion_list": {
145 "kind": "list",
146 "title": "Interacciones",
147 "entity": "Interaccion",
148 "columns": [
149 { "field": "canal", "label": "Canal", "weight": 1.0 },
150 { "field": "nota", "label": "Nota", "weight": 3.0 },
151 { "field": "cliente_id", "label": "Cliente", "weight": 2.0, "ref_entity": "Cliente" },
152 { "field": "timestamp", "label": "Fecha", "weight": 1.2 }
153 ],
154 "actions": [
155 { "kind": "open_view", "view": "interaccion_form", "label": "✚ Registrar interacción" }
156 ],
157 "search_in": ["canal", "nota"]
158 },
159 "interaccion_form": {
160 "kind": "form",
161 "title": "Registrar interacción (morphism)",
162 "entity": "Interaccion",
163 "fields": [
164 { "name": "cliente_ref", "label": "Cliente", "kind": "entity_ref", "ref_entity": "Cliente", "required": true, "help": "Click en un cliente de la lista." },
165 { "name": "interaccion_id", "label": "ID de la interacción", "kind": "auto_id" },
166 {
167 "name": "canal", "label": "Canal", "kind": "select", "required": true,
168 "options": [
169 { "value": "llamada", "label": "Llamada" },
170 { "value": "email", "label": "Email" },
171 { "value": "reunion", "label": "Reunión" }
172 ]
173 },
174 { "name": "nota", "label": "Nota", "kind": "multiline" },
175 { "name": "timestamp", "label": "Fecha ISO", "kind": "text", "required": true, "default": "2026-05-21T12:00:00Z" }
176 ],
177 "on_submit": {
178 "kind": "morphism",
179 "name": "registrar_interaccion",
180 "inputs": { "cliente": "cliente_ref" },
181 "params": ["interaccion_id", "canal", "nota", "timestamp"],
182 "next_view": "interaccion_list"
183 }
184 }
185 }
186}