<!DOCTYPE html> 

<html class="sr js anime-ready" style lang=en>
  <head>
    <meta charset=utf-8>
    <meta http-equiv=X-UA-Compatible content="IE=edge">
    <meta name=viewport content="width=device-width, initial-scale=1">

    <title>Alpha</title>

    <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">

    <link rel="stylesheet" href="/assets/css/home.css?{{date}}">
    <link rel="icon" type="image/png" href="/assets/images/icons/alpha.png" />
    <script src="/assets/js/libs/jquery.min.js"></script>
  </head>

  <body class="is-boxed has-animations" style=height:100%>
    <div class=body-wrap>
      <header class=site-header>
      <div class=container>
      <div class=site-header-inner>
      <div class="brand header-brand">
      <h1 class=m-0>
      <a href=#>
      <img class=header-logo-image src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjgiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSI1MCUiIHkxPSIwJSIgeDI9IjUwJSIgeTI9IjEwMCUiIGlkPSJhIj48c3RvcCBzdG9wLWNvbG9yPSIjMDBCRkZCIiBvZmZzZXQ9IjAlIi8+PHN0b3Agc3RvcC1jb2xvcj0iIzAyNzBENyIgb2Zmc2V0PSIxMDAlIi8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSIgaWQ9ImIiPjxzdG9wIHN0b3AtY29sb3I9IiMxRjIzMkEiIHN0b3Atb3BhY2l0eT0iLjQ4IiBvZmZzZXQ9IjAlIi8+PHN0b3Agc3RvcC1jb2xvcj0iIzFGMjMyOSIgc3RvcC1vcGFjaXR5PSIwIiBvZmZzZXQ9IjEwMCUiLz48L2xpbmVhckdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCB4MT0iODcuNjY1JSIgeTE9IjEwMy43MzklIiB4Mj0iLTMuMTY5JSIgeTI9IjM4LjgwNyUiIGlkPSJjIj48c3RvcCBzdG9wLWNvbG9yPSIjRkZGIiBzdG9wLW9wYWNpdHk9IjAiIG9mZnNldD0iMCUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkZGIiBzdG9wLW9wYWNpdHk9Ii42NCIgb2Zmc2V0PSIxMDAlIi8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeDE9Ii0xNC4xMDQlIiB5MT0iMTExLjI2MiUiIHgyPSIxMDkuODcxJSIgeTI9IjI2LjM1NSUiIGlkPSJkIj48c3RvcCBzdG9wLWNvbG9yPSIjMDI3MEQ3IiBvZmZzZXQ9IjAlIi8+PHN0b3Agc3RvcC1jb2xvcj0iIzAyNzBENyIgc3RvcC1vcGFjaXR5PSIwIiBvZmZzZXQ9IjEwMCUiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGZpbGw9InVybCgjYSkiIHRyYW5zZm9ybT0icm90YXRlKDkwIDE0IDE2KSIgZD0iTTYgMmwtOCAxMy45OTlMNiAzMGgxNmw4LTE0LjAwMUwyMiAyeiIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xNCAwdjMyTDAgMjRWOHoiLz48cGF0aCBmaWxsPSJ1cmwoI2MpIiBkPSJNMjggMjRMMCA4bDE0LjAwMS04TDI4IDh6Ii8+PHBhdGggZmlsbC1vcGFjaXR5PSIuNDgiIGZpbGw9InVybCgjZCkiIHN0eWxlPSJtaXgtYmxlbmQtbW9kZTptdWx0aXBseSIgZD0iTTI4IDhMMCAyMy45NzhWOGwxNC4wMDEtOEwyOCA4eiIvPjwvZz48L3N2Zz4=" alt=Logo>
      </a>
      </h1>
      </div>
      </div>
      </div>
      </header>

      <main>
        <section class=hero>
          <div class=container>
            <div class=hero-inner>
              <div class=hero-copy>
                <h1 class="hero-title mt-0">{{title}}</h1>
                {% if description %}
                <p class=hero-paragraph>{{description}}</p>
                {% endif %}

                <div class=hero-cta>
                  <a class="button button-secondary" href="#tests">Tests</a>
                  {% if dashboard %}
                    <a class="button button-primary" href="/dashboard" target="_blank">Dashboard</a>
                  {% endif %}
                  <a class="button button-primary" onclick="runLastTest()" id="run-test">Run last test</a>
                  {% if admin %}
                  <a class=button href="/admin" target="_blank">Databases</a>
                  {% endif %}
                </div>
                <br/>
                <p class=hero-paragraph style="color:{{mode_color}}">{{ip}} - {{mode}} mode</p>
                <p>{{conda_env}} - {{alphaz_version}}</p>
              </div>
              
              <div class="hero-figure anime-element">
                <svg class=placeholder width=528 height=396 viewBox="0 0 528 396">
                <rect width=528 height=396 style=fill:transparent></rect>
                </svg>

                <div class="hero-figure-box hero-figure-box-01" data-rotation=45deg style="transform:rotate(45deg) scale(1);opacity:1"></div>
                <div class="hero-figure-box hero-figure-box-02" data-rotation=-45deg style="transform:rotate(-45deg) scale(1);opacity:1"></div>
                <div class="hero-figure-box hero-figure-box-03" data-rotation=0deg style="transform:rotate(0deg) scale(1);opacity:1"></div>
                <div class="hero-figure-box hero-figure-box-04" data-rotation=-135deg style="transform:rotate(-135deg) scale(1);opacity:1"></div>
                <div class="hero-figure-box hero-figure-box-05" style="transform:scaleX(1) scaleY(1) perspective(500px) rotateY(-15deg) rotateX(8deg) rotateZ(-1deg)"></div>
                <div class="hero-figure-box hero-figure-box-06" style="transform:scaleX(1) scaleY(1) perspective(500px) rotateZ(20deg)"></div>
                <div class="hero-figure-box hero-figure-box-07" style="transform:scaleX(1) scaleY(1) perspective(500px) rotateZ(20deg)"></div>
                <div class="hero-figure-box hero-figure-box-08" data-rotation=-22deg style="transform:rotate(-22deg) scale(1);opacity:1"></div>
                <div class="hero-figure-box hero-figure-box-09" data-rotation=-52deg style="transform:rotate(-52deg) scale(1);opacity:1"></div>
                <div class="hero-figure-box hero-figure-box-10" data-rotation=-50deg style="transform:rotate(-50deg) scale(1);opacity:1"></div>
              </div>
            </div>
          </div>
        </section>

        <section class="features section">
          <div class=container>
            <h1 class="hero-title mt-0" id="routes">Routes</h1>

            <div class="features-inner section-inner has-bottom-divider">
              <div class=features-wrap>

              {% for category in routes.categories %}
                <div class="feature text-center is-revealing" style=visibility:visible id="routes-{{category}}">
                  <div class=feature-inner>
                    <div class=feature-icon></div>

                    <h3 class="feature-title mt-24">{{category}}</h3>

                    <p class="text-sm mb-0"></p>

                    <div class="feature-routes">
                      {% for path in routes.categories_routes[category] %}

                        {% if routes.routes[path].arguments.description %}
                          <p class="info">{{routes.routes[path].arguments.description}}</p>
                        {% endif %}

                        <div class="feature-route">
                          <a href="{{path.split(':')[1]}}" target="_blank">{{path.split(':')[1]}}</a>&nbsp;

                          {% if routes.routes[path].arguments.admin %}
                            <sub><img src="/assets/images/icons/admin.png" class="route-property"/></sub>
                          {% endif %}

                          {% if routes.routes[path].arguments.logged %}
                            <sub><img src="/assets/images/icons/user.png" class="route-property"/></sub>
                          {% endif %}
                          
                          {% if routes.routes[path].arguments.cache %}
                            <sub><img src="/assets/images/icons/save.png" class="route-property"/></sub>
                            {% if routes.routes[path].arguments.timeout %}
                              <sub class="timeout">{{routes.routes[path].arguments.timeout}}s</sub>
                            {% endif %}
                          {% endif %}

                          <sup class="methods" style="color:white">{% for method in routes.routes[path].arguments.methods %} {{method}} {% endfor %}</sup>
                        </div>

                        <div class="parameters">
                          {% for parameter in routes.routes[path].arguments.parameters %}
                            <div class="parameter" {% if parameter.required %} style="color:#0270D7"{%endif %}>
                              <div class="parameter-value">
                                {{parameter.name}}{% if parameter.default %}<sub style="color:orange">={{parameter.default}}</sub>{% endif %}&nbsp;
                                <sub style="color:green">{{parameter.type}}</sub>

                                {% if (routes.routes[path].arguments.cache) and (parameter.cacheable) %}
                                  <sub><img src="/assets/images/icons/save.png" class="route-property"/></sub>
                                {% endif %}                          
                              </div>

                              {% if parameter.options %}
                                <select class="options">
                                  {% for option in parameter.options %}
                                  <option class="option">{{option}}</span> 
                                  {% endfor %}
                                </select>
                              {% endif %}

                            </div>
                          {% endfor %}
                        </div>
                      {% endfor %}
                    </div>
                  </div>  
                </div>
              {% endfor %}

              </div>
            </div>
          </div>
        </section>

        <section class="features section">
          <div class=container>
            <h1 class="hero-title mt-0" id="tests">Tests</h1>
            
            <div class="features-inner section-inner has-bottom-divider">
              <div class=features-wrap>
                {% for category in tests.categories %}
                <div class="feature text-center is-revealing" style=visibility:visible id="test-{{category}}">
                  <div class=feature-inner>
                    <div class=feature-icon></div>
                      <div class="test-category">
                        <div>
                        <i class="icon-play run" onclick="executeTest('{{category}}','','')"></i>
                        <img src='/assets/images/loading.gif' id="loading_{{category}}" class="hide"/>
                        </div>
                        <h3 class="feature-title mt-24">{{category}}</h3>
                      </div>

                      <p class="text-sm mb-0"></p>

                      <div class="feature-routes">
                        {% for group in tests.categories[category].groups %}
                          <div class="test-category">
                            <i class="icon-play run" onclick="executeTest('{{category}}','{{group}}','')"></i>
                            <h4>{{group}}</h4>
                          </div>

                          {% for test in tests.categories[category].groups[group].tests %}
                            <div class="feature-route test-block">
                              <i class="icon-play run" {% if tests.categories[category].groups[group].tests[test].status %} style="color:#27ae60" {% else %} style="color:#c0392b;" {%endif %} onclick="executeTest('{{category}}','{{group}}','{{test}}')"></i>

                              <div class="test" {% if tests.categories[category].groups[group].tests[test].disable %} style="color:black !important" {%endif %}><b>{{test}}</b>
                                {% if tests.categories[category].groups[group].tests[test].elapsed %}
                                  <span class="elapsed">{{tests.categories[category].groups[group].tests[test].elapsed}}s</span>
                                {% endif %}
                                {% if tests.categories[category].groups[group].tests[test].start_time %}
                                  <span class="last-elapsed">{{tests.categories[category].groups[group].tests[test].last_run_elapsed}}</span>
                                {% endif %}
                                <br/>
                                <span class="description">{{tests.categories[category].groups[group].tests[test].description}}</span>
                              </div>
                            </div>

                          {% endfor %}

                        {% endfor %}


                      </div>

                    </div>
                  </div>
                {% endfor %}
              </div>
              </div>
            </div>
          </div>
        </section>

        <section class="cta section">
          <div class=container>
            <div class="cta-inner section-inner">
              <h3 class="section-title mt-0">{{compagny}}</h3>
              <div class=cta-cta>
                <a class="button button-primary button-wide-mobile" href="{{compagny_website}}" target="_blank">WebSite</a>
              </div>
            </div>
          </div>
        </section>

        <div class=logo-background></div>

        <div id="routes-btns">
          <a class="button side-button" href="#routes">Routes</a>
          {% for category in routes.categories %}
            <a class="button button-secondary side-button" href="#routes-{{category}}">{{category}}</a>
          {% endfor %}
        </div>

        <div id="tests-btns">
          <a class="button side-button" href="#tests">Tests</a>
          {% for category in tests.categories %}
            <a class="button button-primary side-button" href="#test-{{category}}">{{category}}</a>
          {% endfor %}
        </div>

      </main>

      <footer class=site-footer>
        <div class=container>
          <div class=site-footer-inner>
            <div class="brand footer-brand">
              <a href=#><img class=header-logo-image src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjgiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSI1MCUiIHkxPSIwJSIgeDI9IjUwJSIgeTI9IjEwMCUiIGlkPSJhIj48c3RvcCBzdG9wLWNvbG9yPSIjMDBCRkZCIiBvZmZzZXQ9IjAlIi8+PHN0b3Agc3RvcC1jb2xvcj0iIzAyNzBENyIgb2Zmc2V0PSIxMDAlIi8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSIgaWQ9ImIiPjxzdG9wIHN0b3AtY29sb3I9IiMxRjIzMkEiIHN0b3Atb3BhY2l0eT0iLjQ4IiBvZmZzZXQ9IjAlIi8+PHN0b3Agc3RvcC1jb2xvcj0iIzFGMjMyOSIgc3RvcC1vcGFjaXR5PSIwIiBvZmZzZXQ9IjEwMCUiLz48L2xpbmVhckdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCB4MT0iODcuNjY1JSIgeTE9IjEwMy43MzklIiB4Mj0iLTMuMTY5JSIgeTI9IjM4LjgwNyUiIGlkPSJjIj48c3RvcCBzdG9wLWNvbG9yPSIjRkZGIiBzdG9wLW9wYWNpdHk9IjAiIG9mZnNldD0iMCUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkZGIiBzdG9wLW9wYWNpdHk9Ii42NCIgb2Zmc2V0PSIxMDAlIi8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeDE9Ii0xNC4xMDQlIiB5MT0iMTExLjI2MiUiIHgyPSIxMDkuODcxJSIgeTI9IjI2LjM1NSUiIGlkPSJkIj48c3RvcCBzdG9wLWNvbG9yPSIjMDI3MEQ3IiBvZmZzZXQ9IjAlIi8+PHN0b3Agc3RvcC1jb2xvcj0iIzAyNzBENyIgc3RvcC1vcGFjaXR5PSIwIiBvZmZzZXQ9IjEwMCUiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGZpbGw9InVybCgjYSkiIHRyYW5zZm9ybT0icm90YXRlKDkwIDE0IDE2KSIgZD0iTTYgMmwtOCAxMy45OTlMNiAzMGgxNmw4LTE0LjAwMUwyMiAyeiIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xNCAwdjMyTDAgMjRWOHoiLz48cGF0aCBmaWxsPSJ1cmwoI2MpIiBkPSJNMjggMjRMMCA4bDE0LjAwMS04TDI4IDh6Ii8+PHBhdGggZmlsbC1vcGFjaXR5PSIuNDgiIGZpbGw9InVybCgjZCkiIHN0eWxlPSJtaXgtYmxlbmQtbW9kZTptdWx0aXBseSIgZD0iTTI4IDhMMCAyMy45NzhWOGwxNC4wMDEtOEwyOCA4eiIvPjwvZz48L3N2Zz4=" alt=Logo></a>
            </div>

            <ul class="footer-links list-reset">
              <li>
              <a href=#>Contact</a>
              </li>
              <li>
              <a href=#>About us</a>
              </li>
              <li>
              <a href=#>FAQ's</a>
              </li>
              <li>
              <a href=#>Support</a>
              </li>
            </ul>

            <ul class="footer-social-links list-reset">
              <li>
                <a href=#>
                <span class=screen-reader-text>Help</span>

                <svg width="20" height="20" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
                <g class="layer">
                <title>Layer 1</title>
                <g id="layer1">
                <path  fill=#0270D7 id="path4024" d="m10.02686,0.00001l-8.88982,4.971l0,9.94199l8.88982,4.971l8.88982,-4.971l0,-9.94199l-8.88982,-4.971zm-2.66694,4.32447l3.55593,0l1.77796,0l0,1.72404l0,2.29873l0,1.72404l-2.5336,0l0,1.72404l-1.61498,0l0,-1.72404l0,-1.72404l1.61498,0l0.75564,0l0,-2.29873l-3.55593,0l0,-1.72404zm1.18531,8.9363l2.37062,0l0,2.29873l-2.37062,0l0,-2.29873z"/>
                </g>
                </g>
                </svg>

                </a>
              </li>
            </ul>
            <div class=footer-copyright>© {{year}} {{compagny}}, all rights reserved</div>
          </div>
        </div>
      </footer>
    </div>
    <div id="loading"></div>
  </body>
