{% extends "layout.html" %}
{% block title %}Update your account{% endblock %}
{% block head %}
  {{ super() }}
  <script src="{{ url_for('static', filename='js/scripts/account.js') }}" type="application/javascript" charset="utf-8"></script>
  <link href="{{ url_for('static', filename='css/jqueryTabs.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
  <script src="{{ url_for('static', filename='js/jquery/jqueryTabs.js') }}" type="application/javascript" charset="utf-8"></script>
{% endblock %}
{% block body %}
<div id="tabContainer">
  <ul>
    <li><a href="#tab1" class="active">Update Account information</a></li>
    {% if params %}
    <li><a href="#tab3">Add user</a></li>
    <li><a href="#tab2">Build & Run configuration</a></li>
    {% endif %}
  </ul><!-- //Tab buttons -->
  <div class="tabDetails">
    <div id="tab1" class="tabContents">
      <form class="account">
        <div class='form'>
          <fieldset>
            <legend><b> User credentials </b> </legend>
            <label for="username">Username: </label>
            <select name="username" id="username">
              {% for username in username_list -%}
              <option value="{{username}}">{{username}}</option>
              {% endfor -%}
            </select>
            <div class='clear'></div>
            <label for="password">Password: </label>
            <input type='password' name='password' id='password' value=''/>
            <div class='clear'></div>
            <label for="npassword">New Password: </label>
            <input type='password' name='npassword' id='npassword' value=''/>
            <div class='clear'></div>
            <label for="cpassword">Confirm New Password: </label>
            <input type='password' name='cpassword' id='cpassword' value=''/>
            <div class='clear'></div>
          </fieldset>
          <br/>
          <fieldset>
            <legend><b> Git user and email </b> </legend>
            <label for="name">Your name: </label>
            <input type='text' name='name' id='name' value='{{name}}'/>
            <div class='clear'></div>
            <label for="email">Your email address: </label>
            <input type='text' name='email' id='email' value='{{email}}'/>
            <div class='clear'></div>
          </fieldset>
          <br/>
          <label></label>
          <input type="submit" name="update" id ="update" value="Update Account" class="button"/>
          <div class='clear'></div>
        </div>
      </form>
    </div>
    {% if params %}
    <div id="tab3" class="tabContents">
      <form class="slapgrid">
        <div class='form'>
          <label for="username">New user name :</label>
          <input type='text' name='username' id='new_username'/>
          <div class='clear'></div>
          <label for="password">New password :</label>
          <input type='password' name='password' id='new_password'/>
          <div class='clear'></div>
          <br/>
          <label></label>
          <input type="submit" name="add_user" id="add_user" value="Add new user" class="button"/>
          <div class='clear'></div>
        </div>
      </form>
    </div>
    <div id="tab2" class="tabContents">
      <form class="slapgrid">
        <div class='form'>
          <h2>Which one do you want to run ?</h2>
          <label for="run_software">Build :</label>
          <input type='checkbox' name='run_software' id='run_software' value='run_software' {% if params.run_software -%}checked{% endif %}>
          <div class='clear'></div>
          <label for="run_instance">Run :</label>
          <input type='checkbox' name='run_instance' id='run_instance' value='run_instance' {% if params.run_instance -%}checked{% endif %}>
          <div class='clear'></div>
          <h2>How many tries ?</h2>
          <label for="max_run_software">Max times for Build :</label>
          <input type='text' name='max_run_software' id='max_run_software' value="{{params.max_run_software}}">
          <div class='clear'></div>
          <label for="max_run_instance">Max times for Run :</label>
          <input type='text' name='max_run_instance' id='max_run_instance' value="{{params.max_run_instance}}">
          <div class='clear'></div>
          <br/>
          <label></label>
          <input type="submit" name="save" id ="save" value="Save config" class="button"/>
          <div class='clear'></div>
        </div>
      </form>
    </div>
    {% endif %}
</div>
</div>
{% if username %}<div id="file_info" class="file_info">leave passwords blank to preserve your current password...
  </div><br/>{%endif%}
<div id="tooltip-information" style="display:none; float:left">
  <p style="font-size:12px;">
  Please find this information in your slaprunner<br/> connection informations.
  </p>
</div>
{% endblock %}
