<html py:extends="master.xhtml" py:strip="True">
  <py:block name="title">
    Group Home
  </py:block>
  <body py:block="body" py:strip="True">
<?python
import datetime
now = datetime.datetime.now()
show_rankings = competition.output_upload_begins <= now
?>
    <div class="container">
      <div class="card competition-info mb-3">
        <div class="card-body">
          <h2 class="card-title">
            ${competition.name}
            <py:if test="group.incognito">
              (Participating in Incognito)
            </py:if>
          </h2>
          <ul>
            <li><strong>Input Upload:</strong> ${h.ftime(competition.input_upload_begins, competition.input_upload_ends)}</li>
            <li><strong>Output Upload:</strong> ${h.ftime(competition.output_upload_begins, competition.output_upload_ends)}</li>
            <li py:if="competition.verification_begins">
              <strong>Verification:</strong> ${h.ftime(competition.verification_begins, competition.verification_ends)}
            </li>
            <li py:if="competition.resolution_begins">
              <strong>Resolution:</strong> ${h.ftime(competition.resolution_begins, competition.resolution_ends)}
            </li>
            <li py:if="competition.open_verification_begins">
              <strong>Open Verification:</strong> ${h.ftime(competition.open_verification_begins, competition.open_verification_ends)}
            </li>
            <li py:if="competition.evaluation_begins">
              <strong>Evaluation:</strong> ${h.ftime(competition.evaluation_begins, competition.evaluation_ends)}
            </li>
          </ul>
          <p class="card-text" py:if="competition.open_verification_open">
            <strong>Open Verification</strong> is now available. View the
            rankings table to participate.
          </p>
          <div class="card-text"
             py:if="request.identity and request.identity['user'].admin">
            <strong>Switch Stage (admin only):</strong>
            <ul class="nav nav-pills">
              <li py:for="sw_stage in ('input_upload', 'output_upload', 'verification', 'resolution', 'evaluation')"
                  class="nav-item">
                <a href="${tg.url('/group/{}/stage/{}'.format(group.id, sw_stage))}"
                   class="nav-link ${'active' if sw_stage == stage else ''}"
                   py:content="sw_stage.replace('_', ' ').title()" />
              </li>
            </ul>
          </div>
        </div>
        <div class="card-footer">
          <a href="${tg.url(f'/competition/{competition.id}/problem_statement.pdf')}"
             class="btn btn-info">
            <i class="fas fa-file-pdf fa-fw"></i>
            Problem Statement
          </a>
          <a href="${tg.url('/competition/{}'.format(competition.id))}"
             class="btn btn-info"
             py:if="show_rankings">
            <i class="fas fa-trophy fa-fw"></i>
            View Rankings
          </a>
        </div>
      </div>
      <py:include href="algobowl.templates.group.input_upload" />
      <py:include href="algobowl.templates.group.output_upload" />
      <py:include href="algobowl.templates.group.verification" />
      <py:include href="algobowl.templates.group.resolution" />
      <py:include href="algobowl.templates.group.evaluation" />
    </div>
  </body>
</html>
