{% set formActive = True if webenv.toppage not in ['tag', 'id'] else False %}
{% set classList = "active" if formActive else "" %}
{% set showHideText = "hide" if formActive else "show"%}
<form action="/awt#results" method="POST">
  <fieldset id="ABIF_submission_area">
    <legend>ABIF submission area
(<a href="#" id="abifshowhide" onclick="javascript:toggleShowHide({target:'abifbox', targactive: {{"true" if formActive else "false"}}});">{{showHideText}}</a>)
    </legend>
    <div id="abifbox" class="{{classList}}">
      <!-- Left: ABIF input -->
      <div style="flex: 1 1 auto; min-width: 0;">
        <textarea id="abifinput" name="abifinput"
                  rows="{{ webenv.inputRows }}" cols="{{ webenv.inputCols }}"
                  placeholder="{{ msgs.placeholder }}"
                  style="width: 100%;"
                  >{{ abifinput }}</textarea>
      </div>

      <!-- Right: Method options -->
      <div style="flex: 0 0 clamp(10vw, 18vw, 20vw); max-width: 20vw;">
        <fieldset>
          <legend>Method options</legend>
          <div>
            <label>
              <input type="checkbox" name="include_FPTP" value="yes" {% if result_types is defined and 'FPTP' in result_types %}checked{% endif %}>
              FPTP results?
            </label>
          </div>
          <div>
            <label>
              <input type="checkbox" id="include_IRV" name="include_IRV" value="yes" {% if result_types is defined and 'IRV' in result_types %}checked{% endif %}>
              IRV/RCV results?
            </label>
          </div>
          <div style="margin-left: 1.5em;">
            <label>
              <input type="checkbox" id="include_irv_extra" name="include_irv_extra" value="yes" {% if result_types is defined and 'IRV' in result_types %}checked{% endif %} {% if not (result_types is defined and 'IRV' in result_types) %}disabled{% endif %}>
              IRV extra analysis?
            </label>
          </div>
          <div>
            <label>
              <input type="checkbox" name="include_approval" value="yes" {% if result_types is defined and 'approval' in result_types %}checked{% endif %}>
              Approval results?
            </label>
          </div>
          <div>
            <label>
              <input type="checkbox" name="include_STAR" value="yes" {% if result_types is defined and 'STAR' in result_types %}checked{% endif %}>
              STAR results?
            </label>
          </div>
          <div>
            <label>
              <input type="checkbox" id="include_pairtable" name="include_pairtable" value="yes" {% if result_types is defined and 'wlt' in result_types %}checked{% endif %}>
              pairwise (Condorcet/Copeland) results?
            </label>
          </div>
          <div style="margin-left: 1.5em;">
            <label>
              <input type="checkbox" id="include_dotsvg" name="include_dotsvg" value="yes" {% if result_types is defined and 'dot' in result_types %}checked{% endif %} {% if not (result_types is defined and 'wlt' in result_types) %}disabled{% endif %}>
              pairwise tournament diagram?
            </label>
          </div>
        </fieldset>
      </div>
    </div>
    <!-- Bottom row: ballot options (left) and submit button (right) -->
    <div id="abif-bottomrow" class="abif-bottomrow" data-testid="abif-bottomrow">
      <div style="flex: 1 1 auto; min-width: 0;">
        <fieldset>
          <legend>Ballot options</legend>
          <label>
            <input type="checkbox" id="transform_ballots" name="transform_ballots" value="yes" {% if transform_ballots %}checked{% endif %}>
            Transform ballots (using ballot-type metadata)?
          </label>
        </fieldset>
      </div>
      <div style="flex: 0 0 clamp(10vw, 18vw, 20vw); max-width: 20vw; text-align: right;">
        <input type="submit" value="Submit" id="submitButton">
      </div>
    </div>
  </fieldset>
</form>
