{% extends "base.html" %}
{% block content %}
  <div class="container">
    <br>
    <div class="row">
      <div class="col s12">

        <form autocomplete="off" action="{{ url_for('index', lang=_('code')) }}" method="POST" enctype="multipart/form-data" id="submit-form">
          <h6>{{ _('Input data') }}</h6>
          <div class="card">
            <div class="card-content">
<!--              <label><b>{{ _('Upload a treebank') }}</b> {{ _('in CONLL-U format') }} (<a class="nav-link" href="https://github.com/clarinsi/STARK/blob/master/settings.md#&#45;&#45;input" target="_blank" title="{{ _('Help') }}"><span class="menu-title sr-only">{{ _('Help') }}</span></a>)</label>-->
              <div class = "file-field input-field">
                <div class = "btn insidebutton">
                   <span>{{ _('Browse') }}</span>
                   <input type = "file" name="file"/>
                </div>
                <div class = "file-path-wrapper">
<!--                   <input class="file-path validate{% if 'file' in validation %} invalid{% endif %}" type="text" placeholder="{{ _('Upload') }}"/>-->
                   <input class="file-path validate{% if 'file' in validation %} invalid{% endif %}" type="text" placeholder="{{ _('Upload a treebank') }} {{ _('in CONLL-U format') }}"/>
                   {% if 'file' in validation %}
                    <span class="helper-text" data-error="{{validation['file']}}"></span>
                  {% endif %}
                </div>
              </div>
              <div class="row">
                <div class="input-field col s12 dynamic-height">
                  <input id="input_url" name="input_url" type="text" class="validate{% if 'input_url' in validation %} invalid{% endif %}">
                  <label for="input_url"><u>{{ _('Or') }}</u> {{ _('insert a URL link to a treebank in CONLL-U format') }} <a class="nav-link example-input-link" target="_blank" href="https://raw.githubusercontent.com/UniversalDependencies/UD_English-GUM/master/en_gum-ud-dev.conllu" title="UD_English-GUM"><span class="menu-title sr-only">UD_English-GUM</span></a> -
                    <a class="nav-link example-input-link" target="_blank" href="https://raw.githubusercontent.com/UniversalDependencies/UD_French-GSD/master/fr_gsd-ud-dev.conllu" title="UD_French-GSD"><span class="menu-title sr-only">UD_French-GSD</span></a> -
                    <a class="nav-link example-input-link" target="_blank" href="https://raw.githubusercontent.com/UniversalDependencies/UD_Slovenian-SSJ/master/sl_ssj-ud-dev.conllu" title="UD_Slovenian-SSJ"><span class="menu-title sr-only">UD_Slovenian-SSJ</span></a>)</label>
                  {% if 'input_url' in validation %}
                    <span class="helper-text" data-error="{{validation['input_url']}}"></span>
                  {% endif %}
                </div>
              </div>
            </div>
          </div>
          <br>
          <h6>{{ _('Tree specification') }}</h6>
          <div class="card">
            <div class="card-content">
              <label><b>{{ _('Node type') }}</b>: {{ _('token characteristics to consider') }} (<a class="nav-link" href="https://github.com/clarinsi/STARK/blob/master/settings.md#--node_type" target="_blank" title="{{ _('Help') }}"><span class="menu-title sr-only">{{ _('Help') }}</span></a>)</label>
              <div class="row">
                <div class="input-field">
                  <div class="col s3">
                    <label>
                      <input type="checkbox" class="node_type filled-in {% if 'node_type' in validation %} invalid{% endif %}" name="node_type_upos" />
                      <span>{{ _('Part-of-speech') }}</span>
                    </label>
                  </div>
                  <div class="col s3">
                    <label>
                      <input type="checkbox" class="node_type filled-in" name="node_type_lemma"/>
                      <span>{{ _('Lemma') }}</span>
                    </label>
                  </div>
                  <div class="col s3">
                    <label>
                      <input type="checkbox" class="node_type filled-in" name="node_type_form"/>
                      <span>{{ _('Form') }}</span>
                    </label>
                  </div>
                  <div class="col s3">
                    <label>
                      <input type="checkbox" class="node_type node_type_none filled-in {% if 'node_type' in validation %} invalid{% endif %}" name="node_type_none" checked="checked" />
                      <span>{{ _('No type') }}</span>
                      {% if 'node_type' in validation %}
                        <span class="helper-text" data-error="{{validation['node_type']}}"></span>
                      {% endif %}
                    </label>
                  </div>
                  <!-- Shared error message for all checkboxes -->
                  {% if 'node_type' in validation %}
                    <div class="col s12">
                      <span class="validation-error" id="node-type-error">{{ validation['node_type'] }}</span>
                    </div>
                  {% endif %}
                </div>
              </div>
              <div class="row">
                <div class="col s12">
                  <label><b>{{ _('Labeled trees') }}</b>: {{ _('include names of dependency relations') }} (<a class="nav-link" href="https://github.com/clarinsi/STARK/blob/master/settings.md#--labeled" target="_blank" title="{{ _('Help') }}"><span class="menu-title sr-only">{{ _('Help') }}</span></a>)</label>
                  <div class="input-field">
                    <div class="switch">
                      <label>
                        {{ _('No') }}
                        <input type="checkbox" name="labeled_trees" checked="checked">
                        <span class="lever"></span>
                        {{ _('Yes') }}
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col s12">
                  <label><b>{{ _('Fixed order') }}</b>: {{ _('differentiate trees based on surface word order') }} (<a class="nav-link" href="https://github.com/clarinsi/STARK/blob/master/settings.md#--fixed" target="_blank" title="{{ _('Help') }}"><span class="menu-title sr-only">{{ _('Help') }}</span></a>)</label>
                  <div class="input-field">
                    <div class="switch">
                      <label>
                        {{ _('No') }}
                        <input type="checkbox" name="fixed_order" checked="checked">
                        <span class="lever"></span>
                        {{ _('Yes') }}
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <br>
          <h6><a class="waves-effect waves-light inline expand" id="advanced-tree-expand"><i class="material-icons em-1">add</i>  {{ _('Advanced settings') }}</a></h6>
          <div class="card" id="advanced-tree">
            <div class="card-content">
              <div class="row">
                <div class="input-field col s12 dynamic-height">
                  <input id="root_restriction" name="root_restriction" type="text" class="validate">
                  <label for="root_restriction"><b>{{ _('Head') }}</b>: {{ _('specify potential restrictions on the head node') }} (<a class="nav-link" href="https://github.com/clarinsi/STARK/blob/master/settings.md#--head" target="_blank" title="{{ _('Help') }}"><span class="menu-title sr-only">{{ _('Help') }}</span></a>)</label>
                </div>
              </div>
              <div class="row">
                <div class="input-field col s12 dynamic-height">
                  <input id="ignored_labels" name="ignored_labels" type="text" class="validate">
                  <label for="ignored_labels"><b>{{ _('Ignored labels') }}</b>: {{ _('specify the dependency labels of nodes to be ignored') }} (<a class="nav-link" href="https://github.com/clarinsi/STARK/blob/master/settings.md#--ignore_labels" target="_blank" title="{{ _('Help') }}"><span class="menu-title sr-only">{{ _('Help') }}</span></a>)</label>
                </div>
              </div>
              <div class="row">
                <div class="input-field col s12 dynamic-height">
                  <input id="display_size" name="display_size" type="text" class="validate {% if 'display_size' in validation %} invalid{% endif %}" value="2-10">
                  <label for="display_size"><b>{{ _('Tree size') }}</b>: {{ _('number of tokens in the tree') }} (<a class="nav-link" href="https://github.com/clarinsi/STARK/blob/master/settings.md#--size" target="_blank" title="{{ _('Help') }}"><span class="menu-title sr-only">{{ _('Help') }}</span></a>)</label>
                  {% if 'display_size' in validation %}
                    <span class="helper-text" data-error="{{validation['display_size']}}"></span>
                  {% endif %}
                </div>

              </div>
              <div class="row">
                <div class="input-field col s12 dynamic-height">
                  <input id="query" name="query" type="text" class="validate">
                  <label for="query"><b>{{ _('Query') }}</b>: {{ _('write a query. Note: Tree size attribute will be ignored!') }} (<a class="nav-link" href="https://github.com/clarinsi/STARK/blob/master/settings.md#--query" target="_blank" title="{{ _('Help') }}"><span class="menu-title sr-only">{{ _('Help') }}</span></a>)</label>
                </div>
              </div>
              <div class="row">
                <div class="input-field col s12 dynamic-height">
                  <input id="frequency_threshold" name="frequency_threshold" type="text" class="validate {% if 'frequency_threshold' in validation %} invalid{% endif %}" value="1">
                  <label for="frequency_threshold"><b>{{ _('Frequency threshold') }}</b>: {{ _('specify the minimum frequency of a tree in the treebank') }} (<a class="nav-link" href="https://github.com/clarinsi/STARK/blob/master/settings.md#--frequency_threshold" target="_blank" title="{{ _('Help') }}"><span class="menu-title sr-only">{{ _('Help') }}</span></a>)</label>
                  {% if 'frequency_threshold' in validation %}
                    <span class="helper-text" data-error="{{validation['frequency_threshold']}}"></span>
                  {% endif %}
                </div>
              </div>
              <div class="row">
                <div class="col s12">
                  <label><b>{{ _('Association measures') }}</b>: {{ _('print MI, logDice and t-score') }} (<a class="nav-link" href="https://github.com/clarinsi/STARK/blob/master/settings.md#--association_measures" target="_blank" title="{{ _('Help') }}"><span class="menu-title sr-only">{{ _('Help') }}</span></a>)</label>
                  <div class="input-field">
                    <div class="switch">
                      <label>
                        {{ _('No') }}
                        <input class="association_measures" type="checkbox" name="association_measures">
                        <span class="lever"></span>
                        {{ _('Yes') }}
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col s12">
                  <label><b>{{ _('Complexity measures') }}</b>: {{ _('print maximum tree depth and mean dependency distance (MDD)') }}</label>
                  <div class="input-field">
                    <div class="switch">
                      <label>
                        {{ _('No') }}
                        <input class="complexity_measures" type="checkbox" name="complexity_measures">
                        <span class="lever"></span>
                        {{ _('Yes') }}
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col s12">
                  <label><b>{{ _('Complete trees') }}</b>: {{ _('extract head node with all its dependants') }} (<a class="nav-link" href="https://github.com/clarinsi/STARK/blob/master/advanced.md#--complete" target="_blank" title="{{ _('Help') }}"><span class="menu-title sr-only">{{ _('Help') }}</span></a>). {{_("Note: Extracting incomplete trees ('No' option) is slow and limited to a maximum tree size of 4 nodes.") }}</label>
                  <div class="input-field">
                    <div class="switch">
                      <label>
                        {{ _('No') }}
                        <input class="complete_trees" type="checkbox" name="complete_trees" checked="checked">
                        <span class="lever"></span>
                        {{ _('Yes') }}
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <h6><a class="waves-effect waves-light inline expand" id="compare-expand"><i class="material-icons em-1 ">add</i>  {{ _('Compare treebanks') }}</a></h6>
          <div class="card" id="compare-settings">
            <div class="card-content">
              <div class="row">
                <label>{{ _('Select a reference treebank to identify key phenomena (prints the &#37;DIFF, BIC and OR keyness scores).') }} (<a class="nav-link" href="https://github.com/clarinsi/STARK/blob/master/settings.md#--compare" target="_blank" title="{{ _('Help') }}"><span class="menu-title sr-only">{{ _('Help') }}</span></a>)</label>
