{% extends "layout/default.html" %}

{% set title = _("Options") %}

{% block body %}

<h1>{{_("Options")}}</h1>


<div class="row">
  <div class="col s12">
      <ul class="tabs">
          <li class="tab col s3"><a class="active" href="#system">{{_('System')}}</a></li>
          <li class="tab col s3"><a href="#param">{{_('Parameter')}}</a></li>
          <li class="tab col s3"><a href="#navbar">{{_('Navbar')}}</a></li>
          {% if g.user.admin == 1 %}
            <li class="tab col s3"><a href="#house">{{_('House')}}</a></li>
            <li class="tab col s3"><a href="#room">{{_('Room')}}</a></li>
            <li class="tab col s3"><a href="#machine">{{_('Machine')}}</a></li>
            <li class="tab col s3"><a href="#admin">{{_('Admin')}}</a></li>
          {% endif %}
    </ul>
</div>
</div>

<div id="system" >
<div class="card-panel white">
      <table class="white responsive-table">
        <thead>
          <tr>
              <th data-field="name">{{_('Parameter')}}</th>
              <th data-field="info">{{_('Informations')}}</th>
          </tr>
        </thead>

        <tbody>
          <tr>
            <td>{{ _('Hostname') }}</td>
            <td>{{ getHost }}</td>
          </tr>
          <tr>
            <td>{{ _('Platform') }}</td>
            <td>{{ getPlat }}</td>
          </tr>
          <tr>
            <td>{{ _('RAM') }}</td>
            <td> <div class="progress">
                  <div class="determinate" style="{{ g.ram  }}"></div>
              </div></td>
          </tr>
          <tr>
            <td>{{ _('Data') }}</td>
            <td><a href="{{ url_for('core.update_data_git') }}" class="btn {{buttonColor}}">{{_('Update Data')}}</a></td>
          </tr>
          <tr>
            <td>{{ _('Disk') }}</td>
            <td><div class="progress">
                  <div class="determinate" style="{{ g.disk }}"></div>
              </div></td>
          </tr>
          <tr>
            <td>{{ _('UpTime') }}</td>
            <td>{{ g.uptime }}</td>
          </tr>
        </tbody>
      </table>

</div>
</div>

<div id="param" >
<div class="card-panel white">
      <br>
            <form class="form" method=post action="">
               <label for="color" >{{_("Color")}}</label>
                  <br>

                  <input name="color" type="radio" id="red darken-1" value="red darken-1"/>
                  <label for="red darken-1" ><a class="btn red darken-1"></a></label>

                  <input name="color" type="radio" id="pink" value="pink" />
                  <label for="pink" ><a class="btn pink"></a></label>

                  <input name="color" type="radio" id="purple darken-1" value="purple darken-1"/>
                  <label for="purple darken-1" ><a class="btn purple darken-1"></a></label>

                  <input name="color" type="radio" id="deep-purple darken-1" value="deep-purple darken-1"/>
                  <label for="deep-purple darken-1" ><a class="btn deep-purple darken-1"></a></label>
                  <br><br>
                  <input name="color" type="radio" id="indigo darken-1" value="indigo darken-1"/>
                  <label for="indigo darken-1" ><a class="btn indigo darken-1"></a></label>

                  <input name="color" type="radio" id="blue darken-1" value="blue darken-1"/>
                  <label for="blue darken-1" ><a class="btn blue darken-1"></a></label>

                  <input name="color" type="radio" id="light-blue darken-1" value="light-blue darken-1"/>
                  <label for="light-blue darken-1" ><a class="btn light-blue darken-1"></a></label>

                  <input name="color" type="radio" id="cyan darken-1" value="cyan darken-1"/>
                  <label for="cyan darken-1" ><a class="btn cyan darken-1"></a></label>
                  <br><br>
                  <input name="color" type="radio" id="teal darken-1" value="teal darken-1"/>
                  <label for="teal darken-1" ><a class="btn teal darken-1"></a></label>

                  <input name="color" type="radio" id="green darken-1" value="green darken-1"/>
                  <label for="green darken-1" ><a class="btn green darken-1"></a></label>

                  <input name="color" type="radio" id="light-green darken-1" value="light-green darken-1"/>
                  <label for="light-green darken-1" ><a class="btn light-green darken-1"></a></label>

                  <input name="color" type="radio" id="lime darken-1 darken-1" value="lime darken-1 darken-1"/>
                  <label for="lime darken-1 darken-1" ><a class="btn lime darken-1 darken-1"></a></label>


                  <br><br>
                  <input name="color" type="radio" id="yellow darken-1" value="yellow darken-1"/>
                  <label for="yellow darken-1" ><a class="btn yellow darken-1"></a></label>

                  <input name="color" type="radio" id="amber darken-1" value="amber darken-1"/>
                  <label for="amber darken-1" ><a class="btn amber darken-1"></a></label>

                  <input name="color" type="radio" id="orange darken-1" value="orange darken-1"/>
                  <label for="orange darken-1" ><a class="btn orange darken-1"></a></label>

                  <input name="color" type="radio" id="deep-orange darken-1" value="deep-orange darken-1"/>
                  <label for="deep-orange darken-1" ><a class="btn deep-orange darken-1"></a></label>
                  <br><br>
                  <input name="color" type="radio" id="brown darken-1 darken-1" value="brown darken-1 darken-1"/>
                  <label for="brown darken-1 darken-1" ><a class="btn brown darken-1"></a></label>

                  <input name="color" type="radio" id="default" value="None"/>
                  <label for="default" ><a class="btn"></a></label>



            <br><br>
            <button class="btn {{ buttonColor }}">{{_("Save")}}</button>
      </form>