</html>

<script>
  function isRunTest() {
    var exist = localStorage.hasOwnProperty('category') || localStorage.hasOwnProperty('group') || localStorage.hasOwnProperty('test');
    var no_null = localStorage.getItem('category') != null || localStorage.getItem('group') != null || localStorage.getItem('test') != null;
    return exist && no_null;
  }

  function runLastTest() {
    executeTest(localStorage.getItem('category'), localStorage.getItem('group'), localStorage.getItem('test'))
  }

  function executeTest(category, group, test) {
    //$(window).scrollTop(0);
    setVisible('#loading', true);
    
    category = category ? category : "";
    group = group ? group : "";
    test = test ? test : "";
    parameters = "run=Y&category=" + category

    $("#loading_" + category).removeClass("hide");
    
    if (!category || category == 'null') localStorage.removeItem('category');
    else localStorage.setItem('category', category);

    if (!group || group == 'null') localStorage.removeItem('group');
    else localStorage.setItem('group', group);
    
    if (!test || test == 'null') localStorage.removeItem('test');
    else localStorage.setItem('test', test);

    if (group != '') {
      parameters = parameters + "&group=" + group
    }
    if (test != '') {
      parameters = parameters + "&name=" + test
    }

    $.ajax({
            type: "GET",
            url: "/tests",
            data: parameters,
            success: function(data, status) {
              location.reload();
              $("#loading_" + category).addClass("hide");
            },
            error: function (err) { console.log(err); $("#loading_" + category).addClass("hide"); }
         });
  }

  function onReady(callback) {
  var intervalId = window.setInterval(function() {
    if (document.getElementsByTagName('body')[0] !== undefined) {
      window.clearInterval(intervalId);
      callback.call(this);
    }
  }, 1000);
}

function setVisible(selector, visible) {
  document.querySelector(selector).style.display = visible ? 'block' : 'none';
}

onReady(function() {
  setVisible('#loading', false);

  if(isRunTest())
      document.getElementById("run-test").style.visibility = 'visible';
  else
      document.getElementById("run-test").style.visibility = 'hidden';

});

</script>