<!--                <label><b>{{ _('Upload a compare corpus') }}</b> {{ _('in CONLL-U format') }} (<a class="nav-link" href="https://github.com/clarinsi/STARK/blob/master/settings.md#&#45;&#45;compare" target="_blank" title="{{ _('Help') }}"><span class="menu-title sr-only">{{ _('Help') }}</span></a>)</label>-->
                <div class = "file-field input-field">
                  <div class = "btn insidebutton">
                     <span>{{ _('Browse') }}</span>
                     <input type = "file" name="compare_file"/>
                  </div>
                  <div class = "file-path-wrapper">
                     <input class="file-path validate{% if 'compare_file' in validation %} invalid{% endif %}" type="text" placeholder="{{ _('Upload a compare corpus') }} {{ _('in CONLL-U format') }}"/>
                     {% if 'compare_file' in validation %}
                      <span class="helper-text" data-error="{{validation['file']}}"></span>
                    {% endif %}
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="input-field col s12 dynamic-height">
                  <input id="compare_url" name="compare_url" type="text" class="validate{% if 'compare_url' in validation %} invalid{% endif %}">
                  <label for="compare_url"><u>{{ _('Or') }}</u> {{ _('insert a URL link to a treebank in CONLL-U format') }} <a class="nav-link example-compare-link" target="_blank" href="https://raw.githubusercontent.com/UniversalDependencies/UD_English-GUM/master/en_gum-ud-dev.conllu" title="UD_English-GUM"><span class="menu-title sr-only">UD_English-GUM</span></a> -
                    <a class="nav-link example-compare-link" target="_blank" href="https://raw.githubusercontent.com/UniversalDependencies/UD_French-GSD/master/fr_gsd-ud-dev.conllu" title="UD_French-GSD"><span class="menu-title sr-only">UD_French-GSD</span></a> -
                    <a class="nav-link example-compare-link" target="_blank" href="https://raw.githubusercontent.com/UniversalDependencies/UD_Slovenian-SSJ/master/sl_ssj-ud-dev.conllu" title="UD_Slovenian-SSJ"><span class="menu-title sr-only">UD_Slovenian-SSJ</span></a>)</label>
                  {% if 'compare_url' in validation %}
                    <span class="helper-text" data-error="{{validation['compare_url']}}"></span>
                  {% endif %}
                </div>
              </div>
            </div>
          </div>
          {% if 'general' in validation %}
          <div class="col s12">
            <span class="validation-error" id="unknown-error">{{ validation['general'] }}</span>
          </div>
          </br>
          {% endif %}
          <button class="btn waves-effect waves-light btn-large btn-round" type="submit" name="action">{{ _('Submit') }}
