{% extends "base.html" %}
{% load static %}
{% load tags %}

{% block scripts %}

{% include 'wrappers/network_editor_imports.html' %}

{% endblock %}

{% block top-buttons %}
<a id="back" href="{% url 'Manage networks' %}"><i class="bi bi-arrow-90deg-left"></i></a>
{% endblock %}

{% block main %}
<div data-cy="network-sidenav" class="network-sidenav" id="network-sidenav">
  <div class="tab-navigation">
    <button class="btn network-sidenav-navigation-btn" id="network-details-nav-button" data-item="#network-details"
      data-toggle="tooltip" data-placement="bottom" title="Network Settings" data-cy="network-details-nav-button">
      <i class="bi bi-gear"></i>
    </button>
    <button class="btn network-sidenav-navigation-btn" id="node-list-nav-button" data-item="#node-list"
      data-toggle="tooltip" data-placement="bottom" title="Node List" data-cy="node-list-nav-button">
      <i class="bi bi-three-dots-vertical"></i>
    </button>
  </div>
  <div class="tab-content">
    <div id="network-details" class="tab-container">
      <div class="toolbar-tab-title">
        <h2>Network Settings</h2>
        <p>Set the details and behaviour of the network</p>
      </div>
      <div class="toolbar-content">
        <div class="toolbar-form-container doc-metadata-form">
          <form id="doc-meta-form" data-id="doc-meta">
            {% include 'elements/el_form_fields.html' with fields=doc_metadata_form.visible_fields protected=False %}
          </form>
        </div>
        <div class="toolbar-form-container doc-metadata-form">
          <form id="random-elements-form" class="config-form">
            {% include 'elements/el_form_fields.html' with fields=form.visible_fields protected=protected %}
          </form>
        </div>
      </div>
    </div>

    <div id="node-list" class="tab-container">
      <div class="toolbar-tab-title">
        <h3>Node List</h3>
        <p>View the list of nodes in the network</p>
      </div>
      <div class="toolbar-content">
        {% include 'elements/el_node_list.html' %}
      </div>
    </div>
  </div>
</div>
<app-root></app-root>

</div>

{% endblock %}

{% block style %}
<style>
  @font-face {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: 400;
    src: url(https://fonts.gstatic.com/s/materialicons/v139/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2) format('woff2');
  }

  #main {
    padding: 0 !important;
    display: flex;
    flex-direction: row;
  }

  #toolbar-buttons {
    position: absolute;
    top: 10px;
    left: 50%;
    background-color: #424242;
    z-index: 1000;
    width: 230px;
    border-radius: .2rem;
    transform: translate(-50%, 0%);
  }

  #toolbar-buttons .accordion-header {
    height: 40px;
  }

  #toolbar-buttons .accordion-button {
    padding: .875rem .875rem;
    background-color: #424242;
  }

  #toolbar-buttons .accordion-body {
    margin-top: .5rem;
    background-color: #424242;
    padding: 0;
  }

  #toolbar-buttons .accordion-body button {
    width: 100%;
    padding: .875rem .875rem;
  }

  #toolbar-buttons .accordion-body button:hover {
    background-color: var(--dark);
  }

  #toolbar-buttons * {
    color: var(--text-superlight);
    text-align: left;
  }

  #network-details,
  #node-list {
    padding: var(--increment);
    flex: 1;
    z-index: 999;
    background-color: var(--superlight);
    display: none;
  }

  .network-sidenav {
    display: flex;
    flex-direction: column;
    top: 0px;
    left: 0px;
    width: 30%;
    min-width: 300px;
    max-width: 1000px;
    height: 100%;
    z-index: 999;
    background-color: var(--lighter);
    overflow: hidden;
  }

  .tab-navigation {
    display: flex;
    flex-direction: row;
    flex-shrink: 1;
    width: 100%;
    overflow: hidden;
    padding: 5px 10px 0 10px;
  }

  .network-sidenav-navigation-btn {
    font-size: 1.5rem;
    padding: 5px 20px;
    border-radius: 0;
  }

  .network-sidenav-navigation-btn.active {
    color: var(--primary);
    background-color: var(--superlight);
  }

  .network-sidenav-navigation-btn:focus {
    outline: none;
    box-shadow: none;
  }

  app-root {
    height: 100%;
  }

  .material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
  }

  html {
    display: flex;
    flex: 1;
    height: 100%
  }

  .field-container:has(.form-switch) {
    max-width: 100px;
  }

  .help-text {
    color: var(--text-dark);
  }

  #network-tabs {
    width: 100%;
    border-bottom: 1px solid var(--text-superlight);
  }

  #network-tabs>* {
    margin-left: var(--increment);
    margin-right: var(--increment);
    color: var(--text-superlight);
    border-radius: .5rem .5rem 0 0;
    background-color: var(--light);
  }

  .field-container:has(.form-switch) {
    max-width: 100px;
  }

  .help-text {
    color: var(--text-dark);
  }

  .toolbar-tab-title {
    margin-bottom: 30px;
    margin-top: 10px;
    color: var(--text-superlight);
    flex-shrink: 1;
  }

  .tab-content,
  .tab-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
  }

  .toolbar-content {
    overflow-y: auto;
  }

  .toolbar-form-container {
    padding-right: 5px;
  }
</style>
{% endblock %}
