{% load static %}
{% load i18n %}


<!-- from INSTANCE DETAIL (1 object) -->

{% if item.dataformat == "string" %}
    {% if item.dataformat_ext == "safe" %} {{ item.value|safe }}
    {% elif item.dataformat_ext == "url" %} <a href="{{ item.value|safe }}">{{ item.value|safe }}</a>
    {% else %} {{ item.value|default:'' }} {% endif %}

{% elif item.dataformat == "boolean" %} 
<div class="d-flex">
    {% if item.value %}<i class="fa fa-check"></i>{% endif %}
</div>

    
{% elif item.dataformat == "int" %}  {{ item.value|default:'' }}

{% elif item.dataformat == "float" %}  {{ item.value|default:'' }}

{% elif item.dataformat == "group" %}  
    <div class="d-flex flex-wrap"> 
    {% for z in item.value %}{{ z.key }} ({{ z.display }}){% if not forloop.last %}, {% endif %}{% endfor %}   
    </div>   

{% elif item.dataformat == "role" %}  
    <div class="d-flex flex-wrap"> 
    {% for z in item.value %}{{ z.key }} ({{ z.display }}){% if not forloop.last %}, {% endif %}{% endfor %}   
    </div>   


{% elif item.dataformat == "user" %}
    <div class="d-flex flex-wrap"> 
    {% for z in item.value %}{{ z.key }} ({{ z.display }}){% if not forloop.last %}, {% endif %}{% endfor %}
    </div>  

{% elif item.dataformat == "schema" %}  
    <div class="d-flex flex-wrap"> 
    {% for z in item.value %}{{ z.display|default:z.key }}{% if not forloop.last %}, {% endif %}{% endfor %}
    </div>          

{% elif item.dataformat == "enumerate" %}
    <div class="d-flex flex-wrap">
        {% for z in item.value %} {{ z.widget|safe }} {{ z.value }} {{ z.detail }} <br> {% endfor %}
    </div>
        
{% elif item.dataformat == "external" %}  
    <div class="d-flex flex-wrap"> 
        <i>{{ item.value|default:'' }}</i>
    </div>   

{% elif item.dataformat == "text" %}  
    {% if item.dataformat_ext == "html" %}
    <div>{{ item.value|safe }}</div>
    {% else %}
    <pre>{{ item.value|default:'' }}</pre> 
    {% endif %}

{% elif item.dataformat == "file" %}  
<div class="d-flex flex-wrap"> 
    {% if item.queryset.0.displayname %}
        <i class="fa fa-file me-2"></i> {{ item.queryset.0.displayname }} ({{ item.queryset.0.size}})
    {% endif %}
</div>

{% elif item.dataformat == "password" %}  
<div class="d-flex justify-content-left">
   {{ item.value.0|default:'' }}
</div>

{% elif item.dataformat == "permission" %}  
    <div class="d-flex flex-wrap">
        {% for z in item.value %} {{ z.key }}{% if not forloop.last %}, {% endif %}{% endfor %}
    </div>  
    
{% else %} {{ item.value|default:'' }}  {% endif %}
