feat(nakui): Fase 3 del ERP — ficha de detalle

View::Detail: ficha de un record con sus campos + listas de records
relacionados (RelatedList, back-references por via_field) + botones
Volver/Editar. ListView.row_detail enlaza lista→ficha con un botón 👁
por fila; Module::validate exige que apunte a una vista detail. En
meta-form: render_detail/render_related + select_detail con retorno.

El CRM: 👁 en Clientes y Oportunidades abre su ficha; la del cliente
lista sus oportunidades e interacciones. Tests en meta-schema y
nakui-ui verdes; clippy limpio.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
sergio
2026-05-21 19:12:26 +00:00
parent eba629a806
commit 6588d0ed6c
9 changed files with 449 additions and 29 deletions
+49 -2
View File
@@ -61,7 +61,8 @@
"actions": [
{ "kind": "open_view", "view": "cliente_form", "label": "✚ Nuevo cliente" }
],
"search_in": ["nombre", "email", "empresa"]
"search_in": ["nombre", "email", "empresa"],
"row_detail": "cliente_detail"
},
"cliente_form": {
"kind": "form",
@@ -92,7 +93,8 @@
{ "kind": "open_view", "view": "abrir_form", "label": "✚ Abrir oportunidad" },
{ "kind": "open_view", "view": "mover_form", "label": "⏩ Mover etapa" }
],
"search_in": ["titulo", "etapa"]
"search_in": ["titulo", "etapa"],
"row_detail": "oportunidad_detail"
},
"abrir_form": {
"kind": "form",
@@ -181,6 +183,51 @@
"params": ["interaccion_id", "canal", "nota", "timestamp"],
"next_view": "interaccion_list"
}
},
"cliente_detail": {
"kind": "detail",
"title": "Ficha del cliente",
"entity": "Cliente",
"fields": [
{ "field": "nombre", "label": "Nombre" },
{ "field": "email", "label": "Email" },
{ "field": "empresa", "label": "Empresa" }
],
"related": [
{
"title": "Oportunidades",
"entity": "Oportunidad",
"via_field": "cliente_id",
"columns": [
{ "field": "titulo", "label": "Título", "weight": 2.5 },
{ "field": "etapa", "label": "Etapa", "weight": 1.2 },
{ "field": "monto", "label": "Monto", "weight": 1.2, "format": { "kind": "currency", "symbol": "$" } }
]
},
{
"title": "Interacciones",
"entity": "Interaccion",
"via_field": "cliente_id",
"columns": [
{ "field": "canal", "label": "Canal", "weight": 1.0 },
{ "field": "nota", "label": "Nota", "weight": 3.0 },
{ "field": "timestamp", "label": "Fecha", "weight": 1.2 }
]
}
]
},
"oportunidad_detail": {
"kind": "detail",
"title": "Ficha de la oportunidad",
"entity": "Oportunidad",
"fields": [
{ "field": "titulo", "label": "Título" },
{ "field": "etapa", "label": "Etapa" },
{ "field": "monto", "label": "Monto", "format": { "kind": "currency", "symbol": "$" } },
{ "field": "currency", "label": "Moneda" },
{ "field": "cliente_id", "label": "Cliente", "ref_entity": "Cliente" },
{ "field": "timestamp", "label": "Fecha" }
]
}
}
}