<!--            <i class="material-icons right">send</i>-->
          </button>
        </form>

        <!-- Modal Structure -->
        <div id="modal1" class="modal">
          <div class="modal-content">
            <h6>{{ _('No results') }}</h6>
            <p>{{ _('Processing with your settings didnt produce any results!') }}</p>
          </div>
          <div class="modal-footer">
            <a href="#!" class="modal-close waves-effect waves-green btn-flat">Ok</a>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- Modal Trigger -->
  <a class="waves-effect waves-light btn modal-trigger" href="#modal2">Modal</a>

  <!-- Modal Structure -->
  <div id="modal2" class="modal">
    <div class="modal-content">
      <h4>Warning</h4>
      <p>{{_("Extracting incomplete trees ('No' option) is slow and limited to a maximum tree size of 4 nodes.") }}</p>
    </div>
    <div class="modal-footer">
      <a href="#!" class="modal-close waves-effect waves-green btn-flat">OK</a>
    </div>
  </div>

{% endblock %}
{% block custom_js %}
  <script src="static/js/init.js"></script>

  {% if 'results' in validation %}
  <script type="text/javascript">
    (function($){
      $(function(){

        $('.sidenav').sidenav();

      }); // end of document ready
      $(document).ready(function(){
        $('.modal').modal('open');
      });
    })(jQuery); // end of jQuery name space
  </script>
  {% endif %}
{% endblock %}
