devicehub-django/device/templates/details.html

262 lines
8.2 KiB
HTML
Raw Normal View History

2024-10-08 05:26:48 +00:00
{% extends 'base.html' %}
2024-07-05 13:32:07 +00:00
{% load i18n %}
{% block content %}
<div class="row">
<div class="col">
<h3>{{ object.shortid }}</h3>
</div>
2024-07-05 13:32:07 +00:00
</div>
<div class="row">
<div class="col">
<ul class="nav nav-tabs nav-tabs-bordered">
2024-10-29 07:25:01 +00:00
<li class="nav-item">
<a href="#details" class="nav-link active" data-bs-toggle="tab" data-bs-target="#details">{% trans 'General details' %}</a>
</li>
2024-10-29 07:25:01 +00:00
<li class="nav-item">
<a href="#annotations" class="nav-link" data-bs-toggle="tab" data-bs-target="#annotations">{% trans 'User annotations' %}</a>
</li>
2024-10-29 07:25:01 +00:00
<li class="nav-item">
<a href="#documents" class="nav-link" data-bs-toggle="tab" data-bs-target="#documents">{% trans 'Documents' %}</a>
</li>
2024-10-29 07:25:01 +00:00
<li class="nav-item">
<a href="#lots" class="nav-link" data-bs-toggle="tab" data-bs-target="#lots">{% trans 'Lots' %}</a>
</li>
2024-10-29 07:25:01 +00:00
<li class="nav-item">
<a href="#components" class="nav-link" data-bs-toggle="tab" data-bs-target="#components">{% trans 'Components' %}</a>
</li>
2024-10-29 07:25:01 +00:00
<li class="nav-item">
<a href="#evidences" class="nav-link" data-bs-toggle="tab" data-bs-target="#evidences">{% trans 'Evidences' %}</a>
</li>
2024-10-29 07:25:01 +00:00
<li class="nav-item">
2024-10-30 15:00:23 +00:00
<a class="nav-link" href="{% url 'device:device_web' object.id %}" target="_blank">Web</a>
</li>
</ul>
2024-07-05 13:32:07 +00:00
</div>
</div>
2024-10-08 05:26:48 +00:00
<div class="tab-content pt-2">
<div class="tab-pane fade show active" id="details">
<h5 class="card-title">{% trans 'Details' %}</h5>
2024-10-08 05:26:48 +00:00
<div class="row mb-3">
2024-10-29 07:30:17 +00:00
<div class="col-lg-3 col-md-4 label">Phid</div>
2024-10-08 05:26:48 +00:00
<div class="col-lg-9 col-md-8">{{ object.id }}</div>
</div>
2024-07-05 13:32:07 +00:00
{% if object.is_eraseserver %}
<div class="row mb-3">
<div class="col-lg-3 col-md-4 label">
{% trans 'Is a erase server' %}
</div>
<div class="col-lg-9 col-md-8"></div>
</div>
{% endif %}
<div class="row mb-1">
2024-10-29 07:30:17 +00:00
<div class="col-lg-3 col-md-4 label">Type</div>
2024-10-08 05:26:48 +00:00
<div class="col-lg-9 col-md-8">{{ object.type }}</div>
</div>
2024-07-05 13:32:07 +00:00
2024-11-09 19:30:49 +00:00
{% if object.is_websnapshot and object.last_user_evidence %}
2024-10-22 05:24:42 +00:00
{% for k, v in object.last_user_evidence %}
<div class="row mb-1">
2024-10-22 05:24:42 +00:00
<div class="col-lg-3 col-md-4 label">{{ k }}</div>
<div class="col-lg-9 col-md-8">{{ v|default:'' }}</div>
</div>
{% endfor %}
{% else %}
<div class="row mb-1">
<div class="col-lg-3 col-md-4 label">
{% trans 'Manufacturer' %}
</div>
2024-10-22 05:24:42 +00:00
<div class="col-lg-9 col-md-8">{{ object.manufacturer|default:'' }}</div>
2024-10-08 05:26:48 +00:00
</div>
2024-07-05 13:32:07 +00:00
<div class="row mb-1">
<div class="col-lg-3 col-md-4 label">
{% trans 'Model' %}
</div>
2024-10-08 05:26:48 +00:00
<div class="col-lg-9 col-md-8">{{ object.model|default:'' }}</div>
</div>
2024-07-05 13:32:07 +00:00
<div class="row mb-1">
<div class="col-lg-3 col-md-4 label">
{% trans 'Version' %}
</div>
<div class="col-lg-9 col-md-8">{{ object.version|default:'' }}</div>
</div>
<div class="row mb-1">
<div class="col-lg-3 col-md-4 label">
{% trans 'Serial Number' %}
</div>
2024-11-04 07:21:19 +00:00
<div class="col-lg-9 col-md-8">{{ object.serial_number|default:'' }}</div>
2024-10-08 05:26:48 +00:00
</div>
{% endif %}
<div class="row mb-3">
<div class="col-lg-3 col-md-4 label">
{% trans 'Identifiers' %}
</div>
2024-10-08 05:26:48 +00:00
</div>
{% for chid in object.hids %}
<div class="row mb-3">
2024-10-08 05:26:48 +00:00
<div class="col">{{ chid|default:'' }}</div>
</div>
{% endfor %}
2024-07-05 13:32:07 +00:00
</div>
<div class="tab-pane fade" id="annotations">
<div class="btn-group mt-1 mb-3">
2024-10-08 05:26:48 +00:00
<a href="{% url 'device:add_annotation' object.pk %}" class="btn btn-primary">
<i class="bi bi-plus"></i>
{% trans 'Add new annotation' %}
2024-10-08 05:26:48 +00:00
</a>
</div>
2024-07-05 13:32:07 +00:00
<h5 class="card-title">{% trans 'Annotations' %}</h5>
2024-10-08 05:26:48 +00:00
<table class="table table-striped">
<thead>
<tr>
<th scope="col">
{% trans 'Key' %}
</th>
<th scope="col">
{% trans 'Value' %}
</th>
<th scope="col" data-type="date" data-format="YYYY-MM-DD HH:mm">
{% trans 'Created on' %}
</th>
2024-10-08 05:26:48 +00:00
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{% for a in object.get_user_annotations %}
<tr>
<td>{{ a.key }}</td>
<td>{{ a.value }}</td>
<td>{{ a.created }}</td>
<td></td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
2024-07-05 13:32:07 +00:00
</div>
<div class="tab-pane fade" id="documents">
<div class="btn-group mt-1 mb-3">
2024-10-08 05:26:48 +00:00
<a href="{% url 'device:add_document' object.pk %}" class="btn btn-primary">
<i class="bi bi-plus"></i>
{% trans 'Add new document' %}
2024-10-08 05:26:48 +00:00
</a>
</div>
2024-07-30 11:37:08 +00:00
<h5 class="card-title">{% trans 'Documents' %}</h5>
2024-10-08 05:26:48 +00:00
<table class="table table-striped">
<thead>
<tr>
<th scope="col">
{% trans 'Key' %}
</th>
<th scope="col">
{% trans 'Value' %}
</th>
<th scope="col" data-type="date" data-format="YYYY-MM-DD HH:mm">
{% trans 'Created on' %}
</th>
2024-10-08 05:26:48 +00:00
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{% for a in object.get_user_documents %}
<tr>
<td>{{ a.key }}</td>
<td>{{ a.value }}</td>
<td>{{ a.created }}</td>
<td></td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
2024-07-05 13:32:07 +00:00
</div>
<div class="tab-pane fade" id="lots">
{% for tag in lot_tags %}
<h5 class="card-title">{{ tag }}</h5>
{% for lot in object.lots %}
{% if lot.type == tag %}
<div class="row mb-3">
<div class="col">
<a href="{% url 'dashboard:lot' lot.id %}">{{ lot.name }}</a>
</div>
</div>
{% endif %}
{% endfor %}
{% endfor %}
</div>
<div class="tab-pane fade" id="components">
<h5 class="card-title">{% trans 'Components last evidence' %}</h5>
2024-10-08 05:26:48 +00:00
<div class="list-group col-6">
2024-10-22 05:24:42 +00:00
{% for c in object.components %}
2024-10-08 05:26:48 +00:00
<div class="list-group-item">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ c.type }}</h5>
<small class="text-muted">{{ evidence.created }}</small>
</div>
<p class="mb-1">
2024-10-22 05:24:42 +00:00
{% for k, v in c.items %}
{% if k not in 'actions,type' %}
{{ k }}: {{ v }}<br />
{% endif %}
{% endfor %}
2024-10-08 05:26:48 +00:00
</p>
</div>
{% endfor %}
2024-07-05 13:32:07 +00:00
</div>
2024-07-18 15:21:22 +00:00
</div>
<div class="tab-pane fade" id="evidences">
<h5 class="card-title">{% trans 'List of evidences' %}</h5>
2024-10-08 05:26:48 +00:00
<div class="list-group col-6">
{% for snap in object.evidences %}
<div class="list-group-item">
<div class="d-flex w-100 justify-content-between">
<small class="text-muted">{{ snap.created }}</small>
</div>
<p class="mb-1">
<a href="{% url 'evidence:details' snap.uuid %}">{{ snap.uuid }}</a>
</p>
</div>
{% endfor %}
2024-07-05 13:32:07 +00:00
</div>
</div>
</div>
{% endblock %}
2024-10-22 05:24:42 +00:00
{% block extrascript %}
<script>
document.addEventListener('DOMContentLoaded', function () {
// Obtener el hash de la URL (ejemplo: #components)
const hash = window.location.hash
// Verificar si hay un hash en la URL
if (hash) {
// Buscar el botón o enlace que corresponde al hash y activarlo
const tabTrigger = document.querySelector(`[data-bs-target="${hash}"]`)
if (tabTrigger) {
// Crear una instancia de tab de Bootstrap para activar el tab
const tab = new bootstrap.Tab(tabTrigger)
tab.show()
}
}
})
</script>
{% endblock %}