</div>
</div>

<div id='navbar'>
  <div class="card-panel white">
    <h4>{{ _("Navbar") }}</h4><br><br>
    {% for nav in g.navbar %}
    <div class="row">
    <form class="form" method=post action="{{url_for('core.update_navbar')}}">
        <div class="col s4">
          <a href="#" class="btn-floating btn-large {{ buttonColor }} tooltipped" data-position="top" data-delay="50" data-tooltip="{{ nav.tooltip }}">
            <i class="large fa {{ nav.fa }}" aria-hidden="true"></i>
          </a>
        </div>
        <div class="col s4">
          <input type="hidden" name="last" value="{{nav.id}}">
          <select name="new" class="browser-default">
            {% for list in g.list %}
              {% if list.url != None %}
               <option value="{{list.id}}">{{ list.tooltip }}</option>
              {% endif %}
            {% endfor %}
          </select>
        </div>
        <div class="col s4">
          <button class='btn {{buttonColor}}'>{{_('Submit')}}</button>
        </div>
    </form>
    </div>
    {% endfor %}
  </div>
</div>
  {% if g.user.admin == 1 %}
<div id="house" >
<div class="card-panel white">
  <table class="white responsive-table">
    <thead>
      <tr>
          <th data-field="name">{{_('House')}}</th>
          <th data-field="address">{{_('Address')}}</th>
          <th data-field="city">{{_('City')}}</th>
          <th data-field="postal">{{_('Zip Code')}}</th>
          <th data-field="country">{{_('Country')}}</th>
          <th data-field="latitude">{{_('Latitude')}}</th>
          <th data-field="longitude">{{_('Longitude')}}</th>
          <th>{{_('Change')}}</th>
      </tr>
    </thead>

    <tbody>
      {% for house in g.houses %}
        <tr>
            <td>{{house.name}}</td>
            <td>{{house.address}}</td>
            <td>{{house.city}}</td>
            <td>{{house.postal}}</td>
            <td>{{house.country}}</td>
            <td>{{house.latitude}}</td>
            <td>{{house.longitude}}</td>
            <td><a href="{{url_for('core.delete_house', id=house.id)}}" class="btn {{buttonColor}}">{{_('Delete')}}</a></td>
        </tr>
      {% endfor %}
      <tr>
        <form action="{{url_for('core.add_house')}}" method="post">
          <td><input placeholder="{{_('House')}}" type="text" id="name" name="name" required></td>
          <td><input placeholder="{{_('Address')}}" type="text" id="address" name="address" required></td>
          <td><input placeholder="{{_('City')}}" type="text" id="city" name="city" required></td>
          <td><input placeholder="{{_('Zip Code')}}" type="text" id="postal" name="postal" required></td>
          <td><input placeholder="{{_('Country')}}" type="text" id="country" name="country" required></td>
          <td><input placeholder="{{_('Latitude')}}" type="text" id="latitude" name="latitude" required></td>
          <td><input placeholder="{{_('Longitude')}}" type="text" id="longitude" name="longitude" required></td>
          <td><button class="btn {{ buttonColor }}" type="submit" name="button">{{_('Send')}}</button></td>
        </form>
      </tr>
    </tbody>
  </table>
