{% load xsl_transform_tag %}
{% load blob_tags %}
{% load format_json %}
{% load i18n %}

<h1>View Data</h1>
    <div class="{% if BOOTSTRAP_VERSION|first == "4" %}float-right{% elif BOOTSTRAP_VERSION|first == "5"  %}float-end{% endif %}">
        <a class="btn btn-danger {% if BOOTSTRAP_VERSION|first == "4" %}mr-auto{% elif BOOTSTRAP_VERSION|first == "5"  %}me-auto{% endif %}" href="{% url 'core_curate_enter_data' data.data_structure.id True %}">
            <i class="fas fa-arrow-left"></i> Back to {% trans "form_label"|title %}</a>
        <button class="btn btn-secondary download {% if BOOTSTRAP_VERSION|first == "4" %}mr-auto{% elif BOOTSTRAP_VERSION|first == "5"  %}me-auto{% endif %}"><i class="fas fa-download"></i> Download </button>
        <button class="btn btn-primary {% if BOOTSTRAP_VERSION|first == "4" %}mr-auto {% elif BOOTSTRAP_VERSION|first == "5"  %}me-auto{% endif %} save-to-repo"><i class="fas fa-save"></i> Save to Repository</button>
    </div>


<span>Title: {{data.data_structure.name}}</span>
{% if data.data_structure.template.format == "XSD" %}
    <div id="XMLHolder">
    {% xsl_transform_detail xml_content=data.form_string request=request as xml_representation %}
    {% if 'core_file_preview_app' in INSTALLED_APPS %}
        {% render_blob_links_in_span xml_string=xml_representation as xml_representation %}
    {% endif %}
    {{ xml_representation|safe}}
    </div>
{% elif data.data_structure.template.format == "JSON" %}
    <div id="JSONHolder" class="mb-1">
        <pre class="display-detail"><code>{{data.form_string|format_json}}</code></pre>
    </div>
{% else %}
    {{data.data_structure.form_string}}
{% endif %}

<div id="template_format" class="hidden">{{data.data_structure.template.format}}</div>
<div id="curate_data_structure_id" class="hidden">{{ data.data_structure.id }}</div>
