{% extends "base_raw.html" %}
{% load backend_tags %}
{% block content %}
<h2>Gen Report</h2>
<a class='btn btn-danger ms-3' href="{% url 'backend:dump_fixed_results' %}?redir={{ request.path_info }}">Dump API</a>
<a href="#test_result" class='btn btn-link'>Test Result</a>
<a href="#mikrotik" class='btn btn-link'>Mikrotik</a>
{% if dump_again %}
<h1>Please Click Dump API</h1>
{% else %}
<form class='my-2'>
  <div>
    <h2>SLAs</h2>
    {% for sla in  slas %}
    <label class='me-3'>
      <input type='checkbox' name='sla_name' value='{{ sla }}' {% if sla in sla_name %}checked{% endif %}/>{{ sla }}
    </label>
    {% endfor %}
  </div>
  <div>
    <h2>Verifiers</h2>
    {% for v in  vrs %}
    <label class='me-3'>
      <input type='checkbox' name='vr_name' value='{{ v }}' {% if v in vr_name %}checked{% endif %}/>{{ v }}
    </label>
    {% endfor %}
  </div>
  <br>
  <a href="{{ request.path_info }}" class='btn btn-danger'>Reset</a>
<input type='submit' name='filter' Value='Filter' class='btn btn-primary' />
<input type='submit' name='genReport' value='Gen Report' class='btn btn-info' />
{% if report_link %}
  <a href="{{ report_link }}" class='btn btn-link'>Download</a>
{% endif %}
</form>
<h1 id='test_result'>Test Result</h1>
<div class='table-responsive'>
  {{ tbl|safe }} 
</div>
<h1 id='mikrotik'>Mikrotik</h1>
<h5 class='text-primary'>IP/ROUTE</h5>
{% for ip in mk_ips %}
<h4>{{ ip.gateway }}</h4>
  <div class='d-flex flex-row justify-content-start  flex-wrap align-content-stretch mb-5'>
    {% for k,v in ip.items %}
      <div class='border p-3 fw-bolder'>{{ k }}</div><div class='border p-3'>{{ v }}</div>
    {% endfor %}
  </div>
  
{% endfor %}

<h5 class='text-primary'>IP/Address</h5>
<!-- 
<pre>
{{ mk_address | pprint }}
</pre> -->
{% for ip in mk_address %}
<h4>{{ ip.interface }}</h4>
  <div class='d-flex flex-row justify-content-start  flex-wrap align-content-stretch mb-5'>
    {% for k,v in ip.items %}
      <div class='border p-3 fw-bolder'>{{ k }}</div><div class='border p-3'>{{ v }}</div>
    {% endfor %}
  </div>
  
{% endfor %}
<style>
th {
  text-align:center;
}
</style>
{% endif %}
{% endblock %}
