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