<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Custom Data Exploration</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../ui/bootstraptheme.css">
    <link rel="stylesheet" href="../ui/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../ui/bootstrap-select/dist/css/bootstrap-select.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.css">
  </head>
  <body>
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
      <div class="container-fluid">
        <div class="navbar-header">
          <a class="navbar-brand" href="."><i class="fa fa-home"></i></a>
        </div>
        <ul class="nav navbar-nav">
          <li class="navbar-brand">Root Cause Analysis</li>
        </ul>
        <ul class="nav navbar-nav">
          <li><a href="." class="username" data-placement="bottom"></a></li>
          <li><a href="form.html" data-placement="bottom">NAS</a></li>
        </ul>
      </div>
    </nav>
    {% if 'data' not in handler.args %}
    <div class="container mt-3">
      <form action="upload" class="dropzone" id="fileupload">
        <input type="hidden" name="save" value="data.csv">
        <input type="hidden" name="_xsrf" value="{{ handler.xsrf_token }}">
      </form>
    </div>
    {% else %}
    <div class="container-fluid">
      <div class="formhandler" data-src="custom-data" data-page-size="5"></div>
    </div>
    <div class="container-fluid" id="groupmeans">
      <div class="container" data-event="submit" data-target="#" id="form">
        <script type="text/html" src="groupmeans-form-template.html"></script>
      </div>
      <div class="container" id="template-table">
        <script type="text/html" src="table-template.html"></script>
      </div>
    </div>
    {% end %}
  </body>
  <script src="../ui/jquery/dist/jquery.min.js"></script>
  <script src="../ui/popper.js/dist/umd/popper.min.js"></script>
  <script src="../ui/bootstrap/dist/js/bootstrap.min.js"></script>
  <script src="../ui/bootstrap-select/dist/js/bootstrap-select.min.js"></script>
  <script src="../ui/lodash/lodash.min.js"></script>
  <script src="../ui/g1/dist/g1.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.js"></script>
  <script src="common.js"></script>
  <script>
    /* globals Dropzone, create_dropdowns, draw_table */
    Dropzone.autoDiscover = false
    $(function () {
      $('#fileupload').dropzone({  // Needs a manual redirect for some reason
        success: function () {
          window.location.href += '?data=1'
        }
      })
      $('.formhandler').formhandler()
      $('#form').template()
      create_dropdowns('custom-data')
      draw_table('custom-data')
    })
  </script>
</html>
