<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="chrome=1">
  <title>Poff admin</title>
  <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
</head>
<body>
  <div class="wrapper">
    <header>

      {% for category, msg in get_flashed_messages(with_categories=true) %}
        <div class="msg-{{ category }}">
          <span>
            <strong>{{ category.upper() }}: </strong>
            {{ msg }}
        </div>
      {% endfor %}

      <h1>Poff</h1>

      <p>
        Manage your dns here please.
      </p>
    </header>

    <section>

      <h1>Domains</h1>

      {% for domain in domains %}
        <h2>{{ domain.name }}</h2>
        <form action="{{ url_for('.domain_details', domain_id=domain.id) }}" method="post">
          <input type="hidden" name="_method" value="DELETE">
          <input type="submit" value="Delete domain">
        </form>
        <h3>Records</h3>
        {% for record in domain.records %}
            <p>
              {{ record.name }} - {{ record.type }} - {{ record.content }}
              {% if record.dyndns_client %}
                - Key: {{ record.dyndns_client.b64_key }}
              {% else %}
                <form action="{{ url_for('.new_dyndns_client', record_id=record.id) }}" method="post">
                  <input type="submit" value="Generate new DynDNS client">
                </form>
              {% endif %}
              <form action="{{ url_for('.record_details', record_id=record.id) }}" method="post">
                <input type="hidden" value="DELETE" name="_method">
                <input type="submit" value="Delete record">
              </form>
            </p>
        {% endfor %}
        <form action="/domains/{{ domain.id }}/new_record" method="post">
          {{ recordform.render() }}
          <input type="submit" value="New record">
        </form>
      {% endfor %}

      <h3>New domain</h3>
      <form action="/domains" method="post">
        {{ domainform.render() }}
        <input type="submit" value="New domain">
      </form>

    </section>

    <footer>
      <p><a href="https://github.com/thusoy/poff">Poff</a>, the minimal pdns frontend</p>
      <p>Maintained by <a href="http://github.com/thusoy">Tarjei Husøy</a>
    </footer>

  </div><!-- /wrapper -->

</body>
</html>