</div>
</div>

<div id="room" >
<div class="card-panel white">
  <table class="white responsive-table">
    <thead>
      <tr>
          <th data-field="name">{{_('Name')}}</th>
          <th data-field="house">{{_('House')}}</th>
          <th>{{_('Change')}}</th>
      </tr>
    </thead>

    <tbody>
      {% for room in g.rooms %}
        <tr>
            <td>{{room.name}}</td>
            <td>{{room.house}}</td>
            <td><a href="{{url_for('core.delete_room', id=room.id)}}" class="btn {{buttonColor}}">{{_('Delete')}}</a></td>
        </tr>
      {% endfor %}
      <tr>
        <form action="{{url_for('core.add_room')}}" method="post">
          <td><input placeholder="{{_('Name')}}" type="text" id="name" name="name" required></td>
          <td>
              <select name="house" class="browser-default">
                {% for house in g.houses %}
                    <option value="{{house.name}}">{{house.name}}</option>
                {% endfor %}
              </select>
          </td>
          <td><button class="btn {{ buttonColor }}" type="submit" name="button">{{_('Send')}}</button></td>
        </form>
      </tr>
    </tbody>
  </table>
</div>
</div>

<div id="machine" >
<div class="card-panel white">
  <table class="white responsive-table">
    <thead>
      <tr>
          <th data-field="id">{{_('Id')}}</th>
          <th data-field="name">{{_('Name')}}</th>
          <th data-field="house">{{_('House')}}</th>
          <th data-field="room">{{_('Room')}}</th>
          <th data-field="host">{{_('Host')}}</th>
          <th>{{_('Change')}}</th>
      </tr>
    </thead>
    <tbody>
      {% for machine in g.machines %}
        <tr>
            <td>{{machine.id}}</td>
            <td>{{machine.name}}</td>
            <td>{{machine.house}}</td>
            <td>{{machine.room}}</td>
            <td>{{machine.host}}</td>
            <td><a href="{{url_for('core.delete_machine', id=machine.id)}}" class="btn {{buttonColor}}">{{_('Delete')}}</a></td>
        </tr>
      {% endfor %}
      <tr>
        <form action="{{url_for('core.add_machine')}}" method="post">
          <td></td>
          <td><input placeholder="{{_('Name')}}" type="text" id="name" name="name" required></td>
          <td>
              <select name="house" class="browser-default">
                {% for house in g.houses %}
                    <option value="{{house.name}}">{{house.name}}</option>
                {% endfor %}
              </select>
          </td>
          <td>
              <select name="room" class="browser-default">
                {% for room in g.rooms %}
                    <option value="{{room.name}}">{{room.name}}</option>
                {% endfor %}
              </select>
          </td>
          <td><input placeholder="{{_('Host')}}" type="text" id="host" name="host" required></td>
          <td><button class="btn {{ buttonColor }}" type="submit" name="button">{{_('Send')}}</button></td>
        </form>
      </tr>
    </tbody>
  </table>
</div>
</div>




<div id="admin" >
 {% if g.user.admin == 1 %}
 <div class="card-panel white">

  <br><br>
  <h4>{{ _("Admin Options") }}</h4><br><br>
  <a href="{{ url_for('core.maj') }}" class="btn {{ buttonColor }}">{{_("Update Onyx")}}</a>
  <a href="{{ url_for('core.shutdown') }}" class="btn {{ buttonColor }}">{{_("Close Onyx")}}</a>
  <a href="{{ url_for('auth.account_manage') }}" class="btn {{ buttonColor }}">{{_("Manage Account")}}</a>
<br><br>

  <form action="{{url_for('core.change_lang')}}" method="post">
    <label for="lang" >{{_("Langue")}}</label>
    <select name="lang" class="browser-default">
          <option value="fr-FR">{{_("French")}}</option>
          <option value="en-US">{{_("English")}}</option>
    </select>

    <button class="btn {{ buttonColor }}">{{_("Save")}}</button>
  </form>



</div>
{% endif %}
</div>

</div>

{% endif %}





<br><br>







{% endblock %}
{% block script %}

<script>
  $(document).ready(function(){
    $('ul.tabs').tabs();
});


</script>

{% endblock %}
