import type { Esquemas } from "../../../api/cliente";
{%- if targets %}
import { EnlaceReferencia } from "../../../compartido/ui/enlace-referencia";
{%- endif %}
{%- if display_helpers %}
import { {{ display_helpers | join(sep=", ") }} } from "../../../compartido/formularios";
{%- endif %}
type {{ pascal }} = Esquemas["Dto{{ pascal }}"];
{% if targets -%}
/** `{{ ident }}`, y cómo se cargan las etiquetas de lo que referencia, para sus enlaces. */
export function VistaDetalle{{ pascal }}({
{{ ident }},
{%- for t in targets %}
etiqueta{{ t.pascal }},
{%- endfor %}
}: {
{{ ident }}: {{ pascal }};
{%- for t in targets %}
etiqueta{{ t.pascal }}: (id: string) => Promise<string>;
{%- endfor %}
}) {
{%- else -%}
export function VistaDetalle{{ pascal }}({ {{ ident }} }: { {{ ident }}: {{ pascal }} }) {
{%- endif %}
return (
<dl className="grid grid-cols-[max-content_1fr] gap-x-6 gap-y-2">
{%- for f in fields %}
<dt className="font-semibold">{{ f.label }}</dt>
{%- if f.input == "reference" %}
{%- for r in references %}{% if r.camel == f.camel %}
<dd>
{%- if r.link_inline %}
<EnlaceReferencia ruta="{{ r.ref_path }}" id={{ "{" }}{{ ident }}.{{ r.camel }}} cargar={{ "{" }}{{ r.loader }}} />
{%- else %}
<EnlaceReferencia
ruta="{{ r.ref_path }}"
id={{ "{" }}{{ ident }}.{{ r.camel }}}
cargar={{ "{" }}{{ r.loader }}}
/>
{%- endif %}
</dd>
{%- endif %}{% endfor %}
{%- else %}
<dd>{{ "{" }}{{ f.display }}}</dd>
{%- endif %}
{%- endfor %}
</dl>
);
}