{% extends "layout.html" %}

{% block content %}

<h1>Results!</h1>

<p>What you looked up:</p>

<ul>
	<li>URL or IP: {{ URI_type }} </li>
</ul>

<table id="data" class="table table-striped">
	<thead>
		<tr>
			<th>URL</th>
			<th>creation date</th>
			<th>registrar</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>{{ looked_up.domain_name }}</td>
			<td>{{ looked_up.creation_date }}</td>
			<td>{{ looked_up.registrar }}</td>
		</tr>
	</tbody>
</table>

<table id="virustotal_all_vendors" class="table table-striped">
	<thead>

		<tr>
			<th>Vendor name</th>
			<th>Results</th>
		</tr>
	</thead>
	<tbody>
		{% for value in virustotal_results.attributes.last_analysis_results.values() %}
		<tr>
			<td>{{ value.engine_name }}</td>
			<td>{{ value.result }}</td>
		</tr>
		{% endfor %}
	</tbody>
</table>

{% endblock %}

{# Below JavaScript table magic from: https://blog.miguelgrinberg.com/post/beautiful-interactive-tables-for-your-flask-templates #}

{% block scripts %}
<script>
	$(document).ready(function () {
		$('#virustotal_all_vendors').DataTable();
	});
</script>
{% endblock %}